IMP  2.1.1
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-2013 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/kernel/Restraint.h>
16 #include <IMP/restraint_macros.h>
17 #include <IMP/ScoreState.h>
18 #include <IMP/UnaryFunction.h>
19 
20 IMPEXAMPLE_BEGIN_NAMESPACE
21 
22 //! Restrain the diameter of a set of points
23 /** This restraint shows how to write a restraint that includes
24  a ScoreState which is needed to compute some invariant.
25 
26  \note Be sure to check out the swig wrapper file and how it
27  wraps this class.
28 
29  The source code is as follows:
30  \include ExampleComplexRestraint.h
31  \include ExampleComplexRestraint.cpp
32 
33 */
34 class IMPEXAMPLEEXPORT ExampleComplexRestraint : public kernel::Restraint {
37  Float diameter_;
40  FloatKey dr_;
41 
42  public:
43  //! Use f to restrain particles in sc to be within diameter of one another
44  /** f should have a minimum at 0 and be an upper bound-style function.
45  */
47  Float diameter,
48  std::string name = "ExampleComplexRestraint%1%");
49 
50  virtual double
51  unprotected_evaluate(IMP::kernel::DerivativeAccumulator *accum)
52  const IMP_OVERRIDE;
53  virtual IMP::kernel::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE;
55 };
56 
57 IMPEXAMPLE_END_NAMESPACE
58 
59 #endif /* IMPEXAMPLE_EXAMPLE_COMPLEX_RESTRAINT_H */
Class for adding derivatives from restraints to the model.
Import IMP/kernel/SingletonContainer.h in the namespace.
Import IMP/kernel/UnaryFunction.h in the namespace.
A smart pointer to a reference counted object.
Definition: base/Pointer.h:87
Abstract single variable functor class for score functions.
Import IMP/kernel/restraint_macros.h in the namespace.
Import IMP/kernel/PairContainer.h in the namespace.
Abstract base class for all restraints.
A restraint is a term in an IMP ScoringFunction.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Import IMP/kernel/ScoreState.h in the namespace.
virtual ModelObjectsTemp do_get_inputs() const =0
double Float
Basic floating-point value (could be float, double...)
Definition: base/types.h:20
A shared container for Singletons.
Restrain the diameter of a set of points.