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;
79 if (
rl > 0.0) r2l =
rl *
rl;
85 if (numNeighbors == 0) numNeighbors = 1;
87 for (
size_t j = 0; j < numNeighbors - 1; j++)
91 double const rij = nj.
d;
92 if ((
e1 == nej ||
e2 == nej) && rij < rc && rij >
rl)
96#ifndef N2P2_NO_SF_CACHE
102 if (crad < 0)
cr.fdf(rij, crad, cdrad);
107 cr.fdf(rij, radij, dradij);
109 for (
size_t k = j + 1; k < numNeighbors; k++)
113 if ((
e1 == nej &&
e2 == nek) ||
114 (
e2 == nej &&
e1 == nek))
116 double const rik = nk.
d;
117 if (rik < rc && rik >
rl)
123 double rjk = drjk.
norm2();
124 if (rjk >= r2c || rjk <= r2l)
continue;
129#ifndef N2P2_NO_SF_CACHE
132 cr.fdf(rik, radik, dradik);
138 if (crad < 0)
cr.fdf(rik, crad, cdrad);
143 cr.fdf(rik, radik, dradik);
147 cr.fdf(rjk, radjk, dradjk);
149 double costijk = drij * drik;
150 double rinvijik = 1.0 / rij / rik;
155 if (costijk <= -1.0 || costijk >= 1.0)
continue;
158 double const acostijk = acos(costijk);
164 ca.fdf(acostijk, ang, dang);
166 double const rad = radij * radik * radjk;
170 if (!derivatives)
continue;
172 double const dacostijk = -1.0
173 / sqrt(1.0 - costijk * costijk);
175 double const rinvij = rinvijik * rik;
176 double const rinvik = rinvijik * rij;
177 double const rinvjk = 1.0 / rjk;
178 double phiijik = rinvij * (rinvik - rinvij*costijk);
179 double phiikij = rinvik * (rinvij - rinvik*costijk);
180 double psiijik = rinvijik;
186 double const chiij = rinvij * dradij * radik * radjk;
187 double const chiik = rinvik * radij * dradik * radjk;
188 double const chijk = -rinvjk * radij * radik * dradjk;
191 double const p1 = rad * phiijik + ang * chiij;
192 double const p2 = rad * phiikij + ang * chiik;
193 double const p3 = rad * psiijik + ang * chijk;
200#ifndef N2P2_FULL_SFD_MEMORY
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.
SymFncBaseCompAng(std::size_t type, ElementMap const &)
Constructor, initializes type.
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).
virtual void calculate(Atom &atom, bool const derivatives) const
Calculate symmetry function for one atom.
virtual bool operator<(SymFnc const &rhs) const
Overload < operator.
SymFncCompAngn(ElementMap const &elementMap)
Constructor, sets type = 21.
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.