LocalStress

class LocalStress(configuration)

Class for calculating the local stress.

Parameters:configuration (BulkConfiguration) – The configuration for which the local stress should be calculated.
evaluate(atom_index=None)

Return the local stress of the selected atom. Each stress tensor is given by 6 energies: \((\sigma_i^{xx}, \sigma_i^{yy}, \sigma_i^{zz}, \sigma_i^{yz}, \sigma_i^{xz}, \sigma_i^{xy})\) where \(i\) is atom_index and \(\sigma_i^{\text{pair}}\) is the corresponding stress tensor.

Parameters:atom_index (int) – Index of atom to return.
Default: Local stress of all atoms.
Returns:The requested stress tensor as a length 6 array if atom_index is not None, or all stress tensors as an (N, 6) array if atom_index is None.
Return type:PhysicalQuantity of type energy
metatext()
Returns:The metatext of the object or None if no metatext is present.
Return type:str | unicode | None
nlprint(stream=None)

Print a string containing an ASCII table useful for plotting the AnalysisSpin object.

Parameters:stream (python stream) – The stream the table should be written to.
Default: NLPrintLogger()
setMetatext(metatext)

Set a given metatext string on the object.

Parameters:metatext (str | unicode | None) – The metatext string that should be set. A value of “None” can be given to remove the current metatext.

Usage Examples

Calculate the LocalStress of a SiO2 quartz cell using a classical Tersoff potential:

# -------------------------------------------------------------
# Set up a SiO2 alpha-quartz cell.
# -------------------------------------------------------------

# Set up lattice
lattice = Hexagonal(4.916*Angstrom, 5.4054*Angstrom)

# Define elements
elements = [Silicon, Silicon, Silicon, Oxygen, Oxygen, Oxygen, Oxygen, Oxygen,
            Oxygen]

# Define coordinates
fractional_coordinates = [[ 0.4697,  0.0000,  0.00000 ],
                          [ 0.0000,  0.4697,  0.66667 ],
                          [ 0.5303,  0.5303,  0.33333 ],
                          [ 0.4135,  0.2669,  0.1191  ],
                          [ 0.2669,  0.4135,  0.547567],
                          [ 0.7331,  0.1466,  0.785767],
                          [ 0.5865,  0.8534,  0.214233],
                          [ 0.8534,  0.5865,  0.452433],
                          [ 0.1466,  0.7331,  0.8809  ]]

# Set up configuration
bulk_configuration = BulkConfiguration(
    bravais_lattice=lattice,
    elements=elements,
    fractional_coordinates=fractional_coordinates
    )

# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------

potentialSet = Tersoff_SiO_2007()
calculator = TremoloXCalculator(parameters=potentialSet)
bulk_configuration.setCalculator(calculator)

# -------------------------------------------------------------
# Local stress
# -------------------------------------------------------------
local_stress = LocalStress(bulk_configuration)
nlsave('Quartz_ls.nc', local_stress)
nlprint(local_stress)

local_stress.py

Notes

  • The LocalStress provides a measure how much each atom contributes to the overall stress tensor of the system. It does not represent a physical stress, in a strict sense, as the point particles do not have a finite volume. Therefore, in contrast to the Stress, the local stress is not given in units of energy per volume but in energy units.

  • The LocalStress is calculated by analytically decomposing the total stress tensor into local contributions of the individual atoms of the system. Therefore, the local stress can only be calculated for classical potentials with the TremoloXCalculator.

  • The local stress contributions of each atom sum up to yield the total stress tensor of the system

    \[\sigma = \frac{1}{V} \sum_i \sigma_i \, .\]
  • The local stress of each atom is composed of additive components arising from the pair-, triple-, and quadruple-interactions in the system.

    For pairwise interactions \(v_{ij}(\mathbf{r}_{ij})\) the local stress of atom \(i\) is calculated as

    \[\sigma_i^{\rm pair} = \sum_{(i,j) \in \mathcal{P}} -\frac{1}{2} \mathbf{F}_i^{ij}\mathbf{r}_{ij}^{T} + \sum_{(j,i) \in \mathcal{P}} \frac{1}{2} \mathbf{F}_i^{ji}\mathbf{r}_{ij}^{T} \, ,\]

    where \(\mathbf{F}_{k}^{ij} = - \frac{d}{d\mathbf{r}_k}v_{ij}\) is the force on atom \(k\) resulting form the interaction between atoms \(i\) and \(j\). The sum runs over all interactions pairs \(\mathcal{P}\).

    For triple and quadruple interactions the stress contributions are accordingly

    \[\sigma_i^{\rm triple} = -\frac{1}{2} \sum_{(i,j,k) \in \mathcal{T}} \left( \mathbf{F}_j^{ijk}\mathbf{r}_{ij}^{T} + \mathbf{F}_k^{ijk}\mathbf{r}_{ik}^{T} \right) + \frac{1}{2} \sum_{(j,i,k) \in \mathcal{T}} \mathbf{F}_i^{jik}\mathbf{r}_{ij}^{T} + \frac{1}{2} \sum_{(j,k,i) \in \mathcal{T}} \mathbf{F}_i^{jki}\mathbf{r}_{ij}^{T}\]

    and

    \[\begin{split}\begin{matrix} \sigma_i^{\rm quadruple} = < \, \frac{1}{2} \sum_{(i,j,k,m) \in \mathcal{Q}} \mathbf{F}_i^{ijkm}\mathbf{r}_{ij}^{T} \, + \, \frac{1}{2} \sum_{(j,i,k,m) \in \mathcal{Q}} \left( -\mathbf{F}_j^{jikm}\mathbf{r}_{ij}^{T} + (\mathbf{F}_j^{jikm} + \mathbf{F}_i^{jikm})\mathbf{r}_{ik}^{T} \right) \\ < \\ < + \, \frac{1}{2} \sum_{(j,k,i,m) \in \mathcal{Q}} \left( -(\mathbf{F}_j^{jkim} + \mathbf{F}_k^{jkim})\mathbf{r}_{ik}^{T} - \mathbf{F}_m^{jkim} \mathbf{r}_{im}^{T} \right) \, + \, \frac{1}{2} \sum_{(j,k,m,i) \in \mathcal{Q}} \mathbf{F}_i^{jkmi}\mathbf{r}_{im}^{T} \end{matrix}\end{split}\]

    Here, \(\mathcal{T}\) and \(\mathcal{Q}\) denote the sets of all interaction-triples and -quadruples, and \(\mathbf{F}_k^{\rm triple, quadruple} = - \frac{d}{d\mathbf{r}_k}v^{\rm triple, quadruple}\) is the force on particle \(k\) arising from a triple- or quadruple-potential \(v\).

    The extension to manybody potentials, such as EAMsetflPotential is carried out in a similar way.

  • In the current implementation, the long-range contributions in the CoulombSPME potential are not included in the local stress as they are evaluated in reciprocal space.

  • The local stress of a configuration can be visualized by opening the saved local stress object in the Viewer. To visualize the local stress tensor of each atom \(i\), you can select between the local pressure representation, i.e.

    \[p_i = -\frac{1}{3} (\sigma_i^{xx} + \sigma_i^{yy} + \sigma_i^{zz}) \, ,\]

    or the Frobenius norm of the tensor

    \[norm (\sigma_i) = \left[ \sum_{\alpha, \beta = \{x,y,z\}} (\sigma_i^{\alpha \beta})^2 \right]^{1/2} \, .\]

    By selecting the User defined option, you can choose which components should be included in the Frobenius norm.