IMP  2.1.0
The Integrative Modeling Platform
DummyRestraint.h
Go to the documentation of this file.
1 /**
2  * \file DummyRestraint.h
3  * \brief
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPEM2D_DUMMY_RESTRAINT_H
10 #define IMPEM2D_DUMMY_RESTRAINT_H
11 
12 #include "IMP/em2d/em2d_config.h"
13 #include "IMP/base/log.h"
14 #include <IMP/kernel/Restraint.h>
15 #include "IMP/restraint_macros.h"
16 #include "IMP/base/Pointer.h"
17 
18 
19 #include <IMP/kernel/Restraint.h>
20 #include <IMP/base/log.h>
21 #include <IMP/SingletonContainer.h>
22 
23 
24 IMPEM2D_BEGIN_NAMESPACE
25 
26 
27 //! Dummy restraint between two particles
28 /*!
29  The restraint does do anything and returns 0 as a value. Use this
30  restraint to force two particles to be considered by DOMINO as belonging
31  to a restraint. This trick can be useful when building the merge tree for
32  DOMINO, as can add branches that consider pairs of particles before entire
33  subsets.
34  NOTE: Using this restraint for DOMINO requires a fairly good knowledge of
35  the works of merge trees.
36 */
37 class IMPEM2DEXPORT DummyRestraint: public kernel::Restraint {
40 
41 public:
42 
43  /**
44  * Inits the dummy restraint between the particles
45  * @param p First particle
46  * @param q Second particle
47  */
49  kernel::Restraint(p->get_model(), "DummyRestraint%1%") {
50  p0_ = p;
51  p1_ = q;
52  }
53 
54  /**
55  * Shows information about the class
56  * @param out Stream used to show the information
57  */
58  void show(std::ostream &out = std::cout) const {
59  out << "Dummy kernel::Restraint" << std::endl;
60  }
61 
62  virtual double
63  unprotected_evaluate(IMP::kernel::DerivativeAccumulator *accum)
64  const IMP_OVERRIDE;
65  virtual IMP::kernel::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE;
67 
68 };
69 IMP_OBJECTS(DummyRestraint,DummyRestraints);
70 
71 
72 
73 //! Dummy restraint for a set of particles. Same use as DummyRestraint
74 class IMPEM2DEXPORT ParticlesDummyRestraint: public kernel::Restraint {
76 
77 public:
78 
79  /**
80  * Sets a dummy restraint for a set of particles
81  * @param sc Must contain all the particles that are going to be restrained
82  */
84  kernel::Restraint(sc->get_model(), "ParticlesDummyRestraint%1%") {
85  container_ = sc;
86  }
87 
88  /**
89  * Shows information about the class
90  * @param out Stream used to show the information
91  */
92  void show(std::ostream &out = std::cout) const {
93  out << "ParticlesDummyRestraint" << std::endl;
94  }
95 
96  virtual double
97  unprotected_evaluate(IMP::kernel::DerivativeAccumulator *accum)
98  const IMP_OVERRIDE;
99  virtual IMP::kernel::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE;
101 
102 };
103 IMP_OBJECTS(ParticlesDummyRestraint, ParticlesDummyRestraints);
104 
105 
106 IMPEM2D_END_NAMESPACE
107 
108 #endif /* IMPEM2D_DUMMY_RESTRAINT_H */
Class for adding derivatives from restraints to the model.
Import IMP/kernel/SingletonContainer.h in the namespace.
A nullptr-initialized pointer to an IMP Object.
A smart pointer to a reference counted object.
Definition: base/Pointer.h:87
Dummy restraint for a set of particles. Same use as DummyRestraint.
Import IMP/kernel/restraint_macros.h in the namespace.
void show(std::ostream &out=std::cout) const
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 to handle individual model particles.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
Dummy restraint between two particles.
void show(std::ostream &out=std::cout) const
ParticlesDummyRestraint(SingletonContainer *sc)
Logging and error reporting support.
virtual ModelObjectsTemp do_get_inputs() const =0
A shared container for Singletons.
DummyRestraint(IMP::kernel::Particle *p, IMP::kernel::Particle *q)