31SymFncCompAngnWeighted::
32SymFncCompAngnWeighted(
ElementMap const& elementMap) :
39 if (
ec != rhs.
getEc() )
return false;
44 if (
rc != c.
rc )
return false;
45 if (
rl != c.
rl )
return false;
53 if (
ec < rhs.
getEc() )
return true;
54 else if (
ec > rhs.
getEc() )
return false;
61 if (
rc < c.
rc )
return true;
62 else if (
rc > c.
rc )
return false;
63 if (
rl < c.
rl )
return true;
64 else if (
rl > c.
rl )
return false;
75 if (
rl > 0.0) r2l =
rl *
rl;
81 if (numNeighbors == 0) numNeighbors = 1;
83 for (
size_t j = 0; j < numNeighbors - 1; j++)
87 double const rij = nj.
d;
88 if (rij < rc && rij >
rl)
92#ifndef N2P2_NO_SF_CACHE
98 if (crad < 0)
cr.
fdf(rij, crad, cdrad);
103 cr.
fdf(rij, radij, dradij);
105 for (
size_t k = j + 1; k < numNeighbors; k++)
109 double const rik = nk.
d;
110 if (rik < rc && rik >
rl)
116 double rjk = drjk.
norm2();
117 if (rjk >= r2c || rjk <= r2l)
continue;
122#ifndef N2P2_NO_SF_CACHE
125 cr.
fdf(rik, radik, dradik);
131 if (crad < 0)
cr.
fdf(rik, crad, cdrad);
136 cr.
fdf(rik, radik, dradik);
140 cr.
fdf(rjk, radjk, dradjk);
142 double costijk = drij * drik;
143 double rinvijik = 1.0 / rij / rik;
148 if (costijk <= -1.0 || costijk >= 1.0)
continue;
151 double const acostijk = acos(costijk);
157 ca.
fdf(acostijk, ang, dang);
159 double const rad = radij * radik * radjk;
165 if (!derivatives)
continue;
167 double const dacostijk = -1.0
168 / sqrt(1.0 - costijk * costijk);
172 double const rinvij = rinvijik * rik;
173 double const rinvik = rinvijik * rij;
174 double const rinvjk = 1.0 / rjk;
175 double phiijik = rinvij * (rinvik - rinvij * costijk);
176 double phiikij = rinvik * (rinvij - rinvik * costijk);
177 double psiijik = rinvijik;
183 double const chiij = rinvij * dradij * radik * radjk;
184 double const chiik = rinvik * radij * dradik * radjk;
185 double const chijk = -rinvjk * radij * radik * dradjk;
188 double const p1 = rad * phiijik + ang * chiij;
189 double const p2 = rad * phiikij + ang * chiik;
190 double const p3 = rad * psiijik + ang * chijk;
197#ifndef N2P2_FULL_SFD_MEMORY
void fdf(double a, double &fa, double &dfa) const
Calculate compact function and derivative at once.
std::size_t atomicNumber(std::size_t index) const
Get atomic number from element index.
Intermediate symmetry function class for weighted angular compact SFs.
CompactFunction ca
Compact function member for angular part.
double angleLeft
Left angle boundary.
double angleLeftRadians
Left angle boundary in radians.
double angleRight
Right angle boundary.
double angleRightRadians
Right angle boundary in radians.
std::string getSubtype() const
Get private subtype member variable.
double rl
Lower bound of compact function, .
CompactFunction cr
Compact function for radial part.
std::string subtype
Subtype string (specifies e.g. polynom type).
Weighted narrow angular symmetry function with compact support (type 24)
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 bool operator<(SymFnc const &rhs) const
Overload < operator.
Symmetry function base class.
std::size_t type
Symmetry function type.
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.
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.
double norm2() const
Calculate square of norm of vector.