IMP logo
IMP Reference Guide  2.11.0
The Integrative Modeling Platform
pmi/symmetry.py
1 ## \example pmi/symmetry.py
2 """Clone molecules and use a symmetry constrant
3 """
4 
5 import IMP
6 import IMP.atom
7 import IMP.rmf
8 import IMP.pmi
9 import IMP.pmi.topology
10 import IMP.pmi.dof
11 import IMP.pmi.macros
13 import math
14 import sys
15 
16 IMP.setup_from_argv(sys.argv, "Symmetry constraint example")
17 
18 # Create System and State
19 mdl = IMP.Model()
21 st = s.create_state()
22 
23 # Create a simple all-bead molecule
24 mol = st.create_molecule("mymol",sequence='A'*10,chain_id='A')
25 mol.add_representation(mol,
26  resolutions=[1])
27 
28 # Clone the molecule multiple times
29 # Calling molecule.create_clone makes a new molecule with the same name, sequence,
30 # initial structure, and choice of representations
31 # Note: another function, molecule.create_copy(), just copies the name and sequence
32 mols = [mol]
33 chains='BCDEFGHI'
34 for nc in range(7):
35  clone = mol.create_clone(chains[nc])
36  mols.append(clone)
37 
38 hier = s.build()
39 
40 # Create a symmetry constraint
41 # A constrant is invariant: IMP will automatically move all clones to match the reference
42 # If instead you want some more flexiblity, consider IMP.pmi.restraints.stereochemistry.SymmetryRestraint
44 center = IMP.algebra.Vector3D([50,0,0])
45 for nc in range(7):
46  rot = IMP.algebra.get_rotation_about_axis([0,0,1],2*math.pi*(nc+1)/8)
47  transform = IMP.algebra.get_rotation_about_point(center,rot)
48  dof.constrain_symmetry(mols[0],mols[nc+1],transform)
49 mdl.update() # propagates coordinates
50 
51 
52 ############ Make stuff look cool with restraints ###########
53 
54 # set up the original molecule as flexible beads
55 dof.create_flexible_beads(mols[0])
56 
57 # Create a connectivity restraint for the first molecule
59 cr.add_to_model()
60 
61 # Create excluded volume for all particles
63 evr.add_to_model()
64 
65 # Quickly move all flexible beads into place
66 dof.optimize_flexible_beads(100)
67 
68 # write a single-frame RMF to view the helix
70 out.init_rmf("example_symmetry.rmf3",hierarchies=[hier])
71 out.write_rmf("example_symmetry.rmf3")
Simplify creation of constraints and movers for an IMP Hierarchy.
Restraints for keeping correct stereochemistry.
Set of Python classes to create a multi-state, multi-resolution IMP hierarchy.
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
Protocols for sampling structures and analyzing them.
Definition: macros.py:1
This class initializes the root node of the global IMP.atom.Hierarchy.
Transformation3D get_rotation_about_point(const Vector3D &point, const Rotation3D &rotation)
Generate a Transformation3D object from a rotation around a point.
Rotation3D get_rotation_about_axis(const Vector3D &axis, double angle)
Generate a Rotation3D object from a rotation around an axis.
Definition: Rotation3D.h:374
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
Class for easy writing of PDBs, RMFs, and stat files.
Definition: output.py:62
This class creates a restraint between consecutive TempResidue objects OR an entire PMI MOlecule obje...
Create movers and set up constraints for PMI objects.
A class to create an excluded volume restraint for a set of particles at a given resolution.
VectorD< 3 > Vector3D
Definition: VectorD.h:395
Python classes to represent, score, sample and analyze models.
Functionality for loading, creating, manipulating and scoring atomic structures.
Support for the RMF file format for storing hierarchical molecular data and markup.