IMP  2.0.1
The Integrative Modeling Platform
ExcludedVolumeRestraint.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/ExcludedVolumeRestraint.h
3  * \brief A prevent spheres from inter-penetrating
4  *
5  * Copyright 2007-2013 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 <IMP/internal/InternalPairsRestraint.h>
15 #include "internal/CoreClosePairContainer.h"
16 #include "rigid_bodies.h"
17 #include <IMP/PairContainer.h>
18 #include <IMP/SingletonContainer.h>
19 #include <IMP/Restraint.h>
20 #include <IMP/UnaryFunction.h>
21 #include <IMP/Refiner.h>
22 #include "RigidClosePairsFinder.h"
24 
25 IMPCORE_BEGIN_NAMESPACE
26 
27 //! Prevent a set of particles and rigid bodies from inter-penetrating
28 /** Given an arbitrary collection of particles and rigid bodies, this
29  restraint prevents the particles from interpenetrating. Such restraints
30  are also known as steric clash restraints.
31 
32  \note See IMP::container::ClosePairContainer for more information about
33  close pair based scoring functions and \imp.
34 
35  \note Changing the set of particles in the SingletonContainer is not
36  currently supported after the first evaluate call.
37 
38  \note Currently the radius of all particles is assumed to be constant
39  */
40 class IMPCOREEXPORT ExcludedVolumeRestraint: public Restraint
41 {
43  mutable ParticleIndexPairs cur_list_;
44  mutable bool was_bad_;
45  mutable bool initialized_;
46  ObjectKey key_;
48  // moved stuff
49  mutable ParticleIndexes rbs_;
50  mutable ParticleIndexes xyzrs_;
52  double slack_;
53  mutable algebra::Transformation3Ds rbs_backup_;
54  mutable algebra::Vector3Ds xyzrs_backup_;
55 
56  void reset_moved() const;
57  void initialize() const;
58  int get_if_moved() const;
59  void fill_list() const;
60  double fill_list_if_good(double max) const;
61  ExcludedVolumeRestraint(SingletonContainerAdaptor sc,
62  SoftSpherePairScore *ssps,
63  ObjectKey ok, double slack=10);
64 public:
65  /** The SingletonContainer contains a set of XYZR particles and RigidMembers.
66 
67  The slack is how far the particles must move before the list of close
68  pairs is computed. It does not matter for correctness, just running
69  time. You may want to fiddle with it or use the
70  IMP::container::get_slack_estimate() function.
71 
72  The spring constant used is k.*/
73  ExcludedVolumeRestraint(SingletonContainerAdaptor sc,
74  double k=1, double slack=10,
75  std::string name="ExcludedVolumeRestraint%1%");
76 
77  void clear_caches();
78 
79 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
80  double unprotected_evaluate_if_good(DerivativeAccumulator *da,
81  double max) const;
82 #endif
83  public:
84  double unprotected_evaluate(IMP::DerivativeAccumulator *accum)
85  const IMP_OVERRIDE;
86  IMP::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE;
90 #ifndef IMP_DOXYGEN
91  const ParticleIndexPairs& get_indexes() const {return cur_list_;}
92 #endif
93  IMP_LIST_ACTION(public, PairFilter, PairFilters, pair_filter,
94  pair_filters,
96 };
97 
98 
99 IMPCORE_END_NAMESPACE
100 
101 #endif /* IMPCORE_EXCLUDED_VOLUME_RESTRAINT_H */