IMP  2.2.1
The Integrative Modeling Platform
restrain_diameter.py
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)
See IMP.container for more information.
Upper bound harmonic function (non-zero when feature > mean)
void set_log_level(LogLevel l)
Set the current global log level.
Simple conjugate gradients optimizer.
double get_distance(XYZR a, XYZR b)
Compute the sphere distance between a and b.
Definition: XYZR.h:88
Store a kernel::ParticleIndexes.
Restrain the diameter of a set of points.
XYZRs create_xyzr_particles(kernel::Model *m, unsigned int num, Float radius, Float box_side=10)
Create a set of particles with random coordinates.
A decorator for a particle with x,y,z coordinates.
Definition: XYZ.h:30
See IMP.core for more information.
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:72