IMP  2.1.1
The Integrative Modeling Platform
simple_em_fit.py
1 ## \example restrainer/simple_em_fit.py
2 # This example shows how to create simple IMP::em::FitRestraint.
3 #
4 
5 # -- File: simple_em_fit.py --#
6 
7 import IMP
8 import IMP.atom
9 import IMP.restrainer
10 
11 imp_model = IMP.kernel.Model()
12 
13 # Create particle point 1
14 p1 = IMP.kernel.Particle(imp_model)
15 p1.add_attribute(IMP.FloatKey("x"), 12, True)
16 p1.add_attribute(IMP.FloatKey("y"), 12, True)
17 p1.add_attribute(IMP.FloatKey("z"), 12, True)
18 p1.add_attribute(IMP.FloatKey("radius"), 1.0)
19 p1.add_attribute(IMP.FloatKey("mass"), 1.0)
20 p1.add_attribute(IMP.FloatKey("protein"), 1.0)
21 p1.add_attribute(IMP.FloatKey("id"), 1.0)
22 
23 # Create particle point 2
24 p2 = IMP.kernel.Particle(imp_model)
25 p2.add_attribute(IMP.FloatKey("x"), 15, True)
26 p2.add_attribute(IMP.FloatKey("y"), 6, True)
27 p2.add_attribute(IMP.FloatKey("z"), 6, True)
28 p2.add_attribute(IMP.FloatKey("radius"), 1.0)
29 p2.add_attribute(IMP.FloatKey("mass"), 1.0)
30 p2.add_attribute(IMP.FloatKey("protein"), 1.0)
31 p2.add_attribute(IMP.FloatKey("id"), 1.0)
32 
33 # Create particle point 3
34 p3 = IMP.kernel.Particle(imp_model)
35 p3.add_attribute(IMP.FloatKey("x"), 6, True)
36 p3.add_attribute(IMP.FloatKey("y"), 15, True)
37 p3.add_attribute(IMP.FloatKey("z"), 15, True)
38 p3.add_attribute(IMP.FloatKey("radius"), 1.0)
39 p3.add_attribute(IMP.FloatKey("mass"), 1.0)
40 p3.add_attribute(IMP.FloatKey("protein"), 1.0)
41 p3.add_attribute(IMP.FloatKey("id"), 1.0)
42 
46 
47 particles = []
48 particles.append(p1)
49 particles.append(p2)
50 particles.append(p3)
51 
53 mhs.append(mp)
54 
56  IMP.restrainer.get_example_path("in.mrc"), 1.0, 3.0)
57 
59 
60 r = se.get_restraint()
61 
62 imp_model.add_restraint(r)
SimpleEMFit create_simple_em_fit(atom::Hierarchy const &mh, em::DensityMap *dmap)
Creates EM FitRestraint.
See IMP.restrainer for more information.
static Hierarchy setup_particle(kernel::Model *m, kernel::ParticleIndex pi, kernel::ParticleIndexesAdaptor children=kernel::ParticleIndexesAdaptor())
Class to handle individual model particles.
std::string get_example_path(std::string file_name)
Return the path to installed example data for this module.
em::DensityMap * load_em_density_map(char const *map_fn, float spacing, float resolution)
See IMP.atom for more information.
Class for storing model, its restraints, constraints, and particles.