conditional atom property

Submitted by jtvanlew on Fri, 04/05/2013 - 00:32

Has anyone ever made an atom property (or assigned it to a region, changed its type, etc) based on a conditional statement?

For instance, if I set some threshold of particle force, say...
variable crit_force equal 50
then i find per/atom values of force magnitudes
variable mag_force atom (fx[i]^2+fy[i]^2+fz[i]^2)^0.5

from there I'd like to say something like...
if "${mag_force[i]} > ${crit_force}" then &
[set the atom, i, into a group, change the atom to type 2, etc.]

but of course, to do it in this way, i'd have to make a loop over particles. But if the loop is done on the script level, it will slow down the simulation a ton.

The same could be done for monitoring per-particle temperatures and making changes, or many other things.

This seems like a feature someone would have wanted in the past, so there might already be a fix to help out, but I've come up short with my searches. Discussions on it would be appreciated.

Regards,
Jon

ckloss's picture

ckloss | Wed, 04/10/2013 - 08:20

Hi Jon,

this is pretty easy to code. On the script level it is possible to use per-atom variables for group definitions in the newest LAMMPS version (but not yet in LIGGGHTS). So this will come in with the next merge, probably in the middle of the year

Cheers
Christoph