resetting P to zero every jump, using fj.T for the costate