[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IMP-users] Problem with IMP.core.TransformationSymmetry



Hi Ben,

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. 

What do I do wrong?

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)
    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.rmf')
IMP.rmf.add_hierarchies(modelrmf, hs)
IMP.rmf.save_frame(modelrmf)


Using IMP 2.13.0.

Best,
Jan