IMP logo
IMP Reference Guide  2.16.0
The Integrative Modeling Platform
membrane.py
1 ## \example pmi/membrane.py
2 """
3 This script shows how to simulate an a protein using a
4 Membrane restraint. This example show 3 ideal helices
5 that have different segments inside the membrane
6 """
7 
8 import IMP
9 import IMP.atom
10 import IMP.rmf
11 import IMP.pmi
12 import IMP.pmi.topology
13 import IMP.pmi.dof
14 import IMP.pmi.macros
15 import IMP.pmi.restraints
19 import sys
20 
21 IMP.setup_from_argv(sys.argv,
22  "Simulation of a protein using a membrane restraint")
23 
24 model = IMP.Model()
25 s = IMP.pmi.topology.System(model)
26 st = s.create_state()
27 
28 # Create molecules and add helix representation
29 # this makes a c-alpha chain in approximately the shape of a helix
30 mols = []
31 
32 for i, len_helix in enumerate([20, 40, 80]):
33  mol = st.create_molecule(
34  "helix_%s" % (str(i)), sequence="A" * len_helix, chain_id="A"
35  )
36  mol.add_representation(mol, resolutions=[1], ideal_helix=True)
37  mols.append(mol)
38 hier = s.build()
39 
41 for mol in mols:
42  dof.create_rigid_body(mol,
43  max_trans=3.0,
44  max_rot=0.5)
45 ##############################
46 # Connectivity
47 ##############################
48 output_objects = []
49 sample_objects = []
50 rmf_restraints = []
51 
52 crs = []
53 for mol in mols:
55  cr.set_label(mol.get_name())
56  cr.add_to_model()
57  output_objects.append(cr)
58  crs.append(cr)
59 
60 ##############################
61 # Excluded Volume
62 ##############################
64  included_objects=mols, resolution=1
65 )
66 evr1.add_to_model()
67 evr1.set_weight(1.0)
68 output_objects.append(evr1)
69 
70 ##############################
71 # Membrane restraint
72 ##############################
73 
74 mr = IMP.pmi.restraints.basic.MembraneRestraint(
75  hier,
76  objects_inside=["helix_0", (1, 20, "helix_1"), (20, 40, "helix_2")],
77  objects_above=[(21, 40, "helix_1"), (1, 19, "helix_2")],
78  objects_below=[(41, 80, "helix_2")],
79  weight=10,
80 )
81 
82 mr.add_to_model()
83 output_objects.append(mr)
84 
85 # For visualization purposes
86 mr.create_membrane_density()
87 
88 ###########################
89 # External barrier
90 ###########################
91 eb = IMP.pmi.restraints.basic.ExternalBarrier(hierarchies=hier, radius=50)
92 eb.add_to_model()
93 
94 ##############################
95 # Shuffle
96 ##############################
97 IMP.pmi.tools.shuffle_configuration(hier, max_translation=300)
98 print(dof.get_movers())
99 
100 ##############################
101 # Sampling
102 ##############################
103 
104 frames = 10 if IMP.get_is_quick_test() else 2000
106  model, root_hier=hier, crosslink_restraints=rmf_restraints,
107  monte_carlo_sample_objects=dof.get_movers(),
108  replica_exchange_maximum_temperature=3.0,
109  global_output_directory="output/", output_objects=output_objects,
110  monte_carlo_steps=10, number_of_frames=frames,
111  number_of_best_scoring_models=0)
112 
113 rex.execute_macro()
114 exit()
Simplify creation of constraints and movers for an IMP Hierarchy.
Restraints for keeping correct stereochemistry.
bool get_is_quick_test()
Definition: flags.h:183
def shuffle_configuration
Shuffle particles.
Definition: tools.py:1318
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)
Some miscellaneous simple restraints.
Protocols for sampling structures and analyzing them.
Definition: macros.py:1
Represent the root node of the global IMP.atom.Hierarchy.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:73
Classes to handle different kinds of restraints.
Restraint to keep all structures inside sphere.
Create a restraint between consecutive TempResidue objects or an entire PMI Molecule object...
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.
Python classes to represent, score, sample and analyze models.
A macro to help setup and run replica exchange.
Definition: macros.py:58
Functionality for loading, creating, manipulating and scoring atomic structures.
Support for the RMF file format for storing hierarchical molecular data and markup.