OpenStructure
Loading...
Searching...
No Matches
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.

1import math
2from ost import geom
3
4filename='fragment.pdb'
5if len(sys.argv)>1:
6 filename=sys.argv[1]
7ent=io.LoadEntity(filename)
8
9edi=ent.EditXCS()
10m=geom.Mat4()
11m.PasteTranslation(-ent.bounds.min)
12edi.ApplyTransform(m)
13edi.UpdateICS()
14frag=gfx.Entity('frag', ent)
15sym_ops=gfx.SymmetryOpList()
16for 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
20sym=gfx.SymmetryNode('sym', sym_ops)
21scene.Add(sym)
22sym.Add(frag)
23
24scene.SetCenter(geom.Vec3())
Three dimensional vector class, using Real precision.
Definition vec3.hh:48
Mat3 DLLEXPORT_OST_GEOM EulerTransformation(Real theta, Real phi, Real xi)