When generating multiple initial geometries or velocities, it is good practice to check that we are sampling in the correct way, i.e that we are uniformily sampling from the distribution we expect or desire to sample from.
In this post I will show an example where the Kolmogorov-Smirnov test (KS-test) is used to check that velocities are sampled uniformily from the Maxwell-Boltzmann distribution function.
From a practical point of view, the test consists in computing the maximum difference between the cumulative of the probability distribution function of your n-point dataset and the cumulative of the continuous distribution you believe you are sampling from :
When the distributions match, as n tends to infinity, the distance should tend to zero.
Depending on how large this difference is respect to a critical value, one can establish whether their data was sampled from the continuous distribution.
Lets assume we have a set of 1000 values of velocities (norm of vectors) we can compute the probability and cumulative distribution of the velocities . Here below I show a histogram plot of the probability distribution function at T=100K for a set of 1000 sampled velocities:
We then also compute the cumulative distribution of the distribution we expect to match, i.e the Maxwell-Boltzmann distribution,
and here is a plot showing both cumulatives:
We see that the two cumulatives are very similar. The maximum distance in this case is D = 0.0238454225145 and the critical probability value for this number of points is (computed as see e.g. http://www.cas.usf.edu/~cconnor/colima/Kolmogorov_Smirnov.htm for a 0.05 level of significance)
We have found D < therefore the test confirms the fact that our data’s distribution is the Maxwell-Boltzmann distribution.