IMP logo
IMP Reference Guide  develop.36b5e40f34,2024/10/14
The Integrative Modeling Platform
ExampleComplexRestraint.h
Go to the documentation of this file.
1 /**
2  * \file IMP/example/ExampleComplexRestraint.h
3  * \brief A restraint to maintain the diameter of a set of points
4  *
5  * Copyright 2007-2022 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPEXAMPLE_EXAMPLE_COMPLEX_RESTRAINT_H
9 #define IMPEXAMPLE_EXAMPLE_COMPLEX_RESTRAINT_H
10 
11 #include <IMP/example/example_config.h>
12 
13 #include <IMP/PairContainer.h>
14 #include <IMP/SingletonContainer.h>
15 #include <IMP/Restraint.h>
16 #include <IMP/ScoreState.h>
17 #include <IMP/UnaryFunction.h>
18 
19 IMPEXAMPLE_BEGIN_NAMESPACE
20 
21 //! Restrain the diameter of a set of points
22 /** This restraint shows how to write a restraint that includes
23  a ScoreState which is needed to compute some invariant.
24 
25  \note Be sure to check out the swig wrapper file and how it
26  wraps this class.
27 
28  The source code is as follows:
29  \include ExampleComplexRestraint.h
30  \include ExampleComplexRestraint.cpp
31 
32 */
33 class IMPEXAMPLEEXPORT ExampleComplexRestraint : public Restraint {
35  ParticleIndex p_;
36  Float diameter_;
39  FloatKey dr_;
40 
41  public:
42  //! Use f to restrain particles in sc to be within diameter of one another
43  /** f should have a minimum at 0 and be an upper bound-style function.
44  */
46  Float diameter,
47  std::string name = "ExampleComplexRestraint%1%");
48 
50  const override;
51  virtual IMP::ModelObjectsTemp do_get_inputs() const override;
53 };
54 
55 IMPEXAMPLE_END_NAMESPACE
56 
57 #endif /* IMPEXAMPLE_EXAMPLE_COMPLEX_RESTRAINT_H */
A container for Singletons.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Single variable function.
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:50
A smart pointer to a reference counted object.
Definition: Pointer.h:87
A container for Pairs.
A shared container for Singletons.
Shared score state.
double Float
Basic floating-point value (could be float, double...)
Definition: types.h:19
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
Restrain the diameter of a set of points.