n2p2 - A neural network potential package
|
#include <CoreFunction.h>
Public Types | |
enum class | Type { COS , POLY1 , POLY2 , POLY3 , POLY4 , EXP } |
List of available function types. More... | |
Public Member Functions | |
CoreFunction () | |
Constructor, initializes to #Type::POLY2. More... | |
void | setType (Type const type) |
Set function type. More... | |
void | setType (std::string const typeString) |
Set function type. More... | |
Type | getType () const |
Getter for type. More... | |
void | setAsymmetric (bool asymmetric) |
Set asymmetric property. More... | |
bool | getAsymmetric () const |
Getter for asymmetric. More... | |
double | f (double x) const |
Calculate function value \(f(x)\). More... | |
double | df (double x) const |
Calculate derivative of function at argument \(\frac{df(x)}{dx}\). More... | |
void | fdf (double x, double &fx, double &dfx) const |
Calculate function and derivative at once. More... | |
std::vector< std::string > | info () const |
Get string with formula of compact function. More... | |
Private Member Functions | |
double | fCOS (double x) const |
double | dfCOS (double x) const |
void | fdfCOS (double x, double &fx, double &dfx) const |
double | fPOLY1 (double x) const |
double | dfPOLY1 (double x) const |
void | fdfPOLY1 (double x, double &fx, double &dfx) const |
double | fPOLY2 (double x) const |
double | dfPOLY2 (double x) const |
void | fdfPOLY2 (double x, double &fx, double &dfx) const |
double | fPOLY3 (double x) const |
double | dfPOLY3 (double x) const |
void | fdfPOLY3 (double x, double &fx, double &dfx) const |
double | fPOLY4 (double x) const |
double | dfPOLY4 (double x) const |
void | fdfPOLY4 (double x, double &fx, double &dfx) const |
double | fEXP (double x) const |
double | dfEXP (double x) const |
void | fdfEXP (double x, double &fx, double &dfx) const |
Private Attributes | |
Type | type |
Core function type. More... | |
bool | asymmetric |
Enables asymmetry modification (use with polynomials). More... | |
double(CoreFunction::* | fPtr )(double x) const |
Function pointer to f. More... | |
double(CoreFunction::* | dfPtr )(double x) const |
Function pointer to df. More... | |
void(CoreFunction::* | fdfPtr )(double x, double &fx, double &dfx) 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) |
Definition at line 28 of file CoreFunction.h.
|
strong |
List of available function types.
Definition at line 32 of file CoreFunction.h.
CoreFunction::CoreFunction | ( | ) |
Constructor, initializes to #Type::POLY2.
Definition at line 29 of file CoreFunction.cpp.
void CoreFunction::setType | ( | Type const | type | ) |
Set function type.
[in] | type | Type of core function used. |
Definition at line 39 of file CoreFunction.cpp.
References COS, dfCOS(), dfEXP(), dfPOLY1(), dfPOLY2(), dfPOLY3(), dfPOLY4(), dfPtr, EXP, fCOS(), fdfCOS(), fdfEXP(), fdfPOLY1(), fdfPOLY2(), fdfPOLY3(), fdfPOLY4(), fdfPtr, fEXP(), fPOLY1(), fPOLY2(), fPOLY3(), fPOLY4(), fPtr, POLY1, POLY2, POLY3, POLY4, and type.
Referenced by nnp::CompactFunction::CompactFunction(), nnp::ScreeningFunction::ScreeningFunction(), nnp::CompactFunction::setCoreFunction(), nnp::ScreeningFunction::setCoreFunction(), nnp::CutoffFunction::setCutoffType(), and setType().
void CoreFunction::setType | ( | std::string const | typeString | ) |
Set function type.
[in] | typeString | Type (string version) of core function used. |
Definition at line 87 of file CoreFunction.cpp.
References COS, EXP, POLY1, POLY2, POLY3, POLY4, and setType().
|
inline |
Getter for type.
Definition at line 158 of file CoreFunction.h.
References type.
Referenced by nnp::CompactFunction::getCoreFunctionType(), and nnp::ScreeningFunction::getCoreFunctionType().
|
inline |
Set asymmetric property.
[in] | asymmetric | Whether asymmetry should be activated. |
Definition at line 161 of file CoreFunction.h.
References asymmetric.
Referenced by nnp::CompactFunction::setAsymmetric().
|
inline |
Getter for asymmetric.
Definition at line 168 of file CoreFunction.h.
References asymmetric.
Referenced by nnp::CompactFunction::getAsymmetric().
|
inline |
Calculate function value \(f(x)\).
[in] | x | Function argument. |
Definition at line 171 of file CoreFunction.h.
References asymmetric, and fPtr.
Referenced by nnp::CompactFunction::f(), nnp::ScreeningFunction::f(), and nnp::CutoffFunction::fCORE().
|
inline |
Calculate derivative of function at argument \(\frac{df(x)}{dx}\).
[in] | x | Function argument. |
Definition at line 179 of file CoreFunction.h.
References asymmetric, and dfPtr.
Referenced by nnp::CompactFunction::df(), nnp::ScreeningFunction::df(), and nnp::CutoffFunction::dfCORE().
|
inline |
Calculate function and derivative at once.
[in] | x | Function argument. |
[out] | fx | Function value. |
[out] | dfx | Derivative value. |
Definition at line 189 of file CoreFunction.h.
References asymmetric, and fdfPtr.
Referenced by nnp::CompactFunction::fdf(), nnp::ScreeningFunction::fdf(), and nnp::CutoffFunction::fdfCORE().
vector< string > CoreFunction::info | ( | ) | const |
Get string with formula of compact function.
Definition at line 107 of file CoreFunction.cpp.
References COS, EXP, POLY1, POLY2, POLY3, POLY4, nnp::strpr(), and type.
Referenced by nnp::ScreeningFunction::info().
|
inlineprivate |
Definition at line 204 of file CoreFunction.h.
References PI.
Referenced by setType().
|
inlineprivate |
Definition at line 209 of file CoreFunction.h.
Referenced by setType().
|
inlineprivate |
|
inlineprivate |
Definition at line 222 of file CoreFunction.h.
Referenced by setType().
|
inlineprivate |
Definition at line 227 of file CoreFunction.h.
Referenced by setType().
|
inlineprivate |
Definition at line 232 of file CoreFunction.h.
Referenced by setType().
|
inlineprivate |
Definition at line 239 of file CoreFunction.h.
Referenced by setType().
|
inlineprivate |
Definition at line 244 of file CoreFunction.h.
Referenced by setType().
|
inlineprivate |
Definition at line 249 of file CoreFunction.h.
Referenced by setType().
|
inlineprivate |
Definition at line 257 of file CoreFunction.h.
Referenced by setType().
|
inlineprivate |
Definition at line 263 of file CoreFunction.h.
Referenced by setType().
|
inlineprivate |
Definition at line 268 of file CoreFunction.h.
Referenced by setType().
|
inlineprivate |
Definition at line 276 of file CoreFunction.h.
Referenced by setType().
|
inlineprivate |
Definition at line 283 of file CoreFunction.h.
Referenced by setType().
|
inlineprivate |
Definition at line 290 of file CoreFunction.h.
Referenced by setType().
|
inlineprivate |
Definition at line 301 of file CoreFunction.h.
References E.
Referenced by setType().
|
inlineprivate |
Definition at line 306 of file CoreFunction.h.
References E.
Referenced by setType().
|
inlineprivate |
Definition at line 312 of file CoreFunction.h.
Referenced by setType().
|
staticprivate |
Definition at line 110 of file CoreFunction.h.
|
staticprivate |
Definition at line 111 of file CoreFunction.h.
Referenced by dfCOS().
|
staticprivate |
Definition at line 112 of file CoreFunction.h.
|
private |
Core function type.
Definition at line 114 of file CoreFunction.h.
|
private |
Enables asymmetry modification (use with polynomials).
Definition at line 117 of file CoreFunction.h.
Referenced by df(), f(), fdf(), getAsymmetric(), and setAsymmetric().
|
private |
Function pointer to f.
Definition at line 120 of file CoreFunction.h.
|
private |
Function pointer to df.
Definition at line 122 of file CoreFunction.h.
|
private |
Function pointer to fdf.
Definition at line 124 of file CoreFunction.h.