IMP  2.1.0
The Integrative Modeling Platform
restrainer/simple_em_fit.py

This example shows how to create simple IMP::em::FitRestraint.

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)