Difference between the derivative of potential energy and virial stress

Dear all

I calculated deformation energy (potential, pair, bond, angle, dihedral E) and corresponding stress via ‘compute per atom stress’.

From the mechanical sense, the derivative of each energy should be equal with the stress outputs, but it does not match.

( stress = 1/Volume * d(potential E)/d(strain))

That is, elastic modulus cannot be derived by the second derivative of potential energy.

Does anyone comment on this problem?

Thank you