30SymGrpExpRad::SymGrpExpRad(
ElementMap const& elementMap) :
44 if (
ec != rhs.
getEc() )
return false;
49 if (
rc != c.
rc )
return false;
50 if (
e1 != c.
e1 )
return false;
56 if (
ec < rhs.
getEc() )
return true;
57 else if (
ec > rhs.
getEc() )
return false;
65 if (
rc < c.
rc )
return true;
66 else if (
rc > c.
rc )
return false;
67 if (
e1 < c.
e1 )
return true;
68 else if (
e1 > c.
e1 )
return false;
74 if (symmetryFunction->
getType() !=
type)
return false;
96 if (sf->
getEc() !=
ec )
return false;
97 if (sf->
getRc() !=
rc )
return false;
98 if (sf->
getE1() !=
e1 )
return false;
101 throw runtime_error(
"ERROR: Unable to add symmetry function members "
102 "with different conversion factors.\n");
114 comparePointerTargets<SymFncExpRad const>);
116 for (
size_t i = 0; i <
members.size(); i++)
130 for (
size_t i = 0; i <
members.size(); i++)
146#ifndef N2P2_NO_SF_CACHE
149 auto cacheIndices =
members.at(0)->getCacheIndices();
153 if (cacheIndices.at(
e1).size() > 0)
156 c0 = cacheIndices.at(
e1).at(0);
157 c1 = cacheIndices.at(
e1).at(1);
160 double* result =
new double[
members.size()];
161 for (
size_t k = 0; k <
members.size(); ++k)
172 double const rij = n.
d;
177#ifndef N2P2_NO_SF_CACHE
178 if (unique)
fc.
fdf(rij, pfc, pdfc);
181 double& cfc = n.
cache[c0];
182 double& cdfc = n.
cache[c1];
183 if (cfc < 0)
fc.
fdf(rij, cfc, cdfc);
188 fc.
fdf(rij, pfc, pdfc);
190 double const*
const d1 = n.
dr.
r;
191 for (
size_t k = 0; k <
members.size(); ++k)
193 double pexp = exp(-
eta[k] * (rij -
rs[k]) * (rij -
rs[k]));
194 result[k] += pexp * pfc;
196 if (!derivatives)
continue;
198 * (rij -
rs[k]) * pfc) * pexp / rij;
201 double const p1drijx = p1 * d1[0];
202 double const p1drijy = p1 * d1[1];
203 double const p1drijz = p1 * d1[2];
206#ifndef N2P2_FULL_SFD_MEMORY
215 double* dGdr = atom.
dGdr[ki].r;
220#ifndef N2P2_FULL_SFD_MEMORY
231 for (
size_t k = 0; k <
members.size(); ++k)
254 for (
size_t i = 0; i <
members.size(); ++i)
259 members[i]->getLineNumber() + 1,
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 setCutoffType(CutoffType const cutoffType)
Set cutoff type.
void setCutoffRadius(double const cutoffRadius)
Set cutoff radius.
std::string getSubtype() const
Get private subtype member variable.
double getCutoffAlpha() const
Get private cutoffAlpha member variable.
CutoffFunction::CutoffType getCutoffType() const
Get private cutoffType member variable.
Radial symmetry function (type 2)
std::size_t getE1() const
Get private e1 member variable.
Symmetry function base class.
double getConvLength() const
Get private convLength member variable.
double getRc() const
Get private rc member variable.
std::size_t getType() const
Get private type member variable.
std::size_t getEc() const
Get private ec member variable.
double cutoffAlpha
Cutoff function parameter (common feature).
std::string subtype
Subtype string (specifies cutoff type) (common feature).
CutoffFunction fc
Cutoff function used by this symmetry function group.
double rc
Cutoff radius (common feature).
CutoffFunction::CutoffType cutoffType
Cutoff type used by this symmetry function group (common feature).
Radial symmetry function group (type 2)
std::vector< double > rs
Vector containing values of all member symmetry functions.
virtual std::vector< std::string > parameterLines() const
Give symmetry function group parameters on multiple lines.
virtual bool operator==(SymGrp const &rhs) const
Overload == operator.
virtual bool addMember(SymFnc const *const symmetryFunction)
Potentially add a member to group.
virtual void setScalingFactors()
Fill scalingFactors with values from member symmetry functions.
virtual bool operator<(SymGrp const &rhs) const
Overload < operator.
std::vector< SymFncExpRad const * > members
Vector of all group member pointers.
virtual void calculate(Atom &atom, bool const derivatives) const
Calculate all symmetry functions of this group for one atom.
virtual void sortMembers()
Sort member symmetry functions.
std::size_t e1
Element index of neighbor atom (common feature).
std::vector< double > eta
Vector containing values of all member symmetry functions.
std::size_t type
Symmetry function type.
std::size_t getType() const
Get private type member variable.
std::size_t index
Symmetry function group index.
std::vector< size_t > memberIndex
Vector containing indices of all member symmetry functions.
std::string getPrintFormatCommon() const
Get common parameter line format string.
std::size_t ec
Element index of center atom (common feature).
std::vector< std::vector< std::size_t > > memberIndexPerElement
Vector containing per-element indices of all member symmetry functions.
std::size_t getEc() const
Get private ec member variable.
double convLength
Data set normalization length conversion factor.
std::set< std::string > parametersCommon
Set of common parameters IDs.
ElementMap elementMap
Copy of element map.
std::size_t getIndex() const
Get private index member variable.
std::string getPrintFormatMember() const
Get member parameter line format string.
std::vector< double > scalingFactors
Scaling factors of all member symmetry functions.
std::set< std::string > parametersMember
Set of common parameters IDs.
string strpr(const char *format,...)
String version of printf function.
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.
double r[3]
cartesian coordinates.