IMP  2.2.0
The Integrative Modeling Platform
DummyRestraint.h
Go to the documentation of this file.
1 /**
2  * \file IMP/em2d/DummyRestraint.h
3  * \brief
4  *
5  * Copyright 2007-2014 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/base/Pointer.h"
16 
17 #include <IMP/kernel/Restraint.h>
18 #include <IMP/base/log.h>
19 #include <IMP/SingletonContainer.h>
20 
21 IMPEM2D_BEGIN_NAMESPACE
22 
23 //! Dummy restraint between two particles
24 /*!
25  The restraint does do anything and returns 0 as a value. Use this
26  restraint to force two particles to be considered by DOMINO as belonging
27  to a restraint. This trick can be useful when building the merge tree for
28  DOMINO, as can add branches that consider pairs of particles before entire
29  subsets.
30  NOTE: Using this restraint for DOMINO requires a fairly good knowledge of
31  the works of merge trees.
32 */
33 class IMPEM2DEXPORT DummyRestraint : public kernel::Restraint {
36 
37  public:
38  /**
39  * Inits the dummy restraint between the particles
40  * @param p First particle
41  * @param q Second particle
42  */
44  : kernel::Restraint(p->get_model(), "DummyRestraint%1%") {
45  p0_ = p;
46  p1_ = q;
47  }
48 
49  /**
50  * Shows information about the class
51  * @param out Stream used to show the information
52  */
53  void show(std::ostream &out = std::cout) const {
54  out << "Dummy kernel::Restraint" << std::endl;
55  }
56 
57  virtual double unprotected_evaluate(IMP::kernel::DerivativeAccumulator *accum)
58  const IMP_OVERRIDE;
59  virtual IMP::kernel::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE;
61 };
62 IMP_OBJECTS(DummyRestraint, DummyRestraints);
63 
64 //! Dummy restraint for a set of particles. Same use as DummyRestraint
65 class IMPEM2DEXPORT ParticlesDummyRestraint : public kernel::Restraint {
67 
68  public:
69  /**
70  * Sets a dummy restraint for a set of particles
71  * @param sc Must contain all the particles that are going to be restrained
72  */
74  : kernel::Restraint(sc->get_model(), "ParticlesDummyRestraint%1%") {
75  container_ = sc;
76  }
77 
78  /**
79  * Shows information about the class
80  * @param out Stream used to show the information
81  */
82  void show(std::ostream &out = std::cout) const {
83  out << "ParticlesDummyRestraint" << std::endl;
84  }
85 
86  virtual double unprotected_evaluate(IMP::kernel::DerivativeAccumulator *accum)
87  const IMP_OVERRIDE;
88  virtual IMP::kernel::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE;
90 };
91 IMP_OBJECTS(ParticlesDummyRestraint, ParticlesDummyRestraints);
92 
93 IMPEM2D_END_NAMESPACE
94 
95 #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.
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)