Counting Vapor Atoms

Dear LAMMPS users,

I want to count vapor atoms of Argon during boiling with time. My geometry includes 25 A of solid (heat source) and 100 A of argon (liquid), when I increase the temperature of solid layers, phase changing of argon atoms occurs and the vapor atoms go up in the simulation box. My problem is how to count vapor atoms with time during the boiling process?
My idea is to make a group of argon atoms from 102 A to the highest level of the sim box, and then counting argon atoms in this group with time.
I am not sure about this idea…I appreciate it if anyone gives me a hint.


Group assignment is not going to work, since groups are fixed (you could make it a dynamic group, but there are simpler ways of achieving the same goal).

The main question is how are you going to define when an atom is part of the vapor or part of the liquid?
Defining a “vapor region” is rather unflexible and may lead to undercounting. The counting can in this case be done with an equal style variable and the count(group,region) function.

Another possible definition could be the number of close neighbors, e.g. using compute coord/atom, then define an atom style variable with a conditional that is true when the number of atoms within the given cutoff is below the given threshold. That variable will have a value of either 1 or 0 and then using compute reduce sum will give you the count.

There may be other ways to detect/define when an atom is considered part of a liquid or part of the gas phase. You should check text books and the published literature for projects that have done such things and quantifying the number of vapor atoms.