PROFASI  Version 1.5
Public Member Functions | List of all members
prf::Energy Class Reference

Energy base class. More...

#include <Energy.hh>

Inheritance diagram for prf::Energy:
Inheritance graph

Public Member Functions

void Connect (Population *pl)
 Connect the energy term with one population.
virtual void set_pars (std::string pars)
 Set some adjustible parameters.
void refresh ()
 Overrides the virtual member from the Observable class.
double value ()
 return result from last calculation
double deltaE ()
 return result from the last energy change calculation
virtual double evaluate ()
virtual double deltaE (Update *)
 do a new delta calculation optimized for the given kind of update
double delta (Update *)
 Quick estimate of the change in an Observable due to an update.
virtual double deltaEwithlimit (Update *updt, double maxde)
 Calculate energy change for an update, but with a stop condition.
virtual void Accept (Update *)
 Accept a proposed update.
virtual void Revert (Update *)
 Reject a proposed update.
virtual void rangeEstimate (double &x1, double &x2)
 Estimate a range in which values of this observable are expected.
int init_obs ()
 All observables must implement one initialize routine.
- Public Member Functions inherited from prf::Observable
void set (std::string cmd)
 Give the object an instruction to process during initialization.
double operator() ()
 Retrieve the value of the observable.
double Value ()
 Retrieve the value of the observable.
void disable_stats ()
 Stop collecting statistical data like averages and histograms.
void enable_stats ()
 Start collecting statistical data like averages and histograms.
- Public Member Functions inherited from prf::Named
 Named ()
 Create an object with name "unnamed".
 Named (const char *st)
 Create an object with name st given as a C string.
 Named (std::string st)
 Create an object with a name given as a string.
std::string Name () const
 Retrive the name of an object.
void Name (std::string gnm)
 Assign a new name to an object.

Detailed Description

The Energy base class declares an interface for different energy terms which can be used, for instance, to decide whether a certain update is to be accepted. All energy terms in ProFASi are implemented as derived classes of this class.

Member Function Documentation

void prf::Energy::Accept ( Update updt)

PROFASI uses many local contribution matrices and backup variables to quickly evaluate the change caused to any energy term by a given update. Those backup variables and the contribution matrices need to be kept in sync with the current system configuration. So, each energy class has an accept and a reject method, which are called when an update is accepted or rejected. What is done inside these functions depends on the energy term and optimization trick used therein.

Reimplemented in prf::HBMS, prf::HBMM, prf::ExVol, prf::LocExVol, prf::ChargedSCInteraction, prf::Hydrophobicity, and prf::Bias.

double prf::Energy::delta ( Update u)

Estimate how much the value will change due to the a given update. Quite often it is possible to estimate the change in the value of an Observable due to such an MC update at a much smaller computational cost than evaluating the Observable from scratch.

This function assumes that the observable was evaluated at one state of the population, and the update passed as argument was performed on that state of the population. It is also ok if the state of the population is only changed with MC updates and the accept or reject function is called for each accepted or rejected update.

Except for energy classes in ProFASi, the other Observables are not evaluated or kept up to date during an MC sweep. For such variables this delta function only returns something useful immediately after an evaluate call.

Reimplemented from prf::Observable.

double prf::Energy::deltaEwithlimit ( Update updt,
double  maxde 

This function contains one of the interesting speed-up tricks of ProFASi. In Markov chain Monte Carlo simulations, there is an acceptance criterion, which depends, on energy changes, temperature a random number etc. Often, it is possible to calculate everything other than the energy change before proceeding to the energy change calculations. This means, before starting out to find how much the energy changed, we can figure out the maximum acceptable total energy change. We then isolate the most expensive contribution and calculate the regular delta E for all other terms, and subtract from the maximum total acceptable change, and get a value for the maximum allowed value for the last and most expensive term. We pass this value to the delta E calculation of the last term, using this function. Implementation of that energy function is allowed to abort its calculation, if at some point during its calculation, it can determine that there is no way to stay below the given limit. This means, this function is allowed to return any (wrong) value greater than maxde, if the correct value is also greater than maxde with certainty. It is understood that the update will be rejected if a value greater than maxde is returned.

As an example, consider the situation when the most expensive term is positive definite. We start by calculating the contributions of the moved atoms before the update. Then while calculating the contributions of the same atoms after the update, if after 5 of the 2000 terms, the partial sum exceeds a limit, there is no point in calculating the remaining contributions, which can not bring the total change below maxde. This trick makes a noticeable impact on the execution speed.Like deltaE, but stop if change exceeds a given limit

Reimplemented in prf::ExVol.

double prf::Energy::evaluate ( )
int prf::Energy::init_obs ( )

Even if it seems that one particular observable might need additional arguments during initialization, it is advantageous to have a uniform syntax for all of them. So, when additional arguments are needed, one should provide them in a separate function called before initialization, and then call init_obs without arguments. The name init_obs instead of a more natural "init" or "initialize" is because an Observable often inherits from other classes which represent its character more fundamentally. So, the names such as "init" are kept free for such base classes.

Reimplemented from prf::Observable.

void prf::Energy::rangeEstimate ( double &  x1,
double &  x2 

The default is between 0 and 1. So, for observables with values always between 0 and 1, you need not over-write this virtual function. Sometimes the observable will have a different fixed range, determined by its definition. Sometimes the range can not be determined perfectly. In such a case, let this function just return something reasonable.

Reimplemented from prf::Observable.

Reimplemented in prf::HBMS, prf::HBMM, prf::DistanceRestraints, prf::ExVol, prf::ObsEnergy, prf::LocExVol, prf::ChargedSCInteraction, prf::Hydrophobicity, prf::TorsionTerm, prf::Bias, and prf::DihedralRestraints.

void prf::Energy::set_pars ( std::string  pars)

This function provides a unified mechanism to adjust parameters in an energy term. What parameters it might make sense to adjust depends on the energy term. If the energy term is a pseudo-energy implementing RMSD constraints relative to a structure abc.pdb, the name of the structure file should be an easily adjustible parameter rather than a hard coded string. The H–O distance in a hydrogen bond, on the other hand, is less useful as an adjustible parameter. It is up to the individual derived classes to do what they like with the requested parameter changes. The base class ignores the parameter requests.

Reimplemented in prf::DistanceRestraints, prf::ObsEnergy, and prf::DihedralRestraints.

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

PROFASI: Protein Folding and Aggregation Simulator, Version 1.5
© (2005-2016) Anders Irbäck and Sandipan Mohanty
Documentation generated on Mon Jul 18 2016 using Doxygen version 1.8.2