IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
MinimumSphereDistancePairScore.h
Go to the documentation of this file.
1/**
2 * \file IMP/npc/MinimumSphereDistancePairScore.h
3 * \brief Apply a UnaryFunction to the minimum transformed distance
4 *
5 * Copyright 2007-2022 IMP Inventors. All rights reserved.
6 */
7
8#ifndef IMPNPC_MINIMUM_SPHERE_DISTANCE_PAIR_SCORE_H
9#define IMPNPC_MINIMUM_SPHERE_DISTANCE_PAIR_SCORE_H
10
11#include <IMP/npc/npc_config.h>
12#include <IMP/PairScore.h>
13#include <IMP/UnaryFunction.h>
14#include <IMP/pair_macros.h>
16#include <cereal/access.hpp>
17#include <cereal/types/base_class.hpp>
18
19IMPNPC_BEGIN_NAMESPACE
20
21//! Apply a UnaryFunction to the minimum transformed sphere-sphere distance
22/** This is like a SphereDistancePairScore in that it calculates the
23 inter-surface distance between two XYZR Particles (spheres) and then
24 scores it with a provided UnaryFunction. However, it also considers
25 the distance between the two particles with the second particle
26 transformed by each of the provided transformations. The transformation
27 which results in the minimum interparticle distance (not necessarily the
28 minimum score) is then used for scoring. This can be used for periodic
29 boundaries or other symmetric systems.
30 */
31class IMPNPCEXPORT MinimumSphereDistancePairScore : public PairScore {
34
35 friend class cereal::access;
36 template<class Archive> void serialize(Archive &ar) {
37 ar(cereal::base_class<PairScore>(this), f_, transforms_);
38 }
39 IMP_OBJECT_SERIALIZE_DECL(MinimumSphereDistancePairScore);
40
41 public:
42 MinimumSphereDistancePairScore(UnaryFunction *f,
44 : f_(f), transforms_(transforms) {}
45
46 MinimumSphereDistancePairScore() {}
47
48 virtual double evaluate_index(Model *m, const ParticleIndexPair &pi,
49 DerivativeAccumulator *da) const override;
51 Model *m, const ParticleIndexes &pis) const override {
52 return IMP::get_particles(m, pis);
53 }
54 IMP_PAIR_SCORE_METHODS(MinimumSphereDistancePairScore);
55 IMP_OBJECT_METHODS(MinimumSphereDistancePairScore);
56};
57
58IMPNPC_END_NAMESPACE
59
60#endif /* IMPNPC_MINIMUM_SPHERE_DISTANCE_PAIR_SCORE_H */
Define PairScore.
Simple 3D transformation class.
Single variable function.
Class for adding derivatives from restraints to the model.
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
Abstract single variable functor class for score functions.
virtual double evaluate_index(Model *m, const ParticleIndexPair &pi, DerivativeAccumulator *da) const override
Compute the score and the derivative if needed.
virtual ModelObjectsTemp do_get_inputs(Model *m, const ParticleIndexes &pis) const override
Overload this method to specify the inputs.
IMP::Vector< Transformation3D > Transformation3Ds
ParticlesTemp get_particles(Model *m, const ParticleIndexes &ps)
Get the particles from a list of indexes.
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
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.
Macros for various classes.
#define IMP_PAIR_SCORE_METHODS(Name)
Definition pair_macros.h:25
A smart pointer to a ref-counted Object that is a class member.
Definition Pointer.h:144