home
about
news
download
doc
source
systems
tests
bugs
contact
IMP Reference Guide
develop.d97d4ead1f,2024/11/21
The Integrative Modeling Platform
IMP Manual
Reference Guide
Tutorial Index
Modules
Classes
Examples
include
IMP
score_functor
version 20241121.develop.d97d4ead1f
Score.h
Go to the documentation of this file.
1
/**
2
* \file IMP/score_functor/Score.h
3
* \brief A Score on the distance between a pair of particles.
4
*
5
* Copyright 2007-2022 IMP Inventors. All rights reserved.
6
*/
7
8
#ifndef IMPSCORE_FUNCTOR_SCORE_H
9
#define IMPSCORE_FUNCTOR_SCORE_H
10
11
#include <IMP/score_functor/score_functor_config.h>
12
#include <
IMP/base_types.h
>
13
#include <
IMP/particle_index.h
>
14
#include <
IMP/warning_macros.h
>
15
#include <
IMP/Particle.h
>
16
#include <limits>
17
18
IMPSCOREFUNCTOR_BEGIN_NAMESPACE
19
//! A functor for computing a distance based score for D particles.
20
struct
Score
{
21
// swig gets confused otherwise
22
Score
() {}
23
#ifdef IMP_DOXYGEN
24
//! Return the score at the passed feature size (eg distance).
25
/** The involved particle indexes are passed along.
26
27
\pre get_is_trivially_zero() or get_maximum_range() has been called
28
and get_is_trivially_zero() is false.
29
*/
30
template
<
unsigned
int
D>
31
double
get_score(
Model
*m,
32
const
Array<D, ParticleIndex>
&p,
33
double
distance)
const
;
34
//! Return the score and derivative at the passed feature size (eg distance).
35
/** The derivative is for the feature decreasing.
36
37
\pre get_is_trivially_zero() or get_maximum_range() has been called
38
and get_is_trivially_zero() is false.
39
*/
40
template
<
unsigned
int
D>
41
DerivativePair
get_score_and_derivative(
42
Model
*m,
const
Array<D, ParticleIndex>
&p,
43
double
distance)
const
;
44
#endif
45
/** Return true if the function can be easily determined to be zero at the
46
passed squared distance. The default implementation provided here
47
returns false.
48
49
\note That it is squared distance, not distance.
50
*/
51
template
<
unsigned
int
D>
52
bool
get_is_trivially_zero
(
Model
*m,
53
const
Array<D, ParticleIndex>
&p,
54
double
squared_distance)
const
{
55
IMP_UNUSED
(m);
56
IMP_UNUSED
(p);
57
IMP_UNUSED
(squared_distance);
58
return
false
;
59
}
60
/** Return an upper bound on the distance at which the score can be
61
non-zero. The default implementation provided here returns infinity.*/
62
template
<
unsigned
int
D>
63
double
get_maximum_range
(
64
Model
*m,
const
Array<D, ParticleIndex>
&p)
const
{
65
IMP_UNUSED
(m);
66
IMP_UNUSED
(p);
67
return
std::numeric_limits<double>::infinity();
68
}
69
/** Return the set of particles read when particle p is part of the passed
70
tuples. The default implementation provided here just returns the list
71
containing p.*/
72
ModelObjectsTemp
get_inputs
(
73
Model
*m,
const
ParticleIndexes
&pis)
const
{
74
return
IMP::get_particles
(m, pis);
75
}
76
void
show
(std::ostream &)
const
{}
77
};
78
79
IMPSCOREFUNCTOR_END_NAMESPACE
80
81
#endif
/* IMPSCORE_FUNCTOR_SCORE_H */
base_types.h
Basic types used by IMP.
IMP::score_functor::Score::get_inputs
ModelObjectsTemp get_inputs(Model *m, const ParticleIndexes &pis) const
Definition:
Score.h:72
particle_index.h
Functions and adaptors for dealing with particle indexes.
IMP::Array
A class to store a fixed array of same-typed values.
Definition:
Array.h:40
IMP::get_particles
ParticlesTemp get_particles(Model *m, const ParticleIndexes &ps)
Get the particles from a list of indexes.
IMP::Vector
A more IMP-like version of the std::vector.
Definition:
Vector.h:50
IMP::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
Model.h:86
IMP::score_functor::Score::get_maximum_range
double get_maximum_range(Model *m, const Array< D, ParticleIndex > &p) const
Definition:
Score.h:63
warning_macros.h
Macros to control compiler warnings.
IMP_UNUSED
#define IMP_UNUSED(variable)
Definition:
warning_macros.h:25
IMP::score_functor::Score::get_is_trivially_zero
bool get_is_trivially_zero(Model *m, const Array< D, ParticleIndex > &p, double squared_distance) const
Definition:
Score.h:52
IMP::DerivativePair
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
Definition:
types.h:22
Particle.h
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
IMP::core::show
std::ostream & show(Hierarchy h, std::ostream &out=std::cout)
Print the hierarchy using a given decorator to display each node.
Definition:
core/Hierarchy.h:423
IMP::score_functor::Score
A functor for computing a distance based score for D particles.
Definition:
Score.h:20