How to select a random atom in a specify region and knowing its type.

Dear all,

I’m working on accumulative cascade simulation in a two species system. Two main issues at present are:

  1. I’ve already know I can select a random atom in the whole model by random() function In variable command. But now I want to select an atom randomly in a specify region repeatedly, without knowing the id index range of the atoms include in it. And, it can be excepted that the atoms in this region will exchange with those in other regions during cascade simulation, so their index list may not be constant.

  2. Let’s say a random atom has been selected, of course its type is random too. But, I’d like to give a same PKA energy to both types of atom. So the assigned velocity should be related to the type of selected atom since the two species have different masses. This should be easy by using “if ‘${selected_type} == 1’ then…” only if knowing which type of atoms had been selected in the last step.

It’s there a ready-made way in LAMMPS to realize these two aims?

Dear all,

       I’m working on accumulative cascade simulation in a two species
system. Two main issues at present are:

1) I’ve already know I can select a random atom in the whole model by
random() function In variable command. But now I want to select an atom
randomly in a specify region repeatedly, without knowing the id index range
of the atoms include in it. And, it can be excepted that the atoms in this
region will exchange with those in other regions during cascade simulation,
so their index list may not be constant.

2) Let’s say a random atom has been selected, of course its type is
random too. But, I’d like to give a same PKA energy to both types of atom.
So the assigned velocity should be related to the type of selected atom
since the two species have different masses. This should be easy by using
“if ‘${selected_type} == 1’ then…” only if knowing which type of atoms
had been selected in the last step.

It's there a ready-made way in LAMMPS to realize these two aims?

​not sure about the specifics. the scripting features in LAMMPS are
somewhat limited (and complex enough to implement as it is). but you may
want to check out, if you can realize your goals using python style
variables,

axel​