Finite-Difference Calculator

class ase.calculators.fd.FiniteDifferenceCalculator(calc: BaseCalculator, eps_disp: float = 1e-06, eps_strain: float = 1e-06)[source]

Wrapper calculator using the finite-difference method.

The forces and the stress are computed using the finite-difference method.

Added in version 3.24.0.

Parameters:
  • calc (BaseCalculator) – ASE Calculator object to be wrapped.

  • eps_disp (float, default 1e-6) – Displacement used for computing forces.

  • eps_strain (float, default 1e-6) – Strain used for computing stress.

ase.calculators.fd.calculate_numerical_forces(atoms: Atoms, eps: float = 1e-06, iatoms: Iterable[int] | None = None, icarts: Iterable[int] | None = None) ndarray[source]

Calculate forces numerically based on the finite-difference method.

Parameters:
  • atoms (Atoms) – ASE Atoms object.

  • eps (float, default 1e-6) – Displacement.

  • iatoms (Optional[Iterable[int]]) – Indices of atoms for which forces are computed. By default, all atoms are considered.

  • icarts (Optional[Iterable[int]]) – Indices of Cartesian coordinates for which forces are computed. By default, all three coordinates are considered.

Returns:

forces – Forces computed numerically based on the finite-difference method.

Return type:

np.ndarray

ase.calculators.fd.calculate_numerical_stress(atoms: Atoms, eps: float = 1e-06, voigt: bool = True) ndarray[source]

Calculate stress numerically based on the finite-difference method.

Parameters:
  • atoms (Atoms) – ASE Atoms object.

  • eps (float, default 1e-6) – Strain in the Voigt notation.

  • voigt (bool, default True) – If True, the stress is returned in the Voigt notation.

Returns:

stress – Stress computed numerically based on the finite-difference method.

Return type:

np.ndarray