How to calculate radius of gyration (Rg) vs time ?

Recently i found a script to calculate radius of gyration (Rg) vs time. However it seems something goes wrong with me ? Could anyone can give me some advance?