IMP logo
IMP Reference Guide  2.22.0
The Integrative Modeling Platform
ExamplePairScore.h
Go to the documentation of this file.
1 /**
2  * \file IMP/example/ExamplePairScore.h
3  * \brief A Score on the distance between a pair of particles.
4  *
5  * Copyright 2007-2022 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPEXAMPLE_EXAMPLE_PAIR_SCORE_H
9 #define IMPEXAMPLE_EXAMPLE_PAIR_SCORE_H
10 
11 #include <IMP/example/example_config.h>
12 #include <IMP/core/XYZ.h>
13 #include <IMP/PairScore.h>
14 #include <IMP/pair_macros.h>
15 #include <IMP/UnaryFunction.h>
16 #include <IMP/Pointer.h>
17 #include <cereal/access.hpp>
18 
19 IMPEXAMPLE_BEGIN_NAMESPACE
20 
21 //! Apply a harmonic to the distance between two particles.
22 /** The source code is as follows:
23  \include ExamplePairScore.h
24  \include ExamplePairScore.cpp
25 */
26 class IMPEXAMPLEEXPORT ExamplePairScore : public PairScore {
27  double x0_, k_;
28 
29  public:
30  ExamplePairScore(double x0, double k);
31  ExamplePairScore() {}
32  virtual double evaluate_index(Model *m,
33  const ParticleIndexPair &p,
34  DerivativeAccumulator *da) const override;
36  Model *m, const ParticleIndexes &pis) const override;
39 
40  // Serialization support
41  private:
42  friend class cereal::access;
43  template<class Archive> void serialize(Archive &ar) {
44  ar(cereal::base_class<PairScore>(this), x0_, k_);
45  }
47 
48 };
49 
51 
52 IMPEXAMPLE_END_NAMESPACE
53 
54 #endif /* IMPEXAMPLE_EXAMPLE_PAIR_SCORE_H */
Abstract class for scoring object(s) of type ParticleIndexPair.
Definition: PairScore.h:44
Macros for various classes.
#define IMP_PAIR_SCORE_METHODS(Name)
Definition: pair_macros.h:25
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Single variable function.
A more IMP-like version of the std::vector.
Definition: Vector.h:50
Simple XYZ decorator.
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
virtual ModelObjectsTemp do_get_inputs(Model *m, const ParticleIndexes &pis) const =0
Overload this method to specify the inputs.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
Definition: object_macros.h:44
A nullptr-initialized pointer to an IMP Object.
Apply a harmonic to the distance between two particles.
virtual double evaluate_index(Model *m, const ParticleIndexPair &vt, DerivativeAccumulator *da) const =0
Compute the score and the derivative if needed.
Class for adding derivatives from restraints to the model.