Skip to content

Conversation

@d-rel82
Copy link

@d-rel82 d-rel82 commented Nov 13, 2025

Summary

This pull request adds functionality to output the stress tensor alongside verbose output, enabling viscosity calculations using the Green-Kubo or Einstein relations.

Details

  • Introduces a new keyword:

    • SAVE-STRESS controls whether the stress tensor is written during MD simulation.
  • Writes components to the main output (.out) file as additional columns next to verbose out.

  • Updates existing source files to integrate new functionality:

    • MOD_mdstuf.f includes new logical variable stresave.
    • mdinit.f checks if the SAVE-STRESS keyword is in the .key file.
    • pressure.f adds logic to calculate the stress tensor in NVT/NVE ensembles.
    • mdstat.f writes components to .out file.

Sample Output

Appears in the .out file:

SAVE-STRESS: The units of the stress tensor components are Atmospheres

 --- Tinker-HP: loading restart file for EtOH_rep01 system ---

 Molecular Dynamics Trajectory via Velocity Verlet Algorithm
     MD Step     E total   E Potential     E Kinetic       Temp       Pres     Stress(xx)     Stress(yy)     Stress(zz)     Stress(xy)     Stress(yz)     Stress(xz)
         1     4052.2025    -3911.2297     7963.4322     296.87     -65.05      -505.6220      -377.1029       687.5805      -271.1346         9.4270        49.8107
         2     4047.1898    -3968.8755     8016.0652     298.84    -141.67       -85.8715      -595.8872       256.7504      -161.0730       337.0726       280.8896
         3     4043.7029    -4012.5023     8056.2053     300.33    -257.10       159.3216      -777.0220      -153.5985      -102.2136       467.6862       362.6684
         4     4045.1988    -3993.1576     8038.3564     299.67    -319.47       241.5343      -834.2966      -365.6566       -84.6812       354.1359       260.8619
         5     4050.1036    -3937.8502     7987.9538     297.79    -335.75       205.0718      -809.6037      -402.7269       -77.7163        92.4782        65.1255

Performance

  • Adds ~4% overhead.

Notes

Manuscript in preparation describing these modifications and a companion toolkit for viscosity calculations.

Happy to adjust anything to better align with project conventions. Thanks for your time and consideration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant