IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
IMP::domino::RestraintCache Class Reference

#include <IMP/domino/subset_scores.h>

Inheritance diagram for IMP::domino::RestraintCache:

Detailed Description

Implement a cache for restraint scores as well as management of restraints for domino.

The cache size passed to the constructor is the maximum number of scores that will be saved. A least-recently-used eviction policy is used when that number is exceeded.

Definition at line 41 of file subset_scores.h.

Public Member Functions

 RestraintCache (ParticleStatesTable *pst, unsigned int size=std::numeric_limits< unsigned int >::max())
void add_restraints (const RestraintsAdaptor &rs)
double get_hit_rate () const
unsigned int get_number_of_entries () const
 Return the number of entries currently in the cache.
RestraintsTemp get_restraints () const
RestraintsTemp get_restraints (const Subset &s, const Subsets &exclusions) const
double get_score (Restraint *r, const Assignment &a) const
 Get the score of a set or restraint.
double get_score (Restraint *r, const Subset &s, const Assignment &a) const
Slice get_slice (Restraint *r, const Subset &s) const
 Return the slice for that restraint given the subset.
virtual std::string get_type_name () const override
virtual ::IMP::VersionInfo get_version_info () const override
 Get information about the module and version of the object.
void load_cache (const ParticlesTemp &ps, RMF::HDF5::ConstGroup group)
void load_last_score (Restraint *r, const Subset &s, const Assignment &a)
 Make it so Restraint::get_last_score() returns the score.
void save_cache (const ParticlesTemp &particle_ordering, const RestraintsTemp &restraints, RMF::HDF5::Group group, unsigned int max_entries)
void show_restraint_information (std::ostream &out=std::cout) const
 Print out information about the known restraints and restraint sets.
void validate () const
 Check the entries in the cache.
Public Member Functions inherited from IMP::Object
CheckLevel get_check_level () const
 get_derived_object (self)
 Return this object cast to the most derived subclass.
LogLevel get_log_level () const
void set_check_level (CheckLevel l)
void set_log_level (LogLevel l)
 Set the logging level used in this object.
const std::string & get_name () const
 Get the (not necessarily unique) name of this object.
void set_name (std::string name)
void set_was_used (bool tf) const
void show (std::ostream &out=std::cout) const
virtual void clear_caches ()

Additional Inherited Members

Protected Member Functions inherited from IMP::Object
 Object (std::string name)
 Construct an object with the given name.
virtual void do_destroy ()

Constructor & Destructor Documentation

◆ ~RestraintCache()

virtual IMP::domino::RestraintCache::~RestraintCache ( )
virtual

Definition at line 231 of file subset_scores.h.

Member Function Documentation

◆ add_restraints()

void IMP::domino::RestraintCache::add_restraints ( const RestraintsAdaptor & rs)

Recursively process the passed restraints (and sets) so all contained restraints and sets that have maximum are known.

◆ get_hit_rate()

double IMP::domino::RestraintCache::get_hit_rate ( ) const

Definition at line 230 of file subset_scores.h.

◆ get_number_of_entries()

unsigned int IMP::domino::RestraintCache::get_number_of_entries ( ) const

Return the number of entries currently in the cache.

Definition at line 223 of file subset_scores.h.

◆ get_restraints()

RestraintsTemp IMP::domino::RestraintCache::get_restraints ( const Subset & s,
const Subsets & exclusions ) const

Return the restraints that should be evaluated for the subset, given the exclusions.

Here is the call graph for this function:

◆ get_score() [1/2]

double IMP::domino::RestraintCache::get_score ( Restraint * r,
const Assignment & a ) const

Get the score of a set or restraint.

The returned score will be std::numeric_limits<double>::max() if any of the limits are violated.

The assignment passed is the assignment for the particles used by the restraint, not that for some whole subset. See the other get_score() function for a perhaps more useful one.

Definition at line 180 of file subset_scores.h.

Here is the call graph for this function:

◆ get_score() [2/2]

double IMP::domino::RestraintCache::get_score ( Restraint * r,
const Subset & s,
const Assignment & a ) const

Get the score for a restraint given a subset and assignment on that subset.

◆ get_slice()

Slice IMP::domino::RestraintCache::get_slice ( Restraint * r,
const Subset & s ) const

Return the slice for that restraint given the subset.

◆ get_type_name()

virtual std::string IMP::domino::RestraintCache::get_type_name ( ) const
overridevirtual

Reimplemented from IMP::Object.

Definition at line 231 of file subset_scores.h.

◆ get_version_info()

virtual ::IMP::VersionInfo IMP::domino::RestraintCache::get_version_info ( ) const
overridevirtual

Get information about the module and version of the object.

Reimplemented from IMP::Object.

Definition at line 231 of file subset_scores.h.

◆ load_last_score()

void IMP::domino::RestraintCache::load_last_score ( Restraint * r,
const Subset & s,
const Assignment & a )

Make it so Restraint::get_last_score() returns the score.

This is useful when writing the restraints to disk, as that code often goes off the last score to avoid recomputing the restraints.

◆ save_cache()

void IMP::domino::RestraintCache::save_cache ( const ParticlesTemp & particle_ordering,
const RestraintsTemp & restraints,
RMF::HDF5::Group group,
unsigned int max_entries )

This assumes that restraints are always added to the cache in the same order.

Parameters
[in]particle_orderingAn ordering for the particles.
[in]restraintsWhich restraints to write out entries for. You probably want to use get_restraints() to generate this.
[in]max_entriesHow many entries to write out at most.
[in]groupWhere to put the entries.

◆ show_restraint_information()

void IMP::domino::RestraintCache::show_restraint_information ( std::ostream & out = std::cout) const

Print out information about the known restraints and restraint sets.

◆ validate()

void IMP::domino::RestraintCache::validate ( ) const

Check the entries in the cache.


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