====== Stress ====== ---- To enable the calculation of the stress tensor you have to add ''stress'' to the compilation options of //potfit//. The stress tensor has to be given in the [[config:main|configuration file]] with the prefix ''#S''. If no ''#S'' line is found for a configuration, then the calculation of stresses is disabled for this configuration. === Stress calculation === //potfit// and [[http://imd.itap.physik.uni-stuttgart.de|IMD]] calculate the virial stress, which is based on a generalization of the virial theorem of Clausius1 for gas pressure. It can be written as $$\boldsymbol\sigma^{\text{virial}} = \frac{1}{2\Omega}\sum_i\sum_{j\neq i}\boldsymbol r_{ij}\otimes\boldsymbol f_{ij}$$ where $\Omega$ is the total volume, $i$ and $j$ the atomic indices, $\boldsymbol r_{ij}=\boldsymbol r_j-\boldsymbol r_i$ and $\boldsymbol f_{ij}$ the interatomic force applied on atom $i$ by atom $j$, $$\boldsymbol f_{ij}=\frac{\partial\phi(r_{ij})}{\partial r_{ij}}\frac{\boldsymbol r_{ij}}{r_{ij}}.$$ === Target function === The deviation of the stress tensor components is added to the [[algorithms:main|target function]] like the forces and energies $$Z_F(\boldsymbol\xi)= \sum_{k=1}^{3N}u_k(F_k(\boldsymbol\xi)-F_k^0)^2 + \sum_{l=1}^{M}w_E(E_l(\boldsymbol\xi)-E_l^0)^2 + \sum_{l=1}^{6M}w_S(S_l(\boldsymbol\xi)-S_l^0)^2$$ with the stress weight $$w_S.$$ ----- 1. Clausius R. J. E.: On a mechanical theorem applicable to heat. //Phil. Mag.// **40** 122–7, 1870 [[http://www.tandfonline.com/doi/abs/10.1080/14786447008640370|Link]]