[lammps-users] Static value of pe per atom


I'm trying to compute the static value and dynamic value of a compute
(pe/atom and ke/atom) in LAMMPS. However, LAMMPS keeps giving me a
'segmentation fault' when I try to run the below script. This problem
crops up for the newest version of LAMMPS (26Jun08) as well as with
older versions. The problem is due to the compute pe/atom. Is this a
software bug?

The reason this script is crashing is you are attempting
something which LAMMPS can't do. This line:

variable PE2 equal ${PE}

tries to evaluate the per-atom energy of an atom,
but it will do it in between 2 runs when those statistics
do not exist. That can only be done during a run when
energies/forces are being evaluated. So the only question
is how to make LAMMPS generate an error when you
attempt to do this, rather than crash (which it shouldn't).

I'll post a patch for the error message later today.


Hi Steve,

Thanks for replying.

I have a related question. In LAMMPS, we can assign global variables
to be either static or dynamic. The static assignment of global
variables allows us to store the numerical value of some particular
quantity at a specific timestep. However, I don't think there is a
straightforward way we can do the same for per atom variables. Is
there any way we can capture the static values of per atom variables?


2008/7/9 Steve Plimpton <[email protected]...>:

I'm not sure what you mean by static vs dynamic. You could
always write a fix to grab whatever quantity you want at a certain
timestep and store it internal to the fix, to do some computation
you want.


Take this code fragment for example:

variable xx equal x[1]
variable xi equal $x
run 10
variable xf equal $x

You can grab the static values of xx, a scalar variable, at any point
of the simulation. However, this cannot be done for per atom
variables. You cannot grab and store the static values of, say, the x
postion of all the atoms.


2008/7/10 Steve Plimpton <[email protected]...>:

There's no easy way to save the per-atom state of some
variable(s) for an arbitrary amount ot time with the variable.
Where would it be stored in a parallel code? The quantities
are associated with atoms and atoms move from processor
to processor. There are fixes (like msd) which store
the initial position of each atom, so they can compute
a displacement. Also see the fix coord/original command.

So you could write a fix to do what you want and it could
call a variable, but the fix would do the storing, not the variable.