9 #ifndef IMPKERNEL_RESTRAINT_H
10 #define IMPKERNEL_RESTRAINT_H
12 #include <IMP/kernel_config.h>
22 IMPKERNEL_BEGIN_NAMESPACE
23 class DerivativeAccumulator;
61 double get_score()
const;
67 double evaluate(
bool calc_derivs)
const;
86 double evaluate_moved(
bool calc_derivs,
90 double evaluate_moved_if_below(
bool calc_derivatives,
94 double evaluate_moved_if_good(
bool calc_derivatives,
98 double evaluate_if_good(
bool calc_derivatives)
const;
101 double evaluate_if_below(
bool calc_derivatives,
double max)
const;
138 return unprotected_evaluate(da);
146 return unprotected_evaluate(da);
153 return unprotected_evaluate(da);
156 virtual double unprotected_evaluate_moved_if_below(
160 return unprotected_evaluate_moved(da, moved_pis, reset_pis);
163 virtual double unprotected_evaluate_moved_if_good(
164 DerivativeAccumulator *da,
const ParticleIndexes &moved_pis,
165 const ParticleIndexes &reset_pis,
double max)
const {
167 return unprotected_evaluate_moved(da, moved_pis, reset_pis);
206 void add_score_and_derivatives_moved(
234 Restraint *create_current_decomposition()
const;
244 void set_weight(
Float weight);
245 Float get_weight()
const {
return weight_; }
259 double get_maximum_score()
const {
return max_; }
260 void set_maximum_score(
double s);
273 double max =
NO_MAX)
const;
274 #if !defined(IMP_DOXYGEN)
275 void set_last_score(
double s)
const {
276 last_last_score_ = last_score_;
279 void set_last_last_score(
double s)
const { last_last_score_ = s; }
310 return Restraints(1, const_cast<Restraint *>(
this));
320 return do_create_decomposition();
325 virtual void do_add_score_and_derivatives_moved(
342 mutable double last_score_;
343 mutable double last_last_score_;
354 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
378 IMPKERNEL_END_NAMESPACE
Control display of deprecation information.
const double NO_MAX
Use this value when you want to turn off maximum for restraint evaluation.
IMP::Vector< IMP::Pointer< Restraint > > Restraints
Class for adding scores from restraints to the model.
virtual RestraintInfo * get_static_info() const
Various useful constants.
virtual RestraintInfo * get_dynamic_info() const
Class for adding derivatives from restraints to the model.
virtual Restraints do_create_decomposition() const
#define IMP_REF_COUNTED_DESTRUCTOR(Name)
Ref counted objects should have private destructors.
A smart pointer to a reference counted object.
ScoringFunction * create_scoring_function(RestraintType *rs, double weight=1.0, double max=NO_MAX, std::string name=std::string())
Create a ScoringFunction on a single restraint.
double get_last_last_score() const
Get the unweighted score from the last-but-one time it was evaluated.
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
Class for storing model, its restraints, constraints, and particles.
virtual double unprotected_evaluate_if_below(DerivativeAccumulator *da, double max) const
The function calling this will treat any score >= max as bad.
Base class for objects in a Model that depend on other objects.
virtual Restraints do_create_current_decomposition() const
virtual double unprotected_evaluate_if_good(DerivativeAccumulator *da, double max) const
#define IMP_UNUSED(variable)
Provide a consistent interface for things that take Restraints as arguments.
Class for adding up scores during ScoringFunction evaluation.
Restraints create_decomposition(const RestraintsTemp &rs)
Return the decomposition of a list of restraints.
Report key:value information on restraints.
Base class for objects in a Model that depend on other objects.
virtual double get_last_score() const
bool get_is_aggregate() const
Return whether this restraint wraps a number of other restraints.
ModelObjectsTemp do_get_outputs() const override
bool get_was_good() const
Represents a scoring function on the model.
Report key:value information on restraints.
double Float
Basic floating-point value (could be float, double...)
virtual double unprotected_evaluate_moved(DerivativeAccumulator *da, const ParticleIndexes &moved_pis, const ParticleIndexes &reset_pis) const
Return the unweighted score, taking moving particles into account.
Class for adding derivatives from restraints to the model.
A restraint is a term in an IMP ScoringFunction.