19#include <boost/lexical_cast.hpp>
30 double min,
double max)
54 rbreak_ = Eigen::VectorXd::Zero(nknots);
56 for (
Index i = 0; i < nknots; i++) {
74 throw std::runtime_error(
75 "In potential " +
name_ +
76 ": no parameters to optimize!\n"
77 "All the knot values fall in the range of either excluded (due to high "
78 "repulsive region) or cut-off region.\n"
79 "This issue can be resolved by one or combination of following steps:\n"
80 "1. Make sure you are using large-enough cut-off for this CG "
82 "2. Make sure the CG-MD runs are sufficiently Index and CG-MD RDF are "
83 "statistically reliable.\n"
84 "3. Use more knot values.\n");
87 M_ = Eigen::MatrixXd::Zero(4, 4);
115 param.
Load(filename);
120 throw std::runtime_error(
"In potential " +
name_ +
121 ": parameters size mismatch!\n"
122 "Check input parameter file \"" +
123 filename +
"\" \nThere should be " +
124 boost::lexical_cast<string>(
lam_.size()) +
129 lam_.head(nonzero) = param.
y().head(nonzero);
152 param.
Save(filename);
156 double rmin,
double rcut) {
178 cout <<
name_ <<
" potential's extrapolated core is attractive!" << endl;
179 cout <<
"Artifically enforcing repulsive core.\n" << endl;
189 double b = -1.0 * m * r0 + u0;
211 double rk = (double)indx *
dr_;
212 double t = (r - rk) /
dr_;
214 Eigen::Vector4d R = Eigen::Vector4d::Zero();
219 Eigen::Vector4d B =
lam_.segment<4>(indx);
220 u += ((R.transpose() *
M_) * B).value();
240 rk = (double)indx *
dr_;
242 if (i_opt >= indx && i_opt <= indx + 3) {
244 Eigen::Vector4d R = Eigen::Vector4d::Zero();
246 double t = (r - rk) /
dr_;
253 Eigen::Vector4d RM = R.transpose() *
M_;
255 return RM(i_opt - indx);
void SaveParam(const std::string &filename) override
double getOptParam(const Index i) const override
double CalculateDF(const Index i, const double r) const override
double CalculateF(const double r) const override
PotentialFunctionCBSPL(const std::string &name, const Index nlam, const double min=0.0, const double max=10.0)
void SavePotTab(const std::string &filename, const double step) override
double CalculateD2F(const Index i, const Index j, const double r) const override
void setOptParam(const Index i, const double val) override
Index getOptParamSize() const override
void setParam(std::string filename) override
virtual void SavePotTab(const std::string &filename, double step)
base class for all analysis tools