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)
Inheritance diagram for IMP::container::AllPairContainer:Public Member Functions | |
| AllPairContainer (SingletonContainer *c, std::string name="AllPairContainer%1%") | |
| Get the individual particles from the passed SingletonContainer. | |
| IMP_IMPLEMENT_PAIR_CONTAINER (AllPairContainer) | |
Static Public Member Functions | |
| static AllPairContainer * | create_untracked_container (SingletonContainer *c) |
| IMP::container::AllPairContainer::AllPairContainer | ( | SingletonContainer * | c, |
| std::string | name = "AllPairContainer%1%" |
||
| ) |
Get the individual particles from the passed SingletonContainer.