| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * @file bspline.hpp
|
|---|
| 3 | * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
|
|---|
| 4 | * @date Mon Nov 21 13:27:22 2011
|
|---|
| 5 | *
|
|---|
| 6 | * @brief B-Splines for molecular dynamics.
|
|---|
| 7 | *
|
|---|
| 8 | */
|
|---|
| 9 |
|
|---|
| 10 | #ifndef BSPLINE_HPP_
|
|---|
| 11 | #define BSPLINE_HPP_
|
|---|
| 12 |
|
|---|
| 13 | #include "base/helper.hpp"
|
|---|
| 14 | #include "base/polynomial.hpp"
|
|---|
| 15 | #include "base/vector.hpp"
|
|---|
| 16 |
|
|---|
| 17 | namespace VMG
|
|---|
| 18 | {
|
|---|
| 19 |
|
|---|
| 20 | class BSpline
|
|---|
| 21 | {
|
|---|
| 22 | public:
|
|---|
| 23 | BSpline(const vmg_float& width);
|
|---|
| 24 |
|
|---|
| 25 | vmg_float EvaluateSpline(const vmg_float& val)
|
|---|
| 26 | {
|
|---|
| 27 | for (unsigned int i=0; i<intervals.size(); ++i)
|
|---|
| 28 | if (val < intervals[i])
|
|---|
| 29 | return spline_nom[i](val) / spline_denom[i](val);
|
|---|
| 30 | return 0.0;
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
| 33 | vmg_float EvaluatePotential(const vmg_float& val)
|
|---|
| 34 | {
|
|---|
| 35 | for (unsigned int i=0; i<intervals.size(); ++i)
|
|---|
| 36 | if (val < intervals[i])
|
|---|
| 37 | return potential_nom[i](val) / potential_denom[i](val);
|
|---|
| 38 | return potential_nom.back()(val) / potential_denom.back()(val);
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | vmg_float EvaluateDerivative(const Vector& v, const int& dv);
|
|---|
| 42 |
|
|---|
| 43 | const vmg_float& GetAntiDerivativeZero() const
|
|---|
| 44 | {
|
|---|
| 45 | return antid;
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | private:
|
|---|
| 49 | std::vector<Polynomial> spline_nom, spline_denom;
|
|---|
| 50 | std::vector<Polynomial> potential_nom, potential_denom;
|
|---|
| 51 | vmg_float antid;
|
|---|
| 52 | std::vector<vmg_float> intervals;
|
|---|
| 53 |
|
|---|
| 54 | vmg_float R;
|
|---|
| 55 | };
|
|---|
| 56 |
|
|---|
| 57 | }
|
|---|
| 58 |
|
|---|
| 59 | #endif /* BSPLINE_HPP_ */
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.