Rosetta Protocols  2014.16.56682
Public Member Functions | Private Member Functions | Private Attributes | List of all members
protocols::canonical_sampling::MultiTempTrialCounter Class Reference

Keep track of move statistics at different temperature levels. More...

#include <MultiTempTrialCounter.hh>

Public Member Functions

 MultiTempTrialCounter (TemperatureControllerCOP)
 Default constructor. More...
 
 ~MultiTempTrialCounter ()
 Default destructor. More...
 
void reset ()
 Set all counters for all temperatures to zero. More...
 
void reset_temp_controller (TemperatureControllerCOP)
 Set the temperature controller. More...
 
void count_trial (std::string const &tag)
 Record when a move of the given type was attempted. More...
 
void count_accepted (std::string const &tag)
 Record when a move of the given type was accepted. More...
 
void count_energy_drop (std::string const &tag, core::Real drop)
 Record when a move of the given type led to the given energy drop. More...
 
void collect ()
 Copy all statistics to the root node, if MPI is enabled. More...
 
protocols::moves::TrialCounter
const & 
temp_level (core::Size) const
 Return const access to the TrialCounter for the given temperature level. More...
 
core::Size num_temp_levels () const
 Return the number of temperature levels recorded by this observer. More...
 
core::Size total_trials () const
 Return how many trials have been recorded for all moves and all temperatures. More...
 
core::Size trial (std::string const &tag) const
 Return how many times the given move was attempted for all temperatures. More...
 
core::Size accepted (std::string const &tag) const
 Return how many times the given move was accepted for all temperatures. More...
 
core::Real energy_drop (std::string const &tag) const
 Return the average drop in energy effected by this move for all temperatures. More...
 
virtual utility::vector1
< std::string > const 
tags () const
 Return the tag name for any move recorded at any temperature. More...
 
void show (std::ostream &, std::string line_header="", bool with_end_line=true) const
 Write acceptance rates for each move at each temperature to the given stream. More...
 
void write_to_file (std::string const &file, std::string const &tag) const
 Write acceptance rates for each move at each temperature to the given file. More...
 
- Public Member Functions inherited from protocols::moves::TrialCounter
 TrialCounter ()
 
void show () const
 

Private Member Functions

protocols::moves::TrialCounterget_current_counter ()
 Return a reference to the TrialCounter representing the current temperature level. Some sanity checks are done in debug mode. More...
 
void write_to_stream (std::ostream &, std::string const &tag) const
 Help write the trial counters to the given stream. More...
 

Private Attributes

TemperatureControllerCOP temp_controller_
 
utility::vector1
< protocols::moves::TrialCounter
counters_
 

Detailed Description

Keep track of move statistics at different temperature levels.

Moves are more likely to be accepted at higher temperatures, so it doesn't make sense to lump all the moves made at different temperatures into the same statistics. Since the default TrialCounter used by MonteCarlo is agnostic to the temperature, this class is provided as a drop-in replacement. Use MonteCarlo.set_counter() to replace the default counter with a MultiTempTrialCounter. Once the simulation is complete, use temp_level() to return the move statistics for the given temperature level. The trial(), accepted(), and energy_drop() method are provided to satisfy the TrialCounter interface, but are not meaningful because they merge the results from all the different temperatures.

Constructor & Destructor Documentation

protocols::canonical_sampling::MultiTempTrialCounter::MultiTempTrialCounter ( TemperatureControllerCOP  tc)

Default constructor.

If the number of temperature levels managed by the controller changes after this object is constructed, reset() must be called.

References reset().

protocols::canonical_sampling::MultiTempTrialCounter::~MultiTempTrialCounter ( )

Default destructor.

Member Function Documentation

Size protocols::canonical_sampling::MultiTempTrialCounter::accepted ( std::string const &  tag) const
virtual

Return how many times the given move was accepted for all temperatures.

Reimplemented from protocols::moves::TrialCounter.

References protocols::moves::TrialCounter::accepted(), and counters_.

void protocols::canonical_sampling::MultiTempTrialCounter::collect ( )

Copy all statistics to the root node, if MPI is enabled.

References utility_exit_with_message.

void protocols::canonical_sampling::MultiTempTrialCounter::count_accepted ( std::string const &  tag)
virtual

