[lammps-users] Compute the energy of atoms in a region

Dear all,

We would like to have the total energy and position of each atom
located in a specific region, during the simulation. To achieve this,
I think we can define a region and then assign the atoms of the region
to a group, e.g. G1. Then we can use total energies and positions of
the atoms of G1 for an specific computation. But I think the assigned
atoms to G1 are determined in the start of simulation, and they are
preserved; I mean the atoms of G1 do not change during the simulation.
I think the assigned of atoms to G1 should be updated in each time
step. Is it possible?

Kind regards,
Mehdi

Dear Mehdi,

Consider post-processing. It should not be difficult to write a script that reads a dump file, checks if an atom is in the desired region, and then writes the data for the desired atoms to another file for use in your specific computation.

Joanne

Groups are static for various reasons. There are some fix commands
that apply themselves dynamically to atoms currently in a region,
E.g. compute temp/region which
can be used with thermostats like fix nvt to operate on atoms
in a region. Also the dump custom command with dump_modify
threshhold can be used to dump a snapshot of atoms in a region
with their per-atom energy. Then you could post-process that
file, as Joanne suggests. If you want something done on-the-fly
and more specific than that, you'd have to write the fix yourself.

Steve