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

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

00286     : sW (1.0),
00287       W (W_in),
00288       centers (cv.size()),
00289       widths (cv.size()),
00290       it (cvm::it),
00291       replica (replica_in)
00292   {
00293     for (size_t i = 0; i < cv.size(); i++) {
00294       centers[i].type (cv[i]->type());
00295       centers[i] = cv[i]->value();
00296       widths[i] = cv[i]->width * hill_width;
00297     }
00298     if (cvm::debug()) 
00299       cvm::log ("New hill, applied to "+cvm::to_str (cv.size())+
00300                 " collective variables, with reference values "+
00301                 cvm::to_str (centers)+", widths "+
00302                 cvm::to_str (widths)+" and weight "+
00303                 cvm::to_str (W)+".\n");
00304   }

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

00317     : sW (1.0),
00318       W (W_in),
00319       centers (centers_in),
00320       widths (widths_in),
00321       it (it_in),
00322       replica (replica_in)
00323   {}

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

Copy constructor.

Definition at line 326 of file colvarbias_meta.h.

00327     : sW (1.0),
00328       W (h.W),
00329       centers (h.centers),
00330       widths (h.widths),
00331       it (h.it),
00332       replica (h.replica)
00333   {}

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

Destructor.

Definition at line 336 of file colvarbias_meta.h.

00337   {}


Member Function Documentation

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

Get the i-th component of the center.

Definition at line 382 of file colvarbias_meta.h.

00383   {
00384     return centers[i];
00385   }

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

Get the center of the hill.

Definition at line 376 of file colvarbias_meta.h.

00377   {
00378     return centers;
00379   }

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

Get the energy using another hill weight.

Definition at line 346 of file colvarbias_meta.h.

00347   {
00348     return new_weight * sW * hill_value;
00349   }

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

Get the energy.

Definition at line 340 of file colvarbias_meta.h.

00341   {
00342     return W * sW * hill_value;
00343   }

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

Represent the hill ina string suitable for a trajectory file.

Definition at line 1047 of file colvarbias_meta.C.

References centers, it, W, and widths.

01048 {
01049   std::ostringstream os;
01050   os.setf (std::ios::fixed, std::ios::floatfield);
01051   os << std::setw (cvm::it_width) << it << " ";
01052 
01053   os.setf (std::ios::scientific, std::ios::floatfield);
01054 
01055   os << "  ";
01056   for (size_t i = 0; i < centers.size(); i++) {
01057     os << " ";
01058     os << std::setprecision (cvm::cv_prec)
01059        << std::setw (cvm::cv_width)  << centers[i];
01060   }
01061 
01062   os << "  ";
01063   for (size_t i = 0; i < widths.size(); i++) {
01064     os << " ";
01065     os << std::setprecision (cvm::cv_prec)
01066        << std::setw (cvm::cv_width) << widths[i];
01067   }
01068 
01069   os << "  ";
01070   os << std::setprecision (cvm::en_prec)
01071      << std::setw (cvm::en_width) << W << "\n";
01072 
01073   return os.str();
01074 }  

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

00371   {
00372     sW = new_scale_fac;
00373   }

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

Set the hill value as specified.

Definition at line 358 of file colvarbias_meta.h.

00359   {
00360     hill_value = new_value;
00361   }

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

Get the current hill value.

Definition at line 352 of file colvarbias_meta.h.

00353   {
00354     return hill_value;
00355   }

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

Get the weight.

Definition at line 364 of file colvarbias_meta.h.

00365   {
00366     return W * sW;
00367   }


Friends And Related Function Documentation

friend class colvarbias_meta [friend]
 

Definition at line 269 of file colvarbias_meta.h.

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   }

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

Write the hill to an output stream.

Definition at line 1077 of file colvarbias_meta.C.

01078 {
01079   os.setf (std::ios::scientific, std::ios::floatfield);
01080 
01081   os << "hill {\n";
01082   os << "  step " << std::setw (cvm::it_width) << h.it << "\n";
01083   os << "  weight   "
01084      << std::setprecision (cvm::en_prec)
01085      << std::setw (cvm::en_width)
01086      << h.W << "\n";
01087 
01088   if (h.replica.size())
01089     os << "  replica   " << h.replica << "\n";
01090 
01091   os << "  centers ";
01092   for (size_t i = 0; i < (h.centers).size(); i++) {
01093     os << " "
01094        << std::setprecision (cvm::cv_prec)
01095        << std::setw (cvm::cv_width)
01096        << h.centers[i];
01097   }
01098   os << "\n";
01099 
01100   os << "  widths  ";
01101   for (size_t i = 0; i < (h.widths).size(); i++) {
01102     os << " "
01103        << std::setprecision (cvm::cv_prec)
01104        << std::setw (cvm::cv_width)
01105        << h.widths[i];
01106   }
01107   os << "\n";
01108 
01109   os << "}\n";
01110 
01111   return os;
01112 }

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   }

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

Comparison operator.

Definition at line 416 of file colvarbias_meta.h.

00417   {
00418     if ( (h1.it >= h2.it) && (h1.replica == h2.replica) ) return true;
00419     else return false;
00420   }

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) return true;
00405     else return false;
00406   }

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

Comparison operator.

Definition at line 409 of file colvarbias_meta.h.

00410   {
00411     if (h1.it >= h2.it) return true;
00412     else return false;
00413   }


Member Data Documentation

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

Center of the hill in the collective variable space.

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

size_t colvarbias_meta::hill::it
 

Time step at which this hill was added.

Definition at line 272 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 275 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 256 of file colvarbias_meta.h.

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

Maximum height in energy of the hill.

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

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


The documentation for this class was generated from the following files:
Generated on Mon Nov 23 04:59:33 2009 for NAMD by  doxygen 1.3.9.1