IMP logo
IMP Reference Guide  2.22.0
The Integrative Modeling Platform
IMP::npctransport::Scoring Class Reference

Scoring associated with a SimulationData object. More...

#include <IMP/npctransport/Scoring.h>

+ Inheritance diagram for IMP::npctransport::Scoring:

Detailed Description

Scoring associated with a SimulationData object.

Definition at line 47 of file Scoring.h.

Public Member Functions

 Scoring (SimulationData *owner_sd, const ::npctransport_proto::Assignment &data)
 
void add_chain_restraints (FGChain *chain)
 
void add_custom_restraint (IMP::Restraint *r)
 
void add_custom_restraints (IMP::Restraints R)
 
void add_interaction (const ::npctransport_proto::Assignment_InteractionAssignment &idata)
 
void add_restrained_anchor_bead (IMP::Particle *p)
 
void add_z_bias_restraint (SingletonContainerAdaptor ps, double k)
 
void add_z_bias_restraint (Particle *p, double k)
 
void clear_custom_restraints ()
 
boost::tuple< Restraint
*, Object * > 
create_backbone_restraint (double rest_length_factor, double backbone_k, ParticlesTemp beads, std::string name) const
 Create a backbone bond restraint over beads according to class flags. More...
 
Restraintcreate_bounding_volume_restraint (SingletonContainerAdaptor beads) const
 
IMP::PairContainercreate_close_beads_container (SingletonContainerAdaptor non_optimiziable_beads, SingletonContainerAdaptor optimizable_beads) const
 
IMP::PairContainercreate_close_beads_container (ParticleIndexes non_optimizable_beads, SingletonContainerAdaptor optimizable_beads) const
 
container::PredicatePairsRestraintcreate_predicates_pair_restraint (PairContainer *bead_pairs, bool is_attr_interactions_on=true) const
 
Restraintcreate_slab_restraint (SingletonContainerAdaptor beads) const
 
IMP::Restraintcreate_z_bias_restraint (SingletonContainerAdaptor ps, double k) const
 
Restraints get_all_chain_restraints () const
 
Restraintget_bounding_volume_restraint (bool update=false)
 
Restraints get_chain_restraints_on (SingletonContainerAdaptor beads) const
 
IMP::PairContainerget_close_beads_container (bool update=false)
 
IMP::Restraints get_custom_restraints () const
 
IMP::ScoringFunctionget_custom_scoring_function (const RestraintsTemp &extra_restraints, SingletonContainerAdaptor non_optimizable_beads, SingletonContainerAdaptor optimizable_beads, bool is_attr_interactions_on=true) const
 
IMP::ScoringFunctionget_custom_scoring_function (const RestraintsTemp &extra_restraints, ParticleIndexes non_optimizable_beads, SingletonContainerAdaptor optimizable_beads, bool is_attr_interactions_on=true) const
 
double get_default_backbone_k () const
 
double get_excluded_volume_k () const
 
FGChains get_fg_chains ()
 
bool get_has_bounding_box () const
 returns true if simulation has a bounding simulation box More...
 
bool get_has_bounding_sphere () const
 returns true if simulation has a bounding simulation sphere ('cell-like') More...
 
bool get_has_bounding_volume () const
 returns true if simulation has any bounding volume (box or sphere are supported) More...
 
double get_interaction_k () const
 
double get_interaction_range_for (core::ParticleType t1, core::ParticleType t2, bool site_specific=true, bool non_specific=false) const
 
bool get_is_backbone_harmonic () const
 
Modelget_model ()
 
Modelget_model () const
 
core::OrderedTypePairPredicateget_ordered_type_pair_predicate ()
 
core::OrderedTypePairPredicate
const * 
get_ordered_type_pair_predicate () const
 
Restraintget_pore_radius_restraint () const
 
IMP::PairScore const * get_predicate_pair_score (core::ParticleType t1, core::ParticleType t2) const
 returns the pair score for particles of types t1 and t2 */ More...
 
