OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
gfx_symmetry.py

Uses the gfx::SymmetryNode class to draw the symmetry equivalents of a small protein fragment.

By using rigid body manipulator, the relative orientation of the fragments can be adjusted.

import math
from ost import geom
filename='fragment.pdb'
if len(sys.argv)>1:
filename=sys.argv[1]
ent=io.LoadEntity(filename)
edi=ent.EditXCS()
m.PasteTranslation(-ent.bounds.min)
edi.ApplyTransform(m)
edi.UpdateICS()
frag=gfx.Entity('frag', ent)
sym_ops=gfx.SymmetryOpList()
for i in range(12):
m=geom.EulerTransformation(0, i*2.0*math.pi/12.0, 0)
sym_ops.append(gfx.SymmetryOp(m, geom.Vec3(0, 0, 10)))
sym=gfx.SymmetryNode('sym', sym_ops)
scene.Add(sym)
sym.Add(frag)
scene.SetCenter(geom.Vec3())