IMP logo
IMP Reference Guide  2.6.2
The Integrative Modeling Platform
ExcludedVolumeRestraint.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/ExcludedVolumeRestraint.h
3  * \brief Prevent spheres from inter-penetrating
4  *
5  * Copyright 2007-2016 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPCORE_EXCLUDED_VOLUME_RESTRAINT_H
9 #define IMPCORE_EXCLUDED_VOLUME_RESTRAINT_H
10 
11 #include <IMP/core/core_config.h>
12 
13 #include "internal/remove_pointers.h"
14 #include "rigid_bodies.h"
15 #include <IMP/PairContainer.h>
16 #include <IMP/SingletonContainer.h>
17 #include <IMP/Restraint.h>
18 #include <IMP/UnaryFunction.h>
19 #include <IMP/Refiner.h>
20 #include "RigidClosePairsFinder.h"
22 #include <boost/unordered_map.hpp>
23 
24 IMPCORE_BEGIN_NAMESPACE
25 
26 //! Prevent a set of particles and rigid bodies from inter-penetrating
27 /** Given an arbitrary collection of particles and rigid bodies, this
28  restraint prevents the particles from interpenetrating. Such restraints
29  are also known as steric clash restraints.
30 
31  \note Pairs of particles within a single rigid body are not restrained
32  (and are ignored in the returned score).
33 
34  \note See IMP::container::ClosePairContainer for more information about
35  close pair based scoring functions and \imp.
36 
37  \note Changing the set of particles in the SingletonContainer is not
38  currently supported after the first evaluate call.
39  */
40 class IMPCOREEXPORT ExcludedVolumeRestraint : public Restraint {
42  mutable ParticleIndexPairs cur_list_;
43  mutable bool was_bad_;
44  mutable bool initialized_;
45  ObjectKey key_;
47  // moved stuff
48  mutable ParticleIndexes rbs_;
49  mutable ParticleIndexes xyzrs_;
50  mutable boost::unordered_map<ParticleIndex, ParticleIndexes>
51  constituents_;
52  double slack_;
53  mutable algebra::Sphere3Ds rbs_backup_sphere_;
54  mutable algebra::Rotation3Ds rbs_backup_rot_;
55  mutable algebra::Sphere3Ds xyzrs_backup_;
56 
57  void reset_moved() const;
58  void initialize() const;
59  bool get_if_moved() const;
60  void fill_list() const;
61  double fill_list_if_good(double max) const;
64  double slack = 10);
65 
66  public:
67  /** The SingletonContainer contains a set of XYZR particles and RigidMembers.
68 
69  The slack is how far the particles must move before the list of close
70  pairs is computed. It does not matter for correctness, just running
71  time. You may want to fiddle with it or use the
72  IMP::container::get_slack_estimate() function.
73 
74  The spring constant used is k.*/
76  double slack = 10,
77  std::string name = "ExcludedVolumeRestraint%1%");
78 
79  void clear_caches();
80 
81 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
82  double unprotected_evaluate_if_good(DerivativeAccumulator *da,
83  double max) const;
84 #endif
85  public:
86  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const
90  ;
93 #ifndef IMP_DOXYGEN
94  const ParticleIndexPairs &get_indexes() const { return cur_list_; }
95 #endif
96  IMP_LIST_ACTION(public, PairFilter, PairFilters, pair_filter, pair_filters,
97  PairPredicate *, PairPredicates, , , );
98 };
99 
100 IMPCORE_END_NAMESPACE
101 
102 #endif /* IMPCORE_EXCLUDED_VOLUME_RESTRAINT_H */
A container for Singletons.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Single variable function.
virtual Restraints do_create_decomposition() const
Definition: Restraint.h:196
virtual void clear_caches()
Definition: Object.h:227
A container for Pairs.
virtual Restraints do_create_current_decomposition() const
Definition: Restraint.h:206
Refine a particle into a list of particles.
functionality for defining rigid bodies
A smart pointer to a ref-counted Object that is a class member.
Definition: Pointer.h:146
A score on the distance between the surfaces of two spheres.
Abstract predicate function.
Definition: PairPredicate.h:31
Handle rigid bodies by looking at their members.
Prevent a set of particles and rigid bodies from inter-penetrating.
Abstract base class for all restraints.
ParticleIndexes get_indexes(const ParticlesTemp &ps)
virtual ModelObjectsTemp do_get_inputs() const =0
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
Class for adding derivatives from restraints to the model.
A restraint is a term in an IMP ScoringFunction.
Definition: Restraint.h:52