30SymGrpExpRadWeighted::SymGrpExpRadWeighted(
ElementMap const& elementMap) :
41 if (
ec != rhs.
getEc() )
return false;
47 if (
rc != c.
rc )
return false;
53 if (
ec < rhs.
getEc() )
return true;
54 else if (
ec > rhs.
getEc() )
return false;
63 if (
rc < c.
rc )
return true;
64 else if (
rc > c.
rc )
return false;
70 if (symmetryFunction->
getType() !=
type)
return false;
91 if (sf->
getEc() !=
ec )
return false;
92 if (sf->
getRc() !=
rc )
return false;
95 throw runtime_error(
"ERROR: Unable to add symmetry function members "
96 "with different conversion factors.\n");
108 comparePointerTargets<SymFncExpRadWeighted const>);
110 for (
size_t i = 0; i <
members.size(); i++)
124 for (
size_t i = 0; i <
members.size(); i++)
140#ifndef N2P2_NO_SF_CACHE
143 auto cacheIndices =
members.at(0)->getCacheIndices();
145 double* result =
new double[
members.size()];
146 for (
size_t k = 0; k <
members.size(); ++k)
157 double const rij = n.
d;
163#ifndef N2P2_NO_SF_CACHE
164 if (cacheIndices[nej].size() == 0)
fc.
fdf(rij, pfc, pdfc);
167 double& cfc = n.
cache[cacheIndices[nej][0]];
168 double& cdfc = n.
cache[cacheIndices[nej][1]];
169 if (cfc < 0)
fc.
fdf(rij, cfc, cdfc);
174 fc.
fdf(rij, pfc, pdfc);
176 double const*
const d1 = n.
dr.
r;
177 for (
size_t k = 0; k <
members.size(); ++k)
180 * exp(-
eta[k] * (rij -
rs[k]) * (rij -
rs[k]));
181 result[k] += pexp * pfc;
183 if (!derivatives)
continue;
185 * (rij -
rs[k]) * pfc) * pexp / rij;
188 double const p1drijx = p1 * d1[0];
189 double const p1drijy = p1 * d1[1];
190 double const p1drijz = p1 * d1[2];
193#ifndef N2P2_FULL_SFD_MEMORY
202 double* dGdr = atom.
dGdr[ki].r;
207#ifndef N2P2_FULL_SFD_MEMORY
218 for (
size_t k = 0; k <
members.size(); ++k)
240 for (
size_t i = 0; i <
members.size(); ++i)
245 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::size_t atomicNumber(std::size_t index) const
Get atomic number from element index.
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.
Weighted radial symmetry function (type 12)
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).
Weighted radial symmetry function group (type 12)
virtual void calculate(Atom &atom, bool const derivatives) const
Calculate all symmetry functions of this group for one atom.
std::vector< double > eta
Vector containing values of all member symmetry functions.
virtual void sortMembers()
Sort member symmetry functions.
virtual bool addMember(SymFnc const *const symmetryFunction)
Potentially add a member to group.
virtual bool operator<(SymGrp const &rhs) const
Overload < operator.
virtual bool operator==(SymGrp const &rhs) const
Overload == operator.
std::vector< double > rs
Vector containing values of all member symmetry functions.
std::vector< SymFncExpRadWeighted const * > members
Vector of all group member pointers.
virtual void setScalingFactors()
Fill scalingFactors with values from member symmetry functions.
virtual std::vector< std::string > parameterLines() const
Give symmetry function group parameters on multiple lines.
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.
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::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.
double r[3]
cartesian coordinates.