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.

1 import math
2 from ost import geom
3 
4 filename='fragment.pdb'
5 if len(sys.argv)>1:
6  filename=sys.argv[1]
7 ent=io.LoadEntity(filename)
8 
9 edi=ent.EditXCS()
10 m=geom.Mat4()
11 m.PasteTranslation(-ent.bounds.min)
12 edi.ApplyTransform(m)
13 edi.UpdateICS()
14 frag=gfx.Entity('frag', ent)
15 sym_ops=gfx.SymmetryOpList()
16 for i in range(12):
17  m=geom.EulerTransformation(0, i*2.0*math.pi/12.0, 0)
18  sym_ops.append(gfx.SymmetryOp(m, geom.Vec3(0, 0, 10)))
19 
20 sym=gfx.SymmetryNode('sym', sym_ops)
21 scene.Add(sym)
22 sym.Add(frag)
23 
24 scene.SetCenter(geom.Vec3())