3D version of step.f90