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

Hi all,
Is there any way this can be avoided? We are required to set exactly 3 atoms of the 2nd type. Thanks for helping me out.

Vyom Vats,

LAMMPS User.

Set type/fraction doesn't change exact numbers of
atoms, b/c it is a random procedure. From the
doc page:

Keyword type/fraction sets the atom type for a fraction of the
selected atoms. The actual number of atoms changed is not guaranteed
to be exactly the requested fraction, but should be statistically
close.

However many it does change, you can make a new group
that excludes those atoms, immediately after the set command.
If you use the new group in subsequent set commands,
the original ones will not be subject to being changed again.

More generally, you can just create a data file with
exactly the # of atoms of each type that you want.

Steve

Hi all,
Is there any way this can be avoided? We are required to set
exactly 3 atoms of the 2nd type. Thanks for helping me out.

your requirement are obviously very specific and
not really within the scope of what lammps is
expecting. the way you programmed your script
doesn't make sense for the purpose, but any
workaround from within lammps is likely not to
give you *exactly* what you are asking for.

to me this seems to be a case where you'd
be better off to write a script or program yourself
that would generate the system you are looking for.

a reasonable compromise might be to use the
python script interface and write a loop that
picks atom ids randomly and then calls lammps'
to define/undefine a group and then call the
set command on it. or something similar.

or just write a script/program that does generate
a lammps input script along the same lines
(nothing requires that you have to write lammps
input scripts manually).

axel.