Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
protocols::relax::RelaxScriptManager Class Reference

A singleton class for managing relax scripts, to ensure that they are loaded once and only once from disk. More...

#include <RelaxScriptManager.hh>

Inheritance diagram for protocols::relax::RelaxScriptManager:
Inheritance graph
[legend]

Public Member Functions

RelaxScriptFileContents const & get_relax_script (std::string const &filename, core::scoring::ScoreFunctionCOP const &mover_sfxn, bool const dualspace) const
 Get a relax script. Load it from disk if it has not already been loaded. More...
 

Private Member Functions

 RelaxScriptManager ()
 Empty constructor. More...
 
 RelaxScriptManager (RelaxScriptManager const &)=delete
 Explicitly deleted copy constructor. More...
 
RelaxScriptManager operator= (RelaxScriptManager const &)=delete
 Explicitly deleted assignment operator. More...
 
RelaxScriptFileContentsOP create_relax_script_instance (std::string const &script_file, std::string const &nearest_sfxn_name, bool const dualspace) const
 Create an instance of a RelaxScriptFileContents object, by owning pointer. More...
 
std::string script_file_path (std::string const &script_file, std::string const &nearest_sfxn_name, bool const dualspace) const
 Get the full script file path from the script name. More...
 
std::string get_nearest_sfxn_if_in_database (std::string const &script_file, core::scoring::ScoreFunctionCOP mover_sfxn) const
 Get the database scorefunction that is closest to the current one, if the relax script is a database relax script that specifies a scorefunction. More...
 
void initialize_relax_scripts_in_database () const
 Read the list of relax scripts from the database. More...
 
std::string determine_closest_scorefunction (core::scoring::ScoreFunction const &target, utility::vector1< std::string > const &names_of_candidates) const
 Given a scorefunction and a list of candidate scorefunctions, determine the closest one. More...
 

Static Private Member Functions

static void handle_script_file_with_period (std::string const &script_file, std::string::size_type position_of_first_period)
 Check whether (a) there is a period in the script file name, and, if so, (b) whether the base name exists in the database. If (a) is true, throw an error message, where the text depends on whether (b) is true. More...
 
static core::Real sfxn_distance_squared (core::scoring::EnergyMap const &target_weights, core::scoring::EnergyMap const &candidate_weights)
 Get the difference between two EnergyMaps. More...
 
static EnergyMapContainerCOP create_energy_map_instance (std::string const &filename)
 Create an instance of an EnergyMapContainer. Needed for threadsafe lazy loading. More...
 

Private Attributes

std::map< std::tuple
< std::string, std::string,
bool >
, RelaxScriptFileContentsOP
filename_to_filecontents_map_
 A map of filename to file contents. More...
 
utility::vector1
< DatabaseRelaxScript
relax_scripts_in_database_
 cached data from database/sampling/relax_scripts/index.dat More...
 
std::map< std::string,
EnergyMapContainerCOP
energy_maps_map_
 

Friends

class utility::SingletonBase< RelaxScriptManager >
 

Detailed Description

A singleton class for managing relax scripts, to ensure that they are loaded once and only once from disk.

Author
Vikram K. Mulligan (vmull.nosp@m.igan.nosp@m.@flat.nosp@m.iron.nosp@m.insti.nosp@m.tute.nosp@m..org)

Constructor & Destructor Documentation

protocols::relax::RelaxScriptManager::RelaxScriptManager ( )
private

Empty constructor.

protocols::relax::RelaxScriptManager::RelaxScriptManager ( RelaxScriptManager const &  )
privatedelete

Explicitly deleted copy constructor.

Member Function Documentation

EnergyMapContainerCOP protocols::relax::RelaxScriptManager::create_energy_map_instance ( std::string const &  filename)
staticprivate

Create an instance of an EnergyMapContainer. Needed for threadsafe lazy loading.

Peforms onetime read from disk.

Referenced by determine_closest_scorefunction().

RelaxScriptFileContentsOP protocols::relax::RelaxScriptManager::create_relax_script_instance ( std::string const &  filename,
std::string const &  nearest_sfxn_name,
bool const  dualspace 
) const
private

Create an instance of a RelaxScriptFileContents object, by owning pointer.

