ugly hartree-fock implementation with the goal of being not-ugly