IMP  2.1.1
The Integrative Modeling Platform
AmbiguousRestraint.h
Go to the documentation of this file.
1 /**
2  * \file IMP/isd/AmbiguousRestraint.h
3  * \brief An implementation of the d-norm to make an ambiguous restraint.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPISD_AMBIGUOUS_RESTRAINT_H
10 #define IMPISD_AMBIGUOUS_RESTRAINT_H
11 
12 #include <IMP/isd/isd_config.h>
13 #include <IMP/kernel/Restraint.h>
14 #include <IMP/restraint_macros.h>
15 
16 IMPISD_BEGIN_NAMESPACE
17 
18 //! Apply an ambiguous restraint by computing the d-norm.
19 // d is an integer.
20 // If d>0, behaves like an "and" function.
21 // If d<0, behaves like an "or" function.
22 // Limits are fuzzy "and" (min) and fuzzy "or" (max) when d is infinite.
23 /*
24  The source code is as follows:
25  \include AmbiguousRestraint.h
26  \include AmbiguousRestraint.cpp
27 */
28 class IMPISDEXPORT AmbiguousRestraint : public kernel::Restraint
29 {
30  int d_;
32 public:
33  //! Create the restraint.
34  /** kernel::Restraints should store the particles they are to act on,
35  preferably in a Singleton or PairContainer as appropriate.
36  Two ways to call it: pass it two restraints, or a list of restraints.
37  */
39  kernel::Restraint *r1);
41 
42  double get_probability() const
43  {
44  return exp(-unprotected_evaluate(nullptr));
45  }
46 
47  /** This macro declares the basic needed methods: evaluate and show
48  */
49  virtual double
50  unprotected_evaluate(IMP::kernel::DerivativeAccumulator *accum)
51  const IMP_OVERRIDE;
52  virtual IMP::kernel::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE;
54 
55 };
56 
57 IMPISD_END_NAMESPACE
58 
59 #endif /* IMPISD_AMBIGUOUS_RESTRAINT_H */
Class for adding derivatives from restraints to the model.
Apply an ambiguous restraint by computing the d-norm.
IMP::base::Vector< IMP::base::WeakPointer< kernel::ModelObject > > ModelObjectsTemp
Import IMP/kernel/restraint_macros.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.
Class for storing model, its restraints, constraints, and particles.