IMP  2.0.1
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 results when using coarse grained rigid bodies.
3 
4 import IMP.atom
5 
6 m= IMP.Model()
7 full=IMP.atom.read_pdb(IMP.atom.get_example_path("example_protein.pdb"), m)
8 chain= IMP.atom.get_by_type(full, IMP.atom.CHAIN_TYPE)[0]
9 print chain
10 # for some reason the python wrapper won't make the implicit conversion to Chain
12 IMP.atom.destroy(full)
13 rb= IMP.atom.create_rigid_body(simplified)
14 original_transform= rb.get_reference_frame().get_transformation_to()
15 
16 
17 # fake optimization, just move the rigid body
20 
21 # extract the difference
22 diff= rb.get_reference_frame().get_transformation_to()/original_transform
23 reload=IMP.atom.read_pdb(IMP.atom.get_example_path("example_protein.pdb"), m)
24 IMP.atom.transform(reload, diff)
25 name=IMP.create_temporary_file("out", ".pdb")
26 IMP.atom.write_pdb(reload, name)