Is there a way to choose a random atom of a certain type to give an initial velocity?
I know I can create a region with a certain volume around the region, and create it small enough such that only one atom is included. But I was wondering if it is possible to just randomly choose an atom of type 2 and give it a certain velocity?
Perhaps my method is not the most robust, but I am not finding a better way.
Is there a way to choose a random atom of a certain type to give an initial
velocity?
I know I can create a region with a certain volume around the region, and
create it small enough such that only one atom is included. But I was
wondering if it is possible to just randomly choose an atom of type 2 and
give it a certain velocity?
Perhaps my method is not the most robust, but I am not finding a better way.
the easiest is probably to write a custom fix style.
conceptually, what you do is not that different from what fix deposit
does (it places an atom at a randomly chosen location and optionally
assigns an initial velocity).
There is a random() function you can put in an equal-style
variable, to select an atom ID from 1 to N.
Then you can put an if test to loop back up in your input
script to repeat
the random ID generation unless the type of the selected
atom is your desired type.