Introduction

Methods for identifying the atoms in a molecule (AIM) can be broadly classified based on whether they partition the molecule’s wave-function in Hilbert space or divide a molecular descriptor in real space [1]. The latter commonly use the molecular electron density to directly define an AIM density ρ A(r) by,

$$ {\rho}_{\mathrm{A}}\left(\mathbf{r}\right)={w}_{\mathrm{A}}\left(\mathbf{r}\right){\rho}_{\mathrm{mol}}\left(\mathbf{r}\right) $$
(1)

Here, w A(r) is a weight function that distributes the molecular electron density ρ mol(r) among all constituting atoms. The weight function fulfills ∀r ∈  3 : ∑A w A(r) = 1 to guarantee an exhaustive partitioning, i.e., ∑A ρ A(r) = ρ mol(r). Real-space methods are either binary with w A(r) ∈ {0, 1}, like the quantum theory of atoms in molecules (QTAIM) [2,3,4] and Voronoi tessellation [5], or fuzzy with w A(r) ∈ [0, 1], like the Becke [6], Politzer [7], and Hirshfeld family of partitioning [8,9,10,11,12,13,14,15,16; Heidar-Zadeh et al. 2017, (unpublished)] schemes. The Hirshfeld method [8] specifically requires a promolecular density \( {\rho}_{\mathrm{mol}}^0\left(\mathbf{r}\right) \), which corresponds to the sum of reference proatom densities centered at the position of atomic nuclei,

$$ {\rho}_{\mathrm{mol}}^0\left(\mathbf{r}\right)=\sum \limits_{\mathrm{B}}^{N_{\mathrm{atoms}}}{\rho}_{\mathrm{B}}^0\left(\mathbf{r}\right) $$
(2)

The atomic weight function is then computed according to the stockholder recipe,

$$ {w}_{\mathrm{A}}\left(\mathbf{r}\right)=\frac{\rho_{\mathrm{A}}^0\left(\mathbf{r}\right)}{\rho_{\mathrm{mol}}^0\left(\mathbf{r}\right)}. $$
(3)

This implies that, at every point in space, the gain or loss in the electron density upon going from the promolecule to the molecular density is distributed among all atoms using their share in the promolecular density, i.e.,

$$ {\displaystyle \begin{array}{c}{\rho}_{\mathrm{A}}\left(\mathbf{r}\right)-{\rho}_{\mathrm{A}}^0\left(\mathbf{r}\right)={w}_{\mathrm{A}}\left(\mathbf{r}\right)\varDelta {\rho}_{\mathrm{mol}}\left(\mathbf{r}\right)\\ {}={w}_{\mathrm{A}}\left(\mathbf{r}\right)\left[{\rho}_{\mathrm{mol}}\left(\mathbf{r}\right)-{\rho}_{\mathrm{mol}}^0\left(\mathbf{r}\right)\right]\end{array}} $$
(4)

Inspired by Politzer’s earlier work [7, 17,19,20,20], in 1977 Hirshfeld [8] used spherically-averaged isolated neutral proatom densities and introduced the stockholder partitioning weight in Eq. (3). The arbitrary choice of neutral proatom densities has been recognized as one of the major drawbacks of the Hirshfeld partitioning [9, 21, 22]. In addition, Hirshfeld charges are known to be very small in magnitude; this can be rationalized based on the fact that minimizing the sum of f-divergence measures between atomic and reference proatom densities uniquely yields Hirshfeld AIM densities for an exhaustive partitioning [23,25,26,27,28,29,29]. In other words, Hirshfeld AIM densities are variationally optimized to be as close as possible to the neutral reference proatom densities, so the Hirshfeld AIM are nearly neutral also.

The first, and still the most popular, approach to systematically select suitable proatom densities, called the iterative Hirshfeld method (Hirshfeld-I) [9, 30; Heidar-Zadeh et al. 2017, (unpublished)], was developed in 2007 by Bultinck et al. using a self-consistent algorithm, which defines the atomic density at i th iteration through,

