moving calcualtion of rho_d to the first time step IF