IMP logo
IMP Reference Guide  2.19.0
The Integrative Modeling Platform
DistanceRestraint.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/DistanceRestraint.h
3  * \brief Distance restraint between two particles.
4  *
5  * Copyright 2007-2022 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPCORE_DISTANCE_RESTRAINT_H
10 #define IMPCORE_DISTANCE_RESTRAINT_H
11 
12 #include <IMP/core/core_config.h>
13 #include "DistancePairScore.h"
14 #include "XYZ.h"
15 #include <IMP/generic.h>
16 
17 #include <IMP/Restraint.h>
18 
19 #include <iostream>
20 #include <cereal/access.hpp>
21 #include <cereal/types/base_class.hpp>
22 #include <cereal/types/polymorphic.hpp>
23 
24 IMPCORE_BEGIN_NAMESPACE
25 
26 //! Distance restraint between two particles
27 /**
28  \note If the particles are closer than a certain distance, then
29  the contributions to the derivatives are set to 0.
30 
31  \see PairRestraint
32  \see DistancePairScore
33  \see SphereDistancePairScore
34  */
35 class IMPCOREEXPORT DistanceRestraint :
36 #if defined(SWIG) || defined(IMP_DOXYGEN)
37  public Restraint
38 #else
39  public IMP::internal::TupleRestraint<DistancePairScore>
40 #endif
41  {
42  friend class cereal::access;
43 
44  template<class Archive> void serialize(Archive &ar) {
45  ar(cereal::base_class<
46  IMP::internal::TupleRestraint<DistancePairScore> >(this));
47  }
49 
50  public:
51  //! Create the distance restraint.
52  /** \param[in] m Model.
53  \param[in] score_func Scoring function for the restraint.
54  \param[in] a First particle in distance restraint.
55  \param[in] b Second particle in distance restraint.
56  \param[in] name restraint name
57  */
58  DistanceRestraint(Model *m, UnaryFunction *score_func,
61  std::string name = "DistanceRestraint %1%");
63 
64 #ifdef SWIG
65  protected:
69 #endif
70 };
71 
72 IMPCORE_END_NAMESPACE
73 
74 #endif /* IMPCORE_DISTANCE_RESTRAINT_H */
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Take Decorator, Particle or ParticleIndex.
virtual double unprotected_evaluate(DerivativeAccumulator *da) const
Return the unweighted score for the restraint.
Distance restraint between two particles.
A more IMP-like version of the std::vector.
Definition: Vector.h:42
Simple XYZ decorator.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
Definition: object_macros.h:95
A Score on the distance between a pair of particles.
Abstract base class for all restraints.
Abstract single variable functor class for score functions.
Definition: UnaryFunction.h:27
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
Compile-time generic restraint and constraint support.