$$ {\rho}_{\mathrm{A}}^{(i)}\left(\mathbf{r}\right)=\left(\frac{\rho_{\mathrm{A}}^0\left(\mathbf{r},{N}_{\mathrm{A}}^{\left(i-1\right)}\right)}{\sum_{\mathrm{B}}{\rho}_{\mathrm{B}}^0\left(\mathbf{r},{N}_{\mathrm{B}}^{\left(i-1\right)}\right)}\right){\rho}_{\mathrm{mol}}\left(\mathbf{r}\right) $$
(5)

where \( {N}_{\mathrm{A}}^{\left(i-1\right)} \) represents the number of electrons of atom A at the (i-1)th iteration,

$$ {N}_{\mathrm{A}}^{\left(i-1\right)}=\int {\rho}_{\mathrm{A}}^{\left(i-1\right)}\left(\mathbf{r}\right)d\mathbf{r}. $$
(6)

The reference proatom density with N A electrons is defined as a weighted average of the atomic densities with the closest-lower-integer number, ⌊N A⌋, and the closest-higher-integer number, ⌈N A⌉, of electrons [31,34,35,34],

$$ {\rho}_{\mathrm{A}}^0\left(\mathbf{r},{N}_{\mathrm{A}}\right)=\left({N}_{\mathrm{A}}-\left\lfloor {N}_{\mathrm{A}}\right\rfloor \right){\rho}_{\mathrm{A}}^0\left(\mathbf{r},\left\lceil {N}_{\mathrm{A}}\right\rceil \right)+\left(\left\lceil {N}_{\mathrm{A}}\right\rceil -{N}_{\mathrm{A}}\right){\rho}_{\mathrm{A}}^0\left(\mathbf{r},\left\lfloor {N}_{\mathrm{A}}\right\rfloor \right). $$
(7)

This iterative scheme conventionally uses Hirshfeld charges as initial guess, refines the atomic densities self-consistently, and converges when the change in AIM populations is sufficiently small, \( \underset{\mathrm{A}}{\underbrace{\max}}\left|{N}_{\mathrm{A}}^{(i)}-{N}_{\mathrm{A}}^{\left(i-1\right)}\right|\le \varepsilon \) with ε being a user-defined threshold. The popularity of the Hirshfeld-I charges can be attributed to their intuitive appeal, limited basis set dependence [30, 35, 36] and accurate modeling of the molecular electrostatic potential on molecular van der Waals’ surfaces, even without including the contributions from the dipole or higher-order multipoles [37].

The major weakness of the Hirshfeld-I scheme is its dependence on the electron density of negatively-charged atomic species. Even when an atomic charge becomes only slightly negative during the self-consistent iterations, the interpolated density in Eq. (7) requires the corresponding anion density of proatom A with nuclear charge Z A. Unfortunately, in some cases the extra electron(s) of the negatively charged atomic species (like the nitrogen anion or the dianion of all atoms) are not physically bound, even if they are computationally (i.e., basis-set) bound. It is also possible for the anion density to be physically bound, but computationally unbound (like the hydrogen and oxygen anions at the Hartree-Fock level of theory). This pitfall can easily go unnoticed, and induces, especially for large basis sets, a very slow decay of the negatively-charged atomic density. For example, the unbound oxygen dianion density is required for computing the charges of metal oxides, where the Hirshfeld-I charge is below −1. This results in an unreasonably negative atomic charge for the oxygen atom and poor approximations of the electrostatic potential on molecular van der Waals’ surfaces. Also, the density of these unbound, or barely bound, reference atomic species heavily depends on the level of theory and basis set used, and can even exhibit non-monotonic decay [38].

Several, typically pragmatic, remedies have been proposed to address the “anion problem” in Hirshfeld-I, often at the expense of increased computational cost and/or defining “effective” atom densities in a way that is at best ad hoc and at worst hand-tuned [16, 39, 40]. Here, we introduce a simple yet novel technique to obtain physically-bound densities for negatively charged reference proatom species using fractional nuclear charges. These bound reference densities decay monotonically at a reasonable rate and alleviate the shortcomings of the Hirshfeld-I charges when applied to compounds containing negatively charged atoms.

Methods

