This maintains a list of particles whose inter-sphere distance is smaller than the distance parameter.
In order to do this efficiently the class actually computes all pairs within distance+slack of one another. As long as the particles don't move more than the slack amount, the list is still valid and doesn't need to be recomputed. The container keeps track internally of how far the particles have moved using a score state, and is also updated via a score state.
import IMP import IMP.core import IMP.atom import IMP.container # This example addes a restraint on nonbonded interactions # after excluding a set of bonded interactions. m= IMP.Model() # The set of particles ps = IMP.container.ListSingletonContainer(IMP.core.create_xyzr_particles(m, 20, 1.0)) # create a bond between two particles bd0= IMP.atom.Bonded.setup_particle(ps.get_particle(0)) bd1= IMP.atom.Bonded.setup_particle(ps.get_particle(1)) IMP.atom.create_custom_bond(bd0, bd1, 2.0) # Set up the nonbonded list for all pairs at are touching # and let things move 3 before updating the list nbl= IMP.container.ClosePairContainer(ps, 0.0, 3.0) nbl.add_pair_filter(IMP.atom.BondedPairFilter()) # Set up excluded volume sdps= IMP.core.SphereDistancePairScore(IMP.core.HarmonicLowerBound(0,1)) evr= IMP.container.PairsRestraint(sdps, nbl) m.add_restraint(evr) # Set up optimizer o= IMP.core.ConjugateGradients() o.set_model(m) o.optimize(1000)
ClosePairsFinder
Public Member Functions | |
void | apply (const PairModifier *sm, DerivativeAccumulator &da) |
void | apply (const PairModifier *sm) |
ClosePairContainer (SingletonContainer *c, Model *m, double distance, core::ClosePairsFinder *cpf, double slack=1) | |
If the container is empty, you can pass the model explicitly. | |
ClosePairContainer (SingletonContainer *c, double distance, core::ClosePairsFinder *cpf, double slack=1) | |
Get the individual particles from the passed SingletonContainer. | |
ClosePairContainer (SingletonContainer *c, Model *m, double distance, double slack=1) | |
If the container is empty, you can pass the model explicitly. | |
ClosePairContainer (SingletonContainer *c, double distance, double slack=1) | |
Get the individual particles from the passed SingletonContainer. | |
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 |
Methods to control the set of filters | |
PairContainer objects can be used as filters to prevent the addition of pairs to the containeroutput list. Pairs which are contained in any container added to this list will be excluded from the close pairs list. | |
unsigned int | add_pair_filter (PairFilter *obj) |
void | add_pair_filters (const PairFilters &obj) |
void | clear_pair_filters () |
bool | get_has_pair_filters () const |
return true if there are any objects in the container | |
unsigned int | get_number_of_pair_filters () const |
PairFilter * | get_pair_filter (unsigned int i) const |
PairFilterConstIterator | pair_filters_begin () const |
PairFilterIterator | pair_filters_begin () |
PairFilterConstIterator | pair_filters_end () const |
PairFilterIterator | pair_filters_end () |
void | remove_pair_filter (PairFilter *d) |
Remove any occurences of d from the container. | |
void | remove_pair_filters (const PairFilters &d) |
Remove any occurences of each item in d. | |
template<class F > | |
void | remove_pair_filters_if (const F &f) |
Remove any occurrences for which f is true. | |
void | reserve_pair_filters (unsigned int sz) |
void | set_pair_filters (const PairFilters &ps) |
Friends | |
template<class T > | |
void | IMP::internal::unref (T *) |
unsigned int IMP::container::ClosePairContainer::add_pair_filter | ( | PairFilter * | obj | ) |
void IMP::container::ClosePairContainer::add_pair_filters | ( | const PairFilters & | obj | ) |
Add several objects to the container. They are not necessarily added at the end.
PairFilter* IMP::container::ClosePairContainer::get_pair_filter | ( | unsigned int | i | ) | const |
Get the object refered to by the index
IndexException | in Python if the index is out of range |
void IMP::container::ClosePairContainer::set_pair_filters | ( | const PairFilters & | ps | ) |
Set the contents of the container to ps removing all its current contents.