IMP logo

IMP::container::AllPairContainer Class Reference


Detailed Description

Return all unordered pairs of particles taken from the SingletonContainer.

Here is an example using this container to restrain all particles in a set to be within a a certain distance of one another.

import IMP
import IMP.core
import IMP.container

# This example restraints the diameter of a set of particles to be smaller than 10

diameter=10
m= IMP.Model()
lc= IMP.container.ListSingletonContainer(IMP.core.create_xyzr_particles(m, 50, 1.0))
h=IMP.core.HarmonicUpperBound(0,1)
r=IMP.core.DiameterRestraint(h, lc, diameter)
m.add_restraint(r)

# Set up optimizer
o= IMP.core.ConjugateGradients()
o.set_model(m)

max=0
for p0 in lc.get_particles():
    for p1 in lc.get_particles():
        d=IMP.core.get_distance(IMP.core.XYZ(p0),
                            IMP.core.XYZ(p1))
        if d > max: max=d
print "The maximim distance is "+str(max)

IMP.set_log_level(IMP.SILENT)
o.optimize(100)

max=0
for p0 in lc.get_particles():
    for p1 in lc.get_particles():
        d=IMP.core.get_distance(IMP.core.XYZ(p0),
                            IMP.core.XYZ(p1))
        if d > max: max=d
print "Afterwards, the maximim distance is "+str(max)

Note:
Sequential access is much more efficient than random access which is suicidally slow for now. Complain if you want fast(er) random access. We might listen.

The maintenance of the invariant is done by an associated IMP::Constraint. As a result, the state is only guaranteed to be correct either during model evaluation, or immediately following model evaluation before any particles have been changed.

Inheritance diagram for IMP::container::AllPairContainer:

Inheritance graph
[legend]

Public Member Functions

 AllPairContainer (SingletonContainer *c)
 Get the individual particles from the passed SingletonContainer.
void apply (const PairModifier *sm, DerivativeAccumulator &da)
void apply (const PairModifier *sm)
double evaluate (const PairScore *s, DerivativeAccumulator *da) const
double evaluate_change (const PairScore *s, DerivativeAccumulator *da) const
double evaluate_prechange (const PairScore *s, DerivativeAccumulator *da) const
ParticlesTemp get_contained_particles () const
bool get_contained_particles_changed () const
bool get_contains_particle_pair (const ParticlePair &p) const
ContainersTemp get_input_containers () const
unsigned int get_number_of_particle_pairs () const
ParticlePair get_particle_pair (unsigned int i) const
virtual std::string get_type_name () const
virtual ::IMP::VersionInfo get_version_info () const

Static Public Member Functions

static AllPairContainercreate_untracked_container (SingletonContainer *c)

Friends

template<class T >
void IMP::internal::unref (T *)

The documentation for this class was generated from the following files:

Generated on Mon Mar 8 23:08:52 2010 for IMP by doxygen 1.5.8