We present the implementation of a variational finite element solver in the HELFEM program for benchmark calculations on diatomic systems. A basis set of the formÞ is used, where (μ, ν, φ) are transformed prolate spheroidal coordinates, B n (μ) are finite element shape functions, and Y m l are spherical harmonics. The basis set allows for an arbitrary level of accuracy in calculations on diatomic molecules, which can be performed at present with either nonrelativistic Hartree-Fock (HF) or density functional (DF) theory. Hundreds of DFs at the local spin density approximation (LDA), generalized gradient approximation (GGA), and the meta-GGA level can be used through an interface with the LIBXC library; meta-GGA and hybrid DFs are not available in other fully numerical diatomic program packages. Finite electric fields are also supported in HELFEM, enabling access to electric properties. We introduce a powerful tool for adaptively choosing the basis set by using the core Hamiltonian as a proxy for its completeness. HELFEM and the novel basis set procedure are demonstrated by reproducing the restricted open-shell HF limit energies of 68 diatomic molecules from the first to the fourth period with excellent agreement with literature values, despite requiring orders of magnitude fewer parameters for the wave function. Then, the electric properties of the BH and N 2 molecules under finite field are studied, again yielding excellent agreement with previous HF limit values for energies, dipole moments, and dipole polarizabilities, again with much more compact wave functions than what were needed for the literature references. Finally, HF, LDA, GGA, and meta-GGA calculations of the atomization energy of N 2 are performed, demonstrating the superb accuracy of the present approach. K E Y W O R D S density functional, diatomic molecule, finite element, Hartree-Fock, partial-wave expansion 1 | INTRODUCTIONIn the first part of this series, [1] we presented fully numerical Hartree-Fock (HF) and density functional calculations on atoms. The present article focuses on diatomic molecules, which may serve as even more stringent tests of ab initio as well as density functional methods than atoms, as the methods' accuracy can be probed for multiple kinds of covalent bonds, as well as for ionic bonds and dispersion effects. As reviewed at length in Ref.[2], the history of fully numerical calculations on diatomic molecules is almost as long as that on atoms, starting with the partial-wave approach of McCullough. [3,4] The partial-wave approach appears to have since fallen out of use, with the well-known programs by Heinemann, Laaksonen, Sundholm, Kobus, and coworkers [5][6][7][8] relying on grid-based approaches for the angular expansion.