Hi Ben,

Thanks! One more observation - it seems that there is some randomness to it. If I run the below script (with just a single model.update() ) multiple times like this:
for i in {1..20}; do python example.py $i; done

I get some configurations that are correct and some they are not. But not always, sometimes all 20 models are the same. Much more randomness when run my laptop comparing to our compute cluster. Really strange. Sth related to random seeds? Filesystems? 

import IMP
import IMP.core
import IMP.atom
import IMP.container
import IMP.rmf
import RMF
import sys

out_id = str(sys.argv[1])
sys.argv = sys.argv[:1]
IMP.setup_from_argv(sys.argv, "rigid bodies")

m = IMP.Model()
rbs = []
hs = []
for i in range(4):
    mp1 = IMP.atom.read_pdb(IMP.core.get_example_path('example_protein.pdb'), m)
    chains = IMP.atom.get_by_type(mp1, IMP.atom.CHAIN_TYPE)
    hs.append(IMP.atom.Hierarchy(chains[0]))
    rbs.append(IMP.atom.create_rigid_body(chains[0]))

for i, rb in enumerate(rbs[1:]):
    # the other 3 particles are all symmetric copies of the first
    IMP.core.Reference.setup_particle(rb, rbs[0])
    # the symmetry operation is rotation around the z axis
    tr = IMP.algebra.Transformation3D(
        IMP.algebra.get_rotation_about_axis(IMP.algebra.get_basis_vector_3d(2),
                                            2 * 3.14 / len(rbs) * (i + 1)),
        IMP.algebra.Vector3D(0, 0, 0))
    sm = IMP.core.TransformationSymmetry(tr)
    c = IMP.core.SingletonConstraint(sm, None, m, rb)
    m.add_score_state(c)

m.update()

modelrmf = RMF.create_rmf_file('model{0}.rmf'.format(out_id))
IMP.rmf.add_hierarchies(modelrmf, hs)
IMP.rmf.save_frame(modelrmf)


On 26. Aug 2020, at 20:09, Ben Webb <ben@salilab.org> wrote:

On 8/25/20 5:47 AM, Jan Kosinski wrote:
OKay, I see, I think it’s like you suggest, but I have to add some crazy code block to update the members, as below in bold:
...
*#crazy code block:*
*for rb in rbs:*
*    rb.update_members()*
*m.update()*
*for rb in rbs:*
*    rb.set_reference_frame(rb.get_reference_frame()) #this updates the members immediately too*
*m.update()*
*#end of the crazy code block*

Hmm, this sounds like something isn't right with the dependencies, so updates aren't happening automatically in the right order (although odd that it works for some chains and not others). I'll open an issue.

Ben
--
ben@salilab.org                      https://salilab.org/~ben/
"It is a capital mistake to theorize before one has data."
- Sir Arthur Conan Doyle
_______________________________________________
IMP-users mailing list
IMP-users@salilab.org
https://salilab.org/mailman/listinfo/imp-users