Our approach for obtaining a bound anion density is based on the observation that one can bind the extra electron(s) by increasing the positive nuclear charge. Suppose that the Hirshfeld-I scheme requires the proatom density of an element with atomic number Z A and N A > Z A electrons. One should first assess whether the N A electrons are bound at the given level of theory and basis set by computing the electron affinity,

$$ E\left({Z}_{\mathrm{A}},{N}_{\mathrm{A}}-1\right)-E\left({Z}_{\mathrm{A}},{N}_{\mathrm{A}}\right)\ge 0 $$
(8)

If this condition is met, N A electrons are bound by the nuclear charge Z A at the given level of theory, and the Hirshfeld-I procedure can be carried out in the conventional way, using the computed ρ A(r, N A; Z A) density with integer atomic number Z A. For some atomic anions and all dianion species, Eq. (8) is not satisfied and the densities have the undesirable features mentioned above.Therefore, we search for the lowest effective nuclear charge \( {Z}_{\mathrm{A}}^{\mathrm{eff}} \) that will effectively bind N A electrons, i.e., the \( {Z}_{\mathrm{A}}^{\mathrm{eff}} \) that solves the following equation,

$$ E\left({Z}_{\mathrm{A}}^{\mathrm{eff}},{N}_A\right)-E\left({Z}_{\mathrm{A}}^{\mathrm{eff}},{N}_A-1\right)=0 $$
(9)

Though there is intrinsic interest in the value of \( {Z}_{\mathrm{A}}^{\mathrm{eff}} \) and the associated critical behavior [41,44,45,46,47,48,47], in this application we are interested mainly in the corresponding ground-state density of the system with N A electrons, i.e., \( {\rho}_{\mathrm{A}}\left(\mathbf{r},{N}_{\mathrm{A}};{Z}_{\mathrm{A}}^{\mathrm{eff}}\right) \). Still, using this density directly is not desirable because it does not meet the nuclear cusp condition [48, 49]. So, we usually opt to transform it by coordinate scaling [50] to exhibit the cusp associated with a nuclear charge of Z A (see Appendix),

$$ {\rho}_{\mathrm{A}}\left(\mathbf{r},{N}_{\mathrm{A}};{Z}_{\mathrm{A}}\right)={\left(\frac{Z_{\mathrm{A}}}{Z_{\mathrm{A}}^{\mathrm{eff}}}\right)}^3{\rho}_{\mathrm{A}}\left(\frac{Z_{\mathrm{A}}}{Z_{\mathrm{A}}^{\mathrm{eff}}}\mathbf{r},{N}_{\mathrm{A}};{Z}_{\mathrm{A}}^{\mathrm{eff}}\right). $$
(10)

This bound pseudo-density for the N A-electron system can then be used in the Hirshfeld-I procedure.

Such critical nuclear charges have already been reported in the literature. For example, Hogreve [42] computed these values using multi reference configuration interaction methods with large and diffuse basis sets. Sergeev and Kais [44] reported these values by using a one-particle model to describe the motion of the loosely bound electron. Recently, Cardenas et al. [47] estimated these values using ionization-potential extrapolation of isoelectronic series. Even though these reported values seem like a good choice in the first place, our numerical tests revealed that \( {Z}_{\mathrm{A}}^{\mathrm{eff}} \) should be found at each level of theory and basis set to keep the electrons bound. This is especially important, because it is commonly advised to use the same level of theory and basis set for molecular and proatom density calculations.

In practice, for a given level of theory and basis set, \( {Z}_{\mathrm{A}}^{\mathrm{eff}} \) in Eq. (9) can be solved for using Newton’s method considering the fact that the derivative of the energy with respect to the atomic number Z A is the electrostatic potential at the position of the nucleus A [51,54,55,56,57,58,57],

$$ \frac{\partial E}{\partial {Z}_{\mathrm{A}}}=\varPhi \left(\mathbf{r}={\mathbf{R}}_{\mathrm{A}}\right)=-\int \frac{\rho \left({\mathbf{r}}^{\prime}\right)}{\left|{\mathbf{r}}^{\prime }-{\mathbf{R}}_{\mathrm{A}}\right|}d{\mathbf{r}}^{\prime }. $$
(11)

