[lammps-users] Elastic constants

The reason deform+npt is wrong is that if you slightly compress a sample
(from it's zero pressure state), either isothermally or adiabatically, the
average pressure should increase. Imposing fix NPT will *tend* to suppress
this pressure increase. I say tend, because it is actually not clear to me
what exactly would happen, since LAMMPS never intended these two fixes to be
used together. It would be a little like watching the fight between king
kong and the dinosaur.

What I suggested before was also not quite right. You need to sample the
relevant stress component (e.g. Pxy) during *equilibrated* NVT simulations,
before and after imposing an xy deformation. How you achieve the deformation
is not important, as long as you equilibrate afterwards. In the snippet
below taken from my T=0 script, I deform the box using displace_box. For
you, pxyneg and pxy0 would have to be computed as averages over equilibrated
NVT simulations.