How to extract velocity info of small penetrant molecules in the diffusion calculation?

Hello All,

I am wondering how to extract the velocity info of small penetrants in the diffusion calculation, for example, an NVT/NVE run, using Perl scripting?

Thanks!