In other words, the atomic number can be iteratively updated until convergence is reached according to,

$$ {\xi}_{\mathrm{A}}^{\left(k+1\right)}={\xi}_{\mathrm{A}}^{(k)}-\frac{E\left({N}_{\mathrm{A}}-1,{\xi}_{\mathrm{A}}^{(k)}\right)-E\left({N}_{\mathrm{A}},{\xi}_{\mathrm{A}}^{(k)}\right)}{\varPhi \left(\mathbf{r}={\mathbf{R}}_{\mathrm{A}},{N}_{\mathrm{A}}-1,{\xi}_{\mathrm{A}}^{(k)}\right)-\varPhi \left(\mathbf{r}={\mathbf{R}}_{\mathrm{A}},{N}_{\mathrm{A}},{\xi}_{\mathrm{A}}^{(k)}\right)} $$
(12)

Alternatively, for a given level of theory and basis set, one can define the effective nuclear charge as the smallest nuclear charge for which the energy of the highest molecular orbital becomes negative to guarantee that all N A electrons are bound.

$$ {E}_{\mathrm{HOMO}}\left({N}_{\mathrm{A}},{Z}_{\mathrm{A}}^{\mathrm{eff}}\right)\le 0 $$
(13)

This can be found by scanning the nuclear charge in a reasonable interval like [N A − 1, N A].

Results and discussion

To demonstrate how the atomic densities corresponding to the effective nuclear charges can remove the artifacts associated with unbound anionic proatom densities, we closely examine Hirshfeld-I charges of ammonia and formamide. We focused on molecules containing the nitrogen atom because such molecules are typically the most problematic for Hirshfeld-I caused by the fact that the nitrogen is relatively electronegative, so the nitrogen AIM has typically a negative charge, but the isolated nitrogen atom has no bound anion. (Indeed, the Hirshfeld-I charges of nitrogen AIM can become absurdly negative. For example, the charge of the nitrogen atom in NLi3 is less than minus three when diffuse basis functions are used!)

All geometries were optimized at UωB97XD/cc-pVTZ level of theory, followed by single point calculations using unrestricted Hartree-Fock and the UB3LYP [58, 59] and UωB97XD [60] density functionals in conjunction with 12 Dunning (d-aug-)cc-pVXZ with X = D, T, Q, 5 correlation consistent basis sets [61]. All quantum chemistry calculations were performed using Gaussian09 [62], employing ultrafine integration grids and the stable = opt keyword to ensure that a (local) minimum of the energy with respect to variations of the orbitals was found. The Hirshfeld-I calculations were performed with the HORTON [63] and ChemTools [64] packages. The finest pruned Becke-Lebedevgrid of HORTON has been used to compute the molecular density, and exponential radial grids extending from 0.0005 to 20 Angstrom with 175 radial and 230 angular Lebedev-Laikov grid points are used to represent the proatom densities.

Table 1 presents the optimized effective nuclear charges for the anion and dianion species of the carbon, nitrogen, and oxygen atoms at various levels of theory using Eq. (12); these critical charges obtained by having zero electron affinity are labeled as ECR (energy-determined critical charges). In addition, the smallest effective nuclear charges satisfying Eq. (13) are also tabulated for the nitrogen anion and dianion; these critical charges obtained by having zero HOMO energy are labeled as HCR (HOMO-determined critical charges). The original basis set of each element has been used for the computations of atoms with fractional nuclear charge. We also scaled the basis set exponents of each atom by \( \sqrt{\frac{Z_{\mathrm{A}}^{\mathrm{eff}}}{Z_{\mathrm{A}}}} \), but found that this barely changed the final \( {Z}_{\mathrm{A}}^{\mathrm{eff}} \) values. It is important to note that even the oxygen anion, which is physically bound, is slightly unbound at Hartree-Fock level of theory (especially when using small basis sets). On the other hand, if \( {Z}_{\mathrm{A}}^{\mathrm{eff}}<{Z}_{\mathrm{A}} \) for binding N A electrons, we use the original nuclear charge Z A and the accompanying density ρ A(r, N A; Z A) as reference proatom density in Hirshfeld-I computation. That is, the density corresponding to the critical atomic number is not used when the conventional Hirshfeld-I proatoms are already bound.

