IMP logo
IMP Reference Guide  develop.27926d84dc,2024/04/19
The Integrative Modeling Platform
IMP::score_functor::ScoreWithCache Struct Reference

A cached functor for computing a distance based score for D particles. More...

#include <IMP/score_functor/ScoreWithCache.h>

+ Inheritance diagram for IMP::score_functor::ScoreWithCache:

Detailed Description

A cached functor for computing a distance based score for D particles.

This is similar to Score but requires callers to call check_cache_valid() in any scoring function evaluation before any of the methods that use the cache.

Definition at line 24 of file ScoreWithCache.h.

Public Member Functions

void check_cache_valid (Model *m) const
 Make sure the cache is up to date. More...
 
ModelObjectsTemp get_inputs (Model *m, const ParticleIndexes &pis) const
 
template<unsigned int D>
bool get_is_trivially_zero_with_cache (Model *m, const Array< D, ParticleIndex > &p, double squared_distance) const
 
template<unsigned int D>
double get_maximum_range (Model *m, const Array< D, ParticleIndex > &p) const
 
template<unsigned int D>
DerivativePair get_score_and_derivative_with_cache (Model *m, const Array< D, ParticleIndex > &p, double distance) const
 Return the score and derivative at the passed feature size (eg distance). More...
 
template<unsigned int D>
double get_score_with_cache (Model *m, const Array< D, ParticleIndex > &p, double distance) const
 Return the score at the passed feature size (eg distance). More...
 
void show (std::ostream &) const
 

Member Function Documentation

void IMP::score_functor::ScoreWithCache::check_cache_valid ( Model m) const

Make sure the cache is up to date.

This must be called in any scoring function evaluation before any of the methods that use the cache.

ModelObjectsTemp IMP::score_functor::ScoreWithCache::get_inputs ( Model m,
const ParticleIndexes pis 
) const

Return the set of particles read when particle p is part of the passed tuples. The default implementation provided here just returns the list containing p.

Definition at line 82 of file ScoreWithCache.h.

+ Here is the call graph for this function:

template<unsigned int D>
bool IMP::score_functor::ScoreWithCache::get_is_trivially_zero_with_cache ( Model m,
const Array< D, ParticleIndex > &  p,
double  squared_distance 
) const

Return true if the function can be easily determined to be zero at the passed squared distance. The default implementation provided here returns false.

Note
That it is squared distance, not distance.

Definition at line 62 of file ScoreWithCache.h.

template<unsigned int D>
double IMP::score_functor::ScoreWithCache::get_maximum_range ( Model m,
const Array< D, ParticleIndex > &  p 
) const

Return an upper bound on the distance at which the score can be non-zero. The default implementation provided here returns infinity.

Definition at line 73 of file ScoreWithCache.h.

template<unsigned int D>
DerivativePair IMP::score_functor::ScoreWithCache::get_score_and_derivative_with_cache ( Model m,
const Array< D, ParticleIndex > &  p,
double  distance 
) const

Return the score and derivative at the passed feature size (eg distance).

The derivative is for the feature decreasing.

Precondition
get_is_trivially_zero_with_cache() or get_maximum_range() has been called and get_is_trivially_zero_with_cache() is false.
template<unsigned int D>
double IMP::score_functor::ScoreWithCache::get_score_with_cache ( Model m,
const Array< D, ParticleIndex > &  p,
double  distance 
) const

Return the score at the passed feature size (eg distance).

The involved particle indexes are passed along.

Precondition
get_is_trivially_zero_with_cache() or get_maximum_range() has been called and get_is_trivially_zero_with_cache() is false.

The documentation for this struct was generated from the following file: