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