IMP  2.0.0
The Integrative Modeling Platform
ConnectivityRestraint.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/ConnectivityRestraint.h \brief Connectivity restraint.
3  *
4  * Restrict max distance between at least one pair of particles of any
5  * two distinct types.
6  *
7  * Copyright 2007-2013 IMP Inventors. All rights reserved.
8  *
9  */
10 
11 #ifndef IMPCORE_CONNECTIVITY_RESTRAINT_H
12 #define IMPCORE_CONNECTIVITY_RESTRAINT_H
13 
14 #include <IMP/core/core_config.h>
15 #include "DistanceRestraint.h"
16 
17 #include <IMP/SingletonContainer.h>
18 #include <IMP/Restraint.h>
19 #include <IMP/PairScore.h>
20 
21 IMPCORE_BEGIN_NAMESPACE
22 
23 //! Ensure that a set of particles remains connected with one another.
24 /** The restraint implements ambiguous connectivity. That is, it takes
25  several particles and ensures that they remain
26  connected, but allows how they are connected to change. If you wish
27  to restraint the connectivity of sets of
28  particles (i.e. each protein is represented using a set of balls)
29  use an appropriate PairScore which calls a Refiner (such
30  as ClosePairsPairScore).
31 
32  \verbinclude connectivity_restraint.py
33 
34  More precisely, the restraint scores by computing the MST on the complete
35  graph connecting all the particles. The edge weights are given by
36  the value of the PairScore for the two endpoints of the edge.
37  */
38 class IMPCOREEXPORT ConnectivityRestraint : public Restraint
39 {
40  IMP::OwnerPointer<PairScore> ps_;
41  IMP::OwnerPointer<SingletonContainer> sc_;
42 public:
43  //! Use the given PairScore
45 #ifndef IMP_DOXYGEN
46  //! create a list internally
48  /** @name Particles to be connected
49 
50  The following methods are used to manipulate the list of particles
51  that are to be connected. Each particle should have all the
52  attributes expected by the PairScore used.
53 
54  Ideally, one should pass a singleton container instead. These
55  can only be used if none is passed.
56  */
57  /*@{*/
58  void add_particle(Particle *p);
59  void add_particles(const ParticlesTemp &ps);
60  void set_particles(const ParticlesTemp &ps);
61  /*@}*/
62 #endif
63 
64  //! Return the set of pairs which are connected by the restraint
65  /** This set of pairs reflects the current configuration at the time of
66  the get_connected_pairs() call, not the set at the time of the last
67  evaluate() call.
68  */
69  ParticlePairsTemp get_connected_pairs() const;
70 
71  //! Return the pair score used for scoring
73  return ps_;
74  }
75 
77 
78  public:
79  double unprotected_evaluate(IMP::DerivativeAccumulator *accum)
80  const IMP_OVERRIDE;
81  IMP::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE;
83 };
84 
85 IMPCORE_END_NAMESPACE
86 
87 #endif /* IMPCORE_CONNECTIVITY_RESTRAINT_H */