IMP::PairScoreget_predicate_pair_score (core::ParticleType t1, core::ParticleType t2)
 returns the pair score for particles of types t1 and t2 */ More...
 
container::PredicatePairsRestraintget_predicates_pair_restraint (bool update=false)
 
double get_range () const
 
IMP::ScoringFunctionget_scoring_function (bool force_update=false)
 
IMP::Restraints get_scoring_function_restraints (bool force_update=false)
 
SimulationDataget_sd ()
 
SimulationData const * get_sd () const
 
boost::tuple< unsigned int,
std::vector< unsigned int >
, std::vector< unsigned int >
, bool > 
get_site_interactions_statistics (ParticleIndex pi1, ParticleIndex pi2) const
 
boost::tuple< unsigned int,
std::vector< unsigned int >
, std::vector< unsigned int >
, bool > 
get_site_interactions_statistics (Particle const *p1, Particle const *p2) const
 
Restraintget_slab_restraint (bool update=false)
 
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. More...
 
IMP::Restraints get_z_bias_restraints ()
 
void remove_particle_type (core::ParticleType pt)
 
void set_interaction_k_factor (IMP::core::ParticleType type, double value)
 
void set_interaction_range_factor (IMP::core::ParticleType type, double value)
 
- Public Member Functions inherited from IMP::Object
virtual void clear_caches ()
 
CheckLevel get_check_level () const
 
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. More...
 
void set_was_used (bool tf) const
 
void show (std::ostream &out=std::cout) const
 
const std::string & get_name () const
 
void set_name (std::string name)
 

Additional Inherited Members

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

Constructor & Destructor Documentation

IMP::npctransport::Scoring::Scoring ( SimulationData owner_sd,
const ::npctransport_proto::Assignment &  data 
)
Parameters
[in]owner_sdnpc simulation data object that owns this scoring object
[out]dataprotobuf data with parameters for this assignment, used to parameterize the scoring function

Member Function Documentation

void IMP::npctransport::Scoring::add_chain_restraints ( FGChain chain)

add FG chain to this scoring object, using the chain->get_chain_restraints() method to retrieve the restraints upon a call to get_scoring_function() or create_scoring_function(), etc.

Parameters
chainan FG chain associated with internal scoring
Returns
pointer to the newly created restraint
Note
if the chain->get_backbone_k() is non-positive, it is reset to this->get_default_backbone_k()
this method assumes that all such chains will be disjoint and so it is later possible to use container::ExclusiveConsecutivePairFilter to filter out all pairs of particles connected by such chain restraints.
void IMP::npctransport::Scoring::add_interaction ( const ::npctransport_proto::Assignment_InteractionAssignment &  idata)

add a SitesPairScore restraint that applies to particles of types t0 and t1 (specified in idata) to the PredicatePairsRestraint object that is returned by get_predr(). The restraint is symmetric, and applies to both (t0,t1) and (t1,t0).

A SitesPairScore restraint means site-specific attractive forces between surface binding sites on each particle + non-specific attraction and soft repulsion between the entire particles.

Parameters
idatathe protobuf data about the interaction (particle types, interaction coefficients, etc.)
See Also
SitesPairScore
void IMP::npctransport::Scoring::add_restrained_anchor_bead ( IMP::Particle p)

add anchor bead to scoring function, using current position of p as equilibrium position relative to pore

Parameters
panchored particle
Note
currently only cylindrical pore case is supported
void IMP::npctransport::Scoring::add_z_bias_restraint ( SingletonContainerAdaptor  ps,
double  k 
)

adds a biasing potential for particles ps towards z, to the restraints returned by get_z_bias_restraints(), and for the scoring function generated by get_scoring_function()

Parameters
pscontainer for the particles to be biased
kforce constant
See Also
get_z_bias_restraints()
get_scoring_function()
void IMP::npctransport::Scoring::add_z_bias_restraint ( Particle p,
double  k 
)