Needed for threadsafe creation. Loads data from disk. NOT for repeated calls!

Note
Not intended for use outside of RelaxScriptManager.

References script_file_path(), and protocols::relax::TR().

Referenced by get_relax_script().

std::string protocols::relax::RelaxScriptManager::determine_closest_scorefunction ( core::scoring::ScoreFunction const &  target,
utility::vector1< std::string > const &  names_of_candidates 
) const
private

Given a scorefunction and a list of candidate scorefunctions, determine the closest one.

Performs onetime read from disk.

References create_energy_map_instance(), energy_maps_map_, protocols::hybridization::score, sfxn_distance_squared(), protocols::relax::TR(), and core::scoring::ScoreFunction::weights().

Referenced by get_nearest_sfxn_if_in_database().

std::string protocols::relax::RelaxScriptManager::get_nearest_sfxn_if_in_database ( std::string const &  script_file,
core::scoring::ScoreFunctionCOP  mover_sfxn 
) const
private

Get the database scorefunction that is closest to the current one, if the relax script is a database relax script that specifies a scorefunction.

Performs onetime read from disk.

References determine_closest_scorefunction(), core::scoring::get_score_function(), and relax_scripts_in_database_.

Referenced by get_relax_script().

RelaxScriptFileContents const & protocols::relax::RelaxScriptManager::get_relax_script ( std::string const &  filename,
core::scoring::ScoreFunctionCOP const &  mover_sfxn,
bool const  dualspace 
) const

Get a relax script. Load it from disk if it has not already been loaded.

Threadsafe and lazily loaded. Requires the FastRelax or FastDesign mover's scorefunction to be provided.

References create_relax_script_instance(), filename_to_filecontents_map_, get_nearest_sfxn_if_in_database(), core::scoring::get_score_function(), and initialize_relax_scripts_in_database().

void protocols::relax::RelaxScriptManager::handle_script_file_with_period ( std::string const &  script_file,
std::string::size_type  position_of_first_period 
)
staticprivate

Check whether (a) there is a period in the script file name, and, if so, (b) whether the base name exists in the database. If (a) is true, throw an error message, where the text depends on whether (b) is true.

PERFORMS DISK READ.

Referenced by script_file_path().

void protocols::relax::RelaxScriptManager::initialize_relax_scripts_in_database ( ) const
private

Read the list of relax scripts from the database.

Performs onetime read from disk.

PEFRORMS DISK READ.

References protocols::abinitio::filename(), relax_scripts_in_database_, and protocols::relax::TR().

Referenced by get_relax_script().

RelaxScriptManager protocols::relax::RelaxScriptManager::operator= ( RelaxScriptManager const &  )
privatedelete

Explicitly deleted assignment operator.

std::string protocols::relax::RelaxScriptManager::script_file_path ( std::string const &  script_file,
std::string const &  nearest_sfxn_name,
bool const  dualspace 
) const
private

Get the full script file path from the script name.

PEFRORMS DISK READ.

References protocols::pack_daemon::error_message, handle_script_file_with_period(), and protocols::relax::TR().

Referenced by create_relax_script_instance().

core::Real protocols::relax::RelaxScriptManager::sfxn_distance_squared ( core::scoring::EnergyMap const &  target_weights,
core::scoring::EnergyMap const &  candidate_weights 
)
staticprivate

Get the difference between two EnergyMaps.

References core::scoring::fa_atr, and core::scoring::n_score_types.

Referenced by determine_closest_scorefunction().

Friends And Related Function Documentation

friend class utility::SingletonBase< RelaxScriptManager >
friend

Member Data Documentation

std::map< std::string, EnergyMapContainerCOP > protocols::relax::RelaxScriptManager::energy_maps_map_
mutableprivate
std::map< std::tuple< std::string, std::string, bool>, RelaxScriptFileContentsOP > protocols::relax::RelaxScriptManager::filename_to_filecontents_map_
mutableprivate

A map of filename to file contents.

Referenced by get_relax_script().

utility::vector1< DatabaseRelaxScript > protocols::relax::RelaxScriptManager::relax_scripts_in_database_
mutableprivate

cached data from database/sampling/relax_scripts/index.dat

Referenced by get_nearest_sfxn_if_in_database(), and initialize_relax_scripts_in_database().


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