IMP logo
IMP Reference Guide  2.10.0
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-2018 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 
49  virtual double unprotected_evaluate(IMP::DerivativeAccumulator *accum)
50  const IMP_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.
A more IMP-like version of the std::vector.
Definition: Vector.h:39
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:20
Abstract base class for all restraints.
Abstract single variable functor class for score functions.
Definition: UnaryFunction.h:25
virtual ModelObjectsTemp do_get_inputs() const =0
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
Class for adding derivatives from restraints to the model.
A restraint is a term in an IMP ScoringFunction.
Definition: Restraint.h:54
Restrain the diameter of a set of points.