IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
Scale.h
Go to the documentation of this file.
1/**
2 * \file IMP/isd/Scale.h
3 * \brief A decorator for scale parameters particles
4 *
5 * Copyright 2007-2022 IMP Inventors. All rights reserved.
6 */
7
8#ifndef IMPISD_SCALE_H
9#define IMPISD_SCALE_H
10
11#include <IMP/isd/isd_config.h>
12
13#include <IMP/PairContainer.h>
15#include <IMP/Decorator.h>
17#include <IMP/isd/Nuisance.h>
18
19IMPISD_BEGIN_NAMESPACE
20
21//! Add scale parameter to particle
22/** This is just syntactic sugar for a Nuisance bounded to be positive.
23 */
24class IMPISDEXPORT Scale : public Nuisance {
25 static void do_setup_particle(Model *m, ParticleIndex pi,
26 double scale = 1.0);
27
28 public:
29 IMP_DECORATOR_METHODS(Scale, Nuisance);
31 IMP_DECORATOR_SETUP_1(Scale, double, scale);
32
33 static bool get_is_setup(Model *m, ParticleIndex pi) {
34 return Nuisance::get_is_setup(m, pi) && Nuisance(m, pi).get_lower() >= 0;
35 }
36
37 Float get_scale() const { return get_nuisance(); }
38
39 void set_scale(Float d) { set_nuisance(d); }
40
41 void add_to_scale_derivative(Float d, DerivativeAccumulator &accum) {
42 add_to_nuisance_derivative(d, accum);
43 }
44
45 Float get_scale_derivative() const { return get_nuisance_derivative(); }
46
47 static FloatKey get_scale_key() { return get_nuisance_key(); }
48
49 bool get_scale_is_optimized() const { return get_nuisance_is_optimized(); }
50
51 void set_scale_is_optimized(bool val) { set_nuisance_is_optimized(val); }
52};
53
54IMP_DECORATORS(Scale, Scales, Nuisances);
55
56IMPISD_END_NAMESPACE
57
58#endif /* IMPISD_SCALE_H */
The base class for decorators.
A decorator for nuisance parameters particles.
A container for Pairs.
A container for Singletons.
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
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
Definition base_types.h:196
double Float
Basic floating-point value (could be float, double...).
Definition types.h:19
Key< 0 > FloatKey
The type used to identify float attributes in the Particles.
Definition base_types.h:32