LAMMPS and GROMACS gives different PE values on energy minimization

Hi all,

I am trying to simulate SPC/E water in LAMMPS. I am comparing GROMACS and LAMMPS energy minimization to see if they both give same/similar energy. In my test with 500 SPC/E waters, the energies were different. So I tested EM on just one water molecule in vacuum. They both give different answers. I am attatching the folders that I used for comparing and all the data I generated as an example to test (the files should run directly without any need for any other file)

Can someone tell me if its not correct to compare the two softwares? Or what might be causing this disparity?

Thank you so much.

Best regards,
Ved (158 Bytes) (164 Bytes)

The absolute values of potential energies in classical models are arbitrary. What matters are potential energy differences and (even more importantly) forces.

It is non-trivial to make sure to have the exact same forces with different ways of handling long-range electrostatics. There will be some small differences due to details of the implementation (e.g. implicit tabulation of real space Coulomb in LAMMPS, approximation to the square root and vectorization in Gromacs). Also, minimization algorithms are can easily diverge between implementations, so comparing MD without a thermostat is more reliable.

Also, you didn’t say how different the numbers were.


These look empty.

I remember doing similar comparison in the past, and the agreement was reasonably good between GROMACS and LAMMPS for simple water models (i.e. at least the first digits of the energy were the same).


Hi Alex,

This was not known to me before, thanks a lot for sharing this information. The numbers were supposed to be included in the files I shared, but they were unfortunately empty. I will include the numbers in this message.


   Energies (kJ/mol)
        LJ (SR)   Coulomb (SR)   Coul. recip.      Potential Pressure (bar)
    0.00000e+00   -3.58577e+01    8.26677e+00   -2.75910e+01    1.25733e+01


   Step         PotEng         TotEng         E_bond        E_angle          Fmax     
         0   36.412785      36.412785      0              0              614.51916    
         1   0.057203929    0.057203929    0              0              11.611913    
         2   0.014355604    0.014355604    0              0              1.8474291    
         3   0.014000422    0.014000422    0              0              0.96704998 

Thanks and regards,

Hi Simon,

Thank you for your reply. I am sorry for attatching empty files. I have attatched the correct files to this message.

The numbers being similar is promising.

Thank you and regards,
gmx.tar.xz (10.5 KB)
lammps.tar.xz (3.4 KB)

I can’t comment on the energy values, but your inputs contain some weird parameters, like a very odd cutoff of 5 Angstroms for all the interactions, and also very weird masses for oxygen and hydrogen in the Gromacs parameters (9.95140 and 4.03200 g/mol ?). Also, the bond and angle rigidity were specified in the LAMMPS files, but not used because of the shake. Was this intentional? Doesn’t it affect the energy values?

If you really want to compare LAMMPS and GROMACS, you need to double-check every single parameters and commands, and also clean the files and remove all unnecessary commands.


You are right. I am surprised myself I let them skip. I changed them to the correct values:

opls_116  OW  8        15.999  -0.8476  A        3.16557e-01  6.50194e-01
opls_117  HW  1        1.008  0.4238   A        0.00000e+00  0.00000e+00

The energy values are still the same. I think this is fine because there is only one water molecule in vacuum and I am doing energy minimization.

A single dipole molecule in a big periodic box is pretty much the worst case for comparing between LAMMPS and GROMACS. They use different algorithms for periodic electrostatics (PME vs P3M). The electrostatic mesh chosen will also be quite sensitive to choice of accuracy in a system with such small total charge yet highly localised. Bear in mind that the long-range electrostatics algorithms used in both LAMMPS and GROMACS are optimised for random distributions of equal charges (salts and proteins in water), not vacuum charge spikes.