Rosetta  2021.16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
protocols::loop_modeling::utilities::TrajectoryLogger Class Reference

Log a detailed account of everything that happens in a loop modeling simulation. More...

#include <TrajectoryLogger.hh>

Public Member Functions

 TrajectoryLogger (string const &prefix="")
 Construct an empty logger. More...
 
 TrajectoryLogger (LoopMover const *mover, string const &prefix="")
 Construct a logger from a loop mover. More...
 
 TrajectoryLogger (protocols::loops::LoopsCOP loops, core::scoring::ScoreFunctionCOP scorefxn, string const &prefix="")
 Construct a logger from a score function and a loops object. More...
 
void init (LoopMover const *mover)
 Initialize the logger from a loop mover after it has been constructed. More...
 
void init (protocols::loops::LoopsCOP loops, core::scoring::ScoreFunctionCOP scorefxn)
 Initialize the logger from a score function and a loops object after it has been constructed. More...
 
void record_move (basic::Tracer &tr, Pose &pose, core::Size const i, core::Size const j, core::Size const k, bool const proposed, bool const accepted) const
 Record a single Monte Carlo move. More...
 
void record_move (basic::Tracer &tr, Pose &pose, core::Size const iteration, bool const proposed, bool const accepted) const
 Record a single Monte Carlo move. More...
 
void record_new_pose (basic::Tracer &tr, Pose &pose) const
 Record when a low-scoring pose is recovered. More...
 
void record_new_score_function (basic::Tracer &tr, Pose &pose) const
 Record when a score function term is ramped (and scores change as a result). More...
 
void record_new_temperature (basic::Tracer &tr, Real temperature) const
 Record when the temperature is ramped. More...
 
void record_endpoint (basic::Tracer &tr, Pose &pose) const
 Record the end of a protocol. More...
 
string get_prefix () const
 Get the prefix that will be used for the scores associated with the pose at the end of the trajectory. More...
 
void set_prefix (string)
 Set the prefix that will be used for the scores associated with the pose at the end of the trajectory. More...
 
Pose const & get_native_pose () const
 Get the reference structure for RMSD calculations. More...
 
void set_native_pose (Pose const &)
 Set the reference structure for RMSD calculations. More...
 
void unset_native_pose ()
 Disable RMSD calculations. More...
 
protocols::loops::LoopsCOP get_loops () const
 Get the region of the protein where an backbone heavy-atom RMSD will be calculated for each step in the trajectory. More...
 
void set_loops (protocols::loops::LoopsCOP)
 Set the region of the protein where an backbone heavy-atom RMSD will be calculated for each step in the trajectory. More...
 
core::scoring::ScoreFunctionCOP get_score_function () const
 Get the score function used to score each step in the trajectory. More...
 
void set_score_function (core::scoring::ScoreFunctionCOP)
 Set the score function used to score each step in the trajectory. More...
 
long get_timer () const
 Return how long the trajectory has been running in seconds. More...
 
void reset_timer ()
 Indicate that the trajectory is starting now. More...
 

Private Member Functions

Real calc_score (Pose &pose) const
 Return the score of the given pose. More...
 
Real calc_rmsd_to_native (Pose &pose) const
 Return the heavy-atom backbone RMSD between the given pose and the -in:file:native pose within the given loops. More...
 

Private Attributes

string prefix_
 The prefix that will be used for the scores associated with the pose at the end of the trajectory. More...
 
Pose native_pose_
 The reference structure for RMSD calculations. More...
 
bool have_native_pose_ = false
 Indicate that RMSDs can be calculated because there is a native pose. More...
 
protocols::loops::LoopsCOP loops_ = nullptr
 The region of the protein where an backbone heavy-atom RMSD will be calculated for each step in the trajectory. More...
 
core::scoring::ScoreFunctionCOP scorefxn_ = nullptr
 The score function used to score each step in the trajectory. More...
 
long start_time_ = 0
 The number of seconds since the epoch that had elapsed at the beginning of the trajectory. More...
 

Detailed Description

Log a detailed account of everything that happens in a loop modeling simulation.

Basic usage is to initialize the logger either with one of the constructors or the init() method, then to call the record methods (e.g. record_move()) whenever something of note happens. The record method were written with LoopProtocol and LoopBuilder in mind, so you may have to add some of your own record methods if you want to use this logger with another LoopMover subclass.

Constructor & Destructor Documentation

protocols::loop_modeling::utilities::TrajectoryLogger::TrajectoryLogger ( string const &  prefix = "")