adds a biasing potential for particle p towards z, to the restraints returned by get_z_bias_restraints(), and for the scoring function generated by get_scoring_function()

Parameters
pthe particle to be biased
kforce constant
boost::tuple< Restraint*, Object*> IMP::npctransport::Scoring::create_backbone_restraint ( double  rest_length_factor,
double  backbone_k,
ParticlesTemp  beads,
std::string  name 
) const

Create a backbone bond restraint over beads according to class flags.

create a backbone bond restraint with specified rest_length_factor (relative to sum of spheres radii) and backbone k over beads. The restraint score type is according to the class flags - either a linear or harmonic potential, with k in units of kcal/mol/A or kcal/mol/A^2, respectively, with the harmonic potential corresponding to a relaxing spring.

returns both the restraint and the linear well pair score or harmonic singleton score that is used in it (which one depends on the IMP version, assigns nullptr to the other), as a pointer to a generic object (= common ancestor class)

Restraint* IMP::npctransport::Scoring::create_bounding_volume_restraint ( SingletonContainerAdaptor  beads) const

Creates bounding volume (box or sphere) restraint based on the box_size_ class variable and get_has_bounding_sphere() and get_has_bounding_box() variables (typically based on box_is_on_), , and apply it to all beads returned by get_sd()->get_beads()

Parameters
beadsbeads on which to apply the constraint
Note
this restraint is (supposed to) guarantee to be always updated with the list inside the container
Returns
a newly created box restraint
IMP::PairContainer* IMP::npctransport::Scoring::create_close_beads_container ( SingletonContainerAdaptor  non_optimiziable_beads,
SingletonContainerAdaptor  optimizable_beads 
) const

creates a new pair container that returns all pairs of particles (a,b) such that: 1) a is any particle from 'non_optimizable_beads' or 'optimizable beads', and b is any particle in 'optimizable_beads' 2) a and b are close (sphere surfaces within range get_range()) 3) a and b do not appear consecutively within the model (e.g., fg repeats) 4) a is not b 5) b and a do not appear in the list (effectively, a list of unordered pairs)

Parameters
non_optimizable_beadsa container for particles that are assumed to be non-optimizable and therefore are not paired among themselves
optimizable_beadsA container for particles that are assumed to be optimizable, and may be paired among themselves or with non_optimizable_beads
Note
it is assumed the two sets of beads are disjoint
IMP::PairContainer* IMP::npctransport::Scoring::create_close_beads_container ( ParticleIndexes  non_optimizable_beads,
SingletonContainerAdaptor  optimizable_beads 
) const

