A direct optimization method for calculating density functionals and exchange–correlation potentials from electron densities | Synapse