Theory of biomineral hydroxyapatite