Variables Configuration

Dear Lammps users,

I have a basic question about the variables use in Lammps, in my simulation the size of the a region varies by time and I need to use the number of atoms in the region to calculation some parameters for run at each time step.
So change in the number of atoms in that region is calculated as:

variable s equal “count(Silicon,Si1)” #where the s is the count of atoms in region at each time step

variable s0 equal $s #s0 is the initial number of atoms in that region and should not change during the simulation.

variable b equal $s0-v_s # b is the change in the number of atoms

Reading the Lammps help this looks to be right but yet the s0 keeps changing with s. I can not find the right way to do this and any help is very appreciated.

Regards,
Leyla

Dear Lammps users,

I have a basic question about the variables use in Lammps, in my simulation
the size of the a region varies by time and I need to use the number of
atoms in the region to calculation some parameters for run at each time
step.
So change in the number of atoms in that region is calculated as:

variable s equal "count(Silicon,Si1)" #where the s is the count of atoms in
region at each time step
variable s0 equal $s #s0 is the initial number of atoms in that region and
should not change during the simulation.
variable b equal $s0-v_s # b is the change in the number of atoms

Reading the Lammps help this looks to be right but yet the s0 keeps changing
with s. I can not find the right way to do this and any help is very
appreciated.

yes, as it should. you should have also noticed
a multiplication by 10, right?

please read the documentation for the variable command again

a variable s0 has to be expanded as ${s0}
s0 is the same as {s}0 which is not what you want.

axel.