Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

colvarbias_meta::hill Class Reference

A hill for the metadynamics bias. More...

#include <colvarbias_meta.h>

List of all members.

Public Member Functions

 hill (cvm::real const &W_in, std::vector< colvar * > &cv, cvm::real const &hill_width, std::string const &replica_in="")
 Runtime constructor: data are read directly from collective variables.
 hill (size_t const &it_in, cvm::real const &W_in, std::vector< colvarvalue > const &centers_in, std::vector< cvm::real > const &widths_in, std::string const &replica_in="")
 General constructor: all data are explicitly passed as arguments (used for instance when reading hills saved on a file).
 hill (colvarbias_meta::hill const &h)
 Copy constructor.
 ~hill ()
 Destructor.
cvm::real energy ()
 Get the energy.
cvm::real energy (cvm::real const &new_weight)
 Get the energy using another hill weight.
cvm::real const & value ()
 Get the current hill value.
void value (cvm::real const &new_value)
 Set the hill value as specified.
cvm::real weight ()
 Get the weight.
void scale (cvm::real const &new_scale_fac)
 Scale the weight with this factor (by default 1.0 is used).
std::vector< colvarvalue > & center ()
 Get the center of the hill.
colvarvaluecenter (size_t const &i)
 Get the i-th component of the center.
std::string output_traj ()
 Represent the hill ina string suitable for a trajectory file.

Public Attributes

size_t it
 Time step at which this hill was added.
std::string replica
 Identity of the replica who added this hill (only in multiple replica simulations).

Protected Attributes

cvm::real hill_value
 Value of the hill function (ranges between 0 and 1).
cvm::real sW
 Scale factor, which could be modified at runtime (default: 1).
cvm::real W
 Maximum height in energy of the hill.
std::vector< colvarvaluecenters
 Center of the hill in the collective variable space.
std::vector< cvm::realwidths
 Widths of the hill in the collective variable space.

Friends

class colvarbias_meta
bool operator< (hill const &h1, hill const &h2)
 Comparison operator.
bool operator<= (hill const &h1, hill const &h2)
 Comparison operator.
bool operator> (hill const &h1, hill const &h2)
 Comparison operator.
bool operator>= (hill const &h1, hill const &h2)
 Comparison operator.
bool operator== (hill const &h1, hill const &h2)
 Comparison operator.
std::ostream & operator<< (std::ostream &os, hill const &h)
 Write the hill to an output stream.


Detailed Description

A hill for the metadynamics bias.

Definition at line 234 of file colvarbias_meta.h.


Constructor & Destructor Documentation

colvarbias_meta::hill::hill cvm::real const &  W_in,
std::vector< colvar * > &  cv,
cvm::real const &  hill_width,
std::string const &  replica_in = ""
[inline]
 

Runtime constructor: data are read directly from collective variables.

Parameters:
weight Weight of the hill
cv Pointer to the array of collective variables involved
replica (optional) Identity of the replica which creates the hill

Definition at line 268 of file colvarbias_meta.h.

References cvm, colvarmodule::debug(), colvarmodule::log(), and colvarmodule::to_str().

00272     : sW (1.0),
00273       W (W_in),
00274       centers (cv.size()),
00275       widths (cv.size()),
00276       it (cvm::it),
00277       replica (replica_in)
00278   {
00279     for (size_t i = 0; i < cv.size(); i++) {
00280       centers[i].type (cv[i]->type());
00281       centers[i] = cv[i]->value();
00282       widths[i] = cv[i]->width * hill_width;
00283     }
00284     if (cvm::debug()) 
00285       cvm::log ("New hill, applied to "+cvm::to_str (cv.size())+
00286                 " collective variables, with centers "+
00287                 cvm::to_str (centers)+", widths "+
00288                 cvm::to_str (widths)+" and weight "+
00289                 cvm::to_str (W)+".\n");
00290   }

colvarbias_meta::hill::hill size_t const &  it_in,
cvm::real const &  W_in,
std::vector< colvarvalue > const &  centers_in,
std::vector< cvm::real > const &  widths_in,
std::string const &  replica_in = ""
[inline]
 

General constructor: all data are explicitly passed as arguments (used for instance when reading hills saved on a file).

