n2p2 - A neural network potential package
|
#include <CutoffFunction.h>
Public Types | |
enum | CutoffType { CT_HARD , CT_COS , CT_TANHU , CT_TANH , CT_EXP , CT_POLY1 , CT_POLY2 , CT_POLY3 , CT_POLY4 } |
List of available cutoff function types. More... | |
Public Member Functions | |
CutoffFunction () | |
Constructor, initializes to ´CT_HARD´. More... | |
void | setCutoffType (CutoffType const cutoffType) |
Set cutoff type. More... | |
CutoffType | getCutoffType () const |
Getter for cutoffType. More... | |
void | setCutoffRadius (double const cutoffRadius) |
Set cutoff radius. More... | |
double | getCutoffRadius () const |
Getter for rc. More... | |
void | setCutoffParameter (double const alpha) |
Set parameter for polynomial cutoff function (CT_POLY). More... | |
double | getCutoffParameter () const |
Getter for alpha. More... | |
double | f (double r) const |
Cutoff function \(f_c\). More... | |
double | df (double r) const |
Derivative of cutoff function \(\frac{d f_c}{d r}\). More... | |
void | fdf (double r, double &fc, double &dfc) const |
Calculate cutoff function \(f_c\) and derivative \(\frac{d f_c}{d r}\). More... | |
Private Member Functions | |
double | fHARD (double r) const |
double | dfHARD (double r) const |
void | fdfHARD (double r, double &fc, double &dfc) const |
double | fCOS (double r) const |
double | dfCOS (double r) const |
void | fdfCOS (double r, double &fc, double &dfc) const |
double | fTANHU (double r) const |
double | dfTANHU (double r) const |
void | fdfTANHU (double r, double &fc, double &dfc) const |
double | fTANH (double r) const |
double | dfTANH (double r) const |
void | fdfTANH (double r, double &fc, double &dfc) const |
double | fCORE (double r) const |
double | dfCORE (double r) const |
void | fdfCORE (double r, double &fc, double &dfc) const |
Private Attributes | |
CutoffType | cutoffType |
Cutoff function type. More... | |
double | rc |
Outer cutoff radius \(r_c\). More... | |
double | rcinv |
Inverse cutoff radius \(\frac{1}{r_c}\). More... | |
double | rci |
Inner cutoff for cutoff function types which allow shifting. More... | |
double | alpha |
Cutoff function parameter for CT_POLYn and CT_EXP \(\alpha\). More... | |
double | iw |
Inverse width of cutoff function \(\frac{1}{r_c - r_{ci}}\). More... | |
CoreFunction | core |
Core functions used by POLYN, if any. More... | |
double(CutoffFunction::* | fPtr )(double r) const |
Function pointer to f. More... | |
double(CutoffFunction::* | dfPtr )(double r) const |
Function pointer to df. More... | |
void(CutoffFunction::* | fdfPtr )(double r, double &fc, double &dfc) const |
Function pointer to fdf. More... | |
Static Private Attributes | |
static double const | PI = 4.0 * atan(1.0) |
static double const | PI_2 = 2.0 * atan(1.0) |
static double const | E = exp(1.0) |
static double const | TANH_PRE = pow((E + 1 / E) / (E - 1 / E), 3) |
Definition at line 25 of file CutoffFunction.h.
List of available cutoff function types.
Most cutoff types allow the definition of an inner cutoff \( r_{ci} := \alpha \, r_c\). Then the cutoff is equal to \(1\) up to the inner cutoff:
\( f_c(r) = \begin{cases} 1, & \text{for } 0 \le r < r_{ci} \\ f(x), & \text{for } r_{ci} \le r < r_c \text{ where } x := \frac{r - r_{ci}}{r_c - r_{ci}} \\ 0 & \text{for } r \geq r_c \end{cases} \)
Definition at line 42 of file CutoffFunction.h.
CutoffFunction::CutoffFunction | ( | ) |
Constructor, initializes to ´CT_HARD´.
Definition at line 30 of file CutoffFunction.cpp.
void CutoffFunction::setCutoffType | ( | CutoffType const | cutoffType | ) |
Set cutoff type.
[in] | cutoffType | Type of cutoff used. |
Definition at line 42 of file CutoffFunction.cpp.
References core, CT_COS, CT_EXP, CT_HARD, CT_POLY1, CT_POLY2, CT_POLY3, CT_POLY4, CT_TANH, CT_TANHU, cutoffType, dfCORE(), dfCOS(), dfHARD(), dfPtr, dfTANH(), dfTANHU(), fCORE(), fCOS(), fdfCORE(), fdfCOS(), fdfHARD(), fdfPtr, fdfTANH(), fdfTANHU(), fHARD(), fPtr, fTANH(), fTANHU(), and nnp::CoreFunction::setType().
Referenced by nnp::SymGrpExpAngn::addMember(), nnp::SymGrpExpAngnWeighted::addMember(), nnp::SymGrpExpAngw::addMember(), nnp::SymGrpExpRad::addMember(), nnp::SymGrpExpRadWeighted::addMember(), runTest(), and nnp::SymFncBaseCutoff::setCutoffFunction().
|
inline |
Getter for cutoffType.
Definition at line 183 of file CutoffFunction.h.
References cutoffType.
void CutoffFunction::setCutoffRadius | ( | double const | cutoffRadius | ) |
Set cutoff radius.
[in] | cutoffRadius | Cutoff radius \(r_c\). |
Definition at line 95 of file CutoffFunction.cpp.
Referenced by nnp::SymGrpExpAngn::addMember(), nnp::SymGrpExpAngnWeighted::addMember(), nnp::SymGrpExpAngw::addMember(), nnp::SymGrpExpRad::addMember(), nnp::SymGrpExpRadWeighted::addMember(), nnp::SymFncBaseExpAng::changeLengthUnit(), nnp::SymFncExpAngnWeighted::changeLengthUnit(), nnp::SymFncExpRad::changeLengthUnit(), nnp::SymFncExpRadWeighted::changeLengthUnit(), main(), nnp::SymFncBaseExpAng::setParameters(), nnp::SymFncExpAngnWeighted::setParameters(), nnp::SymFncExpRad::setParameters(), and nnp::SymFncExpRadWeighted::setParameters().
|
inline |
Getter for rc.
Definition at line 188 of file CutoffFunction.h.
References rc.
void CutoffFunction::setCutoffParameter | ( | double const | alpha | ) |
Set parameter for polynomial cutoff function (CT_POLY).
[in] | alpha | Width parameter \(\alpha\). |
Definition at line 102 of file CutoffFunction.cpp.
References alpha, iw, rc, and rci.
Referenced by nnp::SymGrpExpAngn::addMember(), nnp::SymGrpExpAngnWeighted::addMember(), nnp::SymGrpExpAngw::addMember(), nnp::SymGrpExpRad::addMember(), nnp::SymGrpExpRadWeighted::addMember(), nnp::SymFncBaseExpAng::changeLengthUnit(), nnp::SymFncExpAngnWeighted::changeLengthUnit(), nnp::SymFncExpRad::changeLengthUnit(), nnp::SymFncExpRadWeighted::changeLengthUnit(), main(), nnp::SymFncBaseCutoff::setCutoffFunction(), nnp::SymFncBaseExpAng::setParameters(), nnp::SymFncExpAngnWeighted::setParameters(), nnp::SymFncExpRad::setParameters(), and nnp::SymFncExpRadWeighted::setParameters().
|
inline |
Getter for alpha.
Definition at line 193 of file CutoffFunction.h.
References alpha.
|
inline |
Cutoff function \(f_c\).
[in] | r | Distance. |
Definition at line 198 of file CutoffFunction.h.
Referenced by nnp::SymFncBaseExpAng::calculateRadialPart(), nnp::SymFncExpAngnWeighted::calculateRadialPart(), nnp::SymFncExpRad::calculateRadialPart(), nnp::SymFncExpRadWeighted::calculateRadialPart(), and runTest().
|
inline |
Derivative of cutoff function \(\frac{d f_c}{d r}\).
[in] | r | Distance. |
Definition at line 204 of file CutoffFunction.h.
Referenced by runTest().
|
inline |
Calculate cutoff function \(f_c\) and derivative \(\frac{d f_c}{d r}\).
[in] | r | Distance. |
[out] | fc | Cutoff function value. |
[out] | dfc | Value of cutoff function derivative. |
Definition at line 210 of file CutoffFunction.h.
References fc, fdfPtr, and rc.
Referenced by nnp::SymFncExpAngn::calculate(), nnp::SymFncExpAngnWeighted::calculate(), nnp::SymFncExpAngw::calculate(), nnp::SymFncExpRad::calculate(), nnp::SymFncExpRadWeighted::calculate(), nnp::SymGrpExpAngn::calculate(), nnp::SymGrpExpAngnWeighted::calculate(), nnp::SymGrpExpAngw::calculate(), nnp::SymGrpExpRad::calculate(), nnp::SymGrpExpRadWeighted::calculate(), and runTest().
|
inlineprivate |
Definition at line 222 of file CutoffFunction.h.
Referenced by setCutoffType().
|
inlineprivate |
Definition at line 227 of file CutoffFunction.h.
Referenced by setCutoffType().
|
inlineprivate |
Definition at line 232 of file CutoffFunction.h.
References fc.
Referenced by setCutoffType().
|
private |
Definition at line 114 of file CutoffFunction.cpp.
Referenced by setCutoffType().
|
private |
Definition at line 121 of file CutoffFunction.cpp.
References iw, PI, PI_2, and rci.
Referenced by setCutoffType().
|
private |
Definition at line 128 of file CutoffFunction.cpp.
References fc, iw, PI, and rci.
Referenced by setCutoffType().
|
private |
Definition at line 143 of file CutoffFunction.cpp.
References rcinv.
Referenced by setCutoffType().
|
private |
Definition at line 149 of file CutoffFunction.cpp.
References rcinv.
Referenced by setCutoffType().
|
private |
Definition at line 156 of file CutoffFunction.cpp.
Referenced by setCutoffType().
|
private |
Definition at line 165 of file CutoffFunction.cpp.
References rcinv, and TANH_PRE.
Referenced by setCutoffType().
|
private |
Definition at line 171 of file CutoffFunction.cpp.
References rcinv, and TANH_PRE.
Referenced by setCutoffType().
|
private |
Definition at line 178 of file CutoffFunction.cpp.
References fc, rcinv, and TANH_PRE.
Referenced by setCutoffType().
|
private |
Definition at line 187 of file CutoffFunction.cpp.
References core, nnp::CoreFunction::f(), iw, and rci.
Referenced by setCutoffType().
|
private |
Definition at line 194 of file CutoffFunction.cpp.
References core, nnp::CoreFunction::df(), iw, and rci.
Referenced by setCutoffType().
|
private |
Definition at line 201 of file CutoffFunction.cpp.
References core, fc, nnp::CoreFunction::fdf(), iw, and rci.
Referenced by setCutoffType().
|
staticprivate |
Definition at line 129 of file CutoffFunction.h.
|
staticprivate |
Definition at line 130 of file CutoffFunction.h.
Referenced by dfCOS().
|
staticprivate |
Definition at line 131 of file CutoffFunction.h.
Definition at line 132 of file CutoffFunction.h.
|
private |
Cutoff function type.
Definition at line 135 of file CutoffFunction.h.
Referenced by getCutoffType(), and setCutoffType().
|
private |
Outer cutoff radius \(r_c\).
Definition at line 137 of file CutoffFunction.h.
Referenced by df(), f(), fdf(), getCutoffRadius(), setCutoffParameter(), and setCutoffRadius().
|
private |
Inverse cutoff radius \(\frac{1}{r_c}\).
Definition at line 139 of file CutoffFunction.h.
Referenced by dfTANH(), dfTANHU(), fdfTANH(), fdfTANHU(), fTANH(), fTANHU(), and setCutoffRadius().
|
private |
Inner cutoff for cutoff function types which allow shifting.
Definition at line 141 of file CutoffFunction.h.
Referenced by dfCORE(), dfCOS(), fCORE(), fCOS(), fdfCORE(), fdfCOS(), and setCutoffParameter().
|
private |
Cutoff function parameter for CT_POLYn
and CT_EXP
\(\alpha\).
Definition at line 143 of file CutoffFunction.h.
Referenced by getCutoffParameter(), and setCutoffParameter().
|
private |
Inverse width of cutoff function \(\frac{1}{r_c - r_{ci}}\).
Definition at line 145 of file CutoffFunction.h.
Referenced by dfCORE(), dfCOS(), fCORE(), fCOS(), fdfCORE(), fdfCOS(), and setCutoffParameter().
|
private |
Core functions used by POLYN, if any.
Definition at line 147 of file CutoffFunction.h.
Referenced by dfCORE(), fCORE(), fdfCORE(), and setCutoffType().
|
private |
Function pointer to f.
Definition at line 149 of file CutoffFunction.h.
Referenced by f(), and setCutoffType().
|
private |
Function pointer to df.
Definition at line 151 of file CutoffFunction.h.
Referenced by df(), and setCutoffType().
|
private |
Function pointer to fdf.
Definition at line 153 of file CutoffFunction.h.
Referenced by fdf(), and setCutoffType().