8#ifndef IMPNPCTRANSPORT_Z_BIAS_SINGLETON_SCORE_H
9#define IMPNPCTRANSPORT_Z_BIAS_SINGLETON_SCORE_H
11#include "npctransport_config.h"
19IMPNPCTRANSPORT_BEGIN_NAMESPACE
24 :
public SingletonScore {
42 double max_r = HALF_SQRT_MAX_DOUBLE,
43 double z = std::numeric_limits<double>::min())
44 : k_(k), max_r2_( max_r * max_r ), z_(z) {}
50 double get_k()
const {
return k_; }
61 double r2 = std::pow(d.get_x(), 2) + std::pow(d.get_y(), 2);
62 if (r2 > max_r2_ && max_r2_ > 0.0) {
65 return std::make_pair(score, v_deriv);
68 double dz = d.get_z() - z_;
73 else if (dz < -1e-6) {
82 return std::make_pair(score, v_deriv);
90 auto score = score_deriv.first;
91 auto v_deriv = score_deriv.second;
93 IMP_LOG(
VERBOSE,
"result in " << score
94 <<
" and " << v_deriv << std::endl);
95 d.add_to_derivatives(v_deriv, *da);
109IMPNPCTRANSPORT_END_NAMESPACE
Class for adding derivatives from restraints to the model.
Class for storing model, its restraints, constraints, and particles.
A decorator for a particle with x,y,z coordinates and a radius.
std::pair< double, algebra::Vector3D > evaluate_deriv(const core::XYZR &d) const
ZBiasSingletonScore(double k, double max_r=HALF_SQRT_MAX_DOUBLE, double z=std::numeric_limits< double >::min())
virtual ModelObjectsTemp do_get_inputs(Model *m, const ParticleIndexes &pis) const override
Overload this method to specify the inputs.
virtual double evaluate_index(Model *m, ParticleIndex pi, DerivativeAccumulator *da) const override
Compute the score and the derivative if needed.
Index< ParticleIndexTag > ParticleIndex
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.
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
@ VERBOSE
Produce copious output to allow someone to trace through the computation.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Macros for various classes.
#define IMP_SINGLETON_SCORE_METHODS(Name)