Hi Ben,

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:

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

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)

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(
                                            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)

#crazy code block:
for rb in rbs:
for rb in rbs:
    rb.set_reference_frame(rb.get_reference_frame()) #this updates the members immediately too
#end of the crazy code block

modelrmf = RMF.create_rmf_file('model.rmf')
IMP.rmf.add_hierarchies(modelrmf, hs)

If skip any of the updates, the members do not get all updated. Is there an easier way to update the members here?

For the PDB file, I take it from your examples (IMP.core.get_example_path('example_protein.pdb')) so I guess you can just run this script if you want to see the PDB file and the result.


On 24. Aug 2020, at 23:57, Ben Webb <ben@salilab.org> wrote:

On 8/22/20 2:30 PM, Jan Kosinski wrote:
I tried to test sth related to the TransformationSymmetry on rigid bodies and I fail to get it work properly in the below simple example.
In the example I create four copies of a chain, create four-fold symmetry constraints and try to generate the updated configuration using model.update(). In the resulting model.rmf, three chain copies are fine and follow the symmetry but one copy of the chains is weirdly rotated.

Your script looks OK to me. I would need to see your input PDB to say for sure, but TransformationSymmetry on a rigid body sets the reference frame of the body, i.e. the coordinate system used for all particles in that body, not the global coordinates of the member particles. I expect if you examine the rigid bodies' reference frames, you'll see they're related by the transformation correctly. The initial reference frame of a rigid body is (usually) the principal axes of the members, not the origin of the global coordinate system, so my guess is that these don't all line up in your case.

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