Construct an empty logger.

Use the init() method to give the setup the logger before any of the record methods are called.

References core::import_pose::PDB_file, and core::import_pose::pose_from_file().

protocols::loop_modeling::utilities::TrajectoryLogger::TrajectoryLogger ( LoopMover const *  mover,
string const &  prefix = "" 
)

Construct a logger from a loop mover.

The given loop mover must have both a loops and a score function at the time to constructor is called. If either condition is not met, an exception will be raised.

References init().

protocols::loop_modeling::utilities::TrajectoryLogger::TrajectoryLogger ( protocols::loops::LoopsCOP  loops,
core::scoring::ScoreFunctionCOP  scorefxn,
string const &  prefix = "" 
)

Construct a logger from a score function and a loops object.

Member Function Documentation

Real protocols::loop_modeling::utilities::TrajectoryLogger::calc_rmsd_to_native ( Pose pose) const
private

Return the heavy-atom backbone RMSD between the given pose and the -in:file:native pose within the given loops.

References have_native_pose_, core::scoring::is_protein_backbone(), loops_, native_pose_, core::scoring::rmsd_no_super_subset(), and core::pose::Pose::size().

Referenced by record_endpoint(), record_move(), and record_new_pose().

Real protocols::loop_modeling::utilities::TrajectoryLogger::calc_score ( Pose pose) const
private

Return the score of the given pose.

References scorefxn_.

Referenced by record_endpoint(), record_move(), record_new_pose(), and record_new_score_function().

LoopsCOP protocols::loop_modeling::utilities::TrajectoryLogger::get_loops ( void  ) const

Get the region of the protein where an backbone heavy-atom RMSD will be calculated for each step in the trajectory.

See also
loops_

References loops_.

Pose const & protocols::loop_modeling::utilities::TrajectoryLogger::get_native_pose ( ) const

Get the reference structure for RMSD calculations.

See also
native_pose_

References native_pose_.

string protocols::loop_modeling::utilities::TrajectoryLogger::get_prefix ( ) const

Get the prefix that will be used for the scores associated with the pose at the end of the trajectory.

References prefix_.

ScoreFunctionCOP protocols::loop_modeling::utilities::TrajectoryLogger::get_score_function ( ) const

Get the score function used to score each step in the trajectory.

References scorefxn_.

long protocols::loop_modeling::utilities::TrajectoryLogger::get_timer ( ) const

Return how long the trajectory has been running in seconds.

References start_time_.

Referenced by record_endpoint(), and record_move().

void protocols::loop_modeling::utilities::TrajectoryLogger::init ( LoopMover const *  mover)

Initialize the logger from a loop mover after it has been constructed.

References protocols::loop_modeling::LoopMover::get_tool(), protocols::loop_modeling::ToolboxKeys::LOOPS, and protocols::loop_modeling::ToolboxKeys::SCOREFXN.

Referenced by TrajectoryLogger().

void protocols::loop_modeling::utilities::TrajectoryLogger::init ( protocols::loops::LoopsCOP  loops,
core::scoring::ScoreFunctionCOP  scorefxn 
)

Initialize the logger from a score function and a loops object after it has been constructed.

void protocols::loop_modeling::utilities::TrajectoryLogger::record_endpoint ( basic::Tracer &  tr,
Pose pose 
) const
void protocols::loop_modeling::utilities::TrajectoryLogger::record_move ( basic::Tracer &  tr,
Pose pose,
core::Size const  i,
core::Size const  j,
core::Size const  k,
bool const  proposed,
bool const  accepted 
) const

Record a single Monte Carlo move.

This overload is meant for use in LoopProtocol, which uses three nested for-loops to ramp some score function terms and the temperature at different rates.

Parameters
trThe output stream to record the move to.
poseThe pose on which the last move was made (used for calculating a score and an RMSD).
iThe current "score function" cycle.
jThe current "temperature" cycle.
kThe current "mover" cycle.
proposedWhether or not a move was proposed (i.e. did the loop mover succeed in producing a new conformation).
acceptedWhether or not the last move was accepted (i.e. did it pass the Metropolis criterion).

References calc_rmsd_to_native(), calc_score(), get_timer(), and have_native_pose_.

void protocols::loop_modeling::utilities::TrajectoryLogger::record_move ( basic::Tracer &  tr,
Pose pose,
core::Size const  iteration,
bool const  proposed,
bool const  accepted 
) const

Record a single Monte Carlo move.

