First principles study of biomineral hydroxyapatite