An ab initio method for performing valence-electron-only calculations