# How to output radial velocity and axis velocity

Dear community,
I am going to chunk atom in the cylinder coordinate, and then output the radial and axial velocity. But in the manual, I can’t find the how to output radial velocity, there is only vx vy and vz. The main code is as follows:
region box block -200 200 -200 200 0 400 units box

compute 15 all chunk/atom bin/cylinder z lower 5 0 0 0.0 200.0 200 discard yes
fix 16 all ave/chunk 20 5 100 15 vx vy vz file ./v_map_7.21.txt

So how can I output the vr and vz in cylinder coordinate to draw a velocity contours? Thanks a lot.

Ran

Hello,
I dont see `vr` in the list of variables, but it can be calculated from `vx` and `vy` in post-processing, and you have `vz` already.
Simon

Thanks, I will use the method.
Ran

It could also be done using atom style variables. Please note, that you’ll need the coordinates in addition to the velocities. See e.g.: coordinate systems - relationship between cartesian velocity and polar velocity - Mathematics Stack Exchange

Post-processing will not work because the radial velocity (and angular or azimuthal velocity) are per-atom functions of each atom’s Cartesian position and velocity components. If you try to post-process the cylinder-bin-averaged `vx` and `vy` you will get either 0 or unusable results.

You may find it helpful to imagine the asteroid belt: if you average `vx` and `vy` across it, like a LAMMPS bin/cylinder, you get 0 for both numbers. But obviously the asteroid belt orbits the sun with some nonzero average angular velocity.

2 Likes

One possible approach:

``````variable r atom sqrt(x*x+y*y)+1e-10 # avoid divide by zero errors
variable xhat atom x/r
variable yhat atom y/r
variable vr atom vy*yhat+vx*xhat
variable vang atom vy*xhat-vx*yhat
``````