IMP logo
IMP Reference Guide  develop.907651fe7c,2026/01/28
The Integrative Modeling Platform
SingletonConstraint.h
Go to the documentation of this file.
1 // Autogenerated by ../../../../tmp/nightly-build-381/imp-20260128.develop.907651fe7c/tools/build/make_containers.py
2 // from ../../../../tmp/nightly-build-381/imp-20260128.develop.907651fe7c/tools/build/container_templates/core/ClassnameConstraint.h
3 // Do not edit - any changes will be lost!
4 
5 /**
6  * \file IMP/core/SingletonConstraint.h
7  * \brief Use a SingletonModifier applied to a ParticlesTemp to
8  * maintain an invariant
9  *
10  * Copyright 2007-2026 IMP Inventors. All rights reserved.
11  */
12 
13 #ifndef IMPCORE_SINGLETON_CONSTRAINT_H
14 #define IMPCORE_SINGLETON_CONSTRAINT_H
15 
16 #include <IMP/core/core_config.h>
17 #include <IMP/internal/TupleConstraint.h>
18 #include <IMP/SingletonModifier.h>
20 #include <cereal/access.hpp>
21 #include <cereal/types/base_class.hpp>
22 
23 IMPCORE_BEGIN_NAMESPACE
24 //! Apply a SingletonFunction to a Singleton
25 /** The score state is passed up to two SingletonModifiers, one to
26  apply before evaluation and the other after. The one after
27  should take a DerivativeAccumulator as its last argument for
28  SingletonModifier::apply() and will only be called if
29  the score was computed with derivatives.
30 
31  \see container::SingletonsConstraint
32  */
34 #if defined(IMP_DOXYGEN) || defined(SWIG)
35  public Constraint
36 #else
37  public IMP::internal::TupleConstraint<SingletonModifier,
38  SingletonDerivativeModifier>
39 #endif
40  {
41  typedef IMP::internal::TupleConstraint<SingletonModifier,
43  friend class cereal::access;
44  template<class Archive> void serialize(Archive &ar) {
45  ar(cereal::base_class<
46  IMP::internal::TupleConstraint<SingletonModifier,
48  }
50 
51  public:
54  ParticleIndex vt,
55  std::string name = "SingletonConstraint %1%",
56  bool can_skip=false)
57  : IMP::internal::TupleConstraint<
59  vt, name,
60  can_skip) {}
61 
63 
64  //! Get the SingletonModifier object used in this constraint
66  return P::get_before_modifier();
67  }
68 
69 #if defined(IMP_DOXYGEN) || defined(SWIG)
70  //! Get the index(es) used in this constraint
72 
73  protected:
74  void do_update_attributes();
75  void do_update_derivatives(DerivativeAccumulator *da);
76  virtual ModelObjectsTemp do_get_inputs() const;
77  virtual ModelObjectsTemp do_get_outputs() const;
78 #endif
80 };
81 
82 IMPCORE_END_NAMESPACE
83 
84 #endif /* IMPCORE_SINGLETON_CONSTRAINT_H */
A base class for modifiers of ParticlesTemp.
A Modifier on ParticlesTemp.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Apply a SingletonFunction to a Singleton.
A more IMP-like version of the std::vector.
Definition: Vector.h:50
SingletonModifier * get_before_modifier() const
Get the SingletonModifier object used in this constraint.
Implement a constraint on the Model.
Definition: Constraint.h:49
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
Ints get_index(const ParticlesTemp &particles, const Subset &subset, const Subsets &excluded)
A Modifier on ParticlesTemp.
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
Definition: object_macros.h:95
Class for adding derivatives from restraints to the model.