Abstract class for representing restraints.
Restraints should take their score function or UnaryFunction as the first argument. Restraints which act on large numbers of particles should allow the particle list to be skipped in the constructor and should provide methods so that the set of particles can be modified after construction.
A restraint can be added to the model multiple times or to multiple restraint sets in the same model.
Examples: write a restraint
Inherits IMP::base::Object.
Inherited by IMP::atom::CHARMMStereochemistryRestraint, IMP::container::MinimumPairRestraint, IMP::container::MinimumQuadRestraint, IMP::container::MinimumSingletonRestraint, IMP::container::MinimumTripletRestraint, IMP::container::PairsRestraint, IMP::container::PredicatePairsRestraint, IMP::container::PredicateQuadsRestraint, IMP::container::PredicateSingletonsRestraint, IMP::container::PredicateTripletsRestraint, IMP::container::QuadsRestraint, IMP::container::SingletonsRestraint, IMP::container::TripletsRestraint, IMP::core::ConnectivityRestraint, IMP::core::ConstantRestraint, IMP::core::DiameterRestraint, IMP::core::DihedralRestraint, IMP::core::DistanceRestraint, IMP::core::ExcludedVolumeRestraint, IMP::core::MinimumRestraint, IMP::core::MSConnectivityRestraint, IMP::core::VolumeRestraint, IMP::em2d::DummyRestraint, IMP::em2d::Em2DRestraint, IMP::em2d::Fine2DRegistrationRestraint, IMP::em2d::ParticlesDummyRestraint, IMP::em2d::RigidBodiesImageFitRestraint, IMP::em::DensityFillingRestraint, IMP::em::EnvelopePenetrationRestraint, IMP::em::FitRestraint, IMP::example::ExampleComplexRestraint, IMP::example::ExampleRestraint, IMP::examplesystemlocal::ExampleRestraint, IMP::isd::ISDRestraint, IMP::isd::LogicalORRestraint, IMP::isd::TALOSRestraint, IMP::modeller::ModellerRestraints, IMP::modeller::MultipleBinormalRestraint, IMP::multifit::ComplementarityRestraint, IMP::multifit::RadiusOfGyrationRestraint, IMP::multifit::WeightedExcludedVolumeRestraint, IMP::PairScoreRestraint, IMP::PairsScoreRestraint, IMP::QuadScoreRestraint, IMP::QuadsScoreRestraint, IMP::RestraintSet, IMP::saxs::RadiusOfGyrationRestraint, IMP::saxs::Restraint, IMP::SingletonScoreRestraint, IMP::SingletonsScoreRestraint, IMP::TripletScoreRestraint, and IMP::TripletsScoreRestraint.
Public Member Functions | |
| Restraint (std::string name="Restraint %1%") | |
| Restraint * | create_current_decomposition () const |
| Decompose this restraint into constituent terms for the current conf. | |
| Restraint * | create_decomposition () const |
| Decompose this restraint into constituent terms. | |
| Restraint * | create_incremental_decomposition (unsigned int n) const |
| Decompose a restraint parts for incremental evaluation. | |
| double | evaluate (bool calc_derivs) const |
| Return the score for this restraint for the current state of the model. | |
| double | evaluate_if_good (bool calc_derivatives) const |
| See Model::evaluate_if_good() | |
| bool | get_is_part_of_model () const |
| Return true if this particle is part of a model. | |
| Model * | get_model () const |
| Return the model containing this restraint. | |
| virtual void | set_model (Model *model) |
Static Public Member Functions | |
| static Restraint * | get_from (Object *o) |
| For python, cast a generic Object to this type. Throw a ValueException of object is not the right type. | |
Interactions | |
Certain sorts of operations, such as evaluation of restraints in isolation, benefit from being able to determine which containers and particles are needed by which restraints. | |
| virtual ContainersTemp | get_input_containers () const =0 |
| virtual ParticlesTemp | get_input_particles () const =0 |
Weights | |
Each restraint's contribution to the model score is weighted. The total weight for the restraint is the some over all the paths containing it. That is, if a restraint is in a RestraintSet with weight .5 and another with weight 2, and the restaint itself has weight 3, then the total weight of the restraint is | |
| void | set_weight (Float weight) |
| Float | get_weight () const |
Filtering | |
We are typically only interested in "good" conformations of the model. These are described by specifying maximum scores per restraint and for the whole model. Samplers, optimizers etc are free to ignore configurations they encounter which go outside these bounds.
| |
| double | get_maximum_score () const |
| void | set_maximum_score (double s) |
Protected Member Functions | |
| virtual Restraints | do_create_current_decomposition () const |
| virtual Restraints | do_create_decomposition () const |
| virtual Restraints | do_create_incremental_decomposition (unsigned int) const |
| Restraint* IMP::Restraint::create_current_decomposition | ( | ) | const |
Decompose this restraint into constituent terms for the current conf.
Return a decomposition that is value for the current conformation, but will not necessarily be valid if any of the particles are changed. This is the same as create_decomposition() for non-conditional restraints.
The restraints returned have had set_model() called and so can be evaluated.
| Restraint* IMP::Restraint::create_decomposition | ( | ) | const |
Decompose this restraint into constituent terms.
Given the set of input particles, decompose the restraint into as simple parts as possible. For many restraints, the simplest part is simply the restraint itself.
If a restraint can be decomposed, it should return a RestraintSet so that the maximum score and weight can be passed properly.
The restraints returned have had set_model() called and so can be evaluated.
| Restraint* IMP::Restraint::create_incremental_decomposition | ( | unsigned int | n | ) | const |
Decompose a restraint parts for incremental evaluation.
The restraint should be decomposed as efficiently as possible for evaluation when n particles are moved each evaluate call.
| virtual Restraints IMP::Restraint::do_create_current_decomposition | ( | ) | const [protected, virtual] |
A Restraint should override this if they want to decompose themselves for display and other purposes. The returned restraints will be made in to a RestraintSet, if needed and the weight and maximum score set for the restraint set.
Reimplemented in IMP::core::MSConnectivityRestraint, IMP::core::ConnectivityRestraint, and IMP::core::ExcludedVolumeRestraint.
| virtual Restraints IMP::Restraint::do_create_decomposition | ( | ) | const [protected, virtual] |
A Restraint should override this if they want to decompose themselves for domino and other purposes. The returned restraints will be made in to a RestraintSet, if needed and the weight and maximum score set for the restraint set.
Reimplemented in IMP::core::ExcludedVolumeRestraint.
| virtual Restraints IMP::Restraint::do_create_incremental_decomposition | ( | unsigned | int | ) | const [protected, virtual] |
int should override this if they want to decompose themselves for incremental montecarlo and other purposes. The returned restraints will be made in to a RestraintSet, if needed and the weight and maximum score set for the restraint set.
Reimplemented in IMP::core::ExcludedVolumeRestraint.
| double IMP::Restraint::evaluate | ( | bool | calc_derivs | ) | const |
Return the score for this restraint for the current state of the model.
This method is equivalent to calling:
model->evaluate(RestraintsTemp(1,this), calc_derivs)
| double IMP::Restraint::evaluate_if_good | ( | bool | calc_derivatives | ) | const |
| static Restraint* IMP::Restraint::get_from | ( | Object * | o | ) | [static] |
For python, cast a generic Object to this type. Throw a ValueException of object is not the right type.
| bool IMP::Restraint::get_is_part_of_model | ( | ) | const |
Return true if this particle is part of a model.
| Model* IMP::Restraint::get_model | ( | ) | const |
Return the model containing this restraint.
| virtual void IMP::Restraint::set_model | ( | Model * | model | ) | [virtual] |
This method is called to register a restrain with a model. Adding the restraint the model (Model::add_restraint()) will call this method but it can be called directly if one wants to use the restraint, just not as part of the normal scoring function.
Reimplemented in IMP::isd::GaussianProcessInterpolationRestraint, IMP::example::ExampleComplexRestraint, and IMP::core::MinimumRestraint.