Table 1 Effective nuclear charges computed from Eqs. (12) and (13), called ZECR and ZHCR, for the anion and dianion of carbon, nitrogen, and oxygen at different levels of theory. Data for species that are unbound for Z A and hence have a larger effective nuclear charge than ZA are shown in bold

The densities corresponding to critical atomic charges tabulated in Table 1 have been used to compute the atomic charges of NH3 in Fig. 1. This example highlights the large spread of Hirshfeld-I charges when the commonly used unbound anionic proatom densities are used. In such cases, the decay of the nitrogen anion density depends very strongly on the level of theory and basis set used, directly affecting the decay of the nitrogen AIM density and its charge. The very diffuse proatom densities for the nitrogen anion cause the nitrogen to “steal” extra electrons from its neighbouring atoms, and when its charge decreases below −1 then the nitrogen dianion density must also be included for the algorithm to converge. This “runaway charge” problem and other artifacts caused by using unphysical proatom densities are greatly reduced by using the more realistic densities corresponding to the effective nuclear charges obtained through Eqs. (12) and (13). These densities are either scaled according to Eq. (10) or not, which has a noticeable influence on the magnitude (but not the spread) of the nitrogen AIM charges. The suffix -S is used to denote that the (di)anion densities are scaled before being used as reference proatom densities in the Hirshfeld-I algorithm.

Fig. 1
figure 1

Ammonia AIM charges from the original iterative Hirshfeld (HI) scheme and those computed using the critical nuclear charge proatoms for nitrogen. The charges computed using the fractional nuclear charge approach are labeled HI-ECR-S and HI-HCR-S for which the effective nuclear charge of the nitrogen anion has been computed using Eqs. (12) and (13), respectively, and the corresponding density is scaled according to Eq. (10). The same procedures, without scaling the density, have been used to compute HI-ECR and HI-HCR charges. For each scheme, the three columns correspond to UHF, UB3LYP, and UωB97XD levels of theory, respectively, and each column shows the charges computed using 12 Dunning basis sets: cc-pVXZ, aug-cc-pVXZ, and d-aug-cc-pVXZ with X = D, T, Q, 5. The molecular and proatom densities were computed at the same level of theory. The absolute range of the atomic charges obtained using various basis sets for each level of theory is summarized on the x-axis alongside the partitioning method. The actual charges are tabulated in Table S1 of the Supplementary material

From nitrogen charges computed with the effective nuclear charges obtained through Eq. (12), i.e., HI-ECR and HI-ECR-S, it is immediately clear that this treatment works very well at the Hartee-Fock level of theory, where the nitrogen anion is unbound for all basis sets considered, \( {Z}_{\mathrm{A}}^{\mathrm{eff}}>7 \). These Hartee-Fock charges have a small spread and a reasonable negative value larger than −1, so our treatment eliminates the need for nitrogen dianion density. The effect on the charges computed with density functional theory (DFT) is less pronounced, because the UB3LYP/(d-)aug-cc-pVXZ and UωB97XD/d-aug-cc-pVXZ methods fictitiously recognize the nitrogen anion as bound with \( {Z}_{\mathrm{A}}^{\mathrm{eff}}<7 \). However, the charges computed with UB3LYP/cc-pVXZ and UωB97XD/(aug-)cc-pVXZ slightly change because the nitrogen anion is slightly unbound with those methods. For nitrogen charges computed with effective nuclear charges obtained through Eq. (13), i.e., HI-HCR and HI-HCR-S, the nitrogen anion has \( {Z}_{\mathrm{A}}^{\mathrm{eff}}>7 \) at all levels of theory and basis sets, so the nitrogen anion density is replaced at all levels of theory and basis sets considered. The Hartree-Fock charges are more spread than HI-ECR and HI-ECR-S, because the effective nuclear charges obtained are smaller. However, the DFT charges have a smaller spread when compared to the HI-ECR and HI-ECR-S charges, because the anion densities are replaced with the corresponding density of \( {Z}_{\mathrm{A}}^{\mathrm{eff}} \) at all levels of theory.

