The score state is passed up to two SingletonModifiers, one to apply before evaluation and the other after. The one after should take a DerivativeAccumulator as its last argument for SingletonModifier::apply() and will only be called if the score was computed with derivatives.
An example showing a how to use such a score state to maintain a cover of the atoms of a protein by a sphere per residue.
import IMP import IMP.core import IMP.atom import IMP.atom import IMP.helper m= IMP.Model() prot= IMP.atom.read_pdb(IMP.core.get_example_path('example_protein.pdb'), m) res= IMP.atom.get_by_type(prot, IMP.atom.RESIDUE_TYPE) for p in res: IMP.core.XYZR.setup_particle(p.get_particle()) mtr=IMP.atom.Hierarchy.get_traits() pr= IMP.core.ChildrenRefiner(mtr) for r in res: IMP.core.Cover.setup_particle(r.get_particle(), pr) m.evaluate(False)
Public Member Functions | |
virtual std::string | get_type_name () const |
virtual ::IMP::VersionInfo | get_version_info () const |
void | set_after_evaluate_modifier (SingletonModifier *f) |
Apply this modifier to all the elements after an evaluate. | |
void | set_before_evaluate_modifier (SingletonModifier *f) |
Apply this modifier to all the elements before an evaluate. | |
SingletonsConstraint (SingletonContainer *c, SingletonModifier *before, SingletonModifier *after, std::string name="SingletonConstraint %1%") | |
Protected Member Functions | |
void | do_update_attributes () |
void | do_update_derivatives (DerivativeAccumulator *da) |
virtual ContainersTemp | get_input_containers () const |
virtual ParticlesTemp | get_input_particles () const |
virtual ParticlesList | get_interacting_particles () const |
virtual ContainersTemp | get_output_containers () const |
virtual ParticlesTemp | get_output_particles () const |
Friends | |
template<class T > | |
void | IMP::internal::unref (T *) |
IMP::container::SingletonsConstraint::SingletonsConstraint | ( | SingletonContainer * | c, | |
SingletonModifier * | before, | |||
SingletonModifier * | after, | |||
std::string | name = "SingletonConstraint %1%" | |||
) |
[in] | c | The Container to hold the elements to process |
[in] | before | The SingletonModifier to apply to all elements before evaluate. |
[in] | after | The SingletonModifier to apply to all elements after evaluate. |
[in] | name | The object name |