Using Set command to specify Fraction of atoms in a system having more than two types of atoms

To incorporate polydispersity in our system, we created 11 type of atoms (a total of 1024 atoms), as follows:

mass 1 1
mass 2 1.5
mass 3 1.5
mass 4 1.5
mass 5 1.5
mass 6 1.5
mass 7 1.5
mass 8 1.5
mass 9 1.5
mass 10 1.5
mass 11 1.5

set group all type/fraction 2 0.002929 10000
set group all type/fraction 3 0.015625 19765
set group all type/fraction 4 0.039203 10000
set group all type/fraction 5 0.041039 10001
set group all type/fraction 6 0.040015 50002
set group all type/fraction 7 0.034273 50003
set group all type/fraction 8 0.023508 50004
set group all type/fraction 9 0.012812 10005
set group all type/fraction 10 0.005859 10006
set group all type/fraction 11 0.002929 19876

velocity all create 1.44 87287 loop geom

pair_style lj/cut 2.5

pair_coeff 1 1 1.0 1.000 2.5
pair_coeff 1 2 1.0 0.817 2.5
pair_coeff 1 3 1.0 0.900 2.5
pair_coeff 1 4 1.0 0.971 2.5
pair_coeff 1 5 1.0 1.041 2.5
pair_coeff 1 6 1.0 1.113 2.5
pair_coeff 1 7 1.0 1.189 2.5
pair_coeff 1 8 1.0 1.258 2.5
pair_coeff 1 9 1.0 1.351 2.5
pair_coeff 1 10 1.0 1.420 2.5
pair_coeff 1 11 1.0 1.470 2.5
pair_coeff 2 2 1.0 0.633 2.5
pair_coeff 2 3 1.0 0.717 2.5
pair_coeff 2 4 1.0 0.787 2.5
pair_coeff 2 5 1.0 0.858 2.5
pair_coeff 2 6 1.0 0.930 2.5
pair_coeff 2 7 1.0 1.005 2.5
pair_coeff 2 8 1.0 1.075 2.5
pair_coeff 2 9 1.0 1.168 2.5
pair_coeff 2 10 1.0 1.237 2.5
pair_coeff 2 11 1.0 1.287 2.5
pair_coeff 3 3 1.0 0.800 2.5
pair_coeff 3 4 1.0 0.871 2.5
pair_coeff 3 5 1.0 0.941 2.5
pair_coeff 3 6 1.0 1.013 2.5
pair_coeff 3 7 1.0 1.089 2.5
pair_coeff 3 8 1.0 1.158 2.5
pair_coeff 3 9 1.0 1.251 2.5
pair_coeff 3 10 1.0 1.320 2.5
pair_coeff 3 11 1.0 1.370 2.5
pair_coeff 4 4 1.0 0.941 2.5
pair_coeff 4 5 1.0 1.012 2.5
pair_coeff 4 6 1.0 1.084 2.5
pair_coeff 4 7 1.0 1.159 2.5
pair_coeff 4 8 1.0 1.228 2.5
pair_coeff 4 9 1.0 1.322 2.5
pair_coeff 4 10 1.0 1.391 2.5
pair_coeff 4 11 1.0 1.441 2.5
pair_coeff 5 5 1.0 1.082 2.5
pair_coeff 5 6 1.0 1.155 2.5
pair_coeff 5 7 1.0 1.230 2.5
pair_coeff 5 8 1.0 1.299 2.5
pair_coeff 5 9 1.0 1.392 2.5
pair_coeff 5 10 1.0 1.461 2.5
pair_coeff 5 11 1.0 1.511 2.5
pair_coeff 6 6 1.0 1.227 2.5
pair_coeff 6 7 1.0 1.302 2.5
pair_coeff 6 8 1.0 1.371 2.5
pair_coeff 6 9 1.0 1.465 2.5
pair_coeff 6 10 1.0 1.533 2.5
pair_coeff 6 11 1.0 1.583 2.5
pair_coeff 7 7 1.0 1.377 2.5
pair_coeff 7 8 1.0 1.446 2.5
pair_coeff 7 9 1.0 1.540 2.5
pair_coeff 7 10 1.0 1.609 2.5
pair_coeff 7 11 1.0 1.659 2.5
pair_coeff 8 8 1.0 1.516 2.5
pair_coeff 8 9 1.0 1.609 2.5
pair_coeff 8 10 1.0 1.678 2.5
pair_coeff 8 11 1.0 1.728 2.5
pair_coeff 9 9 1.0 1.703 2.5
pair_coeff 9 10 1.0 1.771 2.5
pair_coeff 9 11 1.0 1.821 2.5
pair_coeff 10 10 1.0 1.840 2.5
pair_coeff 10 11 1.0 1.890 2.5
pair_coeff 11 11 1.0 1.940 2.5

The log file showed that the various types of atoms had indeed been created. Here’s what it said:

set group all type/fraction 2 0.002929 10000
3 settings made for type/fraction
set group all type/fraction 3 0.015625 19765
16 settings made for type/fraction
set group all type/fraction 4 0.039203 10000
34 settings made for type/fraction
set group all type/fraction 5 0.041039 10001
41 settings made for type/fraction
set group all type/fraction 6 0.040015 50002
42 settings made for type/fraction
set group all type/fraction 7 0.034273 50003
31 settings made for type/fraction
set group all type/fraction 8 0.023508 50004
21 settings made for type/fraction
set group all type/fraction 9 0.012812 10005
8 settings made for type/fraction
set group all type/fraction 10 0.005859 10006
6 settings made for type/fraction
set group all type/fraction 11 0.002929 19876
3 settings made for type/fraction

However, the 2nd type of atom was missing from the dump file. Also, the number of atoms of some other types were reduced from the number quoted by the log file. Though only 819 1st type of atoms were to be created as per command, 839 were created.

Please suggest a way to correct this anomaly.

Thanks,
Vyom Vats,
LAMMPS User.

If you do a sequence of set commands for type/fraction,
all of them on group all, then each one is going to possilby change
types that were set by previous commands. If you only
created 3 atoms of type 2, and then did "set" 10 more
times, it's possible those 3 atoms will be changed to something
else.

Steve