Colour coding depending on the radial distance

Dear all,

In my simulation the particles form a spherical cluster. I want to add colours to the particles depending on their radial distance from the center of the cluster. How can i do that ?

Regards,
Hirak

Dear HIrak,
Its very simple.
variable x0 equal 0 # x of center, you can change them
variable y0 equal 0
variable z0 equal 0
variable distance atom sqrt((x-v_x0)(x-v_x0)+(y-v_y0)(y-v_y0)+(z-v_z0)*(z-v_z0))
then you can dump v_distance

Jiang

Thanks, let me try it