Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | 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 235 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 269 of file colvarbias_meta.h.

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

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

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 299 of file colvarbias_meta.h.

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

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

Copy constructor.

Definition at line 313 of file colvarbias_meta.h.

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

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

Destructor.

Definition at line 323 of file colvarbias_meta.h.

00324   {}


Member Function Documentation

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

Get the i-th component of the center.

Definition at line 369 of file colvarbias_meta.h.

00370   {
00371     return centers[i];
00372   }

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

Get the center of the hill.

Definition at line 363 of file colvarbias_meta.h.

00364   {
00365     return centers;
00366   }

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

Get the energy using another hill weight.

Definition at line 333 of file colvarbias_meta.h.

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

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

Get the energy.

Definition at line 327 of file colvarbias_meta.h.

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

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

Represent the hill ina string suitable for a trajectory file.

Definition at line 1648 of file colvarbias_meta.C.

References centers, it, W, and widths.

01649 {
01650   std::ostringstream os;
01651   os.setf (std::ios::fixed, std::ios::floatfield);
01652   os << std::setw (cvm::it_width) << it << " ";
01653 
01654   os.setf (std::ios::scientific, std::ios::floatfield);
01655 
01656   os << "  ";
01657   for (size_t i = 0; i < centers.size(); i++) {
01658     os << " ";
01659     os << std::setprecision (cvm::cv_prec)
01660        << std::setw (cvm::cv_width)  << centers[i];
01661   }
01662 
01663   os << "  ";
01664   for (size_t i = 0; i < widths.size(); i++) {
01665     os << " ";
01666     os << std::setprecision (cvm::cv_prec)
01667        << std::setw (cvm::cv_width) << widths[i];
01668   }
01669 
01670   os << "  ";
01671   os << std::setprecision (cvm::en_prec)
01672      << std::setw (cvm::en_width) << W << "\n";
01673 
01674   return os.str();
01675 }  

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 357 of file colvarbias_meta.h.

00358   {
00359     sW = new_scale_fac;
00360   }

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

Set the hill value as specified.

Definition at line 345 of file colvarbias_meta.h.

00346   {
00347     hill_value = new_value;
00348   }

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

Get the current hill value.

Definition at line 339 of file colvarbias_meta.h.

00340   {
00341     return hill_value;
00342   }

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

Get the weight.

Definition at line 351 of file colvarbias_meta.h.

00352   {
00353     return W * sW;
00354   }


Friends And Related Function Documentation

friend class colvarbias_meta [friend]
 

Definition at line 256 of file colvarbias_meta.h.

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

Comparison operator.

Definition at line 375 of file colvarbias_meta.h.

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

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

Write the hill to an output stream.

Definition at line 1678 of file colvarbias_meta.C.

01679 {
01680   os.setf (std::ios::scientific, std::ios::floatfield);
01681 
01682   os << "hill {\n";
01683   os << "  step " << std::setw (cvm::it_width) << h.it << "\n";
01684   os << "  weight   "
01685      << std::setprecision (cvm::en_prec)
01686      << std::setw (cvm::en_width)
01687      << h.W << "\n";
01688 
01689   if (h.replica.size())
01690     os << "  replicaID  " << h.replica << "\n";
01691 
01692   os << "  centers ";
01693   for (size_t i = 0; i < (h.centers).size(); i++) {
01694     os << " "
01695        << std::setprecision (cvm::cv_prec)
01696        << std::setw (cvm::cv_width)
01697        << h.centers[i];
01698   }
01699   os << "\n";
01700 
01701   os << "  widths  ";
01702   for (size_t i = 0; i < (h.widths).size(); i++) {
01703     os << " "
01704        << std::setprecision (cvm::cv_prec)
01705        << std::setw (cvm::cv_width)
01706        << h.widths[i];
01707   }
01708   os << "\n";
01709 
01710   os << "}\n";
01711 
01712   return os;
01713 }

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

Comparison operator.

Definition at line 382 of file colvarbias_meta.h.

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

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

Comparison operator.

Definition at line 403 of file colvarbias_meta.h.

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

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

Comparison operator.

Definition at line 389 of file colvarbias_meta.h.

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

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

Comparison operator.

Definition at line 396 of file colvarbias_meta.h.

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


Member Data Documentation

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

Center of the hill in the collective variable space.

Definition at line 249 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 240 of file colvarbias_meta.h.

size_t colvarbias_meta::hill::it
 

Time step at which this hill was added.

Definition at line 259 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 262 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 243 of file colvarbias_meta.h.

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

Maximum height in energy of the hill.

Definition at line 246 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 252 of file colvarbias_meta.h.

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


The documentation for this class was generated from the following files:
Generated on Sun May 19 04:07:51 2013 for NAMD by  doxygen 1.3.9.1