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

An observable is in principle anything that is named and has a value. More...

#include <Observable.hh>

Inheritance diagram for prf::Observable:
Inheritance graph

Public Member Functions

void set (std::string cmd)
 Give the object an instruction to process during initialization.
virtual int init_obs ()
 All observables must implement one initialize routine.
virtual void refresh ()
 Necessary before an observable value is used.
virtual double evaluate ()
 Actual calculation of the value of the observable.
virtual double delta (Update *u)
 Quick estimate of the change in an Observable due to an update.
virtual void rangeEstimate (double &x1, double &x2)
 Estimate a range in which values of this observable are expected.
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

Common interface for a variety of "observables". In PROFASI, an Observable is simply anything that has a name and a value. All kinds of energies, RMSD, secondary structure content ... may fall in this category. While the method by which each individual observable is calculated may vary, as well as its role in the program as a whole, for an outside analysis, such details often don't matter. So, it is often desired to make an array of observables and do one common operation on them. This would not be possible if, for instance, Energy and ProteinRMSD were incompatible types. But since both inherit from this observable class, they are compatible classes as far as the properties defined here are concerned. If you wish to implement a new observable and use it like other Observables of PROFASI, just inherit from this class, and make sure you implement a refresh() function. The refresh function should calculate the value and assign it to a member variable called obsval. Sometimes, the value would be calculated in some other context. But nevertheless, it is necessary to implement this refresh function, even if all it does is to assign the already calculated value to obsval.

Member Function Documentation

double Observable::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 in prf::Energy.

int Observable::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 in prf::Energy, prf::ProteinRMSD, ContactOrder, prf::ContactMap, prf::RCBin, prf::PeriodicObs, prf::OligoOrient, prf::NativenessQ, prf::AtomDistance, prf::RCAngleRMSD, and prf::Rg.

void Observable::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 in prf::HBMS, prf::HBMM, prf::ProteinRMSD, prf::Energy, prf::Chi, prf::ContactMap, prf::OligoOrient, ContactOrder, prf::RC_psi, prf::RCBin, prf::DistanceRestraints, prf::PeriodicObs, prf::RCAngleRMSD, prf::ExVol, prf::ObsEnergy, prf::LocExVol, prf::ChargedSCInteraction, prf::Hydrophobicity, prf::TorsionTerm, prf::Bias, prf::AtomDistance, prf::Rg, prf::RC_phi, and prf::DihedralRestraints.

void Observable::refresh ( )

This is done because complex observables like RMSD are not evaluated at every step. A call to refresh() would make sure that the Observable has its most current value. The optional argument tindx was introduced in version 1.1 when management of histograms was relocated from ObsHandler class to the Observable class. The argument tells the Observable object about a "temperature index" which it can use to put the current data in the appropriate histogram block.

Reimplemented in prf::Energy.

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