IMP logo
IMP Reference Guide  2.20.1
The Integrative Modeling Platform
multistate.py
1 ## \example multistate.py
2 #
3 
4 from __future__ import print_function
5 import IMP.atom
6 import sys
7 
8 IMP.setup_from_argv(sys.argv, "multistate")
9 
10 m = IMP.Model()
11 
12 rt = IMP.atom.Hierarchy.setup_particle(m, m.add_particle("root"))
13 
14 
15 def create_one():
16  h = IMP.atom.read_pdb(IMP.atom.get_example_path("1d3d-protein.pdb"), m)
17  return h
18 
19 
20 h0 = create_one()
21 rt.add_child(h0)
23 h1 = create_one()
24 rt.add_child(h1)
26 
27 
29  rt,
30  state_index=1,
31  residue_index=8,
32  atom_type=IMP.atom.AT_CA)
33 
34 # we get the 8th CA from state 1
35 for p in r8.get_selected_particles():
36  print(IMP.atom.get_state_index(p), p)
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
static State setup_particle(Model *m, ParticleIndex pi, unsigned int index)
Definition: State.h:39
std::string get_example_path(std::string file_name)
Return the full path to one of this module's example files.
void read_pdb(TextInput input, int model, Hierarchy h)
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
static Hierarchy setup_particle(Model *m, ParticleIndex pi, ParticleIndexesAdaptor children=ParticleIndexesAdaptor())
Create a Hierarchy of level t by adding the needed attributes.
int get_state_index(Hierarchy h)
Walk up the hierarchy to find the current state.
Functionality for loading, creating, manipulating and scoring atomic structures.
Select hierarchy particles identified by the biological name.
Definition: Selection.h:70