When implementing a new compute for pe/molecule, I've run into a snag.
I've attached ke/molecule for everyone should it be useful for you and
verified it against the tradition ke per group calculation.
pe/atom provides the per-atom potential energy, so a simple sum over
the molecules should be sufficient. it should look something like the
attached code below, where emol is the per-molecule energies, energy
is the final per-atom energies. how do i get this as the output to the
compute in global vector form? i need to spend more time with the code
(i am not a c++ programmer at all so much of this object orientation
is still foreign to me) but if anyone has any quick advice i would
greatly appreciate it.
Several computes produce global vectors, type:
grep compute_vector compute*cpp
Is your definition of ke or pe/molecule, simply
the sum of ke or pe/atom over the atoms in
each molecule?
If so, I think this would be better cast as a
compute atom/molecule command which
allows any other computes/fixes/variables
that produce per-atom quantities to be
summed on a per-molecule basis.
I have finished pe/molecule and it is attached for anyone who'd like
to use it. The results have been verified with the standard
group-pe/atom-reduce approach, and I have also verified them for an
arbitrary number of processors. I agree Steve that a general compute
atom/molecule command would be wonderful but at the current time I
haven't done this. Perhaps in the future.
Previously I attached a ke/molecule routine. It is in this thread. It
does not function correctly when nproc > 3. It starts giving
completely incorrect results. When I compare output from ke/molecule
(left) and the traditional group/ke (right) approach for nproc < 4
processors, I get:
If anyone very familiar with the parallel implementation in LAMMPS has
any ideas I would greatly appreciate it. My ke/molecule routine is
modeled exactly as my pe/molecule routine and the normal ke function.
See the new compute atom/molecule command in the 21Oct10
patch, which can sum any per-atom value on a per-molecule basis.
Please check if this does what you want ...