same as other create_close_beads_container variant but based on a list of particle indexes and allowing an empty vector of non-optimizable beads as input. The optimizable beads are still treated dynamically (e.g. if they're associated with a dynamic container)

Definition at line 364 of file Scoring.h.

container::PredicatePairsRestraint* IMP::npctransport::Scoring::create_predicates_pair_restraint ( PairContainer bead_pairs,
bool  is_attr_interactions_on = true 
) const

Creates a new container for restraints over pairs of beads. Different scores are used for beads of different (ordered) particle types based on interaction_pair_scores, or just a default linear repulsive with k=get_excluded_volume_k() force on all other pairs in bead_pairs.

Parameters
bead_pairsa container for the pairs of beads to be restrained
is_attr_interactions_onwhether to include attractive interactions that were added by add_interaction()
Restraint* IMP::npctransport::Scoring::create_slab_restraint ( SingletonContainerAdaptor  beads) const

Creates slab bounding volume restraint, based on the slab_thickness_ and tunnel_radius_ class variables, and apply it to all beads returned by get_sd()->get_beads()

Parameters
beadsbeads on which to apply the constraint
Note
this restraint is (supposed to) guarantee to be always updated with the list inside the container
Returns
a newly created slab restraint
IMP::Restraint* IMP::npctransport::Scoring::create_z_bias_restraint ( SingletonContainerAdaptor  ps,
double  k 
) const

create a z bias restraint pulling along z-axis for the particles in ps. If a slab is present, the force acts only within tunnel radius distance from its central axis.

Parameters
psthe particles container
kforce constant for biasing ps
Restraints IMP::npctransport::Scoring::get_all_chain_restraints ( ) const
Returns
all restraints of fg nup chains that were added by add_chain_restraints() so far
Restraint* IMP::npctransport::Scoring::get_bounding_volume_restraint ( bool  update = false)

returns the box/sphere restraint on >get_sd()->get_beads() which will be used in the next call to get_scoring_function(false) (so manipulating it might affect the scoring function). If update is false, then it is guaranteed that these are the same restraints used by the last call to get_scoring_function.

Parameters
updateif true, forces recreation of the cached container, o/w cached version that was used in last call to get_scoring_function(), if applicable
Note
if update=false, might fail to include e.g., new particles that were added after the last call
See Also
get_has_bounding_box(), get_has_bounding_sphere(), get_has_bounding_volume()
Restraints IMP::npctransport::Scoring::get_chain_restraints_on ( SingletonContainerAdaptor  beads) const

returns restraints on all fg nup chains that were added by add_chain_restraints() so far and contain any bead in 'beads'. The restraints are updated directly from the original chain objects chain->get_chain_restraints() object.

Parameters
beadsa least of chain fine beads over which restraints are collected
Returns
a list of all chain restraints that have been added so far and contain beads in 'beads'
IMP::PairContainer* IMP::npctransport::Scoring::get_close_beads_container ( bool  update = false)

a pair container that was used to define interaction particles that will be used in the next call to get_scoring_function(false) (so manipulating it might affect the scoring function)

Parameters
updateif true, forces recreation of the cached container, o/w cached version that was used in last call to get_scoring_function() or to this function will be used
Returns
a container with all pairs of particles (a,b) such that: 1) a is an optimizable bead particle and b is any bead particle (static or not). 2) a and b are close (sphere surfaces within range get_range()+some slack) 3) a and b do not appear consecutively within the model (e.g., bonded fg motifs) 4) a and b are not the same particles 5) b and a do not appear on the list (= unordered list)
Note
if update=false, might fail to include e.g., new particles or new interactions that were added after the last call
TODO: right now will not return any consecutive particles - that's erroneous (e.g., last particle of one chain and first particle of next chain) though may be negligible in practice
supposed to be robust to dynamic changes to the beads list, though need to double check (TODO)
IMP::ScoringFunction* IMP::npctransport::Scoring::get_custom_scoring_function ( const RestraintsTemp extra_restraints,
SingletonContainerAdaptor  non_optimizable_beads,
SingletonContainerAdaptor  optimizable_beads,
bool  is_attr_interactions_on = true 
) const

returns a custom scoring function for the NPC simulation, based on: 1) the chain restraints added by add_chain_restraints() that overlap with 'particles' 2) default repulsive interactions between particles in particles and optimizable particles 3) attractive interactions that depend on pair types, as added by add_interaction() 4) the slab or bounding box restraints if relevant on all particles in 'particles'

Parameters
extra_restraintsad-hoc restraints to be added to scoring function
non_optimizable_beadsparticles container on which to apply bounding volume and pair constraints only if they also involve optimizable beads
optimizable_beadsparticles container on which to apply bounding volume and pair constraints, either with other optimizable beads or with non-optimizable ones.
is_attr_interactions_onif false, only repulsive interactions will be computed between pairs of particles
Note
it is assumed the two sets of beads are disjoint
IMP::ScoringFunction* IMP::npctransport::Scoring::get_custom_scoring_function ( const RestraintsTemp extra_restraints,
ParticleIndexes  non_optimizable_beads,
SingletonContainerAdaptor  optimizable_beads,
bool  is_attr_interactions_on = true 
) const