Record when a move of the given type was accepted.

Reimplemented from protocols::moves::TrialCounter.

References protocols::moves::TrialCounter::count_accepted(), and get_current_counter().

void protocols::canonical_sampling::MultiTempTrialCounter::count_energy_drop ( std::string const &  tag,
core::Real  drop 
)
virtual

Record when a move of the given type led to the given energy drop.

Reimplemented from protocols::moves::TrialCounter.

References protocols::moves::TrialCounter::count_energy_drop(), and get_current_counter().

void protocols::canonical_sampling::MultiTempTrialCounter::count_trial ( std::string const &  tag)
virtual

Record when a move of the given type was attempted.

Reimplemented from protocols::moves::TrialCounter.

References protocols::moves::TrialCounter::count_trial(), and get_current_counter().

Real protocols::canonical_sampling::MultiTempTrialCounter::energy_drop ( std::string const &  tag) const
virtual

Return the average drop in energy effected by this move for all temperatures.

Reimplemented from protocols::moves::TrialCounter.

References counters_, and protocols::moves::TrialCounter::energy_drop().

TrialCounter & protocols::canonical_sampling::MultiTempTrialCounter::get_current_counter ( )
private

Return a reference to the TrialCounter representing the current temperature level. Some sanity checks are done in debug mode.

See also
count_trial()
count_accepted()
count_energy_drop()

References counters_, and temp_controller_.

Referenced by count_accepted(), count_energy_drop(), and count_trial().

Size protocols::canonical_sampling::MultiTempTrialCounter::num_temp_levels ( ) const

Return the number of temperature levels recorded by this observer.

References counters_.

void protocols::canonical_sampling::MultiTempTrialCounter::reset ( )
virtual

Set all counters for all temperatures to zero.

Reimplemented from protocols::moves::TrialCounter.

References counters_, and temp_controller_.

Referenced by MultiTempTrialCounter(), and reset_temp_controller().

void protocols::canonical_sampling::MultiTempTrialCounter::reset_temp_controller ( TemperatureControllerCOP  temp_controller)

Set the temperature controller.

References reset(), and temp_controller_.

void protocols::canonical_sampling::MultiTempTrialCounter::show ( std::ostream &  os,
std::string  line_header = "",
bool  with_end_line = true 
) const
virtual

Write acceptance rates for each move at each temperature to the given stream.

Reimplemented from protocols::moves::TrialCounter.

References write_to_stream().

vector1< string > const protocols::canonical_sampling::MultiTempTrialCounter::tags ( ) const
virtual

Return the tag name for any move recorded at any temperature.

Reimplemented from protocols::moves::TrialCounter.

References counters_, and protocols::moves::TrialCounter::tags().

TrialCounter const & protocols::canonical_sampling::MultiTempTrialCounter::temp_level ( core::Size  level) const

Return const access to the TrialCounter for the given temperature level.

References counters_, and temp_controller_.

Size protocols::canonical_sampling::MultiTempTrialCounter::total_trials ( ) const
virtual

Return how many trials have been recorded for all moves and all temperatures.

Reimplemented from protocols::moves::TrialCounter.

References counters_, and protocols::moves::TrialCounter::total_trials().

Size protocols::canonical_sampling::MultiTempTrialCounter::trial ( std::string const &  tag) const
virtual

Return how many times the given move was attempted for all temperatures.

Reimplemented from protocols::moves::TrialCounter.

References counters_, and protocols::moves::TrialCounter::trial().

void protocols::canonical_sampling::MultiTempTrialCounter::write_to_file ( std::string const &  file,
std::string const &  tag 
) const

Write acceptance rates for each move at each temperature to the given file.

References out, and write_to_stream().

void protocols::canonical_sampling::MultiTempTrialCounter::write_to_stream ( std::ostream &  os,
std::string const &  tag 
) const
private

Help write the trial counters to the given stream.

See also
show()
write_to_file()

References counters_, protocols::abinitio::abscript::I, and temp_controller_.

Referenced by show(), and write_to_file().

Member Data Documentation

utility::vector1< protocols::moves::TrialCounter > protocols::canonical_sampling::MultiTempTrialCounter::counters_
private
TemperatureControllerCOP protocols::canonical_sampling::MultiTempTrialCounter::temp_controller_
private

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