IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
PairModifier.h
Go to the documentation of this file.
1// Autogenerated by tools/build/make_containers.py
2// from tools/build/container_templates/kernel/ClassnameModifier.h
3// Do not edit - any changes will be lost!
4
5/**
6 * \file IMP/PairModifier.h
7 * \brief A Modifier on ParticlePairsTemp
8 *
9 * Copyright 2007-2026 IMP Inventors. All rights reserved.
10 */
11
12#ifndef IMPKERNEL_PAIR_MODIFIER_H
13#define IMPKERNEL_PAIR_MODIFIER_H
14
15#include <IMP/kernel_config.h>
17#include "base_types.h"
18#include "internal/container_helpers.h"
20
21IMPKERNEL_BEGIN_NAMESPACE
22
23//! A base class for modifiers of ParticlePairsTemp
24/** The primary function of such a class is to change
25 the passed particles.
26
27 \see IMP::PairPredicate
28
29 Implementers should see IMP_PAIR_MODIFIER().
30 */
31class IMPKERNELEXPORT PairModifier : public ParticleInputs,
32 public ParticleOutputs,
33 public Object {
34 public:
35 typedef ParticlePair Argument;
36 typedef ParticleIndexPair IndexArgument;
37 PairModifier(std::string name = "PairModifier %1%");
38
39 /** Apply the function to a single value*/
40 virtual void apply_index(Model *m, const ParticleIndexPair& v) const = 0;
41
42 /** Apply the function to a collection of ParticlePairsTemp */
43 /** If bounds are passed, only apply to ones between the upper and
44 lower bounds.*/
45 virtual void apply_indexes(Model *m, const ParticleIndexPairs &o,
46 unsigned int lower_bound,
47 unsigned int upper_bound) const {
48 for (unsigned int i = lower_bound; i < upper_bound; ++i) {
49 apply_index(m, o[i]);
50 }
51 }
52
53 /** Apply the function to a collection of ParticlePairsTemp */
54 /** Information on particles that moved since the last scoring function
55 evaluation is also passed, which may be used to accelerate the
56 computation. */
57 virtual void apply_indexes_moved(
58 Model *m, const ParticleIndexPairs &o,
59 unsigned int lower_bound, unsigned int upper_bound,
60 const ParticleIndexes &moved_pis,
61 const ParticleIndexes &reset_pis) const {
62 IMP_UNUSED(moved_pis);
63 IMP_UNUSED(reset_pis);
64 apply_indexes(m, o, lower_bound, upper_bound);
65 }
66};
67
68IMPKERNEL_END_NAMESPACE
69
70#endif /* IMPKERNEL_PAIR_MODIFIER_H */
Class for adding derivatives from restraints to the model.
Basic types used by IMP.
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
Object(std::string name)
Construct an object with the given name.
virtual void apply_index(Model *m, const ParticleIndexPair &v) const =0
virtual void apply_indexes(Model *m, const ParticleIndexPairs &o, unsigned int lower_bound, unsigned int upper_bound) const
virtual void apply_indexes_moved(Model *m, const ParticleIndexPairs &o, unsigned int lower_bound, unsigned int upper_bound, const ParticleIndexes &moved_pis, const ParticleIndexes &reset_pis) const
Base class for objects that take particle arguments and read from them.
Base class for objects that take particle arguments and modify them.
Classes used in the construction of ModelObjects.
IMP::Vector< ParticleIndexPair, std::allocator< ParticleIndexPair > > ParticleIndexPairs
Definition base_types.h:208
Vector< ParticleIndex, std::allocator< ParticleIndex > > ParticleIndexes
A list of particles, each identified by its ParticleIndex.
Definition base_types.h:199
Array< 2, ParticleIndex > ParticleIndexPair
An ordered pair of particles, each identified by its ParticleIndex.
Definition base_types.h:202
Array< 2, WeakPointer< Particle >, Particle * > ParticlePair
Definition base_types.h:180
#define IMP_UNUSED(variable)