rerun produces inconsistent values for (shifted) virial when external force is used
The attached tpr files along with script run a system with low density walls
(small effect on the system) and then rerun the same trajectory on the same input data. Then the virial xx/yy/zz components on both runs' edr files is computed using g_energy giving different virial values (which is clearly wrong as far as I can tell).
Using an external force like e-field, walls or similar force in z only causes weird deviations in the (shifted) virial (see attached log files), all other virial contributions converge to sensible (and very similar) values. The shifted virial contribution also seems to be responsible for the inconsistent rerun values.
#3 Updated by Berk Hess over 10 years ago
I have found that the difference is caused by the constraint
contribution to the virial.
When you set the env var GMX_CONSTRAINTVIR you will get the force
and the constraint contributions to the virial in the energy file.
The force parts match for original and rerun, whereas the constraint
part is zero for rerun.
I'll have to figure out what goes wrong there.
But I think the everything (potential, forces, etc) is correct,
except for the (constraint) virial output of the rerun.