29SymFncExpRadWeighted::SymFncExpRadWeighted(
ElementMap const& elementMap) :
41 if (
ec != rhs.
getEc() )
return false;
47 if (
rc != c.
rc )
return false;
48 if (
eta != c.
eta )
return false;
49 if (
rs != c.
rs )
return false;
55 if (
ec < rhs.
getEc() )
return true;
56 else if (
ec > rhs.
getEc() )
return false;
65 if (
rc < c.
rc )
return true;
66 else if (
rc > c.
rc )
return false;
67 if (
eta < c.
eta )
return true;
68 else if (
eta > c.
eta )
return false;
69 if (
rs < c.
rs )
return true;
70 else if (
rs > c.
rs )
return false;
76 vector<string> splitLine =
split(
reduce(parameterString));
78 if (
type != (
size_t)atoi(splitLine.at(1).c_str()))
80 throw runtime_error(
"ERROR: Incorrect symmetry function type.\n");
84 eta = atof(splitLine.at(2).c_str());
85 rs = atof(splitLine.at(3).c_str());
86 rc = atof(splitLine.at(4).c_str());
109 string s =
strpr(
"symfunction_short %2s %2zu %16.8E %16.8E %16.8E\n",
130 double const rij = n.
d;
132 * exp(-
eta * (rij -
rs) * (rij -
rs));
137#ifndef N2P2_NO_SF_CACHE
143 if (cfc < 0)
fc.
fdf(rij, cfc, cdfc);
148 fc.
fdf(rij, pfc, pdfc);
150 result += pexp * pfc;
152 if (!derivatives)
continue;
154 * (pdfc - 2.0 *
eta * (rij -
rs)
159#ifndef N2P2_FULL_SFD_MEMORY
193 v.push_back(
strpr((
pad(s, w) +
"%14.8E").c_str(),
205 return exp(-
eta * (r -
rs) * (r -
rs)) *
fc.
f(r);
218#ifndef N2P2_NO_SF_CACHE
232 v.push_back(
strpr(
"%zu f ", i) + s);
233 v.push_back(
strpr(
"%zu df ", i) + 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.
std::size_t size() const
Get element map size.
std::size_t atomicNumber(std::size_t index) const
Get atomic number from element index.
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 .
Weighted radial symmetry function (type 12)
virtual std::vector< std::string > parameterInfo() const
Get description with parameter names and values.
double rs
Shift of gaussian.
virtual void setParameters(std::string const ¶meterString)
Set symmetry function parameters.
virtual std::string getSettingsLine() const
Get settings file line from currently set parameters.
virtual std::vector< std::string > getCacheIdentifiers() const
Get unique cache identifiers.
virtual double calculateRadialPart(double distance) const
Calculate (partial) symmetry function value for one given distance.
virtual bool operator<(SymFnc const &rhs) const
Overload < operator.
virtual std::string parameterLine() const
Give symmetry function parameters in one line.
double eta
Width of gaussian.
virtual void calculate(Atom &atom, bool const derivatives) const
Calculate symmetry function for one atom.
virtual bool operator==(SymFnc const &rhs) const
Overload == operator.
virtual void changeLengthUnit(double convLength)
Change length unit.
virtual double calculateAngularPart(double angle) const
Calculate (partial) symmetry function value for one given angle.
virtual bool checkRelevantElement(std::size_t index) const
Check whether symmetry function is relevant for given element.
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::vector< Vec3D > dGdr
Derivative of symmetry functions with respect to this atom's coordinates.
std::vector< double > G
Symmetry function values.
std::size_t numNeighbors
Total number of neighbors.
Vector in 3 dimensional real space.