88 keys.
add(
"compulsory",
"LOWER",
"the lower boundary for this particular bin");
89 keys.
add(
"compulsory",
"UPPER",
"the upper boundary for this particular bin");
90 keys.
add(
"compulsory",
"SMEAR",
"0.5",
"the ammount to smear the Gaussian for each value in the distribution");
103 inv_max_minus_min(0.0)
108 std::ostringstream ostr;
109 ostr<<
"betweeen "<<
lowb<<
" and "<<
highb<<
" width of gaussian window equals "<<
width;
114 if( dd.size()!=0 && params.find(dd)==std::string::npos)
return;
116 plumed_massert(data.size()>=1,
"There is no input for this keyword");
118 std::string name=data[0];
120 unsigned nbins; std::vector<double>
range(2); std::string smear;
122 plumed_massert(found_nb,
"Number of bins in histogram not found");
124 plumed_massert(found_r,
"Lower bound for histogram not specified");
126 plumed_massert(found_r,
"Upper bound for histogram not specified");
127 plumed_massert(range[0]<range[1],
"Range specification is dubious");
131 std::string lb,ub;
double delr = ( range[1]-range[0] ) / static_cast<double>( nbins );
132 for(
unsigned i=0;i<nbins;++i){
135 bins.push_back( name +
" " + dd +
"LOWER=" + lb +
" " + dd +
"UPPER=" + ub +
" " + dd +
"SMEAR=" + smear );
137 plumed_assert(bins.size()==nbins);
141 if( dd.size()!=0 && params.find(dd)==std::string::npos)
return;
143 if(data.size()<1) errormsg=
"No input has been specified";
145 std::string name=data[0];
148 else plumed_merror(
"cannot understand kernel type " + name );
152 if( !found_r ) errormsg=
"Lower bound has not been specified use LOWER";
154 if( !found_r ) errormsg=
"Upper bound has not been specified use UPPER";
155 if(
lowb>=
highb ) errormsg=
"Lower bound is higher than upper bound";
168 else plumed_merror(
"cannot understand kernel type " + ktype );
172 const double pi=3.141592653589793238462643383279502884197169399375105820974944592307;
174 double lowB, upperB, f;
178 df = ( exp( -lowB*lowB ) - exp( -upperB*upperB ) ) / ( sqrt(2*pi)*
width );
179 f = 0.5*( erf( upperB ) - erf( lowB ) );
184 if( fabs(lowB)<1. ) df = 1 - fabs(lowB) /
width;
185 if( fabs(upperB)<1. ) df -= fabs(upperB) /
width;
186 if (upperB<=-1. || lowB >=1.){
190 if( lowB>-1.0 ){ ia=lowB; }
else{ ia=-1.0; }
191 if( upperB<1.0 ){ ib=upperB; }
else{ ib=1.0; }
192 f = (ib*(2.-fabs(ib))-ia*(2.-fabs(ia)))*0.5;
195 plumed_merror(
"function type does not exist");
void setKernelType(const std::string &ktype)
enum PLMD::HistogramBead::@3 periodicity
static void registerKeywords(Keywords &keys)
void add(const std::string &t, const std::string &k, const std::string &d)
Add a new keyword of type t with name k and description d.
static void generateBins(const std::string ¶ms, const std::string &dd, std::vector< std::string > &bins)
This class holds the keywords and their documentation.
std::string description() const
enum PLMD::HistogramBead::@2 type
void set(const std::string ¶ms, const std::string &dd, std::string &errormsg)
const double pi(3.141592653589793238462643383279502884197169399375105820974944592307)
PI.
double calculate(double x, double &df) const
double difference(const double &d1, const double &d2) const