diff --git a/src/analysis/Histogram.cpp b/src/analysis/Histogram.cpp index 48e749bc03cda52d9f115853d3c230bede0c1cbc..16b909bfe670f8803fb568ba8e18e9a0cf26b71a 100644 --- a/src/analysis/Histogram.cpp +++ b/src/analysis/Histogram.cpp @@ -166,7 +166,7 @@ void Histogram::performAnalysis(){ double weight; std::vector<double> point( getNumberOfArguments() ); for(unsigned i=0;i<getNumberOfDataPoints();++i){ getDataPoint( i, point, weight ); - KernelFunctions kernel( point, bw, kerneltype, weight, true); + KernelFunctions kernel( point, bw, kerneltype, false, weight, true); gg->addKernel( kernel ); } diff --git a/src/cltools/SumHills.cpp b/src/cltools/SumHills.cpp index 6e03a55303678dc9bf8f7019046626867b7af982..99f7da2646b4e2c2013a633c54a2a0d88de95c40 100644 --- a/src/cltools/SumHills.cpp +++ b/src/cltools/SumHills.cpp @@ -153,6 +153,36 @@ plumed sum_hills --hills PATHTOMYHILLSFILE --fmt %8.3f where here we chose a float with length of 8 and 3 digits +The output can be named in a arbitrary way : + +\verbatim +plumed sum_hills --hills PATHTOMYHILLSFILE --outfile myfes.dat +\endverbatim + +will produce a file myfes.dat which contains the free energy. + +If you use stride, this keyword is the suffix + +\verbatim +plumed sum_hills --hills PATHTOMYHILLSFILE --outfile myfes_ --stride 100 +\endverbatim + +will produce myfes_0.dat, myfes_1.dat, myfes_2.dat etc. + +The same is true for the output coming from histogram corrections +\verbatim +plumed sum_hills --histo HILLS --kt 2.5 --sigma 0.01 --outhisto mycorrection.dat +\endverbatim + +is producing a file mycorrection.dat +while, when using stride, this is the suffix + +\verbatim +plumed sum_hills --histo HILLS --kt 2.5 --sigma 0.01 --outhisto mycorrection_ --stride 100 +\endverbatim + +that gives mycorrection_0.dat, mycorrection_1.dat, mycorrection_3.dat etc.. + */ //+ENDPLUMEDOC @@ -377,15 +407,22 @@ int CLToolSumHills::main(FILE* in,FILE*out,Communicator& pc){ plumed_massert(parse("--kt",kt),"if you make a dimensionality reduction (--idw) or a histogram (--histo) then you need to define --kt "); } - /* - - different implementation through function - - */ - std::string addme; + actioninput.push_back("FUNCSUMHILLS"); actioninput.push_back("ISCLTOOL"); + + // set names + std::string outfile; + if(parse("--outfile",outfile)){ + actioninput.push_back("btim="+outfile); + } + std::string outhisto; + if(parse("--outhisto",outhisto)){ + actioninput.push_back("OUTHISTO="+outhisto); + } + + addme="ARG="; for(unsigned i=0;i<(ncv-1);i++){ if(cvs[i].size()==1){ diff --git a/src/tools/BiasRepresentation.cpp b/src/tools/BiasRepresentation.cpp index 7d27322341354015926db7cce0b878603587fdde..bdbb47afab7010e4e49d50211b6bfcba36231a3e 100644 --- a/src/tools/BiasRepresentation.cpp +++ b/src/tools/BiasRepresentation.cpp @@ -113,7 +113,7 @@ KernelFunctions* BiasRepresentation::readFromPoint(IFile *ifile){ ifile->scanField(names[i],cc[i]); } double h=1.0; - return new KernelFunctions(cc,histosigma,"gaussian",h,false); + return new KernelFunctions(cc,histosigma,"gaussian",false,h,false); } void BiasRepresentation::pushKernel( IFile *ifile ){ KernelFunctions *kk; diff --git a/src/tools/KernelFunctions.cpp b/src/tools/KernelFunctions.cpp index d1fd90c95aca0e62e35c7cd8ca63dc4bf401d76c..197ddc31c1888172a78bf7cefb73e1cdb9f0a692 100644 --- a/src/tools/KernelFunctions.cpp +++ b/src/tools/KernelFunctions.cpp @@ -85,14 +85,12 @@ the kernels we can use in this method. */ //+ENDPLUMEDOC -KernelFunctions::KernelFunctions( const std::vector<double>& at, const std::vector<double>& sig, const std::string& type, const double& w, const bool& norm ): +KernelFunctions::KernelFunctions( const std::vector<double>& at, const std::vector<double>& sig, const std::string& type, const bool multivariate, const double& w, const bool norm ): center(at), width(sig) { - unsigned ncv=center.size(); - if( width.size()==ncv ) diagonal=true; - else if( width.size()==(ncv*(ncv+1))/2 ) diagonal=false; - else plumed_merror("specified sigma is neither diagonal or full covariance matrix"); + if (multivariate==true)diagonal=false; + if (multivariate==false)diagonal=true; // Setup the kernel type if(type=="GAUSSIAN" || type=="gaussian"){ @@ -105,10 +103,10 @@ width(sig) if( norm ){ double det; + unsigned ncv=ndim(); if(diagonal){ det=1; for(unsigned i=0;i<width.size();++i) det*=width[i]; } else { - unsigned ncv=ndim(); Matrix<double> mymatrix( getMatrix() ), myinv( ncv, ncv ); Invert(mymatrix,myinv); double logd; logdet( myinv, logd ); @@ -233,13 +231,16 @@ double KernelFunctions::evaluate( const std::vector<Value*>& pos, std::vector<do KernelFunctions* KernelFunctions::read( IFile* ifile, const std::vector<std::string>& valnames ){ std::string sss; ifile->scanField("multivariate",sss); std::vector<double> cc( valnames.size() ), sig; + bool multivariate; if( sss=="false" ){ + multivariate=false; sig.resize( valnames.size() ); for(unsigned i=0;i<valnames.size();++i){ ifile->scanField(valnames[i],cc[i]); ifile->scanField("sigma_"+valnames[i],sig[i]); } } else if( sss=="true" ){ + multivariate=true; unsigned ncv=valnames.size(); sig.resize( (ncv*(ncv+1))/2 ); Matrix<double> upper(ncv,ncv), lower(ncv,ncv); @@ -257,7 +258,7 @@ KernelFunctions* KernelFunctions::read( IFile* ifile, const std::vector<std::str plumed_merror("multivariate flag should equal true or false"); } double h; ifile->scanField("height",h); - return new KernelFunctions( cc, sig, "gaussian", h, false ); + return new KernelFunctions( cc, sig, "gaussian", multivariate ,h, false); } } diff --git a/src/tools/KernelFunctions.h b/src/tools/KernelFunctions.h index 78fc5bba5d3889d3a96e62dc121f0d1a8d6dea00..de80735a9decfbd8dfdac2094b2cd1c96e2b4321 100644 --- a/src/tools/KernelFunctions.h +++ b/src/tools/KernelFunctions.h @@ -47,7 +47,7 @@ private: /// Get the cutoff for a kernel double getCutoff( const double& width ) const ; public: - KernelFunctions( const std::vector<double>& at, const std::vector<double>& sig, const std::string& type, const double& w, const bool& norm ); + KernelFunctions( const std::vector<double>& at, const std::vector<double>& sig, const std::string& type, const bool multivariate ,const double& w, const bool norm ); /// Get the dimensionality of the kernel unsigned ndim() const; /// Get the position of the center