![]() |
Rosetta Protocols
2014.16.56682
|
Base class for controlling the temperature of a simulation. More...
#include <TemperatureController.hh>
Public Member Functions | |
| TemperatureController () | |
| Default constructor. More... | |
| TemperatureController (TemperatureController const &other) | |
| Default constructor. More... | |
| virtual void | apply (core::pose::Pose &) |
| No-op implemented only to satisfy the Mover interface. More... | |
| virtual bool | reinitialize_for_each_job () const |
| Return false. This class does not need to be reinitialized for each job. More... | |
| virtual bool | reinitialize_for_new_input () const |
| Return false. This class does not need to be reinitialized for new input. More... | |
| virtual void | parse_my_tag (utility::tag::TagCOP tag, basic::datacache::DataMap &data, protocols::filters::Filters_map const &filters, protocols::moves::Movers_map const &movers, core::pose::Pose const &pose) |
| Called by MoverFactory when constructing new Movers. Takes care of the specific mover's parsing. More... | |
| virtual void | initialize_simulation (core::pose::Pose &pose, MetropolisHastingsMover const &mover, core::Size cycle) |
| Callback executed before any Monte Carlo trials are attempted. More... | |
| virtual core::Real | temperature_move (core::pose::Pose &pose, MetropolisHastingsMover &mover, core::Real score)=0 |
| Execute a temperature move if necessary. More... | |
| virtual void | finalize_simulation (core::pose::Pose &pose, MetropolisHastingsMover const &mover) |
| Callback executed after all Monte Carlo trials are completed. More... | |
| core::Real | temperature () const |
| Return the temperature of the underlying MonteCarlo object. More... | |
| core::Real | temperature (core::Size level) const |
| Return the temperature of the given level. More... | |
| core::Size | temperature_level () const |
| Return the current temperature level. More... | |
| core::Size | n_temp_levels () const |
| Return the number of temperature levels used by this controller. More... | |
| protocols::moves::MonteCarloCOP | monte_carlo () const |
| Return const access to the MonteCarlo object being controlled. More... | |
| void | set_monte_carlo (protocols::moves::MonteCarloOP monte_carlo) |
| Set the MonteCarlo object to be controlled. More... | |
Public Member Functions inherited from protocols::moves::Mover | |
| Mover () | |
| virtual | ~Mover () |
| virtual MoverSP | create () |
| virtual void | apply (core::io::serialization::PipeMap &pmap) |
| virtual void | parse_state (SerializableState const &state) |
| virtual void | parse_def (utility::lua::LuaObject const &def, utility::lua::LuaObject const &score_fxns, utility::lua::LuaObject const &tasks, MoverCacheSP cache) |
| virtual void | save_state (SerializableState &state) |
| Mover (std::string const &type_name) | |
| sets the type for a mover; name_ has been removed (2010/05/14) More... | |
| Mover (Mover const &other) | |
| Mover & | operator= (Mover const &other) |
| assignment operator More... | |
| virtual core::Real | last_proposal_density_ratio () |
| std::string const & | type () const |
| std::string | get_current_tag () const |
| A tag is a unique identifier used to identify structures produced by this Mover. get_current_tag() returns the tag, and set_current_tag( std::string tag ) sets the tag. This functionality is not intended for use with the 2008 job distributor. More... | |
| void | set_current_tag (std::string const &new_tag) |
| virtual void | set_input_pose (PoseCOP pose) |
| setter for poses contained for rms More... | |
| virtual void | set_native_pose (PoseCOP pose) |
| setter for native poses contained for rms -— we should get rid of this method? it is widely used, but a bit unsafe More... | |
| PoseCOP | get_input_pose () const |
| PoseCOP | get_native_pose () const |
| virtual void | test_move (Pose &pose) |
| : Unit test support function. Apply one move to a given pose. Allows extra test specific functions to be called before applying More... | |
| void | type (const std::string &type_in) |
| virtual MoverOP | clone () const |
| Return a clone of the Mover object. More... | |
| virtual std::string | get_name () const =0 |
| Each derived class must specify its name. The class name. More... | |
| std::string | get_type () const |
| MoverStatus | get_last_move_status () const |
| end parser interface, start Job Distributor interface///////////// More... | |
| void | reset_status () |
| resets status to SUCCESS, meant to be used before an apply(). The job distributor (august 08 vintage) uses this to ensure non-accumulation of status across apply()s. More... | |
| virtual core::pose::PoseOP | get_additional_output () |
| Mechanism by which a mover may return multiple output poses from a single input pose. More... | |
| virtual void | clear_info () |
| Strings container can be used to return miscellaneous info (as std::string) from a mover, such as notes about the results of apply(). The job distributor (Apr 09 vintage) will check this function to see if your protocol wants to add string info to the Job that ran this mover. One way this can be useful is that later, a JobOutputter may include/append this info to an output file. More... | |
| virtual Strings & | info () |
| non-const accessor More... | |
| virtual Strings const & | info () const |
| const accessor More... | |
| virtual MoverOP | fresh_instance () const |
| Generates a new Mover object freshly created with the default ctor. More... | |
| void | set_current_job (protocols::jobdist::BasicJobCOP job) |
| jobdist::BasicJobCOP | get_current_job () const |
| virtual void | show (std::ostream &output=std::cout) const |
| Outputs details about the Mover, including current settings. More... | |
Static Public Member Functions | |
| static void | register_options () |
| Register the options used by this mover with the global options system. More... | |
Static Public Member Functions inherited from protocols::moves::Mover | |
| static std::string | name () |
| static void | register_options () |
| Overload this static method if you access options within the mover. More... | |
Protected Member Functions | |
| protocols::moves::MonteCarloOP | monte_carlo () |
| Return non-const access to the MonteCarlo object being controlled. More... | |
| void | set_defaults () |
| Help the constructor initialize new objects. More... | |
| virtual void | init_from_options () |
| Assign user-specified command-line values to data members. More... | |
| virtual bool | init_from_file (std::string const &filename) |
| Initialize temperatures and weights from a file. More... | |
| virtual void | write_to_file (std::string const &file_in, std::string const &output_name, utility::vector1< core::Real > const &wcounts) |
| Save temperatures and weights to a file. More... | |
| void | generate_temp_range (core::Real temp_low, core::Real temp_high, core::Size n_levels, InterpolationType interpolation=linear) |
| Explicitly set the temperature levels by interpolating the given parameters. More... | |
| void | set_temperatures (utility::vector1< core::Real > const &) |
| Explicitly set the temperature levels. More... | |
| core::Size | current_temp () |
| Return the current temperature level. Identical to temperature_level() as far as I can tell. More... | |
| void | set_current_temp (core::Size new_temp) |
| Set the temperature to the given level. More... | |
| bool | check_temp_consistency () |
| Assert that the current temperature of the MonteCarlo object agrees with the current temperature level of this object. More... | |
| void | clear () |
| Forget all temperature levels and return to an uninitialized state. More... | |
| bool | time_for_temp_move () |
| Return true if a temperature move should be made on this iteration. More... | |
| bool | stats_line_output () const |
| Return true if a statistics summary should be written. More... | |
| bool | stats_silent_output () const |
| Return true if a statistics summary should be inserted into a silent file. More... | |
| std::string const & | stats_file () const |
| Return the name of the silent file into which statistics should be recorded. More... | |
Protected Member Functions inherited from protocols::moves::Mover | |
| void | set_last_move_status (MoverStatus status) |
| nonvirtual setter for MoverStatus last_status_. Protected means that only the mover itself will be able to change its own status. The job distributor (august 08 vintage) is aware of status set with this function and will do what the MoverStatus says. More... | |
Private Attributes | |
| protocols::moves::MonteCarloOP | monte_carlo_ |
| The underlying monte carlo simulation. More... | |
| utility::vector1< core::Real > | temperatures_ |
| Temperature levels. More... | |
| core::Size | temperature_stride_ |
| Frequency for attempting temperature moves. More... | |
| bool | trust_current_temp_ |
| If false, look for current temperature in monte_carlo_ before each move. Set to true by default. More... | |
| bool | stats_line_output_ |
| If true, a statistics summary will be written. More... | |
| bool | stats_silent_output_ |
| If true, the statistics summary will be inserted in a silent file. More... | |
| std::string | stats_file_ |
| Name of the silent file used for writing statistics. More... | |
| protocols::jd2::JobOP | job_ |
| Job object to report on temperatures. More... | |
| bool | instance_initialized_ |
| If false, init_from_options() will be called before the simulation starts. More... | |
| core::Size | current_temp_ |
| Current temperature level. Not the current temperature! More... | |
| core::Size | temp_trial_count_ |
| Number of times time_for_temp_move() has been called. This method is meant to be called every time temperature_move() is called. More... | |
Static Private Attributes | |
| static bool | options_registered_ |
| If false, the options used by this class have not yet been added to the global options system. More... | |
Additional Inherited Members | |
Public Types inherited from protocols::moves::Mover | |
| typedef utility::tag::TagCOP | TagCOP |
| typedef core::pose::Pose | Pose |
| typedef core::pose::PoseCOP | PoseCOP |
| typedef protocols::filters::Filters_map | Filters_map |
| typedef std::list< std::string > | Strings |
Base class for controlling the temperature of a simulation.
Many schemes to improve the performance of condensed phase Monte Carlo simulations depends on changing the temperature of the system. Common examples include simulated annealing and parallel tempering. This class provides an interface for writing these algorithms. The most important method is temperature_move(), which is responsible for actually changing the temperature of the MonteCarlo object used for the underlying simulation.
Methods are also get and set generally useful parameters. These methods include get_high_temp(), get_low_temp(), get_temp_levels(), get_stride(), and temperature_level(). Temperature levels are provided for managing a number of discrete temperature levels. Not all of these parameters are respected by and/or make sense for all temperature controllers. For example, FixedTemperatureController ignores all of this information.
| protocols::canonical_sampling::TemperatureController::TemperatureController | ( | ) |
Default constructor.
| protocols::canonical_sampling::TemperatureController::TemperatureController | ( | TemperatureController const & | other | ) |
Default constructor.
References current_temp_, instance_initialized_, job_, stats_file_, stats_line_output_, stats_silent_output_, temp_trial_count_, temperature_stride_, temperatures_, and trust_current_temp_.
|
inlinevirtual |
No-op implemented only to satisfy the Mover interface.
Implements protocols::moves::Mover.
Reimplemented in protocols::canonical_sampling::MpiHamiltonianExchange, and protocols::canonical_sampling::SimulatedTempering.
|
protected |
Assert that the current temperature of the MonteCarlo object agrees with the current temperature level of this object.
References current_temp_, monte_carlo(), runtime_assert, temperature(), temperatures_, and trust_current_temp_.
Referenced by protocols::canonical_sampling::SimulatedTempering::temperature_move(), protocols::canonical_sampling::MpiHamiltonianExchange::temperature_move(), and protocols::canonical_sampling::MpiParallelTempering::temperature_move().
|
protected |
Forget all temperature levels and return to an uninitialized state.
References instance_initialized_, and temperatures_.
Referenced by protocols::canonical_sampling::MpiHamiltonianExchange::clear(), and init_from_file().
|
inlineprotected |
Return the current temperature level. Identical to temperature_level() as far as I can tell.
References current_temp_.
Referenced by protocols::canonical_sampling::MpiHamiltonianExchange::find_exchange_partner(), and protocols::canonical_sampling::SimulatedTempering::temperature_move().
|
virtual |
Callback executed after all Monte Carlo trials are completed.
Reimplemented in protocols::canonical_sampling::MpiParallelTempering, protocols::canonical_sampling::MpiHamiltonianExchange, and protocols::canonical_sampling::SimulatedTempering.
References job_.
Referenced by protocols::canonical_sampling::SimulatedTempering::finalize_simulation(), protocols::canonical_sampling::MpiHamiltonianExchange::finalize_simulation(), and protocols::canonical_sampling::MpiParallelTempering::finalize_simulation().
|
protected |
Explicitly set the temperature levels by interpolating the given parameters.
References protocols::canonical_sampling::exponential, protocols::canonical_sampling::interpolation_type_enum_to_string(), protocols::canonical_sampling::linear, runtime_assert, temperatures_, and protocols::canonical_sampling::tr.
Referenced by init_from_options(), and parse_my_tag().
|
protectedvirtual |
Initialize temperatures and weights from a file.
Return false if an IO error occurs.
Reimplemented in protocols::canonical_sampling::SimulatedTempering, and protocols::canonical_sampling::MpiHamiltonianExchange.
References clear(), getline(), utility::io::izstream::good(), in, tag, temperatures_, and protocols::canonical_sampling::tr.
Referenced by init_from_options(), and parse_my_tag().
|
protectedvirtual |
Assign user-specified command-line values to data members.
Reimplemented in protocols::canonical_sampling::MpiHamiltonianExchange, protocols::canonical_sampling::SimulatedTempering, and protocols::canonical_sampling::FixedTemperatureController.
References generate_temp_range(), init_from_file(), instance_initialized_, option, options_registered_, protocols::sic_dock::range(), stats_file_, stats_line_output_, stats_silent_output_, temperature_stride_, protocols::canonical_sampling::tr, user, and utility_exit_with_message.
Referenced by protocols::canonical_sampling::SimulatedTempering::init_from_options(), protocols::canonical_sampling::MpiHamiltonianExchange::init_from_options(), and initialize_simulation().
|
virtual |
Callback executed before any Monte Carlo trials are attempted.
The cycle parameter gives the number of times that the simulation has been restarted. Since the restart feature is currently commented out, cycle should always be 0.
Reimplemented in protocols::canonical_sampling::MpiParallelTempering, protocols::canonical_sampling::MpiHamiltonianExchange, and protocols::canonical_sampling::SimulatedTempering.
References protocols::jd2::Job::add_string_real_pair(), current_temp_, protocols::jd2::get_current_job(), init_from_options(), instance_initialized_, protocols::jd2::jd2_used(), job_, monte_carlo(), temp_trial_count_, temperature(), temperatures_, and protocols::canonical_sampling::tr.
Referenced by protocols::canonical_sampling::SimulatedTempering::initialize_simulation(), protocols::canonical_sampling::MpiHamiltonianExchange::initialize_simulation(), and protocols::canonical_sampling::MpiParallelTempering::initialize_simulation().
| MonteCarloCOP protocols::canonical_sampling::TemperatureController::monte_carlo | ( | ) | const |
Return const access to the MonteCarlo object being controlled.
References monte_carlo_.
Referenced by check_temp_consistency(), protocols::canonical_sampling::MpiHamiltonianExchange::initialize_simulation(), initialize_simulation(), set_current_temp(), set_monte_carlo(), temperature(), and protocols::canonical_sampling::MpiHamiltonianExchange::temperature_move().
|
protected |
Return non-const access to the MonteCarlo object being controlled.
References monte_carlo_.
| Size protocols::canonical_sampling::TemperatureController::n_temp_levels | ( | ) | const |
Return the number of temperature levels used by this controller.
This parameter must be set from the command line using the -tempering:temp:levels flag. The default value is 10. In some cases (e.g. when using MpiParallelTempering), this parameter must also match the number of processes allocated to your app by mpirun. For example:
I'm not sure why this requirement exists. It's simple enough to ask MPI how many threads are available; why not just set that many temperature levels? Perhaps this would make things harder to reproduce, because the behavior of the program would depend on options passed to mpirun.
References temperatures_.
Referenced by protocols::canonical_sampling::MpiParallelTempering::finalize_simulation(), protocols::canonical_sampling::MpiHamiltonianExchange::find_exchange_partner(), protocols::canonical_sampling::MpiHamiltonianExchange::init_from_file(), protocols::canonical_sampling::SimulatedTempering::initialize_simulation(), protocols::canonical_sampling::MpiParallelTempering::initialize_simulation(), protocols::canonical_sampling::MpiHamiltonianExchange::operator=(), protocols::canonical_sampling::MpiParallelTempering::operator=(), protocols::canonical_sampling::SimulatedTempering::reset_raw_counter(), protocols::canonical_sampling::MpiHamiltonianExchange::show(), protocols::canonical_sampling::SimulatedTempering::temperature_move(), protocols::canonical_sampling::SimulatedTempering::write_to_file(), and write_to_file().
|
virtual |
Called by MoverFactory when constructing new Movers. Takes care of the specific mover's parsing.
Some movers need not be parsed, so we shouldn't stop executions. This, however, calls attention to the lack of this method, which could be due to something as silly as a wrong parameters definition.
Reimplemented from protocols::moves::Mover.
Reimplemented in protocols::canonical_sampling::MpiHamiltonianExchange, and protocols::canonical_sampling::SimulatedTempering.
References generate_temp_range(), init_from_file(), instance_initialized_, protocols::canonical_sampling::interpolation_type_string_to_enum(), stats_file_, stats_line_output_, stats_silent_output_, temperature_stride_, protocols::canonical_sampling::tr, and trust_current_temp_.
Referenced by protocols::canonical_sampling::MpiHamiltonianExchange::parse_my_tag(), and protocols::canonical_sampling::SimulatedTempering::parse_my_tag().
|
static |
Register the options used by this mover with the global options system.
References NEW_OPT, protocols::evaluation::options_registered_, and protocols::sic_dock::range().
Referenced by protocols::docking::TemperedDocking::register_options().
|
inlinevirtual |
Return false. This class does not need to be reinitialized for each job.
Reimplemented from protocols::moves::Mover.
|
inlinevirtual |
Return false. This class does not need to be reinitialized for new input.
Reimplemented from protocols::moves::Mover.
|
protected |
Set the temperature to the given level.
Note that the argument is a temperature level, not a raw temperature.
References protocols::jd2::Job::add_string_real_pair(), current_temp_, job_, monte_carlo(), and temperatures_.
Referenced by protocols::canonical_sampling::MpiHamiltonianExchange::initialize_simulation(), protocols::canonical_sampling::MpiParallelTempering::initialize_simulation(), set_temperatures(), protocols::canonical_sampling::SimulatedTempering::temperature_move(), protocols::canonical_sampling::MpiHamiltonianExchange::temperature_move(), and protocols::canonical_sampling::MpiParallelTempering::temperature_move().
|
protected |
Help the constructor initialize new objects.
References instance_initialized_, and trust_current_temp_.
Referenced by protocols::canonical_sampling::MpiParallelTempering::MpiParallelTempering().
| void protocols::canonical_sampling::TemperatureController::set_monte_carlo | ( | protocols::moves::MonteCarloOP | monte_carlo | ) |
Set the MonteCarlo object to be controlled.
References monte_carlo(), and monte_carlo_.
|
protected |
Explicitly set the temperature levels.
References set_current_temp(), and temperatures_.
Referenced by protocols::canonical_sampling::FixedTemperatureController::FixedTemperatureController(), protocols::canonical_sampling::MpiHamiltonianExchange::init_from_file(), and protocols::canonical_sampling::SimulatedTempering::init_from_file().
|
inlineprotected |
Return the name of the silent file into which statistics should be recorded.
References stats_file_.
Referenced by protocols::canonical_sampling::SimulatedTempering::finalize_simulation(), and protocols::canonical_sampling::SimulatedTempering::temperature_move().
|
inlineprotected |
Return true if a statistics summary should be written.
References stats_line_output_.
Referenced by protocols::canonical_sampling::SimulatedTempering::write_to_file().
|
inlineprotected |
Return true if a statistics summary should be inserted into a silent file.
References stats_silent_output_.
Referenced by protocols::canonical_sampling::SimulatedTempering::write_to_file().
| Real protocols::canonical_sampling::TemperatureController::temperature | ( | ) | const |
Return the temperature of the underlying MonteCarlo object.
References monte_carlo().
Referenced by check_temp_consistency(), protocols::canonical_sampling::FixedTemperatureController::clone(), protocols::canonical_sampling::MpiParallelTempering::finalize_simulation(), initialize_simulation(), protocols::canonical_sampling::MpiHamiltonianExchange::show(), protocols::canonical_sampling::MpiParallelTempering::shuffle_temperatures(), protocols::canonical_sampling::FixedTemperatureController::temperature_move(), protocols::canonical_sampling::SimulatedTempering::temperature_move(), protocols::canonical_sampling::MpiHamiltonianExchange::temperature_move(), protocols::canonical_sampling::MpiParallelTempering::temperature_move(), and protocols::canonical_sampling::SimulatedTempering::write_to_file().
| Real protocols::canonical_sampling::TemperatureController::temperature | ( | core::Size | level | ) | const |
Return the temperature of the given level.
References temperatures_.
| Size protocols::canonical_sampling::TemperatureController::temperature_level | ( | ) | const |
Return the current temperature level.
Tempering controllers often work with a handful of discrete temperature levels. This method makes it possible to work with levels, which are discrete, rather than temperatures, which are continuous. Higher temperature levels correspond to higher temperatures, and as usual in rosetta, counting starts at one. So the lowest temperature being simulated will always be level 1.
References current_temp_.
Referenced by protocols::canonical_sampling::MpiHamiltonianExchange::temperature_move().
|
pure virtual |
Execute a temperature move if necessary.
This method is expected to return the new temperature (in units of kT, although kT doesn't mean much in the context of rosetta).
Implemented in protocols::canonical_sampling::MpiParallelTempering, protocols::canonical_sampling::MpiHamiltonianExchange, protocols::canonical_sampling::SimulatedTempering, and protocols::canonical_sampling::FixedTemperatureController.
|
inlineprotected |
Return true if a temperature move should be made on this iteration.
References temp_trial_count_, and temperature_stride_.
Referenced by protocols::canonical_sampling::SimulatedTempering::temperature_move(), protocols::canonical_sampling::MpiHamiltonianExchange::temperature_move(), and protocols::canonical_sampling::MpiParallelTempering::temperature_move().
|
protectedvirtual |
Save temperatures and weights to a file.
Reimplemented in protocols::canonical_sampling::SimulatedTempering.
References file, n_temp_levels(), out, stats_line_output_, stats_silent_output_, and temperatures_.
|
private |
Current temperature level. Not the current temperature!
Referenced by check_temp_consistency(), current_temp(), initialize_simulation(), set_current_temp(), temperature_level(), and TemperatureController().
|
private |
If false, init_from_options() will be called before the simulation starts.
Referenced by clear(), init_from_options(), initialize_simulation(), parse_my_tag(), set_defaults(), and TemperatureController().
|
private |
Job object to report on temperatures.
Referenced by finalize_simulation(), initialize_simulation(), set_current_temp(), and TemperatureController().
|
private |
The underlying monte carlo simulation.
Referenced by monte_carlo(), and set_monte_carlo().
|
staticprivate |
If false, the options used by this class have not yet been added to the global options system.
Referenced by init_from_options().
|
private |
Name of the silent file used for writing statistics.
Referenced by init_from_options(), parse_my_tag(), stats_file(), and TemperatureController().
|
private |
If true, a statistics summary will be written.
Referenced by init_from_options(), parse_my_tag(), stats_line_output(), TemperatureController(), and write_to_file().
|
private |
If true, the statistics summary will be inserted in a silent file.
Referenced by init_from_options(), parse_my_tag(), stats_silent_output(), TemperatureController(), and write_to_file().
|
private |
Number of times time_for_temp_move() has been called. This method is meant to be called every time temperature_move() is called.
Referenced by initialize_simulation(), TemperatureController(), and time_for_temp_move().
|
private |
Frequency for attempting temperature moves.
Referenced by init_from_options(), parse_my_tag(), TemperatureController(), and time_for_temp_move().
|
private |
Temperature levels.
Referenced by check_temp_consistency(), clear(), generate_temp_range(), init_from_file(), initialize_simulation(), n_temp_levels(), set_current_temp(), set_temperatures(), temperature(), TemperatureController(), and write_to_file().
|
private |
If false, look for current temperature in monte_carlo_ before each move. Set to true by default.
Referenced by check_temp_consistency(), parse_my_tag(), set_defaults(), and TemperatureController().
1.8.7