31SymFncCompRad::SymFncCompRad(
ElementMap const& elementMap) :
41 if (
ec != rhs.
getEc() )
return false;
45 if (
e1 != c.
e1 )
return false;
46 if (
rc != c.
rc )
return false;
47 if (
rl != c.
rl )
return false;
53 if (
ec < rhs.
getEc() )
return true;
54 else if (
ec > rhs.
getEc() )
return false;
60 if (
e1 < c.
e1 )
return true;
61 else if (
e1 > c.
e1 )
return false;
62 if (
rc < c.
rc )
return true;
63 else if (
rc > c.
rc )
return false;
64 if (
rl < c.
rl )
return true;
65 else if (
rl > c.
rl )
return false;
71 vector<string> splitLine =
split(
reduce(parameterString));
73 if (
type != (
size_t)atoi(splitLine.at(1).c_str()))
75 throw runtime_error(
"ERROR: Incorrect symmetry function type.\n");
80 rl = atof(splitLine.at(3).c_str());
81 rc = atof(splitLine.at(4).c_str());
86 throw runtime_error(
"ERROR: Lower radial boundary >= upper "
87 "radial boundary.\n");
114 string s =
strpr(
"symfunction_short %2s %2zu %2s %16.8E %16.8E %s\n",
128#ifndef N2P2_NO_SF_CACHE
146 double const rij = n.
d;
151#ifndef N2P2_NO_SF_CACHE
152 if (unique)
cr.
fdf(r, rad, drad);
155 double& crad = n.
cache[c0];
156 double& cdrad = n.
cache[c1];
157 if (crad < 0)
cr.
fdf(r, crad, cdrad);
162 cr.
fdf(r, rad, drad);
167 if (!derivatives)
continue;
172#ifndef N2P2_FULL_SFD_MEMORY
228#ifndef N2P2_NO_SF_CACHE
240 v.push_back(
strpr(
"%zu f ",
e1) + s);
241 v.push_back(
strpr(
"%zu df ",
e1) + s);
void fdf(double a, double &fa, double &dfa) const
Calculate compact function and derivative at once.
double f(double a) const
Compact function .
void setLeftRight(double left, double right)
Set left and right boundary.
Symmetry function base class for SFs with compact support.
std::string getSubtype() const
Get private subtype member variable.
double rl
Lower bound of compact function, .
virtual std::vector< std::string > parameterInfo() const
Get description with parameter names and values.
CompactFunction cr
Compact function for radial part.
std::string subtype
Subtype string (specifies e.g. polynom type).
void setCompactFunction(std::string subtype)
Set radial compact function.
Radial symmetry function with compact support (type 20)
virtual double calculateAngularPart(double angle) const
Calculate (partial) symmetry function value for one given angle.
std::size_t e1
Element index of neighbor atom.
virtual void calculate(Atom &atom, bool const derivatives) const
Calculate symmetry function for one atom.
virtual std::vector< std::string > parameterInfo() const
Get description with parameter names and values.
virtual std::string parameterLine() const
Give symmetry function parameters in one line.
virtual void changeLengthUnit(double convLength)
Change length unit.
virtual bool operator<(SymFnc const &rhs) const
Overload < operator.
virtual double calculateRadialPart(double distance) const
Calculate (partial) symmetry function value for one given distance.
virtual void setParameters(std::string const ¶meterString)
Set symmetry function parameters.
virtual std::vector< std::string > getCacheIdentifiers() const
Get unique cache identifiers.
virtual bool checkRelevantElement(std::size_t index) const
Check whether symmetry function is relevant for given element.
virtual bool operator==(SymFnc const &rhs) const
Overload == operator.
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::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.