IMP  2.0.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/isd/ISDRestraint.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 ISDRestraint
29 {
30  int d_;
31  Restraints rs_;
32 public:
33  //! Create the restraint.
34  /** 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  */
38  AmbiguousRestraint(int d, Restraint *r0, Restraint *r1);
39  AmbiguousRestraint(int d, Restraints rs);
40 
41  double get_probability() const
42  {
43  return exp(-unprotected_evaluate(nullptr));
44  }
45 
46  /** This macro declares the basic needed methods: evaluate and show
47  */
49 
50 };
51 
52 IMPISD_END_NAMESPACE
53 
54 #endif /* IMPISD_AMBIGUOUS_RESTRAINT_H */