Unified theoretical treatment of analytic first and second energy derivatives in open-shell Hartree—Fock theory