First-principles investigation of the structural, magnetic, and electronic properties of olivine LiFePO4