vibeqc.compute_stress_tensor¶
- vibeqc.compute_stress_tensor(system, gradient)[source]¶
Force virial – NOT the true periodic stress.
Warning
This is only the atomic-force virial
s_{ij} = -(1/V).S_A R_{A,i}.F_{A,j}. It is not the periodic stress(1/V).dE/de: it omits the explicit lattice/Ewald strain dependence and the Gaussian-basis Pulay stress, and it assumes the atoms scale with the strain. On H₂/STO-3G it comes out opposite in sign to the truedE/de. Do not use it to relax the cell or report a stress. For cell relaxation usevibeqc.bipole_optimize.relax_cell()(energy-only Nelder-Mead) orrelax_cell_gradient()(L-BFGS-B on the exact FD strain gradient); both are correct by construction. This helper is retained only for the force-virial diagnostic.- Computes the 3x3 force virial in Ha/bohr^3:
s_{ij} = -(1/V) . S_A R_{A,i} . F_{A,j}
where R_A are atomic positions and F_A = -dE/dR_A.
- 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^3.
- Return type:
ndarray shape (3, 3)