randomizing atom types (Re: Mixing elements)

> Andrew,
>
> I have a question that I think you may be able to help me with. I am
> wanting to simulate SiC(1-x). It is easy for me to simulate Si or C or
> SiC. However I am not sure the best way to vary the C concentration.
> Have you been able to do this before, or are you aware of methods
> that can produce what I want?
>
> Best Regards,
>
> Ben

incidentally moltemplate does not have a way to randomly switch the
types of individual atoms, (only entire molecules or unit cells).

  If you are not worried about structural polymorphisms in SiC, then I
would use a text editor to extract the atoms section of you DATA file
containing a large diamond crystal or SiC crystal (which you can build
by other means) and write a short program to read each line of the
file, and generate a random number for the atom type, and print out
that line again substituting the random number for the atom type
(usually in the 3rd column if you are using "atom_style full"). This
should take less than 10 lines of code.

  Then paste these lines back into the data file.

  You can also do this using a long list of "set atom atomID type
atomType" lammps commands:
http://lammps.sandia.gov/doc/set.html

Python has a "random.shuffle()" function which is useful if you want
to guarantee that a certain exact count of the number of carbon and
silicon atoms in your final output file. Example:

from random import *
L = [1]*4 + [2]*6
L

[1, 1, 1, 1, 2, 2, 2, 2, 2, 2]

shuffle(L)
L

[2, 2, 1, 2, 2, 2, 1, 2, 1, 1]

That's the best I could come up with.
Cheers

Andrew