Figure 2 shows the Hirshfeld-I charges of the carbon, nitrogen, and oxygen atoms of formamide at different levels of theory using the original and effective nuclear bound (di)anion proatom densities. The original Hirshfeld-I charges of carbon and nitrogen display a noticeable dependence on the basis set used. This dependence is removed when the nitrogen anion density is replaced with the density corresponding to the effective nuclear charge to yield a bound anionic system. Similar to NH3, the charges are most affected at the Hartree-Fock level for HI-ECR and HI-ECR-S, and at the DFT level for HI-HCR and HI-HCR-S. We believe that the effective nuclear charges computed through Eq. (12) are more suitable, as they fully comply with ionization potential computations at each level of theory and basis set. For example, the nitrogen anion has a positive ionization potential at the UB3LYP/(d-)aug-cc-pVXZ and UωB97XD/d-aug-cc-pVXZ levels, implying that the electrons are bound, and the effective nuclear charge of the nitrogen atom for binding 8 electrons at these levels are less than 7 according to Eq. (12), but not based on Eq. (13). Consequently, we believe that the effective nuclear charges that yield a zero electron affinity for binding the extra electron(s) at each level of theory and basis set, ZECR, are worth further investigation for (di)anion proatom species in the Hirshfeld-I algorithm.

Fig. 2
figure 2

Formamide AIM charges from the original iterative Hirshfeld (HI) charges and those computed using the critical nuclear charge proatoms for a) nitrogen, b) carbon, and c) oxygen. The charges computed using the fractional nuclear charge approach are labeled HI-ECR-S and HI-HCR-S for which the effective nuclear charges of the anions have been computed using Eqs. (12) and (13), respectively, and the corresponding density is scaled according to Eq. (10). The same procedures, without scaling the density, have been used to compute HI-ECR and HI-HCR charges. For each scheme, the three columns correspond to UHF, UB3LYP, and UωB97XD levels of theory, respectively, and each column shows the charges computed using 12 Dunning basis sets: cc-pVXZ, aug-cc-pVXZ, and d-aug-cc-pVXZ with X = D, T, Q, 5. The molecular and proatom densities were computed at the same level of theory. The absolute range of the atomic charges obtained using various basis sets for each level of theory is summarized on the x-axis alongside the partitioning method. The actual charges are tabulated in Table S2-S4 of the Supplementary material

Conclusions

The iterative Hirshfeld scheme is one of the most popular recent density partitioning schemes commonly used for identifying atoms in molecules and materials. The elegant self-consistent algorithm of Hirshfeld-I is known to converge almost always to a unique solution and is almost insensitive to the choice of initial proatoms. However, very often, Hirshfeld-I calculations require the proatom densities from unbound isolated atomic anions and/or dianions. Conventionally one (often with great difficulty) determines the (only basis-set-bound) densities of these ions with the same electronic structure method and basis set as the molecular calculation. However, this often leads to Hirshfeld-I charges that are too large in magnitude and too sensitive to the level of theory and basis set used for computing the molecular and reference proatom densities. Here we proposed a novel approach to obtain reasonable densities for unbound (di)anion atomic species. The key idea is based on exploiting the densities corresponding to the effective nuclear charges, i.e., the smallest atomic number \( {Z}_{\mathrm{A}}^{\mathrm{eff}} \) for which N A electrons are bound. This requires computing the critical atomic number of unbound atomic species at a given level of theory and basis set, and utilizing the corresponding scaled bound density as a reference density. Our result shows that this protocol produces reasonably decaying atomic densities and improves the computational robustness of Hirshfeld-I algorithm.

As an alternative, one can also use a fixed level of theory and basis set to compute the reference proatom densities. This considerably reduces the spread of Hirshfeld-I charges and makes them insensitive to the level of theory and basis set used for the molecule or material being partitioned, though a suitable definition for the electron density of unbound atomic anions and polyanions is still required. Currently, we are constructing an accurate database of ground and excited state densities of neutral and charged atomic species using multi-reference configuration interaction methods with large basis sets. We believe that combining the critical-charge and density scaling approach in this paper with the high-quality densities from this database will guarantee the computational robustness of Hirshfeld-I.