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 Float get_lower()
const;
56 void set_lower(
Float d);
60 bool get_has_upper()
const;
61 Float get_upper()
const;
64 void set_upper(
Float d);
68 Float get_nuisance_derivative()
const {
69 return get_particle()->get_derivative(get_nuisance_key());
72 void add_to_nuisance_derivative(
Float d, DerivativeAccumulator &accum) {
73 get_particle()->add_to_derivative(get_nuisance_key(), d, accum);
76 bool get_nuisance_is_optimized()
const {
77 return get_particle()->get_is_optimized(get_nuisance_key());
80 void set_nuisance_is_optimized(
bool val) {
81 get_particle()->set_is_optimized(get_nuisance_key(), val);
84 friend class NuisanceScoreState;
89 void enforce_bounds();
95 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
96 class IMPISDEXPORT NuisanceScoreState :
public ScoreState {
99 friend class cereal::access;
100 template<
class Archive>
void serialize(Archive &ar) {
101 ar(cereal::base_class<ScoreState>(
this), pi_);
106 NuisanceScoreState(Particle *p)
107 : ScoreState(p->get_model(),
"NuisanceScoreState%1%"),
110 NuisanceScoreState() {}
113 friend class Nuisance;
114 virtual void do_before_evaluate()
override;
115 virtual void do_after_evaluate(DerivativeAccumulator *da)
override;
The base class for decorators.
ParticleIndex get_particle_index() const
Returns the particle index decorated by this decorator.
#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.
Index< ParticleIndexTag > ParticleIndex
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
Class for storing model, its restraints, constraints, and particles.
Ints get_index(const ParticlesTemp &particles, const Subset &subset, const Subsets &excluded)
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)
#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.
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