eabf.h

Go to the documentation of this file.
00001 //
00002 // The extended adaptive biasing force method has been contributed to NAMD by the following authors:
00003 //
00004 //    Haohao Fu and Christophe Chipot
00005 //    Laboratoire International Associ\'e
00006 //    Centre National de la Recherche Scientifique et University of Illinois at Urbana--Champaign
00007 //    Unit\'e Mixte de Recherche No. 7565, Universit\'e de Lorraine
00008 //    B.P. 70239, 54506 Vand\oe uvre-lès-Nancy cedex, France
00009 //
00010 // Copyright 2016, Centre National de la Recherche Scientifique
00011 //
00012 
00013 #ifndef EABF_H
00014 #define EABF_H
00015 
00016 #include <iostream>
00017 #include <string>
00018 #include <sstream>
00019 #include <vector>
00020 class ofstream_namd;
00021 
00022 class eABF
00023 {
00024 public:
00025         eABF() {}
00026         eABF(const std::string& _outputfile,
00027                 const int _outputfreq,
00028                 const bool _restart, const std::string& _inputfile,
00029                 const bool _outputgrad, const int _gradfreq, const double _temperature):
00030                 outputfile(_outputfile), outputfreq(_outputfreq), restart(_restart), inputfile(_inputfile),
00031                 outputgrad(_outputgrad), gradfreq(_gradfreq), temperature(_temperature)
00032         {}
00033         virtual ~eABF() {}
00034 
00035         // called by colvar each step, update the sampling point
00036         virtual bool update(const std::string&) = 0;
00037 
00038         // merge another file, used when reading another file
00039         bool mergefile(const std::string& inputname, const std::string& outputname)
00040         {
00041                 this->inputfile = inputname;
00042                 this->readfile();
00043                 std::string temp = this->outputfile;
00044                 this->outputfile = outputname;
00045                 this->writefile();
00046                 this->calpmf();
00047                 this->outputfile = temp;
00048                 return true;
00049         }
00050 
00051         // which coloum in the string provided by colvar is used
00052     bool setcolumn(std::vector<int> col)
00053         {
00054                 this->col = col;
00055                 return true;
00056         }
00057 
00058 protected:
00059         // the colvar setting
00061         std::vector<double> lowerboundary;
00062         std::vector<double> upperboundary;
00063         std::vector<double> width;
00065 
00066         // the restart (output) file generated by parseABF
00067         std::string outputfile;
00068 
00069         // the frequency writing a restart file
00070         int outputfreq;
00071 
00072         // whether restart
00073         bool restart;
00074 
00075         // the restart input file
00076         std::string inputfile;
00077 
00078         // whether output gradient and pmf
00079         bool outputgrad;
00080 
00081         // the frequency writing grad and pmf file
00082         int gradfreq;
00083 
00084         // the temperature of simulation
00085         double temperature;
00086 
00087         // internal variables
00089         std::vector<int> max;        // the max index of the RC
00090         std::vector<int> min;        // the min index of the RC
00091         std::vector<int> bins;     // the number of bins
00092 
00093         std::vector<double> krestr; // force constant
00094 
00096         //    need to be defined
00098         // countall; // the distribution of samples, needed for eABF
00099         // sumx; // the sum of x in each bin, needed for eABF
00100         // sumx2; // the sum of x^2, needed for eABF
00101         // county; // the distribution in each bin, needed for eABF
00102         int line; // the number of non-zero countall
00103 
00104         std::vector<int> col;    // the column read by the program
00106 
00107         // initialize the variables
00108         virtual bool initialize() = 0;
00109 
00110         // read variables from a restart file
00111         virtual bool readfile() = 0;
00112 
00113         // write restart file
00114         virtual bool writefile() const = 0;
00115 
00116         // write the head of the pmf file
00117         virtual bool writehead(ofstream_namd&) const = 0;
00118 
00119         // calculate grad and pmf
00120         virtual bool calpmf() const = 0;
00121 
00122 };
00123 
00124 #endif // EABF_H

Generated on Fri Sep 22 01:17:12 2017 for NAMD by  doxygen 1.4.7