How to compute lost atoms in a simulation cell

Hello everyone. I want to take the whole advantage of the forum and ask masters of Lammps simulations about my question. I am studying silicon carbide oxidation under dry O2 gas conditions. It is expected that a part of the atoms in SiC surface will be separated from their initial crystallized positions. How am I supposed to calculate the number of C atoms out of the crystal, or other words, lost atoms in the system and the number of O atoms inside the SiC crystal? Is there any lammps command for that? Should I determine variables in my input script?

Here is my input code
LAMMPS Input file

SiC with O2 #name of the project


units metal #picoseconds 10e-12 (eV, A, ps)
dimension 3
boundary p p f #periodic boundary conditions for x and y and fixed for z axis
atom_style charge #lmp data file must consist of charge

Atom Definition

read_data try.lmp


mass 1 28.086
mass 2 12.011
mass 3 15.999

reset_timestep 0
fix 1 all box relax/iso 0.0 vmax 0.001
velocity all create 298.15 4928459 rot yes mom yes dist gaussian
fix 2 all nvt temp 298.15 298.15 0.001 #set nvt ensemple
fix 3 all temp/berendsen 298.15 298.15 0.001 #set the beredsen control termostat
fix zwalls all wall/reflect zlo EDGE zhi EDGE #set a repeilsive boundary conditions for Z ort
pair_style reax/c NULL # set interatomic potential style
pair_coeff * * ffield20.reax Si C O # read in interatomic potential file
fix 4 all qeq/reax 1 0.0 10.0 1e-6 reax/c
thermo_style custom step temp epair etotal econserve press
thermo 500 #(every 500 timesteps – output thermo properties)
timestep 5.0e-4
neighbor 1.0 bin # define parameters for neighbor list
neigh_modify every 1 delay 10 check no # define parameters for neighbor list
thermo_modify lost ignore flush yes


dump dumpXYZ all xyz 1 try.dump #write trajectory file in dump format (OVITO)
dump dmp all atom 100 dump.lammpstrj # write trajectory file in lammps trajectory format (VMD)
#dat file
thermo_style one
#thermo 100 #(every 100 timesteps – output thermo properties)
restart 100 file.restart #write executable wile of topology after 100 steps, which can be run as inticial topologu of atoms

min_style cg #(perfect crystal)
minimize 1e-10 1e-10 5000 5000

Run the simulation

run 2000000 #for 1 ns = 510e-42*10e6=1000ps

This can be easily done with an equal style variable. Just add the following somewhere after your read_data command and before your run command:

variable lost equal $(atoms)-atoms

Then you can use the standard way to output variables.

Thank you for your instant response. It will help me in my calculations. Anyway, my standard code requires to be edited because I have anomalies in temperatures.