IMP  2.4.0
The Integrative Modeling Platform
atom/cg_pdb.py

This example shows how to properly write out a pdb of the structure results when using coarse grained rigid bodies.

1 ## \example atom/cg_pdb.py
2 # This example shows how to properly write out a pdb of the structure
3 # results when using coarse grained rigid bodies.
4 
5 from __future__ import print_function
6 import IMP.atom
7 
9 full = IMP.atom.read_pdb(IMP.atom.get_example_path("example_protein.pdb"), m)
10 chain = IMP.atom.get_by_type(full, IMP.atom.CHAIN_TYPE)[0]
11 print(chain)
12 # for some reason the python wrapper won't make the implicit conversion to
13 # Chain
15  IMP.atom.Chain(chain), 3)
16 IMP.atom.destroy(full)
17 rb = IMP.atom.create_rigid_body(simplified)
18 original_transform = rb.get_reference_frame().get_transformation_to()
19 
20 
21 # fake optimization, just move the rigid body
23 rb.set_reference_frame(IMP.algebra.ReferenceFrame3D(
25 
26 # extract the difference
27 diff = rb.get_reference_frame().get_transformation_to() / original_transform
28 reload = IMP.atom.read_pdb(IMP.atom.get_example_path("example_protein.pdb"), m)
29 IMP.atom.transform(reload, diff)
30 name = IMP.create_temporary_file("out", ".pdb")
31 IMP.atom.write_pdb(reload, name)