8 #ifndef IMPNPCTRANSPORT_HARMONIC_DISTANCE_PAIR_SCORES_H
9 #define IMPNPCTRANSPORT_HARMONIC_DISTANCE_PAIR_SCORES_H
11 #include "npctransport_config.h"
18 #include <boost/array.hpp>
20 IMPNPCTRANSPORT_BEGIN_NAMESPACE
44 double delta_length,
double x0,
double k) {
45 double shifted_length = delta_length - x0;
46 double score = 0.5 * k * shifted_length * shifted_length;
47 static const double MIN_DISTANCE = .00001;
48 if (IMP_LIKELY( da && delta_length > MIN_DISTANCE )) {
50 m->add_to_coordinate_derivatives(pp[0], deriv, *da);
51 m->add_to_coordinate_derivatives(pp[1], -deriv, *da);
52 IMP_LOG(
TERSE,
"Distance: " << shifted_length <<
"\nscore: " << score
53 <<
"\nderiv: " << deriv << std::endl);
56 IMP_LOG(
TERSE,
"Distance: " << shifted_length <<
"\nscore: " << score
68 double rest_length_factor_, k_;
82 std::string name =
"HarmonicIDPairScore%1%");
84 void set_rest_length_factor(
double rest_length_factor)
85 { rest_length_factor_ = rest_length_factor; }
86 double get_rest_length_factor()
const {
return rest_length_factor_; }
89 double get_k() {
return k_; }
100 inline double HarmonicWellPairScore::evaluate_index(
106 double x0 = (s0.get_radius() + s1.get_radius()) * rest_length_factor_;
108 double delta_length_2 = delta.get_squared_magnitude();
109 double delta_length = std::sqrt(delta_length_2);
118 IMPNPCTRANSPORT_END_NAMESPACE
Abstract class for scoring object(s) of type ParticleIndexPair.
Macros for various classes.
#define IMP_PAIR_SCORE_METHODS(Name)
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
#define IMP_OBJECT_LOG
Set the log level to the object's log level.
double do_evaluate_index_harmonic(Model *m, const ParticleIndexPair &pp, DerivativeAccumulator *da, const algebra::Vector3D &delta, double delta_length, double x0, double k)
A more IMP-like version of the std::vector.
Class for storing model, its restraints, constraints, and particles.
Functions to deal with very common math operations.
virtual ModelObjectsTemp do_get_inputs(Model *m, const ParticleIndexes &pis) const =0
Overload this method to specify the inputs.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
#define IMP_CHECK_CODE(expr)
Only compile the code if checks are enabled.
Various compiler workarounds.
Output a line or two per evaluation call.
Decorator for a sphere-like particle.
virtual double evaluate_index(Model *m, const ParticleIndexPair &vt, DerivativeAccumulator *da) const =0
Compute the score and the derivative if needed.
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
Class for adding derivatives from restraints to the model.