[lammps-users] Computing potential energy

Dear LAMMPS users,

I'm trying to calculate numerically the Hessian in LAMMPS. I'm trying
to write a command to calculate it. However. this requires me to
compute the PE for each configuration of the atoms and I've realized
that compute_pe.cpp is only updated when thermo is updated.

Does anyone know how the PE can be computed instantaneously?

Any assistance or advice will be greatly appreciated.

Regards,
Zhun-Yong Ong
University of Illinois

Dear LAMMPS users,

I'm trying to calculate numerically the Hessian in LAMMPS. I'm trying
to write a command to calculate it. However. this requires me to
compute the PE for each configuration of the atoms and I've realized
that compute_pe.cpp is only updated when thermo is updated.

Does anyone know how the PE can be computed instantaneously?

have you tried using "run 0" to have a full calculation
without propagation?

cheers,
   axel.

Hi Axel,

I tried that before emailing the mailing list. It does work but it's
not particularly efficient if you have a system of hundreds of atoms
and want to calculate the PE of thousands of atomic configurations. :frowning:

Zhun-Yong

Hi Axel,

I tried that before emailing the mailing list. It does work but it's
not particularly efficient if you have a system of hundreds of atoms
and want to calculate the PE of thousands of atomic configurations. :frowning:

if you want specific help for a specific problem, it is best to
provide as much useful detail about the problem, so that you can
get a detailed answer.

so how do you generate your thousands of atomic configurations?
or rather, please explain in more detail the procedure that you
have in mind and how you expect LAMMPS to handle it.

cheers,
   axel.

There's not a simple answer to this Q. When
LAMMPS is computing forces for a timestep, it
knows if energies are needed on that timestep,
and sets a flag accordingly. The way the PE compute
does this, is by setting peflag = 1 in its constructor.
If you're writing a new compute, you could do the same,
but if you are doing something different, then you
would need to trigger the pairwise energy evaluation another
way.

Steve

Hi Steve,

Thanks for your reply.

If I understand the source code correctly, a compute based on
compute_scalar of the PE compute does not calculate the PE per se but
instead returns what was collected with ev_tally.

Over the weekend, I wrote a command (based on a modification of
run.cpp) to calculate the energy for different atomic configurations.
It works by calling the methods in update->integrate and setting the
parameter eflag to 1. So far, it has worked fine for me although the
approach is somewhat inelegant.

I wonder if there is any way to trigger the PE evaluation without
having to call update->integrate.

Zhun-Yong

I wonder if there is any way to trigger the PE evaluation without
having to call update->integrate.

What you did sounds OK. There is no way to trigger PE tallying
(and thus PE computation) without calling all the force routines
(pair, bond, etc) with eflag set. So if that's what you did via
update->integrate, then that's reasonable.

Steve