IMP
2.1.1
The Integrative Modeling Platform
IMP Mainpage
All IMP Modules
Related Pages
Modules
Namespaces
Classes
Files
Examples
Indexes
File List
File Members
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-2013 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/kernel/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(
kernel::Model
*m,
28
const
base::Array<D, kernel::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
kernel::Model
*m,
const
base::Array<D, kernel::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
kernel::Model
*m,
const
base::Array<D, kernel::ParticleIndex>
&pi)
const
{
41
return
P::get_maximum_range(m, pi) - x0_;
42
}
43
bool
get_is_trivially_zero(
kernel::Model
*m,
44
const
kernel::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
Import IMP/kernel/particle_index.h in the namespace.
IMP::score_functor::Shift
Definition:
Shift.h:20
IMP::base::Array
A class to store an fixed array of same-typed values.
Definition:
base/Array.h:33
utility.h
Functions to deal with very common math operations.
Model.h
Storage of a model, its restraints, constraints and particles.
IMP::DerivativePair
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
Definition:
base/types.h:23
IMP::kernel::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
kernel/declare_Model.h:72