Evaluation of Exchange-Correlation Energy, Potential, and Stress
We describe a method for calculating the exchange and correlation (XC) contributions to the total energy, effective potential, and stress tensor in the generalized gradient approximation. We avoid using the analytical expressions for the functional derivatives of E_xc*rho, which depend on discontinuous second-order derivatives of the electron density rho. Instead, we first approximate E_xc by its integral in a real space grid, and then we evaluate its partial derivatives with respect to the density at the grid points. This ensures the exact consistency between the calculated total energy, potential, and stress, and it avoids the need of second-order derivatives. We show a few applications of the method, which requires only the value of the (spin) electron density in a grid (possibly nonuniform) and returns a conventional (local) XC potential.