eABF2D Class Reference

#include <eabf2D.h>

Inheritance diagram for eABF2D:

eABF List of all members.

Public Member Functions

 eABF2D (const double _lowerboundary, const double _upperboundary, const double _width, const double _krestr, const double _lowerboundary2, const double _upperboundary2, const double _width2, const double _krestr2, const std::string &_outputfile, const int _outputfreq, const bool _restart, const std::string &_inputfile, const bool _outputgrad, const int _gradfreq, const double _temperature)
virtual ~eABF2D ()
bool update (const std::string &)

Detailed Description

Definition at line 23 of file eabf2D.h.


Constructor & Destructor Documentation

eABF2D::eABF2D ( const double  _lowerboundary,
const double  _upperboundary,
const double  _width,
const double  _krestr,
const double  _lowerboundary2,
const double  _upperboundary2,
const double  _width2,
const double  _krestr2,
const std::string &  _outputfile,
const int  _outputfreq,
const bool  _restart,
const std::string &  _inputfile,
const bool  _outputgrad,
const int  _gradfreq,
const double  _temperature 
)

Definition at line 28 of file eabf2D.C.

References eABF::krestr, eABF::lowerboundary, eABF::restart, eABF::upperboundary, and eABF::width.

00042                                    :
00043         eABF(_outputfile, _outputfreq, _restart, _inputfile, _outputgrad, _gradfreq, _temperature)
00044 {
00045         lowerboundary.push_back(_lowerboundary);
00046         lowerboundary.push_back(_lowerboundary2);
00047         upperboundary.push_back(_upperboundary);
00048         upperboundary.push_back(_upperboundary2);
00049         width.push_back(_width);
00050         width.push_back(_width2);
00051         krestr.push_back(_krestr);
00052         krestr.push_back(_krestr2);
00053         this->initialize();
00054         this->restart = _restart;
00055     if(restart == true)
00056         this->readfile();
00057 }

virtual eABF2D::~eABF2D (  )  [inline, virtual]

Definition at line 43 of file eabf2D.h.

References eABF::bins.

00044     {
00045                 for (int i = 0; i < bins[0] * bins[0]; i++)
00046                         delete[] countall[i];
00047                 delete[] countall;
00048     }


Member Function Documentation

bool eABF2D::update ( const std::string &   )  [virtual]

Implements eABF.

Definition at line 92 of file eabf2D.C.

References eabffunc::chartodouble(), eabffunc::chartoint(), eABF::col, eABF::gradfreq, eABF::line, eABF::min, eABF::outputfreq, eABF::outputgrad, eabffunc::split(), and eABF::width.

00093 {
00094     // this is the string obtained from colvar each step
00095     // the format of this string is the same as those in colvar.traj file
00096 
00097         std::vector<std::string> data;
00098         eabffunc::split(colvarstring, data);
00099 
00100     int step;
00101 
00102     double abf_force;
00103     double eabf_force;
00104     double abf_force2;
00105     double eabf_force2;
00106 
00107         step = eabffunc::chartoint(data[0]);
00108         abf_force = eabffunc::chartodouble(data[col[0]]);
00109         eabf_force = eabffunc::chartodouble(data[col[1]]);
00110         abf_force2 = eabffunc::chartodouble(data[col[2]]);
00111         eabf_force2 = eabffunc::chartodouble(data[col[3]]);
00112 
00113 
00114         if (abf_force > 150 && eabf_force < -150)
00115                 eabf_force += 360;
00116         else if (abf_force < -150 && eabf_force > 150)
00117                 eabf_force -= 360;
00118 
00119         if (abf_force2 > 150 && eabf_force2 < -150)
00120                 eabf_force2 += 360;
00121         else if (abf_force2 < -150 && eabf_force2 > 150)
00122         eabf_force2 -= 360;
00123 
00124         int binx = int(floor(abf_force / width[0])) - min[0];
00125         int biny = int(floor(eabf_force / width[0])) - min[0];
00126         int binx2 = int(floor(abf_force2 / width[1])) - min[1];
00127         int biny2 = int(floor(eabf_force2 / width[1])) - min[1];
00128 
00129         if (step%outputfreq == 0)
00130     {
00131         writefile();
00132     }
00133 
00134         if (outputgrad == true && (step%gradfreq) == 0)
00135     {
00136         calpmf();
00137     }
00138 
00139 
00140         if (binx < 0 || binx >= bins[0] || biny < 0 || biny >= bins[0] || binx2 < 0 || binx2 >= bins[1] || biny2 < 0 || biny2 >= bins[1])
00141                 return false;
00142     else
00143     {
00144         // distribution
00145                 countall[binx*bins[0] + biny][binx2*bins[1] + biny2]++;
00146 
00147         // if this is the first time add "countall", then the line in outputfile will increase
00148                 if (countall[binx*bins[0] + biny][binx2*bins[1] + biny2] == 1)
00149                         line++;
00150         county[biny][biny2]++;
00151     }
00152 
00153     sumx1[biny][biny2] += abf_force;
00154     sumx21[biny][biny2] += abf_force * abf_force;
00155     sumx2[biny][biny2] += abf_force2;
00156         sumx22[biny][biny2] += abf_force2 * abf_force2;
00157 
00158 
00159     // TODO: add convergence judgement
00160     return true;
00161 }


The documentation for this class was generated from the following files:
Generated on Sat Sep 23 01:17:19 2017 for NAMD by  doxygen 1.4.7