Calculation using contracted Binachi identity Let $(M,g)$ be an $n$-dimensional complete Riemannian manifold. Consider the following equation
$$\tag{1} s=nc+\Delta f,$$
where $s$ is the scalar curvature, $c$ is any real number and $f\in C^2(M)$. It is given that by using contracted Binachi identity, the above equation implies that
$$\tag{2} |\nabla f|^2+s+2cf=A_0,$$
for some constant $A_0$. I can not get the intermediate steps. Please help me to under stand this proof.
The above is found in p.376 of this paper. 
 A: This is in the context of Ricci soliton and (2) is a well-known formula proved by Hamilton which follows from the Ricci soliton equation instead of (1). The proof can be found in Lemma 1.1 in this survey. For completeness I'll record the proof here: 
The Ricci soliton equation is 
$$\tag{3} \operatorname{Rc} = c g + D^2 f,$$
or $R_{jk} = cg_{jk} + f_{jk}$. Taking covariant derivative to (3) and commuting the derivatives, 
\begin{align}\nabla _i R_{jk} &= \nabla _i f_{jk} \\
&= \nabla_j f_{ik} + R_{ijk}^l \nabla_l f \\
&= \nabla_j R_{ik}+R_{ijk}^l \nabla_l f.
\end{align}
Taking the trace on $j$ and $k$, and using the contracted second Bianchi identity, 
$$\nabla_i s = \nabla^j R_{ij} - R^l_i \nabla_l f  = \frac 12 \nabla_i s - R^l_i \nabla_l f.$$
Thus $\nabla _i s = -2 R_{i}^l \nabla_l f$. So 
\begin{align}
\nabla_i(|\nabla f|^2+s+2cf) &= 2f_{ji} \nabla_j f + \nabla_i s + 2c\nabla_ i f \\
&= 2(R_{ij} -c g_{ij}) \nabla_j f - 2R_{ij} \nabla _j f + 2c \nabla_i f = 0.
\end{align}
Thus $|\nabla f|^2+s+2cf$ is constant. 
