Update the value of the gradient for the ref file