IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
ExampleComplexRestraint.h
Go to the documentation of this file.
1/**
2 * \file IMP/example/ExampleComplexRestraint.h
3 * \brief A restraint to maintain the diameter of a set of points
4 *
5 * Copyright 2007-2022 IMP Inventors. All rights reserved.
6 */
7
8#ifndef IMPEXAMPLE_EXAMPLE_COMPLEX_RESTRAINT_H
9#define IMPEXAMPLE_EXAMPLE_COMPLEX_RESTRAINT_H
10
11#include <IMP/example/example_config.h>
12
13#include <IMP/PairContainer.h>
15#include <IMP/Restraint.h>
16#include <IMP/ScoreState.h>
17#include <IMP/UnaryFunction.h>
18
19IMPEXAMPLE_BEGIN_NAMESPACE
20
21//! Restrain the diameter of a set of points
22/** This restraint shows how to write a restraint that includes
23 a ScoreState which is needed to compute some invariant.
24
25 \note Be sure to check out the swig wrapper file and how it
26 wraps this class.
27
28 The source code is as follows:
29 \include ExampleComplexRestraint.h
30 \include ExampleComplexRestraint.cpp
31
32*/
33class IMPEXAMPLEEXPORT ExampleComplexRestraint : public Restraint {
36 Float diameter_;
39 FloatKey dr_;
40
41 public:
42 //! Use f to restrain particles in sc to be within diameter of one another
43 /** f should have a minimum at 0 and be an upper bound-style function.
44 */
46 Float diameter,
47 std::string name = "ExampleComplexRestraint%1%");
48
50 const override;
51 virtual IMP::ModelObjectsTemp do_get_inputs() const override;
53};
54
55IMPEXAMPLE_END_NAMESPACE
56
57#endif /* IMPEXAMPLE_EXAMPLE_COMPLEX_RESTRAINT_H */
A container for Pairs.
Abstract base class for all restraints.
Shared score state.
A container for Singletons.
Single variable function.
Class for adding derivatives from restraints to the model.
Restraint(Model *m, std::string name)
Create a restraint and register it with the model.
A shared container for Singletons.
Abstract single variable functor class for score functions.
ExampleComplexRestraint(UnaryFunction *f, SingletonContainer *sc, Float diameter, std::string name="ExampleComplexRestraint%1%")
Use f to restrain particles in sc to be within diameter of one another.
virtual double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
virtual IMP::ModelObjectsTemp do_get_inputs() const override
Index< ParticleIndexTag > ParticleIndex
Definition base_types.h:196
double Float
Basic floating-point value (could be float, double...).
Definition types.h:19
Key< 0 > FloatKey
The type used to identify float attributes in the Particles.
Definition base_types.h:32
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
Definition base_types.h:122
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
A smart pointer to a reference counted object.
Definition Pointer.h:88