Parameters:
it Time step of creation of the hill
weight Weight of the hill
centers Center of the hill
widths Width of the hill around centers
replica (optional) Identity of the replica which creates the hill

Definition at line 298 of file colvarbias_meta.h.

00303     : sW (1.0),
00304       W (W_in),
00305       centers (centers_in),
00306       widths (widths_in),
00307       it (it_in),
00308       replica (replica_in)
00309   {}

colvarbias_meta::hill::hill colvarbias_meta::hill const &  h  )  [inline]
 

Copy constructor.

Definition at line 312 of file colvarbias_meta.h.

00313     : sW (1.0),
00314       W (h.W),
00315       centers (h.centers),
00316       widths (h.widths),
00317       it (h.it),
00318       replica (h.replica)
00319   {}

colvarbias_meta::hill::~hill  )  [inline]
 

Destructor.

Definition at line 322 of file colvarbias_meta.h.

00323   {}


Member Function Documentation

colvarvalue& colvarbias_meta::hill::center size_t const &  i  )  [inline]
 

Get the i-th component of the center.

Definition at line 368 of file colvarbias_meta.h.

00369   {
00370     return centers[i];
00371   }

std::vector<colvarvalue>& colvarbias_meta::hill::center  )  [inline]
 

Get the center of the hill.

Definition at line 362 of file colvarbias_meta.h.

00363   {
00364     return centers;
00365   }

cvm::real colvarbias_meta::hill::energy cvm::real const &  new_weight  )  [inline]
 

Get the energy using another hill weight.

Definition at line 332 of file colvarbias_meta.h.

00333   {
00334     return new_weight * sW * hill_value;
00335   }

cvm::real colvarbias_meta::hill::energy  )  [inline]
 

Get the energy.

Definition at line 326 of file colvarbias_meta.h.

00327   {
00328     return W * sW * hill_value;
00329   }

std::string colvarbias_meta::hill::output_traj  ) 
 

Represent the hill ina string suitable for a trajectory file.

Definition at line 1612 of file colvarbias_meta.C.

References centers, it, W, and widths.

01613 {
01614   std::ostringstream os;
01615   os.setf (std::ios::fixed, std::ios::floatfield);
01616   os << std::setw (cvm::it_width) << it << " ";
01617 
01618   os.setf (std::ios::scientific, std::ios::floatfield);
01619 
01620   os << "  ";
01621   for (size_t i = 0; i < centers.size(); i++) {
01622     os << " ";
01623     os << std::setprecision (cvm::cv_prec)
01624        << std::setw (cvm::cv_width)  << centers[i];
01625   }
01626 
01627   os << "  ";
01628   for (size_t i = 0; i < widths.size(); i++) {
01629     os << " ";
01630     os << std::setprecision (cvm::cv_prec)
01631        << std::setw (cvm::cv_width) << widths[i];
01632   }
01633 
01634   os << "  ";
01635   os << std::setprecision (cvm::en_prec)
01636      << std::setw (cvm::en_width) << W << "\n";
01637 
01638   return os.str();
01639 }  

void colvarbias_meta::hill::scale cvm::real const &  new_scale_fac  )  [inline]
 

Scale the weight with this factor (by default 1.0 is used).

Definition at line 356 of file colvarbias_meta.h.

00357   {
00358     sW = new_scale_fac;
00359   }

void colvarbias_meta::hill::value cvm::real const &  new_value  )  [inline]
 

Set the hill value as specified.

Definition at line 344 of file colvarbias_meta.h.

00345   {
00346     hill_value = new_value;
00347   }

cvm::real const& colvarbias_meta::hill::value  )  [inline]
 

Get the current hill value.

Definition at line 338 of file colvarbias_meta.h.

00339   {
00340     return hill_value;
00341   }

cvm::real colvarbias_meta::hill::weight  )  [inline]
 

Get the weight.

Definition at line 350 of file colvarbias_meta.h.

00351   {
00352     return W * sW;
00353   }


Friends And Related Function Documentation

friend class colvarbias_meta [friend]
 

Definition at line 255 of file colvarbias_meta.h.

