[lammps-users] how to thermostat only the atoms crossing the boundaries of a simulation box?

Dear all

I am trying to mimic the cooling scheme/thermostating proposed in J. Phys. Chem. C 2014, 118, 25, 13869–13875 where a mixture of “hot” Ar, Ag and Si atoms is cooled down by rescaling at each timestep the velocities of only the Ar atoms that cross the boundaries of the (cubic) simulation box. The rest of the mixture is simulated at “NVE” conditions.

I have thought of a possible solution where six thin block regions (each one adjacent to one of the boundary surfaces of the cubic box) are defined, the temperature of the Ar atoms in the union of these six regions is computed via the temp/region command and the rescaling takes place using the fix temp/rescale command.

Is there an alternative way of identifying the Ar atoms crossing the boundaries instead of using their instantaneous residence in one of the six thin regions?

Evangelos Voyiatzis

How about using fix store/state to regularly store the image flags (ix, iy, iz)?
Then define an atom style variable that determines the sum of the absolute value of the difference between the current value of any image flag and its stored value.
If that variable is non-zero, the atom has crossed any box boundary since the image flag was stored. Use that for a dynamic group to which you would apply the thermostat.