{"title":"Review of the finite difference Hartree–Fock method for atoms and diatomic molecules, and its implementation in the x2dhf program","authors":"Jacek Kobus , Susi Lehtola","doi":"10.1016/j.cpc.2025.109576","DOIUrl":null,"url":null,"abstract":"<div><div>We present an extensive review of the two-dimensional finite difference Hartree–Fock (FD HF) method, and present its implementation in the newest version of <span>x2dhf</span>, the FD HF program for atoms and diatomic molecules. The program was originally published in this journal in 1996, and was last revised in 2013. <span>x2dhf</span> can be used to obtain HF limit values of total energies and multipole moments for a wide range of diatomic molecules and their ions, using either point nuclei or a finite nuclear model. Polarizabilities (<span><math><msub><mrow><mi>α</mi></mrow><mrow><mi>z</mi><mi>z</mi></mrow></msub></math></span>) and hyperpolarizabilities (<span><math><msub><mrow><mi>β</mi></mrow><mrow><mi>z</mi><mi>z</mi><mi>z</mi></mrow></msub></math></span>, <span><math><msub><mrow><mi>γ</mi></mrow><mrow><mi>z</mi><mi>z</mi><mi>z</mi><mi>z</mi></mrow></msub></math></span>, <span><math><msub><mrow><mi>A</mi></mrow><mrow><mi>z</mi><mo>,</mo><mi>z</mi><mi>z</mi></mrow></msub></math></span>, <span><math><msub><mrow><mi>B</mi></mrow><mrow><mi>z</mi><mi>z</mi><mo>,</mo><mi>z</mi><mi>z</mi></mrow></msub></math></span>) can also be computed by the program with the finite-field method. <span>x2dhf</span> has been extensively used in the literature to assess the accuracy of existing atomic basis sets and to help in developing new ones. As a new feature since the last revision, the program can now also perform Kohn–Sham density functional calculations with local and generalized gradient exchange-correlation functionals with the Libxc library of density functionals, enabling new types of studies. Furthermore, the initialization of calculations has been greatly simplified. As before, <span>x2dhf</span> can also perform one-particle calculations with (smooth) Coulomb, Green–Sellin–Zachor and Krammers–Henneberger potentials, while calculations with a superposition of atomic potentials have been added as a new feature. The program is easy to install from the GitHub repository and build via CMake using the <span>x2dhfctl</span> script that facilitates creating its single- and multiple-threaded versions, as well as building in Libxc support. Calculations can be carried out with <span>x2dhf</span> in double- or quadruple-precision arithmetic.</div></div><div><h3>New version program summary</h3><div><em>Program Title:</em> <span>x2dhf</span></div><div><em>CPC Library link to program files:</em> <span><span>https://doi.org/10.17632/xxf6fc2vjm.1</span><svg><path></path></svg></span></div><div><em>Developer's repository link:</em> <span><span>https://github.com/x2dhf/x2dhf</span><svg><path></path></svg></span></div><div><em>Licensing provisions:</em> GPLv3</div><div><em>Programming language:</em> Fortran 95, C</div><div><em>Journal reference of previous version:</em> Comput. Phys. Commun. 184 (2013) 799-811 [1].</div><div><em>Does the new version supersede the previous version?:</em> Yes</div><div><em>Reasons for the new version:</em> Code modularisation with Fortran 95, parallelisation via OpenMP and Portable Operating System Interface threads (pthreads), support for density functional theory using the Libxc library [2], simplified initialization of calculations, build process facilitated by CMake and <span>x2dhfctl</span> (a Bash script), testing facilitated by <span>testctl</span> (a Bash script) and a host of test suites.</div><div><em>Summary of revisions:</em> Code overhauled, modularised and streamlined with Fortran 95 standard, parallelisation of the self-consistent field (SCF) process and the successive overrelaxation (SOR) algorithm, corrected implementation of GGA functionals and support for the Libxc library of density functionals [2], improved initialisation of the SCF process via HF or LDA atomic orbitals and the superposition of atomic potentials [3], an enlarged test suite of input data and the corresponding outputs (235 in all) and <span>xhf</span> and <span>testctl</span> scripts to run and examine the tests. Script <span>x2dhfctl</span> added to control the build process via CMake, <span>pecctl</span> to automate calculations of potential energy curves and <span>elpropctl</span> to calculate (hyper)polarisabilities.</div><div><em>Nature of problem:</em> The program finds numerically exact solutions of the HF or Kohn–Sham density functional equations for atoms, diatomic molecules, and their ions by determining the lowest energy eigenstates of a given irreducible representation and spin. Density functional calculations can be carried out using various exchange and correlation functionals provided by the Libxc library [2]. The program can also be used to perform independent particle calculations with the (smooth) Coulomb, Green–Sellin–Zachor, Krammers–Henneberger, and superposition of atomic potentials [3], as well as two-particle HF calculations for the harmonium atom.</div><div><em>Solution method:</em> Factoring out the analytical angular solution around the bond axis, two-dimensional numerical single-particle functions (orbitals) are used to construct an antisymmetric many-electron wave function according to the restricted open-shell HF or density functional theory (DFT) model. The HF/DFT equations are written as coupled two-dimensional second-order (elliptic) partial differential equations (PDEs), which are discretized by an eighth order central difference stencil on a two-dimensional grid, whereas quadrature is performed with a Newton–Cotes rule. The resulting large and sparse system of linear equations are solved by the (multicolour) successive overrelaxation ((MC)SOR) method, and the orbitals and potentials are solved by simultaneous SOR iterations on the corresponding Poisson equations. The convergence of the SCF procedure is monitored with that of the orbital energies and normalisation factors. The precision of the obtained solutions depends on the grid and the system under consideration, and one can typically obtain orbitals that yield total and orbital energies with up to 12 significant figures using double precision arithmetic. If more precise results are needed, <span>x2dhf</span> can also be compiled in quadruple precision floating-point arithmetic.</div><div><em>Additional comments including restrictions and unusual features:</em> CMake (ver. 3) and gfortran/ifort compiler are required to compile and build the program. The incomplete gamma function is needed to evaluate hydrogenic orbitals and its values are calculated by means of the <span>dgamit.F</span> subroutine written by Fullerton [4] which uses FORTRAN 90 versions of <span>d1mach</span> and <span>i1mach</span> functions.</div></div><div><h3>References</h3><div><ul><li><span>[1]</span><span><div>J. Kobus, A finite difference Hartree–Fock program for atoms and diatomic molecules, Comput. Phys. Commun. 184 (2013) 799–811, <span><span>https://doi.org/10.1016/j.cpc.2012.09.033</span><svg><path></path></svg></span>.</div></span></li><li><span>[2]</span><span><div>S. Lehtola, C. Steigemann, M.J.T. Oliveira, M.A.L. Marques, Recent developments in LIBXC—a comprehensive library of functionals for density functional theory, SoftwareX 7 (2018) 1–5, <span><span>https://doi.org/10.1016/j.softx.2017.11.002</span><svg><path></path></svg></span>.</div></span></li><li><span>[3]</span><span><div>S. Lehtola, Assessment of initial guesses for self-consistent field calculations. Superposition of atomic potentials: simple yet efficient, J. Chem. Theory Comput. 15 (2019) 1593–1604, <span><span>https://doi.org/10.1021/acs.jctc.8b01089</span><svg><path></path></svg></span>, <span><span>arXiv:1810.11659</span><svg><path></path></svg></span>.</div></span></li><li><span>[4]</span><span><div>W. Fullerton, Netlib, July 1977 edition, C3, Los Alamos Scientific Lab.</div></span></li></ul></div></div>","PeriodicalId":285,"journal":{"name":"Computer Physics Communications","volume":"311 ","pages":"Article 109576"},"PeriodicalIF":7.2000,"publicationDate":"2025-03-06","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Computer Physics Communications","FirstCategoryId":"101","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0010465525000797","RegionNum":2,"RegionCategory":"物理与天体物理","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q1","JCRName":"COMPUTER SCIENCE, INTERDISCIPLINARY APPLICATIONS","Score":null,"Total":0}
引用次数: 0
Abstract
We present an extensive review of the two-dimensional finite difference Hartree–Fock (FD HF) method, and present its implementation in the newest version of x2dhf, the FD HF program for atoms and diatomic molecules. The program was originally published in this journal in 1996, and was last revised in 2013. x2dhf can be used to obtain HF limit values of total energies and multipole moments for a wide range of diatomic molecules and their ions, using either point nuclei or a finite nuclear model. Polarizabilities () and hyperpolarizabilities (, , , ) can also be computed by the program with the finite-field method. x2dhf has been extensively used in the literature to assess the accuracy of existing atomic basis sets and to help in developing new ones. As a new feature since the last revision, the program can now also perform Kohn–Sham density functional calculations with local and generalized gradient exchange-correlation functionals with the Libxc library of density functionals, enabling new types of studies. Furthermore, the initialization of calculations has been greatly simplified. As before, x2dhf can also perform one-particle calculations with (smooth) Coulomb, Green–Sellin–Zachor and Krammers–Henneberger potentials, while calculations with a superposition of atomic potentials have been added as a new feature. The program is easy to install from the GitHub repository and build via CMake using the x2dhfctl script that facilitates creating its single- and multiple-threaded versions, as well as building in Libxc support. Calculations can be carried out with x2dhf in double- or quadruple-precision arithmetic.
New version program summary
Program Title:x2dhf
CPC Library link to program files:https://doi.org/10.17632/xxf6fc2vjm.1
Does the new version supersede the previous version?: Yes
Reasons for the new version: Code modularisation with Fortran 95, parallelisation via OpenMP and Portable Operating System Interface threads (pthreads), support for density functional theory using the Libxc library [2], simplified initialization of calculations, build process facilitated by CMake and x2dhfctl (a Bash script), testing facilitated by testctl (a Bash script) and a host of test suites.
Summary of revisions: Code overhauled, modularised and streamlined with Fortran 95 standard, parallelisation of the self-consistent field (SCF) process and the successive overrelaxation (SOR) algorithm, corrected implementation of GGA functionals and support for the Libxc library of density functionals [2], improved initialisation of the SCF process via HF or LDA atomic orbitals and the superposition of atomic potentials [3], an enlarged test suite of input data and the corresponding outputs (235 in all) and xhf and testctl scripts to run and examine the tests. Script x2dhfctl added to control the build process via CMake, pecctl to automate calculations of potential energy curves and elpropctl to calculate (hyper)polarisabilities.
Nature of problem: The program finds numerically exact solutions of the HF or Kohn–Sham density functional equations for atoms, diatomic molecules, and their ions by determining the lowest energy eigenstates of a given irreducible representation and spin. Density functional calculations can be carried out using various exchange and correlation functionals provided by the Libxc library [2]. The program can also be used to perform independent particle calculations with the (smooth) Coulomb, Green–Sellin–Zachor, Krammers–Henneberger, and superposition of atomic potentials [3], as well as two-particle HF calculations for the harmonium atom.
Solution method: Factoring out the analytical angular solution around the bond axis, two-dimensional numerical single-particle functions (orbitals) are used to construct an antisymmetric many-electron wave function according to the restricted open-shell HF or density functional theory (DFT) model. The HF/DFT equations are written as coupled two-dimensional second-order (elliptic) partial differential equations (PDEs), which are discretized by an eighth order central difference stencil on a two-dimensional grid, whereas quadrature is performed with a Newton–Cotes rule. The resulting large and sparse system of linear equations are solved by the (multicolour) successive overrelaxation ((MC)SOR) method, and the orbitals and potentials are solved by simultaneous SOR iterations on the corresponding Poisson equations. The convergence of the SCF procedure is monitored with that of the orbital energies and normalisation factors. The precision of the obtained solutions depends on the grid and the system under consideration, and one can typically obtain orbitals that yield total and orbital energies with up to 12 significant figures using double precision arithmetic. If more precise results are needed, x2dhf can also be compiled in quadruple precision floating-point arithmetic.
Additional comments including restrictions and unusual features: CMake (ver. 3) and gfortran/ifort compiler are required to compile and build the program. The incomplete gamma function is needed to evaluate hydrogenic orbitals and its values are calculated by means of the dgamit.F subroutine written by Fullerton [4] which uses FORTRAN 90 versions of d1mach and i1mach functions.
References
[1]
J. Kobus, A finite difference Hartree–Fock program for atoms and diatomic molecules, Comput. Phys. Commun. 184 (2013) 799–811, https://doi.org/10.1016/j.cpc.2012.09.033.
[2]
S. Lehtola, C. Steigemann, M.J.T. Oliveira, M.A.L. Marques, Recent developments in LIBXC—a comprehensive library of functionals for density functional theory, SoftwareX 7 (2018) 1–5, https://doi.org/10.1016/j.softx.2017.11.002.
[3]
S. Lehtola, Assessment of initial guesses for self-consistent field calculations. Superposition of atomic potentials: simple yet efficient, J. Chem. Theory Comput. 15 (2019) 1593–1604, https://doi.org/10.1021/acs.jctc.8b01089, arXiv:1810.11659.
[4]
W. Fullerton, Netlib, July 1977 edition, C3, Los Alamos Scientific Lab.
期刊介绍:
The focus of CPC is on contemporary computational methods and techniques and their implementation, the effectiveness of which will normally be evidenced by the author(s) within the context of a substantive problem in physics. Within this setting CPC publishes two types of paper.
Computer Programs in Physics (CPiP)
These papers describe significant computer programs to be archived in the CPC Program Library which is held in the Mendeley Data repository. The submitted software must be covered by an approved open source licence. Papers and associated computer programs that address a problem of contemporary interest in physics that cannot be solved by current software are particularly encouraged.
Computational Physics Papers (CP)
These are research papers in, but are not limited to, the following themes across computational physics and related disciplines.
mathematical and numerical methods and algorithms;
computational models including those associated with the design, control and analysis of experiments; and
algebraic computation.
Each will normally include software implementation and performance details. The software implementation should, ideally, be available via GitHub, Zenodo or an institutional repository.In addition, research papers on the impact of advanced computer architecture and special purpose computers on computing in the physical sciences and software topics related to, and of importance in, the physical sciences may be considered.