IMP logo
IMP Reference Guide  2.20.2
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-2022 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/log.h"
14 #include <IMP/Restraint.h>
15 #include "IMP/Pointer.h"
16 
17 #include <IMP/Restraint.h>
18 #include <IMP/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 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  : 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 Restraint" << std::endl;
55  }
56 
58  const override;
59  virtual IMP::ModelObjectsTemp do_get_inputs() const override;
61 };
63 
64 //! Dummy restraint for a set of particles. Same use as DummyRestraint
65 class IMPEM2DEXPORT ParticlesDummyRestraint : public Restraint {
66  Pointer<SingletonContainer> container_;
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  : 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 
87  const override;
88  virtual IMP::ModelObjectsTemp do_get_inputs() const override;
90 };
92 
93 IMPEM2D_END_NAMESPACE
94 
95 #endif /* IMPEM2D_DUMMY_RESTRAINT_H */
A container for Singletons.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
virtual double unprotected_evaluate(DerivativeAccumulator *da) const
Return the unweighted score for the restraint.
DummyRestraint(IMP::Particle *p, IMP::Particle *q)
Dummy restraint for a set of particles. Same use as DummyRestraint.
A more IMP-like version of the std::vector.
Definition: Vector.h:42
A smart pointer to a reference counted object.
Definition: Pointer.h:87
void show(std::ostream &out=std::cout) const
A shared container for Singletons.
Dummy restraint between two particles.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
Definition: object_macros.h:44
void show(std::ostream &out=std::cout) const
A nullptr-initialized pointer to an IMP Object.
ParticlesDummyRestraint(SingletonContainer *sc)
Class to handle individual particles of a Model object.
Definition: Particle.h:43
Abstract base class for all restraints.
Logging and error reporting support.
virtual ModelObjectsTemp do_get_inputs() const =0
Class for adding derivatives from restraints to the model.
A restraint is a term in an IMP ScoringFunction.
Definition: Restraint.h:56