IMP logo
IMP Reference Guide  2.20.0
The Integrative Modeling Platform
ConstantRestraint.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/ConstantRestraint.h \brief Constant restraint.
3  *
4  * Just return a constant.
5  *
6  * Copyright 2007-2022 IMP Inventors. All rights reserved.
7  *
8  */
9 
10 #ifndef IMPCORE_CONSTANT_RESTRAINT_H
11 #define IMPCORE_CONSTANT_RESTRAINT_H
12 
13 #include <IMP/core/core_config.h>
14 
15 #include <IMP/Restraint.h>
16 #include <IMP/PairScore.h>
17 #include <cereal/access.hpp>
18 #include <cereal/types/base_class.hpp>
19 #include <cereal/types/polymorphic.hpp>
20 
21 IMPCORE_BEGIN_NAMESPACE
22 
23 //! Return a constant value.
24 /** This restraint is mostly for testing, but can also be used to make
25  the total score look nicer.
26  */
27 class IMPCOREEXPORT ConstantRestraint : public Restraint {
28  Float v_;
29 
30  friend class cereal::access;
31 
32  template<class Archive> void serialize(Archive &ar) {
33  ar(cereal::base_class<Restraint>(this), v_);
34  }
36 
37  public:
38  //! Add v to the total score.
41 
43  const override;
44  virtual IMP::ModelObjectsTemp do_get_inputs() const override;
46 };
47 
48 IMPCORE_END_NAMESPACE
49 
50 #endif /* IMPCORE_CONSTANT_RESTRAINT_H */
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
virtual double unprotected_evaluate(DerivativeAccumulator *da) const
Return the unweighted score for the restraint.
A more IMP-like version of the std::vector.
Definition: Vector.h:42
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
Define PairScore.
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
Definition: object_macros.h:95
Return a constant value.
double Float
Basic floating-point value (could be float, double...)
Definition: types.h:19
Abstract base class for all restraints.
virtual ModelObjectsTemp do_get_inputs() const =0
Class for adding derivatives from restraints to the model.
A restraint is a term in an IMP ScoringFunction.
Definition: Restraint.h:56