IMP  2.2.1
The Integrative Modeling Platform
core/restrain_diameter.py

An example restraining the diameter of a set of points. That is, the restraint penalizes conformations where there are two points more than a certain distance from one another.

1 ## \example core/restrain_diameter.py
2 # An example restraining the diameter of a set of points. That is, the
3 # restraint penalizes conformations where there are two points more than a
4 # certain distance from one another.
5 
6 import IMP
7 import IMP.core
8 import IMP.container
9 
10 # This example restraint the diameter of a set of particles to be smaller
11 # than 10
12 
13 diameter = 10
14 m = IMP.kernel.Model()
18 r = IMP.core.DiameterRestraint(h, lc, diameter)
19 m.add_restraint(r)
20 
21 # Set up optimizer
23 
24 max = 0
25 for p0 in lc.get_particles():
26  for p1 in lc.get_particles():
28  IMP.core.XYZ(p1))
29  if d > max:
30  max = d
31 print "The maximum distance is " + str(max)
32 
33 IMP.base.set_log_level(IMP.base.SILENT)
34 o.optimize(100)
35 
36 max = 0
37 for p0 in lc.get_particles():
38  for p1 in lc.get_particles():
40  IMP.core.XYZ(p1))
41  if d > max:
42  max = d
43 print "Afterwards, the maximum distance is " + str(max)