Local structure and redox energies of lithium phosphates with olivine- and Nasicon-like structures