# Enthalpy vs. Energy

Hello All,

This is a follow up of my earlier post about discrepancy between energy and enthalpy. I have two cases for comparison: (1) Energy minimization with CG and (2) MD run for 10000 steps at 1e-6 K. My expectation is to see energy = enthalpy in both simulations. As suggested by the group earlier, with CG I use

velocity all set 0.0 0.0 0.0 units box

Still I don’t see the expected results. With MD I do see as expected.

For more details, I am presenting my scripts and outputs here. I look forward to expert comments.

Hello All,

This is a follow up of my earlier post about discrepancy between energy and
enthalpy. I have two cases for comparison: (1) Energy minimization with CG
and (2) MD run for 10000 steps at 1e-6 K. My expectation is to see energy =
enthalpy in both simulations. As suggested by the group earlier, with CG I
use

velocity all set 0.0 0.0 0.0 units box

Still I don't see the expected results. With MD I do see as expected.

For more details, I am presenting my scripts and outputs here. I look

the explanation is simple.

your minimization stops with a larger
the residual force is responsible
for the difference between enthalpy
and total energy.

axel.

two sections of documentation of the "min_modify" command:

The choice of line search algorithm for the cg and sd minimization
styles can be selected via the line keyword. The default backtracking
search is robust and should always find a local energy minimum.
However, it will "converge" when it can no longer reduce the energy of
the system. Individual atom forces may still be larger than desired at
this point, because the energy change is measured as the difference of
two large values (energy before and energy after) and that difference
may be smaller than machine epsilon even if atoms could move in the
gradient direction to reduce forces further.

By contrast, the quadratic line search algorithm tries to reduce the
forces to zero, while guaranteeing that the energy changes is not
positive (uphill). For some systems, it may also be more efficient
than the backtracking algorithm by requiring fewer energy/force
evaluations. The forcezero line search algorithm is similar to

axel.

Thank you Axel.

The documentation said that ‘line’ is the option for cg and sd. I tried all these options :

min_style cg
Energy is not equal to enthalpy

min_style cg
min_modify line forcezero
This option gives : “ERROR Illegal min_modify command”

min_style sd
Energy is not equal to enthalpy

min_style sd
min_modify line forcezero
This option gives : “ERROR Illegal min_modify command”

Alankar

Thank you Axel.

The documentation said that 'line' is the option for cg and sd. I tried all
these options :

min_style cg
Energy is not equal to enthalpy

min_style cg
min_modify line forcezero
This option gives : "ERROR Illegal min_modify command"

min_style sd
Energy is not equal to enthalpy

min_style sd
min_modify line forcezero
This option gives : "ERROR Illegal min_modify command"

so what is this supposed to say?

axel.

Hello All,

My purpose is not to annoy people. Please ignore my email if you feel annoyed.

I am working on a problem in which I need to determine exact value of enthalpy that is of the order of 10- 60 meV aka 0.01 - 0.06 eV with applied pressure. In case of no external pressure, the energy should be equal to enthalpy. MD method is giving the desired results and now I am looking for options within CG / SD if possible.

I am working on suggestions given by the group and update the group about output. I understand the limitations of different operating system etc. Also, I am relatively new to atomistic simulations.

Seems like the discrepancy of energy and enthalpy comes from residual forces. Using CG or SD, the energy is minimized even though the residual forces are not zero locally somewhere in the simulations cell.

I tried the following options with CG and SD

min_style cg
This gives the same discrepancy : Energy is not equal to enthalpy

min_style cg
min_modify line forcezero
This option gives : “ERROR Illegal min_modify command” Why ?

min_style sd
result = Energy is not equal to enthalpy

min_style sd
min_modify line forcezero
This option gives : “ERROR Illegal min_modify command” . Why ?

I would love to hear about what needs to be modified for using “min_modify line forcezero”. Also, whether CG or SD are capable of solving my problem or I need to stick to MD method ?.

Regards,

Alankar

Hello All,

My purpose is not to annoy people. Please ignore my email if you feel
annoyed.

it would be less annoying, if you would
pay better attention to what you got told.

I am working on a problem in which I need to determine exact value of
enthalpy that is of the order of 10- 60 meV aka 0.01 - 0.06 eV with applied
pressure. In case of no external pressure, the energy should be equal to

i already explained, that with *any* numerical method,
exact identity is an impossibility. the *exact* value of
your total energy *will* depend on the order of how it
is being summed up, since addition and and multiplication
in floating point math do *not* commute. so to expect
identity is ignoring fundamental properties of the
method you are using, to say the least.

enthalpy. MD method is giving the desired results and now I am looking for
options within CG / SD if possible.

so if you get what you want with simulated annealing,
why bother with minimization? as i wrote before, you
are trying to converge a property beyond a meaningful
threshold. have you considered trying to understand
why rather than insisting on something that you got
told to be pointless?

I am working on suggestions given by the group and update the group about
output. I understand the limitations of different operating system etc.

no, you don't understand. this has *nothing* to do
with the operating system, but is *general* issue
of the propagation of truncation errors when doing
floating point math.

Also, I am relatively new to atomistic simulations.

Seems like the discrepancy of energy and enthalpy comes from residual
forces. Using CG or SD, the energy is minimized even though the residual
forces are not zero locally somewhere in the simulations cell.

I tried the following options with CG and SD

min_style cg
This gives the same discrepancy : Energy is not equal to enthalpy

but by how much?? identity is impossible.
you have only at the most 17 digits accuracy
in double precision floating point math. since
you are summing up derived properties of
different magnitude, probably significantly less.

min_style cg
min_modify line forcezero
This option gives : "ERROR Illegal min_modify command" Why ?

i *already* told you: because you have an outdated
or miscompiled LAMMPS executable.

min_style sd
result = Energy is not equal to enthalpy

again, by how much?

min_style sd
min_modify line forcezero
This option gives : "ERROR Illegal min_modify command" . Why ?

I would love to hear about what needs to be modified for using "min_modify
line forcezero". Also, whether CG or SD are capable of solving my problem or
I need to stick to MD method ?.

primarily, you need to rethink what is the meaning of error
and accuracy when doing floating point math. insisting on
getting bitwise identical results with these two scenarios
is ignoring the realities of computer simulations. perhaps
you should port LAMMPS to "bc", which can do arbitrary
precision math (at a cost, of course).

axel.

I thought I was clear when I mentioned 0.01 - 0.06 eV. CG is giving a difference starting from 2nd place of decimal. MD is good even upto 10 places.

“a property beyond a meaningful threshold” has its own definition relevant to problem being addressed.

May be the take home is that “CG is not good for the problem I am trying to solve”.

Thanks,

Alankar

I thought I was clear when I mentioned 0.01 - 0.06 eV. CG is giving a
difference starting from 2nd place of decimal. MD is good even upto 10
places.

without knowing anything about the model, units, settings,
density, number of atoms, this is useless information as you
are only presenting an absolute number.

"a property beyond a meaningful threshold" has its own definition relevant