Calculate MSD in a particular region of a particular type atom

I have given you my opinion on how misguided this kind of calculation is before here: Rearding msd calculation - #2 by akohlmey

I am not in the habit of supporting ill-advised projects.