39 if (
ec != rhs.
getEc() )
return false;
43 if (
e1 != c.
e1 )
return false;
44 if (
e2 != c.
e2 )
return false;
45 if (
rc != c.
rc )
return false;
46 if (
rl != c.
rl )
return false;
54 if (
ec < rhs.
getEc() )
return true;
55 else if (
ec > rhs.
getEc() )
return false;
61 if (
e1 < c.
e1 )
return true;
62 else if (
e1 > c.
e1 )
return false;
63 if (
e2 < c.
e2 )
return true;
64 else if (
e2 > c.
e2 )
return false;
65 if (
rc < c.
rc )
return true;
66 else if (
rc > c.
rc )
return false;
67 if (
rl < c.
rl )
return true;
68 else if (
rl > c.
rl )
return false;
82 if (numNeighbors == 0) numNeighbors = 1;
84 for (
size_t j = 0; j < numNeighbors - 1; j++)
88 double const rij = nj.
d;
89 if ((
e1 == nej ||
e2 == nej) && rij < rc && rij >
rl)
93#ifndef N2P2_NO_SF_CACHE
99 if (crad < 0)
cr.
fdf(rij, crad, cdrad);
104 cr.
fdf(rij, radij, dradij);
106 for (
size_t k = j + 1; k < numNeighbors; k++)
110 if ((
e1 == nej &&
e2 == nek) ||
111 (
e2 == nej &&
e1 == nek))
113 double const rik = nk.
d;
114 if (rik < rc && rik >
rl)
119#ifndef N2P2_NO_SF_CACHE
122 cr.
fdf(rik, radik, dradik);
128 if (crad < 0)
cr.
fdf(rik, crad, cdrad);
133 cr.
fdf(rik, radik, dradik);
138 Vec3D drjk = drik - drij;
139 double costijk = drij * drik;
140 double rinvijik = 1.0 / rij / rik;
145 if (costijk <= -1.0 || costijk >= 1.0)
continue;
148 double const acostijk = acos(costijk);
154 ca.
fdf(acostijk, ang, dang);
156 double const rad = radij * radik;
160 if (!derivatives)
continue;
162 double const dacostijk = -1.0
163 / sqrt(1.0 - costijk * costijk);
166 double const rinvij = rinvijik * rik;
167 double const rinvik = rinvijik * rij;
168 double phiijik = rinvij * (rinvik - rinvij * costijk);
169 double phiikij = rinvik * (rinvij - rinvik * costijk);
170 double psiijik = rinvijik;
176 double const chiij = rinvij * radik * dradij;
177 double const chiik = rinvik * radij * dradik;
180 double const p1 = rad * phiijik + ang * chiij;
181 double const p2 = rad * phiikij + ang * chiik;
182 double const p3 = rad * psiijik;
189#ifndef N2P2_FULL_SFD_MEMORY
void fdf(double a, double &fa, double &dfa) const
Calculate compact function and derivative at once.
Intermediate symmetry function class for angular SFs with compact support.
double angleLeft
Left angle boundary.
double angleRight
Right angle boundary.
double angleRightRadians
Right angle boundary in radians.
std::size_t e2
Element index of neighbor atom 2.
CompactFunction ca
Compact function member for angular part.
double angleLeftRadians
Left angle boundary in radians.
std::size_t e1
Element index of neighbor atom 1.
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).
Wide angular symmetry function with compact support (type 22)
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.
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.