same as other get_custom_scoring_function variant but based on a list of particle indexes and allowing an empty vector of non-optimizable beads as input

Note
The optimizable beads are still treated dynamically (e.g. if they're associated with a dynamic container)

Definition at line 209 of file Scoring.h.

double IMP::npctransport::Scoring::get_default_backbone_k ( ) const

returns the default spring constant between consecutive beads in a chain of beads - this is used for chains whose k is non-positive

Definition at line 466 of file Scoring.h.

double IMP::npctransport::Scoring::get_excluded_volume_k ( ) const

returns the constant force applied by overlapping spheres on each other

Definition at line 495 of file Scoring.h.

FGChains IMP::npctransport::Scoring::get_fg_chains ( )

returns pointers to the collection of the FG Chains stored in this scoring object (can be used to e.g. scale scoring information up or down during optimization)

Definition at line 691 of file Scoring.h.

bool IMP::npctransport::Scoring::get_has_bounding_box ( ) const

returns true if simulation has a bounding simulation box

Definition at line 448 of file Scoring.h.

bool IMP::npctransport::Scoring::get_has_bounding_sphere ( ) const

returns true if simulation has a bounding simulation sphere ('cell-like')

Definition at line 453 of file Scoring.h.

bool IMP::npctransport::Scoring::get_has_bounding_volume ( ) const

returns true if simulation has any bounding volume (box or sphere are supported)

Definition at line 458 of file Scoring.h.

double IMP::npctransport::Scoring::get_interaction_k ( ) const

returns the default interaction constant, which is used only if interaction_k is not specified for a certain interaction

Definition at line 499 of file Scoring.h.

double IMP::npctransport::Scoring::get_interaction_range_for ( core::ParticleType  t1,
core::ParticleType  t2,
bool  site_specific = true,
bool  non_specific = false 
) const
Returns
maximal actual interaction range (normalized by range factors) for a given interaction type, as set by add_interaction(), over site-site and/or non-specific interactions if applicable. If not applicable, returns -1.0
Parameters
t1,t2the types of beads in this interaction
site_specificinclude site-site ranges
non_specificinclude non-specific sphere interaction ranges
Note
if both site_specific and non_specific are true, takes a maximum over both.
Model* IMP::npctransport::Scoring::get_model ( )

returns the model associated with the owned SimulationData

Model* IMP::npctransport::Scoring::get_model ( ) const

returns the model associated with the owned SimulationData

IMP::PairScore const* IMP::npctransport::Scoring::get_predicate_pair_score ( core::ParticleType  t1,
core::ParticleType  t2 
) const

returns the pair score for particles of types t1 and t2 */

IMP::PairScore* IMP::npctransport::Scoring::get_predicate_pair_score ( core::ParticleType  t1,
core::ParticleType  t2 
)

returns the pair score for particles of types t1 and t2 */

container::PredicatePairsRestraint* IMP::npctransport::Scoring::get_predicates_pair_restraint ( bool  update = false)

Returns the restraints over pairs of particles based on their type, which will be used in the next call to get_scoring_function(false) (so manipulating it might affect the scoring function). Also, if update is false, then it is guaranteed that these are the same restraints used by the last call to get_scoring_function()

Different scores are used for particles of different (ordered) particle types. When called for the first time, returns a new PredicatePairsRestraints over all diffusing particles and sets a default linear repulsion restraint between all pairs returned by get_close_beads_container()

Parameters
updateif true, forces recreation of the cached container, o/w cached version that was used in last call to get_scoring_function(), if applicable
Note
if update=false, might fail to include e.g., new particles or new interactions that were added to the simulation after the last call
IMP::ScoringFunction* IMP::npctransport::Scoring::get_scoring_function ( bool  force_update = false)

returns a scoring function for the NPC simulation, based on: 1) the chain restraints added by add_chain_restraints() 2) default repulsive interactions on particles in get_beads() 3) attractive interactions that depend on pair types, as added by add_interaction() 4) the slab or bounding box restraints if relevant on all particles in get_beads() 5) z-biasing potential if add_z_bias_restraint() was called for any particles

