MDStressLab++
Loading...
Searching...
No Matches
MethodSphere Class Reference

Implements radially symmetric weighting functions (Hardy, Virial) and its associated bond function for atomistic stress computation. More...

#include <MethodSphere.h>

Inheritance diagram for MethodSphere:
Collaboration diagram for MethodSphere:

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
 

Detailed Description

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:

  • Hardy-type weighting
  • Virial-type (uniform) weighting

Additionally, users can supply a custom radial weighting function as a piecewise linear map.

Examples
crack/main.cpp, and testLJ.cpp.

Definition at line 28 of file MethodSphere.h.

Constructor & Destructor Documentation

◆ MethodSphere() [1/3]

MethodSphere::MethodSphere ( double  averagingDomainSize,
const std::string &  type = "virial" 
)
explicit

Constructs a MethodSphere using a named weighting type.

Parameters
averagingDomainSizeThe diameter \(R\) of the spherical averaging domain.
typeThe 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() [2/3]

MethodSphere::MethodSphere ( double  averagingDomainSize,
std::map< double, double >  map 
)

Constructs a MethodSphere using a user-defined piecewise-linear weight function.

Parameters
averagingDomainSizeThe diameter \(R\) of the spherical domain.
mapA 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() [3/3]

MethodSphere::MethodSphere ( const MethodSphere _hardy)

Definition at line 115 of file MethodSphere.cpp.

◆ ~MethodSphere()

MethodSphere::~MethodSphere ( )
virtual

Definition at line 120 of file MethodSphere.cpp.

Member Function Documentation

◆ bondFunction()

double MethodSphere::bondFunction ( const Vector3d vec1,
const Vector3d vec2 
) const
protected

Computes the bond function for a pair of atomic positions.

Parameters
vec1Vector from grid point to atom 1.
vec2Vector from grid point to atom 2.
Returns
This function evaluates the line integral of the radially symmetric weighting function along the bond.

Definition at line 168 of file MethodSphere.cpp.

◆ operator()()

double MethodSphere::operator() ( const Vector3d vec) const
protected

Evaluate the weighting function at a vector.

Parameters
vecPosition vector relative to center of the averaging domain.
Returns
Weight value.

Definition at line 154 of file MethodSphere.cpp.

Friends And Related Symbol Documentation

◆ Method< MethodSphere >

friend class Method< MethodSphere >
friend

Definition at line 1 of file MethodSphere.h.


The documentation for this class was generated from the following files: