# DFPT vs analytical nuclear gradient

I have read some literatures about the gradient wrt. atom positions of the DFT energy, and find different methods one commonly used in MD(analytical nuclear gradient,pulay's paper), and another usually used in phonon calculations(DFPT,the introduction in QE and a brief introduction).

Since they compute the same physical targets, why we make different choice in different tasks? Or what's the main difference between them?

These are not the same quantity. The gradient of the energy with respect to the position $$\vec{R}_i=(x_i,y_i,z_i)$$ of atom $$i$$ gives the force, $$\vec{F}_i$$, acting on that atom, $$\vec{F}_i=-\left(\frac{\partial E}{\partial x_i},\frac{\partial E}{\partial y_i},\frac{\partial E}{\partial z_i}\right).$$ One important thing to note is that the changes in the electronic (Kohn-Sham) density when the atoms move do not contribute to the forces.
Since we usually want the forces on all the atoms, it is convenient to redefine the indices of the position and force vectors to run over all $$3N$$ components of the atomic positions; e.g. for $$N$$ atoms we have an "all atom" position vector $$\vec{R}=\left(x_1,y_1,z_1,x_2,y_2,z_2,~\ldots~,x_N,y_N,z_N\right).$$ This allows us to write the "all atom" force vector compactly as, $$\vec{F}_i=-\frac{\partial E}{\partial R_i}.$$
In contrast to the forces, the phonons depend on the force-constant matrix, which is essentially the curvature of the energy, $$\mathrm{K}$$ $$\mathrm{K}_{ij}= \frac{\partial^2 E}{\partial R_i \partial R_j},$$ remembering that these are "all atom" indices, so there are $$3N$$ values of $$i$$ and $$j$$ for $$N$$ atoms.
As well as requiring the first-order change in the Kohn-Sham states, the curvature of the energy is sensitive to the first-order changes in the electronic density when the atoms move, so $$\mathrm{K}$$ has to be computed self-consistently.