The restraint takes several particles and ensures that they remain connected. If you wish to restraint the connectivity of sets of particles (i.e. each protein is represented using a set of balls) use an appropriate PairScore which calls a Refiner (such as LowestRefinedPairScore).
import IMP import IMP.core import IMP.misc import IMP.algebra import IMP.atom m= IMP.Model() # Put the parent particles for each molecule hs=IMP.Particles() # create the molecules for i in range(0,10): p=IMP.Particle(m) d= IMP.atom.Hierarchy.setup_particle(p) for j in range(0,5): p=IMP.Particle(m) cd= IMP.atom.Fragment.setup_particle(p) d.add_child(cd) xd= IMP.core.XYZR.setup_particle(p, IMP.algebra.Sphere3D(IMP.algebra.Vector3D(3*i,j,0), 1)) hs.append(p) ps= IMP.core.SphereDistancePairScore(IMP.core.HarmonicUpperBound(0,1)) cps= IMP.core.ChildrenRefiner(IMP.atom.Hierarchy.get_traits()) lrps = IMP.misc.LowestRefinedPairScore(cps,ps) cr = IMP.core.ConnectivityRestraint(lrps) cr.set_particles(hs) m.add_restraint(cr) m.evaluate(False)
More precisely, the restraint scores by computing the MST on the complete graph connecting all the particles. The edge weights are given by the value of the PairScore for the two endpoints of the edge.
Public Member Functions | |
ConnectivityRestraint (PairScore *ps, SingletonContainer *sc=NULL) | |
Use the given PairScore. | |
ParticlePairs | get_connected_pairs () const |
Return the set of pairs which are connected by the restraint. | |
ContainersTemp | get_input_containers () const |
ParticlesTemp | get_input_particles () const |
ParticlesList | get_interacting_particles () const |
PairScore * | get_pair_score () const |
Return the pair score used for scoring. | |
virtual std::string | get_type_name () const |
virtual ::IMP::VersionInfo | get_version_info () const |
virtual double | unprotected_evaluate (DerivativeAccumulator *accum) const |
Particles to be connected | |
void | add_particle (Particle *p) |
void | add_particles (const Particles &ps) |
void | set_particles (const Particles &ps) |
Friends | |
template<class T > | |
void | IMP::internal::unref (T *) |
IMP::core::ConnectivityRestraint::ConnectivityRestraint | ( | PairScore * | ps, | |
SingletonContainer * | sc = NULL | |||
) |
Use the given PairScore.
If sc is NULL, a ListSingletonContainer is created internally.
ParticlePairs IMP::core::ConnectivityRestraint::get_connected_pairs | ( | ) | const |
Return the set of pairs which are connected by the restraint.
This set of pairs reflects the current configuration at the time of the get_connected_pairs() call, not the set at the time of the last evaluate() call.