Dear everyone,
I am trying to do cascade simulations and one important step is to select one atom in my system and assign velocity to it.
I used ‘region PKA sphere $x $y $z 0.1 side in’ before to include one atom in the defined region. But when I use this at free surfaces, sometimes I found it’s difficult.
I used boundary condition s s p in my simulation. After thermal relaxation, usually the position of free surface boundaries will change. Then it becomes inconvenient to get the precise value of ‘$x $y $z’, and sometimes it will include zero atom even tried a lot of ‘$x $y $z’. I usually change the radius in ‘region sphere’, i.e. change it to ‘region PKA sphere $x $y $z 0.2 side in’, since it has more chance if the sphere is bigger. However, sometimes it will include two atoms or more.
In short, it seems a little difficult for me to select ONLY one particular atom at a thermally relaxed free surface. I am wondering if there is a better method to accomplish this and could you please tell me how?
Any help would be much appreciated!
With My Best Regards
Liu
The velocity command takes a “group” argument. So the Q
is how to put one atom in a group. If you know the ID of
the atom you want, the group command will do it. You could
also use the compute reduce command to take the max
of all atom’s z coords, and its “replace” option to output
the ID of the atom with the max z coord. Then define
an equal-stye variable set to the output of compute reduce.
And use that variable as the input to the group command,
e.g.
group foo id ${yourvar}
Steve
Thank you very much Steve!
That’s very helpful. I’ll try that.
Dear Steve,
I think I can get the max y coord by ‘variable myy atom y, compute coord all reduce max v_myy’ . And I print them by ‘thermo_style custom step c_coord’. It seems everything is all right.
But when I tried to use the replace option of compute reduce, I always failed. I used the following lines:
variable myy atom y
variable myid atom id
compute coord all reduce max v_myid v_myy replace 1 2
variable pos equal c_coord
print $(v_pos)
These commands give the error ‘Mismatched compute in variable formula’. And consequently, I can not use ‘group foo id $(v_pka)’ to put the atom in a group. It will give the same error. It seems when I trying to use the value of variable pos, the error message appears.
I have read the explanation about the error and docs of related commands. But unfortunately, I still cannot fix my problem. Could you or somebody else please give me some instructions? Which part of these commands are wrong?
Thanks very much indeed!
With My Best Regards
Liu
Your compute reduce still creates two output (one for each column).
So the pos variable has to reference one of them. See the
compute reduce doc page for details.
Steve