IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
SingletonConstraint.h
Go to the documentation of this file.
1// Autogenerated by tools/build/make_containers.py
2// from 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>
19#include <cereal/access.hpp>
20#include <cereal/types/base_class.hpp>
21
22IMPCORE_BEGIN_NAMESPACE
23//! Apply a SingletonFunction to a Singleton
24/** The score state is passed up to two SingletonModifiers, one to
25 apply before evaluation and the other after. The one after
26 should take a DerivativeAccumulator as its last argument for
27 SingletonModifier::apply() and will only be called if
28 the score was computed with derivatives.
29
30 \see container::SingletonsConstraint
31 */
32class SingletonConstraint :
33#if defined(IMP_DOXYGEN) || defined(SWIG)
34 public Constraint
35#else
36 public IMP::internal::TupleConstraint<SingletonModifier,
37 SingletonModifier>
38#endif
39 {
40 typedef IMP::internal::TupleConstraint<SingletonModifier,
42 friend class cereal::access;
43 template<class Archive> void serialize(Archive &ar) {
44 ar(cereal::base_class<
45 IMP::internal::TupleConstraint<SingletonModifier,
46 SingletonModifier>>(this));
47 }
48 IMP_OBJECT_SERIALIZE_DECL(SingletonConstraint);
49
50 public:
51 SingletonConstraint(SingletonModifier *before,
52 SingletonModifier *after, Model *m,
54 std::string name = "SingletonConstraint %1%",
55 bool can_skip=false)
56 : IMP::internal::TupleConstraint<
57 SingletonModifier, SingletonModifier>(before, after, m,
58 vt, name, can_skip) {}
59
60 SingletonConstraint() {}
61
62 //! Get the SingletonModifier object used in this constraint
64 return P::get_before_modifier();
65 }
66
67#if defined(IMP_DOXYGEN) || defined(SWIG)
68 //! Get the index(es) used in this constraint
69 typename SingletonModifier::IndexArgument get_index() const;
70
71 protected:
72 void do_update_attributes();
73 void do_update_derivatives(DerivativeAccumulator *da);
76#endif
77 IMP_OBJECT_METHODS(SingletonConstraint);
78};
79
80IMPCORE_END_NAMESPACE
81
82#endif /* IMPCORE_SINGLETON_CONSTRAINT_H */
A Modifier on ParticlesTemp.
Class for adding derivatives from restraints to the model.
A base class for modifiers of ParticlesTemp.
SingletonModifier::IndexArgument get_index() const
Get the index(es) used in this constraint.
virtual ModelObjectsTemp do_get_inputs() const
SingletonModifier * get_before_modifier() const
Get the SingletonModifier object used in this constraint.
virtual ModelObjectsTemp do_get_outputs() const
Index< ParticleIndexTag > ParticleIndex
Definition base_types.h:196
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
Definition base_types.h:122
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.