Anharmonic Vibrational States of Solids from DFT Calculations. Part I: Description of the Potential Energy Surface