IMP logo
IMP Reference Guide  2.7.0
The Integrative Modeling Platform
pmi/atomistic.py
1 ## \example pmi/atomistic.py
2 """This script shows how to simulate an atomic system with MD,
3 with a secondary structure elastic network to speed things up.
4 """
5 
6 from __future__ import print_function
7 import IMP
8 import RMF
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
16 import sys
17 
18 IMP.setup_from_argv(sys.argv, "Simulation of an atomic system")
20  print("This example is too slow to test in debug mode - run without")
21  print("internal tests enabled, or without the --run-quick-test flag")
22  sys.exit(0)
23 
24 # Setup System and add a State
25 mdl = IMP.Model()
27 st1 = s.create_state()
28 
29 # Read sequences and create Molecules
31 gcp2 = st1.create_molecule("GCP2",sequence=seqs["GCP2_YEAST"],chain_id='A')
32 
33 # Add structure. This function returns a list of the residues that now have structure
34 a1 = gcp2.add_structure(IMP.pmi.get_example_path('data/gcp2.pdb'),
35  chain_id='A')
36 
37 # Add structured part representation and then build
38 gcp2.add_representation(a1,resolutions=[0])
39 print('building molecule')
40 hier = s.build()
41 
42 # add charmm restraints
43 print('adding restraints')
45 charmm.add_to_model()
46 
47 # add elastic network on secondary structure units
48 sses = IMP.pmi.io.parse_dssp(IMP.pmi.get_example_path('data/gcp2.dssp'),'A',
49  name_map={'A':'GCP2'})
50 all_rs = []
51 for sse in sses['helix']+sses['beta']:
53  selection_tuples=sse,
54  strength=10.0,
55  dist_cutoff=5.0,
56  ca_only=True,
57  hierarchy=hier)
58  all_rs.append(er)
59  er.add_to_model()
60 
61 # seutp MD and run
63 md_ps = dof.setup_md(gcp2)
65  root_hier=hier,
66  crosslink_restraints = all_rs, #for visualizing SSEs in RMF
67  molecular_dynamics_sample_objects=md_ps,
68  molecular_dynamics_steps=5,
69  number_of_best_scoring_models=0, # set >0 to store best PDB files (but this is slow to do online)
70  number_of_frames=1, # increase number of frames to get better results!
71  global_output_directory='atomistic_output/')
72 rex.execute_macro()