Hi to all,

I have a random number generator in FORTRAN, which gives a random numbers to my particles initial velocity in three dimension (vx,vy,vz). If, I want to make my particles to embark to move with a specific weight (eg. Maxwellian), what should I do?

absv = sqrt(vx*vx+vy*vy+vz*vz)

wt= absv*absv*exp(-(absv*absv)/(a*a))

(a = sqrt(2*k*t/m))

the random generator produce a number between -1 to 1 for the 3 velocity components. I make the arrangement so the velocity would be around -0.35 to 0.35 for each of them (non-relativistic range).

My code is a test particle code, and I could make it work efficiently for each test particle in both constant and dipolar field (with or without Electric field(acc)), but still I am struggling with making the particles to move based on their initial weight. I don't even know, whether I need to use the Maxwell–Boltzmann speed distribution or Maxwell–Boltzmann velocity distribution which in concept, both are telling the same story but giving me different result.

https://en.wikipedia.org/wiki/Maxwel...n_distribution
BTW, if you simply plot any random numbers based on 'wt' you will get the maxwellian speed distribution as an output. I want to know, how can I make the 'wt' to be effective as a probability of particles initial distribution in my code.

any suggestion is appreciated