29SymFncExpRad::SymFncExpRad(
ElementMap const& elementMap) :
43 if (
ec != rhs.
getEc() )
return false;
48 if (
rc != c.
rc )
return false;
49 if (
eta != c.
eta )
return false;
50 if (
rs != c.
rs )
return false;
51 if (
e1 != c.
e1 )
return false;
57 if (
ec < rhs.
getEc() )
return true;
58 else if (
ec > rhs.
getEc() )
return false;
66 if (
rc < c.
rc )
return true;
67 else if (
rc > c.
rc )
return false;
68 if (
eta < c.
eta )
return true;
69 else if (
eta > c.
eta )
return false;
70 if (
rs < c.
rs )
return true;
71 else if (
rs > c.
rs )
return false;
72 if (
e1 < c.
e1 )
return true;
73 else if (
e1 > c.
e1 )
return false;
79 vector<string> splitLine =
split(
reduce(parameterString));
81 if (
type != (
size_t)atoi(splitLine.at(1).c_str()))
83 throw runtime_error(
"ERROR: Incorrect symmetry function type.\n");
88 eta = atof(splitLine.at(3).c_str());
89 rs = atof(splitLine.at(4).c_str());
90 rc = atof(splitLine.at(5).c_str());
113 string s =
strpr(
"symfunction_short %2s %2zu %2s %16.8E %16.8E %16.8E\n",
127#ifndef N2P2_NO_SF_CACHE
145 double const rij = n.
d;
146 double const pexp = exp(-
eta * (rij -
rs) * (rij -
rs));
151#ifndef N2P2_NO_SF_CACHE
152 if (unique)
fc.
fdf(rij, pfc, pdfc);
155 double& cfc = n.
cache[c0];
156 double& cdfc = n.
cache[c1];
157 if (cfc < 0)
fc.
fdf(rij, cfc, cdfc);
162 fc.
fdf(rij, pfc, pdfc);
164 result += pexp * pfc;
166 if (!derivatives)
continue;
168 * (pdfc - 2.0 *
eta * (rij -
rs)
173#ifndef N2P2_FULL_SFD_MEMORY
210 v.push_back(
strpr((
pad(s, w) +
"%14.8E").c_str(),
222 return exp(-
eta * (r -
rs) * (r -
rs)) *
fc.
f(r);
236#ifndef N2P2_NO_SF_CACHE
248 v.push_back(
strpr(
"%zu f ",
e1) + s);
249 v.push_back(
strpr(
"%zu df ",
e1) + s);
double f(double r) const
Cutoff function .
void fdf(double r, double &fc, double &dfc) const
Calculate cutoff function and derivative .
void setCutoffParameter(double const alpha)
Set parameter for polynomial cutoff function (CT_POLY).
void setCutoffRadius(double const cutoffRadius)
Set cutoff radius.
Intermediate class for SFs based on cutoff functions.
std::string subtype
Subtype string (specifies cutoff type).
CutoffFunction fc
Cutoff function used by this symmetry function.
CutoffFunction::CutoffType cutoffType
Cutoff type used by this symmetry function.
virtual std::vector< std::string > parameterInfo() const
Get description with parameter names and values.
double cutoffAlpha
Cutoff parameter .
Radial symmetry function (type 2)
virtual bool checkRelevantElement(std::size_t index) const
Check whether symmetry function is relevant for given element.
std::size_t e1
Element index of neighbor atom.
virtual void setParameters(std::string const ¶meterString)
Set symmetry function parameters.
virtual void changeLengthUnit(double convLength)
Change length unit.
virtual double calculateRadialPart(double distance) const
Calculate (partial) symmetry function value for one given distance.
virtual bool operator<(SymFnc const &rhs) const
Overload < operator.
double eta
Width of gaussian.
virtual double calculateAngularPart(double angle) const
Calculate (partial) symmetry function value for one given angle.
virtual std::vector< std::string > getCacheIdentifiers() const
Get unique cache identifiers.
virtual std::string parameterLine() const
Give symmetry function parameters in one line.
virtual bool operator==(SymFnc const &rhs) const
Overload == operator.
virtual std::vector< std::string > parameterInfo() const
Get description with parameter names and values.
virtual void calculate(Atom &atom, bool const derivatives) const
Calculate symmetry function for one atom.
double rs
Shift of gaussian.
virtual std::string getSettingsLine() const
Get settings file line from currently set parameters.
Symmetry function base class.
double convLength
Data set normalization length conversion factor.
std::size_t type
Symmetry function type.
std::set< std::string > parameters
Set with symmetry function parameter IDs (lookup for printing).
std::size_t index
Symmetry function index (per element).
double scalingFactor
Scaling factor.
std::size_t getType() const
Get private type member variable.
std::vector< std::vector< std::size_t > > cacheIndices
Cache indices for each element.
ElementMap elementMap
Copy of element map.
double scale(double value) const
Apply symmetry function scaling and/or centering.
std::size_t getEc() const
Get private ec member variable.
std::vector< std::size_t > indexPerElement
Per-element index for derivative memory in Atom::Neighbor::dGdr arrays.
std::size_t ec
Element index of center atom.
static std::size_t const sfinfoWidth
Width of the SFINFO parameter description field (see parameterInfo()).
std::size_t minNeighbors
Minimum number of neighbors required.
std::size_t lineNumber
Line number.
std::string getPrintFormat() const
Generate format string for symmetry function parameter printing.
string pad(string const &input, size_t num, char fill, bool right)
string strpr(const char *format,...)
String version of printf function.
vector< string > split(string const &input, char delimiter)
Split string at each delimiter.
string reduce(string const &line, string const &whitespace, string const &fill)
Replace multiple whitespaces with fill.
Struct to store information on neighbor atoms.
std::vector< double > cache
Symmetry function cache (e.g. for cutoffs, compact functions).
std::size_t element
Element index of neighbor atom.
double d
Distance to neighbor atom.
Vec3D dr
Distance vector to neighbor atom.
std::vector< Vec3D > dGdr
Derivatives of symmetry functions with respect to neighbor coordinates.
Storage for a single atom.
std::vector< Neighbor > neighbors
Neighbor array (maximum number defined in macros.h.
std::size_t getStoredMinNumNeighbors(double const cutoffRadius) const
Return needed number of neighbors for a given cutoff radius from neighborCutoffs map.
std::vector< Vec3D > dGdr
Derivative of symmetry functions with respect to this atom's coordinates.
std::vector< double > G
Symmetry function values.
Vector in 3 dimensional real space.