# How is the enthalpy computed in gromacs?

**URL:** <https://gromacs.bioexcel.eu/t/how-is-the-enthalpy-computed-in-gromacs/8949>\
**Category:** User discussions\
**Created:** [April 21, 2024, 10:19pm UTC](https://gromacs.bioexcel.eu/t/how-is-the-enthalpy-computed-in-gromacs/8949 "2024-04-21T22:19:59Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julio1200](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@Julio1200](https://gromacs.bioexcel.eu/u/Julio1200)\
**Post date:** [April 21, 2024, 10:19pm UTC](https://gromacs.bioexcel.eu/t/how-is-the-enthalpy-computed-in-gromacs/8949/1 "2024-04-21T22:19:59Z")

</div>

GROMACS version: 2021.4-2  
GROMACS modification: Yes/No  
Hello, I’m trying to run MD simulations of liquid propanol in the NPT ensemble, and I’m a bit confused about my results. After the simulation, I computed the thermodynamic proprieties below using gmx energy:

## Energy Average Err.Est. RMSD Tot-Drift

Potential -20.5116 0.84 2.40346 -4.75479 (kJ/mol)  
Total Energy 14.1659 0.84 2.42722 -4.66579 (kJ/mol)  
Temperature 298.024 0.16 3.71291 0.764872 (K)  
Pressure -13.653 11 401.47 0.0591182 (bar)  
Volume 62.8428 0.47 1.26078 -2.81342 (nm^3)  
Density 794.311 5.8 15.1766 34.2912 (kg/m^3)  
Enthalpy 7086.76 420 1213.68 -2333.07 (kJ/mol)

The enthalpy is much larger than the total energy and the potential energy, and I would like why. Furthermore, gromacs also computed other thermodynamics properties, that are printed below:

Volume = 7.56896e-05 m^3/mol  
Enthalpy = 14.1735 kJ/mol  
Coefficient of Thermal Expansion Alpha\_P = 0.0289423 (1/K)  
Isothermal Compressibility Kappa = 6.14731e-09 (m^3/J)  
Adiabatic bulk modulus = 1.62673e+08 (J/m^3)  
Heat capacity at constant pressure Cp = 3989.33 J/(mol K)  
Cp-Cv = 3073.76 J/(mol K)

Now the enthalpy appear again, but with a very different value. Why there are two enthapies in gromacs?

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [April 23, 2024, 2:12pm UTC](https://gromacs.bioexcel.eu/t/how-is-the-enthalpy-computed-in-gromacs/8949/2 "2024-04-23T14:12:34Z")

</div>

That looks strange. Do you get the same with a supported version of GROMACS?  
You say that you calculated the values in the upper table using `gmx energy`. How did you calculate the values below?

---

<div class="post-metadata">

**Author:** ![Julio1200](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@Julio1200](https://gromacs.bioexcel.eu/u/Julio1200)\
**Post date:** [April 23, 2024, 10:13pm UTC](https://gromacs.bioexcel.eu/t/how-is-the-enthalpy-computed-in-gromacs/8949/3 "2024-04-23T22:13:05Z")

</div>

Hi MagnusL. What would be a supported version? The values below were computed also with gmx energy. When I use gmx energy, gromacs automatically compute all these values.

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [April 24, 2024, 6:27am UTC](https://gromacs.bioexcel.eu/t/how-is-the-enthalpy-computed-in-gromacs/8949/4 "2024-04-24T06:27:34Z")

</div>

2023 and 2024 are supported, see [https://manual.gromacs.org/current/release-notes/index.html](https://manual.gromacs.org/current/release-notes/index.html) for more information.

Thanks for the clarification. But I still don’t understand fully. I don’t think `gmx energy` calculates anything automatically. And it looks strange that there are two volume and enthalpy outputs. Could you copy and paste the `gmx energy` command you are running, all output from the command (i.e. what observables you can choose from), the observables you choose to analyse as well as the results from the command?

---

<div class="post-metadata">

**Author:** ![Julio1200](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@Julio1200](https://gromacs.bioexcel.eu/u/Julio1200)\
**Post date:** [April 24, 2024, 9:04am UTC](https://gromacs.bioexcel.eu/t/how-is-the-enthalpy-computed-in-gromacs/8949/5 "2024-04-24T09:04:35Z")

</div>

Thanks, I will try to install the latest version of gromacs and run again. To comando I used was

gmx energy -f md.edr -fluct\_props -nmol 500 -o prop\_md.xvg

and I selected potencial, temperature, total-energy, density, enthalpy, volume and pressure. The output was (it’s a bit different because it’s another test, but the problem continue):

```
          :-) GROMACS - gmx energy, 2021.4-Ubuntu-2021.4-2 (-:

                        GROMACS is written by:
 Andrey Alekseenko Emile Apol Rossen Apostolov     
     Paul Bauer Herman J.C. Berendsen Par Bjelkmar       
   Christian Blau Viacheslav Bolnykh Kevin Boyd        
 Aldert van Buuren Rudi van Drunen Anton Feenstra      
Gilles Gouaillardet Alan Gray Gerrit Groenhof      
   Anca Hamuraru Vincent Hindriksen M. Eric Irrgang      
  Aleksei Iupinov Christoph Junghans Joe Jordan        
Dimitrios Karkoulis Peter Kasson Jiri Kraus        
  Carsten Kutzner Per Larsson Justin A. Lemkul     
   Viveca Lindahl Magnus Lundborg Erik Marklund       
    Pascal Merz Pieter Meulenhoff Teemu Murtola       
    Szilard Pall Sander Pronk Roland Schulz       
   Michael Shirts Alexey Shvetsov Alfons Sijbers      
   Peter Tieleman Jon Vincent Teemu Virolainen     
 Christian Wennberg Maarten Wolf Artem Zhmurov       
                       and the project leaders:
    Mark Abraham, Berk Hess, Erik Lindahl, and David van der Spoel

```

Copyright (c) 1991-2000, University of Groningen, The Netherlands.  
Copyright (c) 2001-2019, The GROMACS development team at  
Uppsala University, Stockholm University and  
the Royal Institute of Technology, Sweden.  
check out [http://www.gromacs.org](http://www.gromacs.org) for more information.

GROMACS is free software; you can redistribute it and/or modify it  
under the terms of the GNU Lesser General Public License  
as published by the Free Software Foundation; either version 2.1  
of the License, or (at your option) any later version.

GROMACS: gmx energy, version 2021.4-Ubuntu-2021.4-2  
Executable: /usr/bin/gmx  
Data prefix: /usr  
Working dir: /home/leonardo/Desktop/doutorado/Calc\_propanol/MD\_propanol\_liquido  
Command line:  
gmx energy -f md.edr -fluct\_props -nmol 500 -o prop\_md.xvg

Opened md.edr as single precision energy file

## Select the terms you want from the following list by selecting either (part of) the name or the number or a combination. End your selection with an empty line or a zero.

1 Bond 2 Angle 3 Ryckaert-Bell. 4 LJ-14  
5 Coulomb-14 6 LJ-(SR) 7 Disper.-corr. 8 Coulomb-(SR)  
9 Coul.-recip. 10 Potential 11 Kinetic-En. 12 Total-Energy  
13 Conserved-En. 14 Temperature 15 Pres.-DC 16 Pressure  
17 Constr.-rmsd 18 Box-X 19 Box-Y 20 Box-Z  
21 Volume 22 Density 23 pV 24 Enthalpy  
25 Vir-XX 26 Vir-XY 27 Vir-XZ 28 Vir-YX  
29 Vir-YY 30 Vir-YZ 31 Vir-ZX 32 Vir-ZY  
33 Vir-ZZ 34 Pres-XX 35 Pres-XY 36 Pres-XZ  
37 Pres-YX 38 Pres-YY 39 Pres-YZ 40 Pres-ZX  
41 Pres-ZY 42 Pres-ZZ 43 #Surf\*SurfTen 44 T-System  
45 Lamb-System

Last energy frame read 5000 time 1000.000

Statistics over 500001 steps [0.0000 through 1000.0000 ps], 7 data sets  
All statistics are over 5001 points (frames)

## Energy Average Err.Est. RMSD Tot-Drift

Potential -20.1634 0.031 0.509918 0.16298 (kJ/mol)  
Total Energy 14.525 0.031 0.659254 0.160342 (kJ/mol)  
Temperature 298.068 0.03 3.43175 -0.0226725 (K)  
Pressure 6.17727 10 392.094 -53.3204 (bar)  
Volume 62.7184 0.02 0.269243 0.0483782 (nm^3)  
Density 795.568 0.25 3.41745 -0.609909 (kg/m^3)  
Enthalpy 7266.29 15 329.632 80.1737 (kJ/mol)

You may want to use the -driftcorr flag in order to correct  
for spurious drift in the graphs. Note that this is not  
a substitute for proper equilibration and sampling!

Temperature dependent fluctuation properties at T = 298.068.

Heat capacities obtained from fluctuations do _not_ include  
quantum corrections. If you want to get a more accurate estimate  
please use the g\_dos program.

WARNING: Please verify that your simulations are converged and perform  
a block-averaging error analysis (not implemented in g\_energy yet)  
Volume = 7.55398e-05 m^3/mol  
Enthalpy = 14.5326 kJ/mol  
Coefficient of Thermal Expansion Alpha\_P = 0.000594451 (1/K)  
Isothermal Compressibility Kappa = 2.80862e-10 (m^3/J)  
Adiabatic bulk modulus = 3.56046e+09 (J/m^3)  
Heat capacity at constant pressure Cp = 294.188 J/(mol K)  
Cp-Cv = 28.3289 J/(mol K)

++++ PLEASE READ AND CITE THE FOLLOWING REFERENCE ++++  
M. P. Allen and D. J. Tildesley  
Computer simulation of liquids  
Oxford Science Publications 1 (1987) pp. 1  
-------- -------- — Thank You — -------- --------

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [April 24, 2024, 1:24pm UTC](https://gromacs.bioexcel.eu/t/how-is-the-enthalpy-computed-in-gromacs/8949/6 "2024-04-24T13:24:36Z")

</div>

I can reproduce the error in GROMACS 2021.4, but it works fine in version 2022 (at least from version 2022.3). The problem seems to be inconsistent treatment of -nmol.

---

<div class="post-metadata">

**Author:** ![Julio1200](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@Julio1200](https://gromacs.bioexcel.eu/u/Julio1200)\
**Post date:** [April 25, 2024, 11:37am UTC](https://gromacs.bioexcel.eu/t/how-is-the-enthalpy-computed-in-gromacs/8949/7 "2024-04-25T11:37:41Z")

</div>

I installed 2024.1 and run the simulation, and it worked also! There is no more inconsistencies. Now I will use this version of gromacs. Thank you so much!

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [April 25, 2024, 12:53pm UTC](https://gromacs.bioexcel.eu/t/how-is-the-enthalpy-computed-in-gromacs/8949/8 "2024-04-25T12:53:39Z")

</div>

Good to hear it’s working. I should I have been clearer, though. You don’t need to rerun the simulations. It’s only the analysis that is different (in this specific aspect).

---

<div class="post-metadata">

**Author:** ![Julio1200](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@Julio1200](https://gromacs.bioexcel.eu/u/Julio1200)\
**Post date:** [April 25, 2024, 9:26pm UTC](https://gromacs.bioexcel.eu/t/how-is-the-enthalpy-computed-in-gromacs/8949/9 "2024-04-25T21:26:24Z")

</div>

ah ok, thanks again!

---

<div class="post-metadata">

**Author:** ![dspoel](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/dspoel/32/64_2.png) [@dspoel](https://gromacs.bioexcel.eu/u/dspoel)\
**Post date:** [April 12, 2025, 8:10pm UTC](https://gromacs.bioexcel.eu/t/how-is-the-enthalpy-computed-in-gromacs/8949/10 "2025-04-12T20:10:53Z")

</div>

Unfortunately I the code for computing the fluctuations is not correct. This has been broken for a long time, at least since 4.6.7. I started reimplementing this code long ago and Mark Abraham worked on it as well, but my new code never made it into official gromacs. I happened to stumble over these problems when I tried to calculates alpha\_P and kappa\_T.
