IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
atomistic.py
1## \example pmi/atomistic.py
2"""This script shows how to simulate an atomic system with MD,
3with a secondary structure elastic network to speed things up.
4"""
5
6import IMP
7import IMP.atom
8import IMP.rmf
9import IMP.pmi
11import IMP.pmi.dof
12import IMP.pmi.macros
14import sys
15
16IMP.setup_from_argv(sys.argv, "Simulation of an atomic system")
17if IMP.get_check_level() >= IMP.USAGE_AND_INTERNAL:
18 print("This example is too slow to test in debug mode - run without")
19 print("internal tests enabled")
20 sys.exit(0)
21
22# Setup System and add a State
23mdl = IMP.Model()
25st1 = s.create_state()
26
27# Read sequences and create Molecules
29gcp2 = st1.create_molecule("GCP2", sequence=seqs["GCP2_YEAST"], chain_id='A')
30
31# Add structure. This function returns a list of the residues that now
32# have structure
33a1 = gcp2.add_structure(IMP.pmi.get_example_path('data/gcp2.pdb'),
34 chain_id='A')
35
36# Add structured part representation and then build
37gcp2.add_representation(a1, resolutions=[0])
38print('building molecule')
39hier = s.build()
40
41# add charmm restraints
42print('adding restraints')
44charmm.add_to_model()
45
46# add elastic network on secondary structure units
47sses = IMP.pmi.io.parse_dssp(IMP.pmi.get_example_path('data/gcp2.dssp'), 'A',
48 name_map={'A': 'GCP2'})
49all_rs = []
50for 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# setup MD and run
62md_ps = dof.setup_md(gcp2)
64 mdl,
65 root_hier=hier,
66 molecular_dynamics_sample_objects=md_ps,
67 molecular_dynamics_steps=5,
68 # set >0 to store best PDB files (but this is slow to do online)
69 number_of_best_scoring_models=0,
70 # increase number of frames to get better results!
71 number_of_frames=1,
72 global_output_directory='atomistic_output/')
73rex.execute_macro()
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
Simplify creation of constraints and movers for an IMP Hierarchy.
A macro to help setup and run replica exchange.
Definition macros.py:164
A dictionary-like wrapper for reading and storing sequence data.
Represent the root node of the global IMP.atom.Hierarchy.
Functionality for loading, creating, manipulating and scoring atomic structures.
Create movers and set up constraints for PMI objects.
parse_dssp(dssp_fn, limit_to_chains='', name_map=None)
Read a DSSP file, and return secondary structure elements (SSEs).
Protocols for sampling structures and analyzing them.
Definition macros.py:1
Restraints for keeping correct stereochemistry.
Set of Python classes to create a multi-state, multi-resolution IMP hierarchy.
Python classes to represent, score, sample and analyze models.
std::string get_example_path(std::string file_name)
Return the full path to one of this module's example files.
Support for the RMF file format for storing hierarchical molecular data and markup.
void setup_from_argv(int argc, char **argv, std::string description)
Parse the command line flags and return the positional arguments.
CheckLevel get_check_level()
Get the current audit mode.
Definition exception.h:80