# Some (fairly arbitrary) external stress in atomic units:
external_stress='0.001 0.0003 -0.0007 0.0005 0.0004 0.001'
# The external stress applied here will result in pretty large deformations.
# Since the external stress energy term becomes more and more approximate the
# larger the deformation from the initial cell is, after the first optimization,
# one should run a second geometry optimization starting from the converged
# results of the first one.
# It is always good practice to validate the optimization under external stress
# by computing the stress tensor of the final optimized geometry: the stress
# tensor at the optimized geometry should match the external stress applied during
# the optimization, but with reversed signs.
AMS_JOBNAME=first_go $ADFBIN/ams << eor
B 0.0 0.0 0.0
N 0.905 0.905 0.905
0.0 1.81 1.81
1.81 0.0 1.81
1.81 1.81 0.0
SuperCell 2 2 2
# The convergence threshold should be samller than the applied external stress:
# We want the external stress to break the symmetry:
# The second geometry optimization starting from the results of the first one:
AMS_JOBNAME=second_go $ADFBIN/ams << eor
# In the final calculation we simply compute the stress tensor of the final
# geometry, which should be the opposite of the external stress tensor applied
# during the optimization.
AMS_JOBNAME=sp $ADFBIN/ams << eor
echo "Applied external stress tensor (order: xx,yy,zz,yz,xz,xy):"
echo "Resulting final stress tensor:"
$ADFBIN/adfreport sp.results/uff.rkf -r "AMSResults%StressTensor#12.6f##3"