Parameters
ifforce_update is true, forces recreation of the scoring function, o/w cached version may be retrieved if available, which may not be completely up to date.
Note
if force_udpate=false, might fail to include e.g., new particles or new interactions that were added after the last call
IMP::Restraints IMP::npctransport::Scoring::get_scoring_function_restraints ( bool  force_update = false)

returns the restrains associated with the scoring function return by get_scoring_function(force_update)

SimulationData* IMP::npctransport::Scoring::get_sd ( )

return the SimulationData object that owns this ScoringFunction

Definition at line 436 of file Scoring.h.

SimulationData const* IMP::npctransport::Scoring::get_sd ( ) const

return the SimulationData object that owns this ScoringFunction

Definition at line 442 of file Scoring.h.

boost::tuple< unsigned int, std::vector<unsigned int>, std::vector<unsigned int>, bool > IMP::npctransport::Scoring::get_site_interactions_statistics ( ParticleIndex  pi1,
ParticleIndex  pi2 
) const

return various statistics about site-site interactions between pi1 and pi2 return a tuple with: a - number of site-site interaction that contribute to the score between pi1 and pi2 in the model, based on their current coordinates and their particle types b - vector of occupied pi1 sites counts (count number of interactions per site) c - vector of occupied pi2 sites counts (count number of interactions per site) d - true if particles are interacting non-specifically (a non-zero contribution of non-specific terms)

boost::tuple< unsigned int, std::vector<unsigned int>, std::vector<unsigned int>, bool > IMP::npctransport::Scoring::get_site_interactions_statistics ( Particle const *  p1,
Particle const *  p2 
) const

return various statistics about site-site interactions between p1 and p2 return a tuple with: a) number of site-site interaction that contribute to the score between p1 and p2 in the model, based on their current coordinates and their particle types b) vector of occupied pi1 sites counts (count number of interactions per site) c) vector of occupied pi2 sites counts (count number of interactions per site)

Definition at line 557 of file Scoring.h.

+ Here is the call graph for this function:

Restraint* IMP::npctransport::Scoring::get_slab_restraint ( bool  update = false)

returns the slab restraint on >get_sd()->get_beads() which will be used in the next call to get_scoring_function(false) (so manipulating it might affect the scoring function). Also, if update is false, then it is guaranteed that these are the same restraints used by the last call to get_scoring_function()

Parameters
updateif true, forces recreation of the cached container, o/w cached version that was used in last call to get_scoring_function(), if applicable
Note
if update=false, might fail to include e.g., new particles that were added after the last call
virtual ::IMP::VersionInfo IMP::npctransport::Scoring::get_version_info ( ) const
overridevirtual

Get information about the module and version of the object.

Reimplemented from IMP::Object.

Definition at line 727 of file Scoring.h.

IMP::Restraints IMP::npctransport::Scoring::get_z_bias_restraints ( )

return z_bias restraints for all particles that were added using add_z_bias_restraint()

void IMP::npctransport::Scoring::remove_particle_type ( core::ParticleType  pt)

remove all scoring function elements related to particle type pt NOTE: a few aspects of the scoring function do not support this function as of 2018-06-19 - namely anchor restraints and z coordinate bias

void IMP::npctransport::Scoring::set_interaction_k_factor ( IMP::core::ParticleType  type,
double  value 
)

sets the multiplicative scaling of the interaction k constants for pair interactions involving a particle of this type, for all future calls to add_interaction()

Definition at line 717 of file Scoring.h.

void IMP::npctransport::Scoring::set_interaction_range_factor ( IMP::core::ParticleType  type,
double  value 
)

sets the multiplicative scaling of the interaction range for pair interactions involving a particle of this type, for all future calls to add_interaction()

Definition at line 704 of file Scoring.h.


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