8 #ifndef IMPISD_NUISANCE_H
9 #define IMPISD_NUISANCE_H
11 #include <IMP/isd/isd_config.h>
15 #include <cereal/access.hpp>
16 #include <cereal/types/base_class.hpp>
18 IMPISD_BEGIN_NAMESPACE
29 double nuisance = 1.0);
41 Float get_nuisance()
const {
44 void set_nuisance(
Float d);
52 bool get_has_lower()
const;
53 bool get_has_lower_float()
const;
54 bool get_has_lower_particle()
const;
55 Float get_lower()
const;
58 void set_lower(
Float d);
62 bool get_has_upper()
const;
63 bool get_has_upper_float()
const;
64 bool get_has_upper_particle()
const;
65 Float get_upper()
const;
68 void set_upper(
Float d);
72 Float get_nuisance_derivative()
const {
73 return get_particle()->get_derivative(get_nuisance_key());
76 void add_to_nuisance_derivative(
Float d, DerivativeAccumulator &accum) {
77 get_particle()->add_to_derivative(get_nuisance_key(), d, accum);
80 bool get_nuisance_is_optimized()
const {
81 return get_particle()->get_is_optimized(get_nuisance_key());
84 void set_nuisance_is_optimized(
bool val) {
85 get_particle()->set_is_optimized(get_nuisance_key(), val);
88 friend class NuisanceScoreState;
93 void enforce_bounds();
103 friend class cereal::access;
104 template<
class Archive>
void serialize(Archive &ar) {
105 ar(cereal::base_class<ScoreState>(
this), pi_);
111 :
ScoreState(p->get_model(),
"NuisanceScoreState%1%"),
The base class for decorators.
ParticleIndex get_particle_index() const
Returns the particle index decorated by this decorator.
virtual void do_before_evaluate()=0
Update the state given the current state of the model.
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Model * get_model() const
Returns the Model containing the particle.
Constrain a Nuisance to lie within its bounds.
virtual void do_after_evaluate(DerivativeAccumulator *accpt)=0
Do any necessary updates after the model score is calculated.
A more IMP-like version of the std::vector.
Class for storing model, its restraints, constraints, and particles.
Ints get_index(const ParticlesTemp &particles, const Subset &subset, const Subsets &excluded)
ScoreStates maintain invariants in the Model.
Add nuisance parameter to particle.
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
Helper macros for implementing Decorators.
#define IMP_DECORATOR_SETUP_0(Name)
Particle * get_particle() const
Returns the particle decorated by this decorator.
Key< 4 > ObjectKey
The type used to identify an Object attribute.
Interface to specialized Particle types (e.g. atoms)
virtual ModelObjectsTemp do_get_outputs() const =0
#define IMP_DECORATOR_METHODS(Name, Parent)
double Float
Basic floating-point value (could be float, double...)
Class to handle individual particles of a Model object.
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
ParticleIndex get_index() const
returns the particle index of this particle in its model
bool get_has_attribute(TypeKey attribute_key, ParticleIndex particle) const
return true if particle has attribute with the specified key
Type get_attribute(TypeKey attribute_key, ParticleIndex particle)
get the value of the particle attribute with the specified key
virtual ModelObjectsTemp do_get_inputs() const =0
Class for adding derivatives from restraints to the model.