Rosetta Protocols  2014.16.56682
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | List of all members
protocols::canonical_sampling::TemperatureController Class Referenceabstract

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)
 
Moveroperator= (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 Stringsinfo ()
 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::Realtemperatures_
 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::stringStrings
 

Detailed Description

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.

Constructor & Destructor Documentation

protocols::canonical_sampling::TemperatureController::TemperatureController ( )

Default constructor.

protocols::canonical_sampling::TemperatureController::TemperatureController ( TemperatureController const &  other)

Member Function Documentation

virtual void protocols::canonical_sampling::TemperatureController::apply ( core::pose::Pose )
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.

bool protocols::canonical_sampling::TemperatureController::check_temp_consistency ( )
protected
void protocols::canonical_sampling::TemperatureController::clear ( )
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().

core::Size protocols::canonical_sampling::TemperatureController::current_temp ( )
inlineprotected
void protocols::canonical_sampling::TemperatureController::finalize_simulation ( core::pose::Pose pose,
MetropolisHastingsMover const &  mover 
)
virtual
void protocols::canonical_sampling::TemperatureController::generate_temp_range ( core::Real  temp_low,
core::Real  temp_high,
core::Size  n_levels,
InterpolationType  interpolation = linear 
)
protected
bool protocols::canonical_sampling::TemperatureController::init_from_file ( std::string const &  filename)
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().

void protocols::canonical_sampling::TemperatureController::init_from_options ( )
protectedvirtual
void protocols::canonical_sampling::TemperatureController::initialize_simulation ( core::pose::Pose pose,
MetropolisHastingsMover const &  mover,
core::Size  cycle 
)
virtual
MonteCarloCOP protocols::canonical_sampling::TemperatureController::monte_carlo ( ) const
MonteCarloOP protocols::canonical_sampling::TemperatureController::monte_carlo ( )
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:

mpirun -np 32 my_parallel_tempering_app -tempering:temp:levels 32

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.

See also
temperature_level()
temperature()

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().

void protocols::canonical_sampling::TemperatureController::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 
)
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().

void protocols::canonical_sampling::TemperatureController::register_options ( )
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().

virtual bool protocols::canonical_sampling::TemperatureController::reinitialize_for_each_job ( ) const
inlinevirtual

Return false. This class does not need to be reinitialized for each job.

Reimplemented from protocols::moves::Mover.

virtual bool protocols::canonical_sampling::TemperatureController::reinitialize_for_new_input ( ) const
inlinevirtual

Return false. This class does not need to be reinitialized for new input.

Reimplemented from protocols::moves::Mover.

void protocols::canonical_sampling::TemperatureController::set_current_temp ( core::Size  new_temp)
protected
void protocols::canonical_sampling::TemperatureController::set_defaults ( )
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_.

void protocols::canonical_sampling::TemperatureController::set_temperatures ( utility::vector1< core::Real > const &  temps)
protected
std::string const& protocols::canonical_sampling::TemperatureController::stats_file ( ) const
inlineprotected
bool protocols::canonical_sampling::TemperatureController::stats_line_output ( ) const
inlineprotected

Return true if a statistics summary should be written.

See also
stats_silent_output()
stats_file()

References stats_line_output_.

Referenced by protocols::canonical_sampling::SimulatedTempering::write_to_file().

bool protocols::canonical_sampling::TemperatureController::stats_silent_output ( ) const
inlineprotected

Return true if a statistics summary should be inserted into a silent file.

See also
stats_line_output()
stats_file()

References stats_silent_output_.

Referenced by protocols::canonical_sampling::SimulatedTempering::write_to_file().

Real protocols::canonical_sampling::TemperatureController::temperature ( ) const
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.

See also
n_temp_levels()
temperature()

References current_temp_.

Referenced by protocols::canonical_sampling::MpiHamiltonianExchange::temperature_move().

virtual core::Real protocols::canonical_sampling::TemperatureController::temperature_move ( core::pose::Pose pose,
MetropolisHastingsMover mover,
core::Real  score 
)
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.

bool protocols::canonical_sampling::TemperatureController::time_for_temp_move ( )
inlineprotected
void protocols::canonical_sampling::TemperatureController::write_to_file ( std::string const &  file_in,
std::string const &  output_name,
utility::vector1< core::Real > const &  wcounts 
)
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_.

Member Data Documentation

core::Size protocols::canonical_sampling::TemperatureController::current_temp_
private

Current temperature level. Not the current temperature!

Referenced by check_temp_consistency(), current_temp(), initialize_simulation(), set_current_temp(), temperature_level(), and TemperatureController().

bool protocols::canonical_sampling::TemperatureController::instance_initialized_
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().

protocols::jd2::JobOP protocols::canonical_sampling::TemperatureController::job_
private

Job object to report on temperatures.

Referenced by finalize_simulation(), initialize_simulation(), set_current_temp(), and TemperatureController().

protocols::moves::MonteCarloOP protocols::canonical_sampling::TemperatureController::monte_carlo_
private

The underlying monte carlo simulation.

Referenced by monte_carlo(), and set_monte_carlo().

bool protocols::canonical_sampling::TemperatureController::options_registered_
staticprivate

If false, the options used by this class have not yet been added to the global options system.

Referenced by init_from_options().

std::string protocols::canonical_sampling::TemperatureController::stats_file_
private

Name of the silent file used for writing statistics.

Referenced by init_from_options(), parse_my_tag(), stats_file(), and TemperatureController().

bool protocols::canonical_sampling::TemperatureController::stats_line_output_
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().

bool protocols::canonical_sampling::TemperatureController::stats_silent_output_
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().

core::Size protocols::canonical_sampling::TemperatureController::temp_trial_count_
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().

core::Size protocols::canonical_sampling::TemperatureController::temperature_stride_
private

Frequency for attempting temperature moves.

Referenced by init_from_options(), parse_my_tag(), TemperatureController(), and time_for_temp_move().

utility::vector1< core::Real > protocols::canonical_sampling::TemperatureController::temperatures_
private
bool protocols::canonical_sampling::TemperatureController::trust_current_temp_
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().


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