seams-core v2.15.0
libyodaLib, the C++ engine of d-SEAMS
Loading...
Searching...
No Matches
smooth::RationalSwitch Struct Reference

PLUMED RATIONAL switching function times a C2 taper. More...

#include <src/include/internal/smooth_cv.hpp>

Public Member Functions

void validate () const
double operator() (double r, double &dsdr) const

Public Attributes

double r0 = 1.0
double d0 = 0.0
int n = 6
int m = 12
double dOn = 0.0
double dMax = 1.0

Detailed Description

PLUMED RATIONAL switching function times a C2 taper.

For x = (r - d0) / r0 the rational part is (1 - x^n) / (1 - x^m), evaluated as the ratio of the geometric sums 1 + x + ... + x^(n-1) and 1 + x + ... + x^(m-1), which has no removable singularity at x = 1, and above x = 1 as y^(m-n) times the same ratio in y = 1 / x. It is 1 for r at or below d0. The taper is 1 below dOn, 0 at and beyond dMax, and 1 - u^3 (10 - 15 u + 6 u^2) with u = (r - dOn) / (dMax - dOn) in between, so the product and its first two derivatives vanish at dMax. Near d0 the rational part is 1 - x^n + O(x^m), so s is C^(n-1) and not C^n at d0 > 0; at d0 = 0 and n = 1, s of the length of v has a cone at v = 0.

Definition at line 109 of file smooth_cv.hpp.

Member Function Documentation

◆ operator()()

double smooth::RationalSwitch::operator() ( double r,
double & dsdr ) const

s(r), finite and not negative; dsdr receives ds/dr, the right derivative at r = d0. No power of x above 1 is formed, so only dsdr can leave double range, when r0 or dMax - dOn is near the smallest doubles.

◆ validate()

void smooth::RationalSwitch::validate ( ) const

Throws std::invalid_argument unless r0 > 0, n >= 1, m > n, n and m are at most kMaxSwitchExponent, 0 <= d0 <= dOn < dMax and every value is finite. m == 0 is read as 2n by makeSwitch before this check, and 2n must also be at most kMaxSwitchExponent.

Member Data Documentation

◆ d0

double smooth::RationalSwitch::d0 = 0.0

Definition at line 111 of file smooth_cv.hpp.

◆ dMax

double smooth::RationalSwitch::dMax = 1.0

Definition at line 115 of file smooth_cv.hpp.

◆ dOn

double smooth::RationalSwitch::dOn = 0.0

Definition at line 114 of file smooth_cv.hpp.

◆ m

int smooth::RationalSwitch::m = 12

Definition at line 113 of file smooth_cv.hpp.

◆ n

int smooth::RationalSwitch::n = 6

Definition at line 112 of file smooth_cv.hpp.

◆ r0

double smooth::RationalSwitch::r0 = 1.0

Definition at line 110 of file smooth_cv.hpp.


The documentation for this struct was generated from the following file: