vibeqc.compute_stress_tensor

vibeqc.compute_stress_tensor(system, gradient)[source]

Force-based stress tensor from atomic gradients.

Computes the 3×3 stress tensor in Ha/bohr³:

σ_{ij} = -(1/V) · Σ_A R_{A,i} · F_{A,j}

where R_A are atomic positions and F_A = -dE/dR_A. The energy derivative w.r.t. strain is: dE/dε_{ij} = V · σ_{ij}.

Parameters:
  • system (PeriodicSystem) – The periodic system (provides lattice + atomic positions).

  • gradient ((n_atoms, 3) ndarray) – Atomic gradient in Ha/bohr (negative of forces).

Returns:

Stress tensor in Ha/bohr³.

Return type:

ndarray shape (3, 3)