[lammps-users] ComputePEAtom

hi
  I while back, I believe Steve P. gave Jon Z. some instructions on how to utilize ComputePEAtom inside a lammps package. I have the code Jon wrote and I cannot find the instructions on the mailing list (perhaps they were off-line).

  The issue is : when I use the following code inside a compute ::compute_vector

lmp->force->pair->compute(2,0);
char * list[3] = {"heat_fluxPE","all","pe/atom"};
ComputePEAtom atomPE(lmp,3,list);
atomPE.init(); // does nothing
atomPE.compute_peratom();
....
double pe = atomPE.scalar_atom[i];

I get the same total pe for the system as what is output by thermo, but the system energy blows up in the exponential way that is characteristic of something being added twice or multiplied by a factor.

Without the first line:

lmp->force->pair->compute(2,0);

the system is stable but the value of pe does not change.

I fear I am not using this functionality properly (e.g. should the ComputePEAtom object be constructed once, upon initialization) or that it was not designed to be reused in code outside the integrators. On this point, I tried to trick the code by leaving the compute(2,0) out and in the input requesting :

compute peatom all pe/atom

(so that eflag would be set appropriately) but this resulted in a static value of pe in the compute.

thanks,
Reese

I'm not sure what you're trying to do, but
in principle, the Verlet integrator will set
eflag/vflag each step (via integrate:ev_set())
when it calls pair->compute(),
if your compute needs per-atom energy.
So you shouldn't have to invoke it within
your compute. Which would also be
cheaper since pair->compute() is expensive.

Steve