home
about
news
download
doc
source
systems
tests
bugs
contact
IMP Reference Guide
2.16.0
The Integrative Modeling Platform
IMP Manual
Reference Guide
Tutorial Index
Modules
Classes
Examples
include
IMP
score_functor
version 2.16.0
Shift.h
Go to the documentation of this file.
1
/**
2
* \file IMP/score_functor/Shift.h
3
* \brief A Score on the distance between a pair of particles.
4
*
5
* Copyright 2007-2021 IMP Inventors. All rights reserved.
6
*/
7
8
#ifndef IMPSCORE_FUNCTOR_SHIFT_H
9
#define IMPSCORE_FUNCTOR_SHIFT_H
10
11
#include <IMP/score_functor/score_functor_config.h>
12
#include <
IMP/algebra/utility.h
>
13
#include <
IMP/Model.h
>
14
#include <
IMP/particle_index.h
>
15
IMPSCOREFUNCTOR_BEGIN_NAMESPACE
16
17
/** A shift the distance by subtracting x0 and pass it to the base
18
class.*/
19
template
<
class
BaseDistanceScore>
20
class
Shift
:
public
BaseDistanceScore {
21
typedef
BaseDistanceScore P;
22
double
x0_;
23
24
public
:
25
Shift
(
double
x0, BaseDistanceScore base) : P(base), x0_(x0) {}
26
template
<
unsigned
int
D>
27
double
get_score(
Model
*m,
28
const
Array<D, ParticleIndex>
&pi,
29
double
distance)
const
{
30
return
P::get_score(m, pi, distance - x0_);
31
}
32
template
<
unsigned
int
D>
33
DerivativePair
get_score_and_derivative(
34
Model
*m,
const
Array<D, ParticleIndex>
&p,
35
double
distance)
const
{
36
return
P::get_score_and_derivative(m, p, distance - x0_);
37
}
38
template
<
unsigned
int
D>
39
double
get_maximum_range(
40
Model
*m,
const
Array<D, ParticleIndex>
&pi)
const
{
41
return
P::get_maximum_range(m, pi) - x0_;
42
}
43
bool
get_is_trivially_zero(
Model
*m,
44
const
ParticleIndexPair
&pi,
45
double
squared_distance)
const
{
46
return
squared_distance >
47
algebra::get_squared(P::get_maximum_range(m, pi) + x0_);
48
}
49
};
50
51
IMPSCOREFUNCTOR_END_NAMESPACE
52
53
#endif
/* IMPSCORE_FUNCTOR_SHIFT_H */
particle_index.h
Functions and adaptors for dealing with particle indexes.
IMP::Array
A class to store an fixed array of same-typed values.
Definition:
Array.h:33
IMP::score_functor::Shift
Definition:
Shift.h:20
Model.h
Storage of a model, its restraints, constraints and particles.
IMP::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
Model.h:73
utility.h
Functions to deal with very common math operations.
IMP::DerivativePair
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
Definition:
types.h:23