I have a crystal structure in which I'd like to randomize the placement of cations from an initial structure. I have a .xyz file (given here https://pastebin.com/d5UcNr2h) which gives atomic identities and coordinates, and the following code:
structure = Import[SystemDialogInput["FileOpen"]];
Do[
If[
structure[[1,i]] == Atom[Cu],
If[RandomReal[] > 0.5, structure[[1,i]] = Atom[Ga], structure[[1,i]] = Atom[Cu]],
Unevaluated[Sequence[]]
],
{i,1,Dimensions[structure[[1]]][[1]]}
]
In short, my current approach is to read in the file, and test if the atomic identity at a given position is Copper (Cu). If the atom is copper, then I roll the dice, and if RandomReal is > 0.5, then I want to substitute the atom with Gallium (Ga). I've tried the individual logical test:
structure[[1,600]]==Atom[Cu]
which does return "True" when the atomic identity is Cu, but the code doesn't modify the actual atomic identity when I run it. What am I missing?
Thanks.