IMP logo
IMP Reference Guide  2.19.0
The Integrative Modeling Platform
pair_restraint.py
1 ## \example core/pair_restraint.py
2 # Restrain the distance between a pair of particles.
3 #
4 
5 import IMP.algebra
6 import IMP.core
7 import sys
8 
9 IMP.setup_from_argv(sys.argv, "pair restraint")
10 
11 # Make two xyz particles randomly distributed in space
12 m = IMP.Model()
14  IMP.algebra.Vector3D(10,10,10))
15 inds = []
16 for i in range(2):
17  p = m.add_particle("p")
20  inds.append(p)
21 
22 # Score the distance between the two particles with a harmonic function
23 uf = IMP.core.Harmonic(0, 1)
25 r = IMP.core.PairRestraint(m, df, (inds[0], inds[1]))
26 
27 # Print the current score of the restraint, without first derivatives
28 print(r.evaluate(False))
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
static XYZR setup_particle(Model *m, ParticleIndex pi)
Definition: XYZR.h:48
Vector3D get_random_vector_in(const Cylinder3D &c)
Generate a random vector in a cylinder with uniform density.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
Basic functionality that is expected to be used by a wide variety of IMP users.
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
VectorD< 3 > Vector3D
Definition: VectorD.h:425
Applies a PairScore to a Pair.
Definition: PairRestraint.h:31
Harmonic function (symmetric about the mean)
Definition: core/Harmonic.h:27