How to obtain the list of the atom IDs of a certain group?

Hi everyone,

I am trying to rescale the magnitudes of the velocities of the atoms in a specified group. My strategy is to loop over all the atom IDs in that group and reset their values by `velocity set` command, the main procedure is as the following.

 region r\_rescale block \[dimension of the block\]

 group g\_rescale region r\_rescale

 variable VsetLoop index \[list of the IDs of atoms in the specified group g\_rescale\]

 group g\_Vset id $\(VsetLoop\)

 velocity g\_Vset set $\(V\_new / V\_old \* Vx\_old\)  $\(V\_new / V\_old \* Vy\_old\) $\(V\_new / V\_old \* Vz\_old\)

 next VsetLoop

However, after reading the docs of variable, group and the related commands, I cannot figure out how to get the list the atom IDs of a certain group. Could you please give me some advice?

By the way, my initial problem is about the method to reset the values of the velocities of the atoms in a given group. I think maybe several cleverer methods are there. Please instruct me if you have one.

Any help would be much appreciated!

With My Best Regards,

Liu

you can also use a variable directly with fix temp/rescale

Hi Jacob, thanks very much for your reply! That is helpful.

I have tried to use fix temp/rescale to reset the velocities of atoms in the group with commands like the following:

group g_rescale region r_rescale

variable Trescale equal 1000

fix Trescale g_rescale temp/rescale 1 {Trescale} {Trescale} 0.00001 1.0

run 1000

Based on the description of the temp/rescale method, all the velocities are rescaled according to a factor which is calculated from the desired and the current temperature. So if I want to rescale all of the atoms’ velocities to exactly the same value in that group, it seems I still need to know th IDs of the atoms in that group and use fix temp/rescale to set them one by one.

However, I have re-read the docs and I found gmask() function may help, besides variable can be used in ‘velocity set’ command. Some simple velocity profile can be set by the ‘velocity set’ command.

But I am still working on that right now. And if there is a better method, please instruct me. Thanks in advance!

Best,

Liu

please note the unphysical nature of what you appear to be doing. that said, you could also check out ‘fix move’

Hi Jacob, thanks for your kindly remind!

I want to simulate irradiation of materials. At the beginning of the simulation, the energy will be deposited in a certain region of the material due to the irradiation. The kinetic energy of the atoms in this region would be changed by the energy deposition. So I need to modify their velocities according to the calculated velocity profile at the start.

I found that ‘velocity set’ can be used to set atom’s velocity. But I am still trying to use it in combination with gmask() function to set them one by one.

Best,

Liu

as a reminder, ‘velocity set’ will only apply to the atoms specified by the ‘group-id.’ so for example, if you wanted to initialize a logarithmically decaying velocity profile on a specific group of atoms, simply specify that group and define the profile using variables

Dear Jacob,

Thanks for your suggestion! Yes, I have used ‘velocity set’ to set velocity of atoms in the specified group based on some relation f(r,v), that is exactly what I want at the first step.

One more thing is that, in my case, the velocity profile of atoms in the specified group is based on a relation which can not be expressed by a simple function and the relation is given by a file. If we plot the dots in the file, it may look like the attached picture. It seems velocity set cannot treat such a general condition. I also tried to use gmask() function together to manipulate the value of the atoms’ velocity of that group, but still, I cannot do that very well if the general relation is given by the data in a file.

Perhaps I can fit the relation by polynomial function and then use velocity set. But maybe some better ideas are there, could you please give me some advice?

Thanks very much in advance!

My Best,

Liu

velocity_vs_radius.png

there are some options for reading in variables from a file; however, at a certain point it will be easier to calculate your initial velocities using your own code, and copy those into your data file