IMP  2.1.0
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/kernel/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/kernel/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 Pairs of particles within a single rigid body are not restrained
33  (and are ignored in the returned score).
34 
35  \note See IMP::container::ClosePairContainer for more information about
36  close pair based scoring functions and \imp.
37 
38  \note Changing the set of particles in the SingletonContainer is not
39  currently supported after the first evaluate call.
40  */
41 class IMPCOREEXPORT ExcludedVolumeRestraint : public kernel::Restraint {
43  mutable kernel::ParticleIndexPairs cur_list_;
44  mutable bool was_bad_;
45  mutable bool initialized_;
46  ObjectKey key_;
48  // moved stuff
49  mutable kernel::ParticleIndexes rbs_;
50  mutable kernel::ParticleIndexes xyzrs_;
52  constituents_;
53  double slack_;
54  mutable algebra::Sphere3Ds rbs_backup_sphere_;
55  mutable algebra::Rotation3Ds rbs_backup_rot_;
56  mutable algebra::Sphere3Ds xyzrs_backup_;
57 
58  void reset_moved() const;
59  void initialize() const;
60  bool get_if_moved() const;
61  void fill_list() const;
62  double fill_list_if_good(double max) const;
63  ExcludedVolumeRestraint(SingletonContainerAdaptor sc,
65  double slack = 10);
66 
67  public:
68  /** The SingletonContainer contains a set of XYZR particles and RigidMembers.
69 
70  The slack is how far the particles must move before the list of close
71  pairs is computed. It does not matter for correctness, just running
72  time. You may want to fiddle with it or use the
73  IMP::container::get_slack_estimate() function.
74 
75  The spring constant used is k.*/
76  ExcludedVolumeRestraint(SingletonContainerAdaptor sc, double k = 1,
77  double slack = 10,
78  std::string name = "ExcludedVolumeRestraint%1%");
79 
80  void clear_caches();
81 
82 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
83  double unprotected_evaluate_if_good(DerivativeAccumulator *da,
84  double max) const;
85 #endif
86  public:
87  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const
88  IMP_OVERRIDE;
89  IMP::kernel::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE;
91  ;
94 #ifndef IMP_DOXYGEN
95  const kernel::ParticleIndexPairs &get_indexes() const { return cur_list_; }
96 #endif
97  IMP_LIST_ACTION(public, PairFilter, PairFilters, pair_filter, pair_filters,
98  PairPredicate *, PairPredicates, , , );
99 };
100 
101 IMPCORE_END_NAMESPACE
102 
103 #endif /* IMPCORE_EXCLUDED_VOLUME_RESTRAINT_H */
ParticleIndexes get_indexes(const ParticlesTemp &ps)
A base class for Keys.
Definition: kernel/Key.h:46
Class for adding derivatives from restraints to the model.
Import IMP/kernel/SingletonContainer.h in the namespace.
A smart pointer to a ref-counted Object that is a class memeber.
Definition: base/Pointer.h:146
Import IMP/kernel/UnaryFunction.h in the namespace.
virtual void clear_caches()
Import IMP/kernel/PairContainer.h in the namespace.
Abstract base class for all restraints.
Import IMP/kernel/Refiner.h in the namespace.
functionality for defining rigid bodies
A restraint is a term in an IMP ScoringFunction.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Abstract predicate function.
IMP::base::Vector< IMP::base::Pointer< PairPredicate > > PairPredicates
virtual Restraints do_create_current_decomposition() const
A score on the distance between the surfaces of two spheres.
Handle rigid bodies by looking at their members.
virtual ModelObjectsTemp do_get_inputs() const =0
Prevent a set of particles and rigid bodies from inter-penetrating.
virtual Restraints do_create_decomposition() const