This overload is meant for use in LoopBuilder, which generates loop conformation is a single non-nested for-loop.

Parameters
trThe output stream to record the move to.
poseThe pose on which the last move was made (used for calculating a score and an RMSD).
iThe current iteration.
proposedWhether or not a move was proposed (i.e. did the loop mover succeed in producing a new conformation).
acceptedWhether or not the last move was accepted (i.e. did it pass the Metropolis criterion).

References calc_rmsd_to_native(), calc_score(), get_timer(), and have_native_pose_.

void protocols::loop_modeling::utilities::TrajectoryLogger::record_new_pose ( basic::Tracer &  tr,
Pose pose 
) const

Record when a low-scoring pose is recovered.

References calc_rmsd_to_native(), calc_score(), and have_native_pose_.

void protocols::loop_modeling::utilities::TrajectoryLogger::record_new_score_function ( basic::Tracer &  tr,
Pose pose 
) const

Record when a score function term is ramped (and scores change as a result).

References calc_score(), core::scoring::chainbreak, core::scoring::fa_rep, core::scoring::rama, core::scoring::rama2b, and scorefxn_.

void protocols::loop_modeling::utilities::TrajectoryLogger::record_new_temperature ( basic::Tracer &  tr,
Real  temperature 
) const

Record when the temperature is ramped.

void protocols::loop_modeling::utilities::TrajectoryLogger::reset_timer ( )

Indicate that the trajectory is starting now.

The timer is automatically started when the logger is constructed, you only need to call this method if the logger is constructed significantly before the trajectory in question begins.

References start_time_.

void protocols::loop_modeling::utilities::TrajectoryLogger::set_loops ( protocols::loops::LoopsCOP  )

Set the region of the protein where an backbone heavy-atom RMSD will be calculated for each step in the trajectory.

See also
loops_

References loops_.

void protocols::loop_modeling::utilities::TrajectoryLogger::set_native_pose ( Pose const &  pose)

Set the reference structure for RMSD calculations.

See also
native_pose_

References have_native_pose_, and native_pose_.

void protocols::loop_modeling::utilities::TrajectoryLogger::set_prefix ( string  prefix)

Set the prefix that will be used for the scores associated with the pose at the end of the trajectory.

References prefix_.

void protocols::loop_modeling::utilities::TrajectoryLogger::set_score_function ( core::scoring::ScoreFunctionCOP  )

Set the score function used to score each step in the trajectory.

References scorefxn_.

void protocols::loop_modeling::utilities::TrajectoryLogger::unset_native_pose ( )

Disable RMSD calculations.

References have_native_pose_.

Member Data Documentation

bool protocols::loop_modeling::utilities::TrajectoryLogger::have_native_pose_ = false
private

Indicate that RMSDs can be calculated because there is a native pose.

Referenced by calc_rmsd_to_native(), record_endpoint(), record_move(), record_new_pose(), set_native_pose(), and unset_native_pose().

protocols::loops::LoopsCOP protocols::loop_modeling::utilities::TrajectoryLogger::loops_ = nullptr
private

The region of the protein where an backbone heavy-atom RMSD will be calculated for each step in the trajectory.

The RMSD is calculated relative to the -in:file:native structure. If that option was not specified, no RMSD will be calculated.

Referenced by calc_rmsd_to_native(), get_loops(), and set_loops().

Pose protocols::loop_modeling::utilities::TrajectoryLogger::native_pose_
private

The reference structure for RMSD calculations.

This structure is typically initialized from -in:file:native in the constructor. Reading a pose in from a file is fairly expensive, and we want to calculate RMSDs after every iteration, so it's important that this initialization only happen once.

Referenced by calc_rmsd_to_native(), get_native_pose(), record_endpoint(), and set_native_pose().

string protocols::loop_modeling::utilities::TrajectoryLogger::prefix_
private

The prefix that will be used for the scores associated with the pose at the end of the trajectory.

Referenced by get_prefix(), record_endpoint(), and set_prefix().

core::scoring::ScoreFunctionCOP protocols::loop_modeling::utilities::TrajectoryLogger::scorefxn_ = nullptr
private

The score function used to score each step in the trajectory.

Referenced by calc_score(), get_score_function(), record_new_score_function(), and set_score_function().

long protocols::loop_modeling::utilities::TrajectoryLogger::start_time_ = 0
private

The number of seconds since the epoch that had elapsed at the beginning of the trajectory.

Referenced by get_timer(), and reset_timer().


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