votca 2024.1-dev
Loading...
Searching...
No Matches
potentialfunctioncbspl.h
Go to the documentation of this file.
1/*
2 * Copyright 2009-2020 The VOTCA Development Team (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18#ifndef VOTCA_CSG_POTENTIALFUNCTIONCBSPL_H
19#define VOTCA_CSG_POTENTIALFUNCTIONCBSPL_H
20
21#include "potentialfunction.h"
22#include <cmath>
23#include <votca/tools/table.h>
24
25namespace votca {
26namespace csg {
27
29 public:
30 PotentialFunctionCBSPL(const std::string &name, const Index nlam,
31 const double min = 0.0, const double max = 10.0);
32 ~PotentialFunctionCBSPL() override = default;
33 // calculate function value for given r
34 double CalculateF(const double r) const override;
35 // calculate first derivative w.r.t. ith parameter
36 double CalculateDF(const Index i, const double r) const override;
37 // calculate second derivative w.r.t. ith parameter
38 double CalculateD2F(const Index i, const Index j,
39 const double r) const override;
40
41 Index getOptParamSize() const override;
42
43 void setParam(std::string filename) override;
44
45 void SaveParam(const std::string &filename) override;
46
47 void SavePotTab(const std::string &filename, const double step) override;
48
49 void SavePotTab(const std::string &filename, const double step,
50 const double rmin, const double rcut) override;
51 void setOptParam(const Index i, const double val) override;
52
53 double getOptParam(const Index i) const override;
54
55 void extrapolExclParam();
56
57 protected:
58 // exclude these many first coefficients from optimization
59 // since the region relevant to these coefficients is not sampled
60 // the value of nexcl_ is determined from rmin
62 // fix these many coeff near the cut-off to zero to ensure
63 // zero potential and force values near cut-off
65
67 double dr_;
68 Eigen::VectorXd rbreak_;
69
70 // this should not be a 4x4 matrix because of alignment problems
71 // as certain eigen datastructures require alignment modifiers if
72 // stored in std:: datastructures, to avoid making the code more
73 // complicated, we revert back to dynamic sized matrices here.
74 Eigen::MatrixXd M_;
75};
76} // namespace csg
77} // namespace votca
78#endif // VOTCA_CSG_POTENTIALFUNCTIONCBSPL_H
~PotentialFunctionCBSPL() override=default
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
void setParam(std::string filename) override
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26