bool operator< hill const &  h1,
hill const &  h2
[friend]
 

Comparison operator.

Definition at line 374 of file colvarbias_meta.h.

00375   {
00376     if (h1.it < h2.it) return true;
00377     else return false;
00378   }

std::ostream& operator<< std::ostream &  os,
colvarbias_meta::hill const &  h
[friend]
 

Write the hill to an output stream.

Definition at line 1642 of file colvarbias_meta.C.

01643 {
01644   os.setf (std::ios::scientific, std::ios::floatfield);
01645 
01646   os << "hill {\n";
01647   os << "  step " << std::setw (cvm::it_width) << h.it << "\n";
01648   os << "  weight   "
01649      << std::setprecision (cvm::en_prec)
01650      << std::setw (cvm::en_width)
01651      << h.W << "\n";
01652 
01653   if (h.replica.size())
01654     os << "  replicaID  " << h.replica << "\n";
01655 
01656   os << "  centers ";
01657   for (size_t i = 0; i < (h.centers).size(); i++) {
01658     os << " "
01659        << std::setprecision (cvm::cv_prec)
01660        << std::setw (cvm::cv_width)
01661        << h.centers[i];
01662   }
01663   os << "\n";
01664 
01665   os << "  widths  ";
01666   for (size_t i = 0; i < (h.widths).size(); i++) {
01667     os << " "
01668        << std::setprecision (cvm::cv_prec)
01669        << std::setw (cvm::cv_width)
01670        << h.widths[i];
01671   }
01672   os << "\n";
01673 
01674   os << "}\n";
01675 
01676   return os;
01677 }

bool operator<= hill const &  h1,
hill const &  h2
[friend]
 

Comparison operator.

Definition at line 381 of file colvarbias_meta.h.

00382   {
00383     if (h1.it <= h2.it) return true;
00384     else return false;
00385   }

bool operator== hill const &  h1,
hill const &  h2
[friend]
 

Comparison operator.

Definition at line 402 of file colvarbias_meta.h.

00403   {
00404     if ( (h1.it >= h2.it) && (h1.replica == h2.replica) ) return true;
00405     else return false;
00406   }

bool operator> hill const &  h1,
hill const &  h2
[friend]
 

Comparison operator.

Definition at line 388 of file colvarbias_meta.h.

00389   {
00390     if (h1.it > h2.it) return true;
00391     else return false;
00392   }

bool operator>= hill const &  h1,
hill const &  h2
[friend]
 

Comparison operator.

Definition at line 395 of file colvarbias_meta.h.

00396   {
00397     if (h1.it >= h2.it) return true;
00398     else return false;
00399   }


Member Data Documentation

std::vector<colvarvalue> colvarbias_meta::hill::centers [protected]
 

Center of the hill in the collective variable space.

Definition at line 248 of file colvarbias_meta.h.

Referenced by colvarbias_meta::create_hill(), operator<<(), and output_traj().

cvm::real colvarbias_meta::hill::hill_value [protected]
 

Value of the hill function (ranges between 0 and 1).

Definition at line 239 of file colvarbias_meta.h.

size_t colvarbias_meta::hill::it
 

Time step at which this hill was added.

Definition at line 258 of file colvarbias_meta.h.

Referenced by operator<<(), and output_traj().

std::string colvarbias_meta::hill::replica
 

Identity of the replica who added this hill (only in multiple replica simulations).

Definition at line 261 of file colvarbias_meta.h.

Referenced by operator<<().

cvm::real colvarbias_meta::hill::sW [protected]
 

Scale factor, which could be modified at runtime (default: 1).

Definition at line 242 of file colvarbias_meta.h.

cvm::real colvarbias_meta::hill::W [protected]
 

Maximum height in energy of the hill.

Definition at line 245 of file colvarbias_meta.h.

Referenced by operator<<(), and output_traj().

std::vector<cvm::real> colvarbias_meta::hill::widths [protected]
 

Widths of the hill in the collective variable space.

Definition at line 251 of file colvarbias_meta.h.

Referenced by operator<<(), and output_traj().


The documentation for this class was generated from the following files:
Generated on Fri May 25 04:07:20 2012 for NAMD by  doxygen 1.3.9.1