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>
27class IMPISDEXPORT Nuisance :
public Decorator {
29 double nuisance = 1.0);
37 return m->get_has_attribute(get_nuisance_key(), pi);
41 Float get_nuisance()
const {
42 return get_model()->get_attribute(get_nuisance_key(), get_particle_index());
44 void set_nuisance(
Float d);
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());
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();
100class IMPISDEXPORT NuisanceScoreState :
public ScoreState {
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%"),
112 pi_(p->get_index()) {}
114 NuisanceScoreState() {}
118 friend class Nuisance;
The base class for decorators.
Particle * get_particle() const
Returns the particle decorated by this decorator.
Class for adding derivatives from restraints to the model.
Class for storing model, its restraints, constraints, and particles.
Class to handle individual particles of a Model object.
virtual ModelObjectsTemp do_get_outputs() const override
virtual ModelObjectsTemp do_get_inputs() const override
virtual void do_after_evaluate(DerivativeAccumulator *da) override
Do any necessary updates after the model score is calculated.
virtual void do_before_evaluate() override
Update the state given the current state of the model.
bool get_has_lower() const
Helper macros for implementing Decorators.
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
#define IMP_DECORATOR_SETUP_0(Name)
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
#define IMP_DECORATOR_METHODS(Name, Parent)
Index< ParticleIndexTag > ParticleIndex
double Float
Basic floating-point value (could be float, double...).
Key< 0 > FloatKey
The type used to identify float attributes in the Particles.
Key< 4 > ObjectKey
The type used to identify an Object attribute.
Key< 3 > ParticleIndexKey
The type used to identify a particle attribute in the Particles.
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.