|
MDStressLab++
|
Implements radially symmetric weighting functions (Hardy, Virial) and its associated bond function for atomistic stress computation. More...
#include <MethodSphere.h>


Public Member Functions | |
| MethodSphere (double, const std::string &type="virial") | |
| Constructs a MethodSphere using a named weighting type. | |
| MethodSphere (double, std::map< double, double >) | |
| Constructs a MethodSphere using a user-defined piecewise-linear weight function. | |
| MethodSphere (const MethodSphere &) | |
| virtual | ~MethodSphere () |
Public Member Functions inherited from Method< MethodSphere > | |
| virtual | ~Method () |
| double | operator() (const Vector3d &vec) const |
| The weighting function \(w\) used to compute stress. | |
| double | bondFunction (const Vector3d &vec1, const Vector3d &vec2) const |
| The bond function \(b(\boldsymbol v^1, \boldsymbol v^2)\) gives the weight associated to a bond formed by two atoms. | |
| double | getAveragingDomainSize () const |
| Gets the spatial size of the averaging domain, i.e. the support of the weighting function. | |
Protected Member Functions | |
| double | operator() (const Vector3d &vec) const |
| Evaluate the weighting function at a vector. | |
| double | bondFunction (const Vector3d &vec1, const Vector3d &vec2) const |
| Computes the bond function for a pair of atomic positions. | |
Friends | |
| class | Method< MethodSphere > |
Additional Inherited Members | |
Protected Attributes inherited from Method< MethodSphere > | |
| double | averagingDomainSize |
Implements radially symmetric weighting functions (Hardy, Virial) and its associated bond function for atomistic stress computation.
This class defines a weighting function \(w\) over a spherical domain of radius \(R\) (the averaging domain size). Two common forms are supported:
Additionally, users can supply a custom radial weighting function as a piecewise linear map.
Definition at line 28 of file MethodSphere.h.
|
explicit |
Constructs a MethodSphere using a named weighting type.
| averagingDomainSize | The diameter \(R\) of the spherical averaging domain. |
| type | The type of weighting function: "hardy" or "virial". |
For "hardy", the radial weighting function \(w(r)\) is defined as:
\[ w(r) = \begin{cases} c, & \text{if } 0 \le r \le R/2 \\ 2c\left(1 - \frac{r}{R}\right), & \text{if } R/2 < r \le R \\ 0, & \text{otherwise} \end{cases} \]
where \(c = \frac{8}{5\pi R^3}\) ensures normalization.
For "virial", the weighting function is:
\[ w(r) = \begin{cases} c, & \text{if } 0 \le r \le R \\ 0, & \text{otherwise} \end{cases} \]
where \(c = \frac{3}{4 \pi R^3}\).
Definition at line 15 of file MethodSphere.cpp.
| MethodSphere::MethodSphere | ( | double | averagingDomainSize, |
| std::map< double, double > | map | ||
| ) |
Constructs a MethodSphere using a user-defined piecewise-linear weight function.
| averagingDomainSize | The diameter \(R\) of the spherical domain. |
| map | A map from normalized radius values in \([0,1]\) to non-negative weight values. |
The keys of the map (in \([0, 1]\)) are rescaled by \(R\) to get the real radii. For each interval \([x_i, x_{i+1}]\), a linear segment is fitted:
\[ w(r) = y_i + \frac{y_{i+1} - y_i}{x_{i+1} - x_i} (r - x_i R), \quad r \in [x_i R, x_{i+1} R] \]
The resulting piecewise linear function is then normalized, i.e.
\[ 4 \pi \int_{0}^{R} w(r) \cdot r^2 \, dr = 1 \]
This allows users to define arbitrary, smooth weight profiles that are zero outside the domain.
Definition at line 63 of file MethodSphere.cpp.
| MethodSphere::MethodSphere | ( | const MethodSphere & | _hardy | ) |
Definition at line 115 of file MethodSphere.cpp.
|
virtual |
Definition at line 120 of file MethodSphere.cpp.
Computes the bond function for a pair of atomic positions.
| vec1 | Vector from grid point to atom 1. |
| vec2 | Vector from grid point to atom 2. |
Definition at line 168 of file MethodSphere.cpp.
|
protected |
Evaluate the weighting function at a vector.
| vec | Position vector relative to center of the averaging domain. |
Definition at line 154 of file MethodSphere.cpp.
|
friend |
Definition at line 1 of file MethodSphere.h.