IMP  2.2.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-2014 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/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 kernel::Restraint {
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::kernel::DerivativeAccumulator *accum)
50  const IMP_OVERRIDE;
51  virtual IMP::kernel::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE;
53 };
54 
55 IMPEXAMPLE_END_NAMESPACE
56 
57 #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/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.