betaFeedback

WorksPhysics and Astronomy

Coupling all-electron full-potential density functional theory with grid-based continuum embeddings

Abstract

Recent advances in continuum embedding models have enabled the incorporation of solvent and electrolyte effects into density functional theory (DFT) simulations of material surfaces, significantly benefiting electrochemistry, catalysis, and other applications. To extend the simulation of diverse systems and properties, the implementation of continuum embedding models into the Environ library adopts a modular programming paradigm, offering a flexible interface for communication with various DFT programs. The speed and scalability of the current implementation rely on a smooth definition of the key physical properties of the atomistic system, in particular of its electronic density. This has hindered the coupling of Environ with all-electron simulation packages, as the sharp electron density peaks near atomic nuclei are difficult to represent on regular grids. In this work, we introduce a novel smoothing scheme that transforms atom-centered electron densities into a regular grid representation while preserving the accuracy of electrostatic calculations. This approach enables a minimal and generic interface, facilitating seamless interoperability between Environ and all-electron DFT programs. We demonstrate this development through the coupling of Environ with the FHI-aims package and present benchmark simulations that validate the proposed method.

interface, facilitating seamless interoperability between Environ and all-electron DFT programs. We demonstrate this development through the coupling of Environ with the FHI-aims package and present benchmark simulations that validate the proposed method.

Introduction

Continuum embedding models are commonly used to incorporate solvation effects in molecular simulations.[1, 2] These models treat the solvent as a structureless dielectric continuum interacting with a solute system while the latter is treated on an atomistic level. The popularity of these methods arises from their high efficiency. For typical applications where the solute is treated on an electronic structure level of theory, continuum embedding causes only a small to moderate computational overhead.[3] By contrast, simulating individual solvent molecules explicitly would not only increase the system size of the electronic structure calculation but also require adequate thermodynamic sampling of the solvent molecules’ phase space, thus increasing the computational cost by multiple orders of magnitude.[4]

A variety of continuum embedding models, also referred to as implicit solvation models, have been proposed in the literature.[2] Historically, these were typically implemented with one particular host program in mind.[5, 6, 7] However, with the modular programming paradigm getting increasingly adopted in computational science, continuum embedding packages are now available which can be incorporated as libraries into different host programs or used as standalone software.

These implementations often rely on fast Fourier transforms (FFT) for their numerical solvers.[6, 7] This allows for a straightforward coupling with density functional theory with plane waves and pseudopotentials (DFT-PWP) host codes.[8] FFT requires data to be represented on a regular grid, i.e., a grid with even spacing in the directions of all three lattice vectors. In contrast, all-electron full-potential DFT (henceforth shortened to all-electron DFT) relies on overlapping atom-centered grids to resolve the potential near the nuclei.[9] In this region, allelectron DFT correctly predicts a steep variation of the charge density with a characteristic cusp, which cannot be adequately represented on a regular grid. This leads to inconsistent results for any practically feasible grid spacing and precludes coupling regular grid based continuum embedding with all-electron DFT in the minimalist fashion which is possible with DFT-PWP. This hinders interoperability despite the underlying physical models of continuum embedding and all-electron DFT being compatible in most cases.

To bridge this gap, we present here an interface between the all-electron DFT program FHI-aims[9, 10, 11, 12] and the regular grid based continuum embedding package Environ.[6] The interface is kept generic in the sense that communication is, for the most part, restricted to grid information and such physical data which is practically always needed, namely the electron density, molecular geometry, potential, energy, and forces. Such an interface makes only minimal assumptions on either side about the methods which are used by the other side. This allows the user to freely choose these methods as long as the underlying physical models are compatible. This interoperability will immediately include methods developed in the future without requiring any adaptations to the interface. At the center of the interface lies a smoothing scheme which we use to represent the all-electron density on the regular grid in a way that accurately preserves atomic multipole moments, leading to consistent results at a feasible grid spacing.

Theoretical background

The physical background and computational details of the methods available in FHI-aims and Environ have been described in other publications. We restrict ourselves here to reiterating only those parts of the formalism which are relevant for the communication interface that is the subject of the present work.

All-electron full-potential density functional theory

Regular grid based software typically store the electron density in a straightforward value-per-grid-point manner. By contrast, FHI-aims uses a partitioning scheme to store the density as atomic multipole components which are functions of only one radial coordinate. In a first step, the full density ρel\rho^{\mathrm{el}} of all electrons in the system is separated into a free atom contribution and a delta density δρ\delta\rho

ρel(r)=∑atρatfree(rat)+δρ(r)(1)\rho^{\mathrm{el}}(\mathbf{r}) = \sum_{at} \rho^{\mathrm{free}}_{at}(r_{at}) + \delta\rho(\mathbf{r}) \tag*{(1)}

where the sum runs over all atoms atat in the system and ρatfree\rho^{\mathrm{free}}_{at} is the density of a single, free (i.e., in vacuum) atom of the same species (i.e., nuclear charge) as atat. Throughout this work, we use the shorthand notations ratr_{at}, Ωat\Omega_{at} to denote the radial and angular components of the atom-centered position r−Rat\mathbf{r} - \mathbf{R}_{at} in spherical coordinates, where Rat\mathbf{R}_{at} is the nuclear position of atat. δρ\delta\rho is then further partitioned into atomic contributions according to

δρat(r)=pat(r)δρ(r)(2)\delta\rho_{at}(\mathbf{r}) = p_{at}(\mathbf{r})\delta\rho(\mathbf{r}) \tag*{(2)}

The exact form of the atomic partitioning functions patp_{at} is not relevant for the present work. Suffice it to say that they fulfill ∑atpat(r)=1\sum_{at} p_{at}(\mathbf{r}) = 1 at every point r\mathbf{r} where ρel\rho^{\mathrm{el}} or any of its components are non-zero such that ∑atδρat=δρ\sum_{at} \delta\rho_{at} = \delta\rho, and that each of them is centered around its nucleus Rat\mathbf{R}_{at} such that it decays to zero at some finite distance from Rat\mathbf{R}_{at}. The atomic contributions are then finally partitioned into multipoles

δρ~at,lm(r)=∫∣r−Rat∣=rdΩat δρat(r)Ylm(Ωat)(3)\widetilde{\delta\rho}_{at,lm}(r) = \int_{\lvert\mathbf{r}-\mathbf{R}_{at}\rvert=r} d\Omega_{at}\,\delta\rho_{at}(\mathbf{r})Y_{lm}(\Omega_{at}) \tag*{(3)}

where YlmY_{lm} are the real-valued linear combinations of the spherical harmonics. Truncating the expansion at a finite order lmax⁡l_{\max}, a multipole density can be reconstructed which reproduces the original ρel\rho^{\mathrm{el}} to a good approximation.

ρMP(r)=∑atρatfree(rat)+∑at∑l=0lmax⁡∑m=−llδρ~at,lm(rat)Ylm(Ωat)(4)\rho^{\mathrm{MP}}(\mathbf{r}) = \sum_{at} \rho^{\mathrm{free}}_{at}(r_{at}) + \sum_{at} \sum_{l=0}^{l_{\max}} \sum_{m=-l}^{l} \widetilde{\delta\rho}_{at,lm}(r_{at})Y_{lm}(\Omega_{at}) \tag*{(4)}

Although it slightly differs from ρel\rho^{\mathrm{el}}, we refer to ρMP\rho^{\mathrm{MP}} as the original electron density throughout this article to distinguish it from the smoothened electron density which we introduce in section 3.2. A few things are worth pointing out about this formalism. In eq. (4), the analytical form of YlmY_{lm} is well-known, and the two remaining types of functions ρatfree\rho^{\mathrm{free}}_{at} and δρ~at,lm\widetilde{\delta\rho}_{at,lm} depend only on a single, radial coordinate rather than the full vector r\mathbf{r}. They can, thus, be tabulated on a dense grid without requiring much memory space. The evaluation at an arbitrary radius uses cubic spline interpolation between the tabulated values. ρatfree\rho^{\mathrm{free}}_{at} and δρ~at,lm\widetilde{\delta\rho}_{at,lm} are tabulated on different types of grids. Without going into their detailed definitions, we note that both types of grids get denser closer to the nucleus. This allows the characteristic cusp of the electron density at the nucleus to be resolved with high accuracy, enabling an all-electron full-potential formalism which does not rely on pseudopotentials. While the evaluation of eq. (4) at an arbitrary point r\mathbf{r} requires only data stored on 1-dimensional grids, the evaluation of eq. (3) at one given r\mathbf{r} still requires δρat(r)\delta\rho_{at}(\mathbf{r}) on a 2-dimensional angular grid centered around Rat\mathbf{R}_{at}. Consequently, evaluating eq. (3) at all grid values of r\mathbf{r} at which we want to tabulate δρ~at,lm\widetilde{\delta\rho}_{at,lm} ultimately does require an atom-centered 3-dimensional grid consisting of radial shells of angular grids. The full grid in FHI-aims which corresponds to the regular grids used in DFT-PWPP thus consists of overlapping atom-centered grids.

Solving the Poisson equation

The electrostatic potential Φ\Phi generated by a charge density ρ\rho in the absence of any other charge carriers or external fields is defined by the Poisson equation (PE)

∇2Φ(r)=−4πρ(r)(5)\nabla^2 \Phi(\mathbf{r}) = -4\pi\rho(\mathbf{r}) \tag*{(5)}

A unique solution (in some cases up to a constant offset) is defined by appropriate boundary conditions, e.g. lim⁡r→∞Φ=0\lim_{r \to\infty} \Phi= 0 or periodicity at the boundary of a unit cell. The density ρ\rho here is more general than the electron density discussed in the previous section and may, for example, include nuclei.

Solving eq. (5) is an integral part of electronic structure theory and consequently has to be implemented in any DFT software package either directly or through external libraries. Different practical approaches have been developed. In FHI-aims, the linearity of the ∇2\nabla^2 operator is exploited to decompose the electronic contribution to the potential into individual vatfreev_{at}^{\mathrm{free}} and δv~at,lm\widetilde{\delta v}_{at,lm} in complete analogy to eq. (4). These components are obtained from δρ~at,lm\delta\widetilde{\rho}_{at,lm}

δv~at,lm(r′)=∫0r′dr r2gl(r,r′)δρ~at,lm(r)+∫r′∞dr r2gl(r′,r)δρ~at,lm(r)(6)\delta\widetilde{v}_{at,lm}(r') = \int_{0}^{r'} \mathrm{d}r\,r^2g_l(r,r')\delta\widetilde{\rho}_{at,lm}(r) + \int_{r'}^{\infty} \mathrm{d}r\,r^2g_l(r',r)\delta\widetilde{\rho}_{at,lm}(r) \tag*{(6)}

using the symmetry dependent radial Green’s function gl(r1,r2)=4π2l+1⋅r1lr2l+1g_l(r_1,r_2) = \frac{4\pi}{2l+1} \cdot\frac{r_1^l}{r_2^{l+1}} of the ∇2\nabla^2 operator.

By contrast, starting from ρ(r)\rho(\mathbf{r}), regular grid based codes typically use FFT to obtain ρ^(g)\hat{\rho}(\mathbf{g}). In reciprocal space, the Laplace operator ∇2\nabla^2 is transformed into a simple multiplication with ∣g∣2|\mathbf{g}|^2, which can easily be inverted to obtain Φ^(g)\hat{\Phi}(\mathbf{g}) and, through inverse FFT, Φ(r)\Phi(\mathbf{r}).1

The generalized Poisson and Poisson-Boltzmann equations

The situation becomes more complicated compared to eq. (5) when investigating systems in which charges are present which we do not want to explicitly include in ρ\rho. In this case, we need to make assumptions about the behavior of the remaining charges and their impact on Φ\Phi. For example, consider some explicit charge distribution ρ\rho which is immersed in a local, linear, and isotropic dielectric medium. We may not want to include the polarization charge of the medium in ρ\rho. Instead, we can describe it by its relative dielectric permittivity ε\varepsilon in the generalized Poisson equation (GPE)[1]

∇(ε(r)∇Φ(r))=−4πρ(r)(7)\nabla\left(\varepsilon(\mathbf{r})\nabla\Phi(\mathbf{r})\right)=-4\pi\rho(\mathbf{r}) \tag*{(7)}

If, additionally, an electrolyte is dissolved in the solvent medium and we do not want to treat the electrolyte charge explicitly as part of ρ\rho either, then we can treat each ionic species ionion as a separate source term ρion\rho_{ion}

∇(ε(r)∇Φ(r))=−4π(ρ(r)+∑ionρion(r))(8)\nabla\left(\varepsilon(\mathbf{r})\nabla\Phi(\mathbf{r})\right)=-4\pi\left(\rho(\mathbf{r})+\sum_{ion}\rho_{ion}(\mathbf{r})\right) \tag*{(8)}

which follows the Poisson-Boltzmann equation (PBE)13

ρion(r)=zionρ∞,ionγ(r)exp⁡(−zionΦ(r)kBT)(9)\rho_{ion}(\mathbf{r})=z_{ion}\rho_{\infty,ion}\gamma(\mathbf{r})\exp\left(-\frac{z_{ion}\Phi(\mathbf{r})}{k_{\mathrm{B}}T}\right) \tag*{(9)}

with the charge zionz_{ion} and bulk concentration ρ∞,ion\rho_{\infty,ion} of species ionion, the Boltzmann constant kBk_{\mathrm{B}}, the temperature TT, and a function γ\gamma which is =1=1 in regions of space that are fully accessible to the electrolyte and =0=0 in regions that the electrolyte cannot enter, with some transition between the regions.

Continuum embedding

The modifications of PE described in the previous section are generally accurate only on a macroscopic scale. Nonetheless, the idea of using them as an approximation on an atomic scale has led to the development of continuum embedding models. When simulating molecules or surfaces in solution, this allows us to treat only the solute (and possibly a small number of solvent molecules) on an atomistic level while representing (most of) the solvent as a dielectric continuum.[1, 2] In the present work, we focus on the continuum embedding software package Environ.

Different variations of the two basic models described in the previous section are implemented in Environ, such as a modification of PBE due to finite ion size and a linearized version of it, 13 as well as Stern layer corrections 14,15. The simpler planar countercharge, Gouy-Chapman-Stern, 13 and Mott-Schottky 16 electrolyte models for surfaces are also available, as well as further modifications of the potential such as periodic boundary corrections, 17 confining potentials, 18, and external charges.

What these models have in common is that they cannot be solved directly using the formalism in eq. (6). This is because the symmetry dependent radial Green’s function gl(r1,r2)g_l(r_1,r_2) is derived from a multipole decomposition of the three-dimensional Green’s function of the ∇2\nabla^2 operator. 19 No general and straightforward decomposition of this kind exists for the ∇(ε(r)∇)\nabla(\varepsilon(\mathbf{r})\nabla) operator with arbitrary ε(r)\varepsilon(\mathbf{r}). Furthermore, eqs. (8) and (9) are interdependent and generally require iterative solver algorithms.

In addition to implementing these solvers, Environ handles a range of additional tasks. The permittivity ε(r)\varepsilon(\mathbf{r}) and the function γ(r)\gamma(\mathbf{r}) in PBE need to be defined. To this end, the region occupied by the solute, called the solvation cavity, is introduced. It is assumed to be inaccessible to solvent molecules. It is defined by a cavity function s(r)\mathbf{s}(\mathbf{r}) which is =1=1 for r\mathbf{r} inside the cavity and =0=0 in the solvent. This allows for a definition ε(r)=ε(s(r))\varepsilon(\mathbf{r})=\varepsilon(s(\mathbf{r})) such that ε(s=1)=1\varepsilon(s=1)=1 and ε(s=0)=εbulk\varepsilon(s=0)=\varepsilon_{\mathrm{bulk}} with the permittivity εbulk\varepsilon_{\mathrm{bulk}} of the bulk solvent. Similarly, γ(r)=γ(s(r))\gamma(\mathbf{r})=\gamma(s(\mathbf{r})) with γ(s=1)=0\gamma(s=1)=0 and γ(s=0)=1\gamma(s=0)=1. [1] [13] The transition of ε(s)\varepsilon(s) and γ(s)\gamma(s) as functions of ss between these extremes is continuous and monotonic. Throughout the present work, we use the term ‘cavity’ in a strict sense only for the region in space where s≃1s\simeq1. The transition region with 0<s≪10<s\ll1 is considered to be outside of the cavity. We will use the shorthand terms inside/outside for ‘inside/outside of the cavity’ henceforth.

Environ provides various options to define the cavity. The self-consistent continuum solvation (SCCS) model[6] defines ss as a function of the electron density

sSCCS(r)={0,ρel(r)≤ρmin⁡t(ln⁡(ρel(r))),ρmin⁡<ρel(r)<ρmax⁡1,ρel(r)≥ρmax⁡(10)s_{\mathrm{SCCS}}(\mathbf{r}) = \begin{cases} 0, & \rho^{\mathrm{el}}(\mathbf{r}) \le\rho_{\min} \\ t(\ln(\rho^{\mathrm{el}}(\mathbf{r}))), & \rho_{\min} < \rho^{\mathrm{el}}(\mathbf{r}) < \rho_{\max} \\ 1, & \rho^{\mathrm{el}}(\mathbf{r}) \ge\rho_{\max} \end{cases} \tag*{(10)}

where tt is a function which smoothly and monotonically switches from 0 to 1, and ρmin⁡\rho_{\min} and ρmax⁡\rho_{\max} are model parameters. The soft-sphere continuum solvation (SSCS) model20 defines the cavity based on the scaled van-der-Waals radii ratvdWr_{at}^{\mathrm{vdW}} of the atoms

sSSCS(r)=1−∏at12(1+erf⁡(rat−αratvdWΔ))(11)s_{\mathrm{SSCS}}(\mathbf{r}) = 1 - \prod_{at} \frac{1}{2}\left(1+\operatorname{erf}\left(\frac{r_{at}-\alpha r_{at}^{\mathrm{vdW}}}{\Delta}\right)\right) \tag*{(11)}

where the scaling factor α\alpha and the softness Δ\Delta are global model parameters which, in the base version of SSCS, do not depend on atom atat. However, an additional electric flux dependent prefactor can be introduced into the αratvdW\alpha r_{at}^{\mathrm{vdW}} term to define a field-aware interface.21 It is clear that sSSCSs_{\mathrm{SSCS}} is never analytically equal to 1, which is why we defined the cavity by s≃1s \simeq1 rather than s=1s = 1 above. Both SCCS and SSCS can be modified to take the finite size of the solvent molecules into account in a solvent-aware cavity definition.22 Finally, ss can be defined as a sphere (cluster-like system geometry), cylinder (system periodic in 1 dimension), or slab (system periodic in 2 dimensions)

ssystem(r)=12erfc⁡(∑i(ri−r0,i)2−WsystemΔ)(12)s_{\mathrm{system}}(\mathbf{r}) = \frac{1}{2}\operatorname{erfc}\left(\frac{\sqrt{\sum_i(\mathbf{r}_i-\mathbf{r}_{0,i})^2}-W_{\mathrm{system}}}{\Delta}\right) \tag*{(12)}

where erfc⁡(x)=1−erf⁡(x)\operatorname{erfc}(x)=1-\operatorname{erf}(x), the softness Δ\Delta and width WsystemW_{\mathrm{system}} are parameters, the sum runs over all non-periodic dimensions of the system, ri\mathbf{r}_i is the cartesian coordinate of r\mathbf{r} in dimension ii, and r0,i\mathbf{r}_{0,i} are the respective coordinates of the system center r0\mathbf{r}_0. Additionally, Environ provides an option to include one or multiple additional dielectric regions of similar shape to eq. (12) with individual dimensionality, softness, width, and center, originally introduced to model ice surfaces with molecular adsorbates.23

To account for effects such as surface tension or dispersion and Pauli repulsion interactions between solute and solvent, continuum embedding models commonly include some non-electrostatic energy contribution. In Environ, this takes the empirical form of an effective pressure and an effective surface tension which are applied to the cavity volume and surface area, which are calculated as the space integrals of ss and ∣∇s∣|\nabla s|, respectively.[1] Furthermore, the continuum embedding software needs to compute the solvent potential which enters the Kohn-Sham (KS) operator in the host DFT program. Apart from the solvent contribution to the electrostatic potential, this may also include functional derivatives due to the electron-density-dependent cavity definition in SCCS and any derived terms such as the cavity surface area. Finally, the force contributions from the solvent model are computed.

To solve GPE, PBE, or their variations in practice, iterative algorithms are employed which at each step solve the regular PE (5) with the source term (right hand side) modified in such a way that after convergence, the resulting Φ\Phi fulfills the specified electrostatic problem for the original ρ\rho. Environ closely follows the formalism of its original host DFT-PWP code[8] using an FFT based Poisson solver. This makes it necessary that the charge density and all derived quantities such as ε\varepsilon and γ\gamma are stored on a regular grid. All operations performed on them or necessary to compute them are implemented in a way that assumes this structure.

It would, in principle, be possible to recreate these iterative algorithms in FHI-aims using eq. (6) for the ‘inner’ Poisson solver which is called at each iteration step. Indeed, FHI-aims currently features implementations of the conductor-like screening model (COSMO),24 Stern layer modified Poisson-Boltzmann (SMPB),15 and multipole expansion (MPE)[3] [25, 26] methods. While these specialized implementations yield optimized computational performance,[3] their limited scope is a considerable disadvantage compared to the wide range of functionality implemented in a general purpose continuum embedding library like Environ.

Reproducing all of Environ’s already existing methods individually in FHI-aims would lead to a difficult-to-maintain, inflexible software extension which would require constant updates as novel embedding methods are developed. Conversely, one might consider introducing additional levels of abstraction into Environ to enable it to operate on data stored on different kinds of grids. However, apart from having to rewrite all existing objects and operations in an overlapping atom-centered grid framework, such an abstraction would also impose that same duplicate effort on future developments in this package.

Instead, here we describe a generic procedure to convert charge densities between the grids of FHI-aims and Environ. Following the modular programming paradigm, this minimal, easy-to-maintain interface immediately makes any methods implemented in either code (currently or in the future) interoperable as long as the underlying physical models are compatible. This is possible because, despite its complexity, continuum embedding generally needs to communicate only a very limited set of data with the host DFT program, as described in the next section.

The interface

Communication

Continuum embedding interacts with DFT by modifying the electrostatic potential in the KS operator. This modification is applied at each self-consistent field (SCF) step using the electron density at that step, thereby allowing for full self-consistency of the embedded DFT system. After convergence, energy and force contributions are computed, also allowing for geometry relaxation in full consistency with the continuum model. Generally, the DFT program does not require any further input from the embedding program. Conversely, the continuum embedding package Environ is designed to operate on only a minimal set of input data from its host DFT program, namely the electron density, the nuclear positions and charges, and the unit cell.

The general workflow of the resulting interface between FHI-aims and Environ is outlined in Figure 1. Within this framework, both FHI-aims and Environ are free to use any methods to compute their contributions to potential, energy, and forces as specified by the user in the separate input files for both programs. At the center of the interface stands a smoothing scheme described in § 3.2. This scheme allows us to convert the electron density from

Image not extracted

Figure 1. Communication workflow between FHI-aims (blue/top) and Environ (red/bottom). At each SCF step, the components of ρMP\rho^{\mathrm{MP}} are smoothened in a way that conserves the long range multipole moments of the core regions, cf. § 3.2. Shown as inserts are examples of original l=0l = 0 and l=1l = 1 components (blue) and their smoothened counterparts (red). The smoothened density is evaluated on Environ’s regular grid. Environ defines the cavity and solves the specified electrostatic problem. It computes any additional contributions and corrections specified by the user. To avoid artifacts in ∇s\nabla s, Environ’s FFT core subroutines are modified to include a low-pass filter in the derivatives, cf. § 3.5. The solvent contributions to the effective potential VeffsolvV_{\mathrm{eff}}^{\mathrm{solv}} in the KS operator, the free energy in solution GsolvG^{\mathrm{solv}}, and the forces Fatsolv\mathbf{F}_{\mathrm{at}}^{\mathrm{solv}} (symbols shortened in figure for clarity) are communicated to FHI-aims. The potential is interpolated back onto the overlapping atom-centered grids and added to the vacuum contribution computed by FHI-aims. An additional energy correction is computed, as described in § 3.6. The KS equations are solved, the density is updated, and the process is repeated to self-consistency.

the grid of FHI-aims to that of Environ without losing important information contained in the core region where an atom-centered grid is considerably more fine-grained than a regular grid. Furthermore, we include a low-pass filter in the FFT based derivatives as described in § 3.5 to avoid high frequency artifacts in the smoothened density. We note in passing that in contrast to the electron density and its electrostatic potential, Environ already has methods implemented to smear out the nuclei and their potentials, which will therefore not be further discussed here.

Specifically, the quantities listed below are computed and communicated at certain steps of the simulation. This procedure assumes that FHI-aims and Environ are parallelized using the same number of processes. In both programs, each process handles a part of the respective program’s grid and the corresponding data. However, the regions in space covered by one process in Environ and by the process with the same process ID in FHI-aims generally do not coincide, owing to the different nature of the grids and the corresponding partitioning schemes.

  • During (re-)initialization, the unit cell and nuclear positions and charges are sent from FHI-aims to Environ. Environ returns smoothing information (ratcutr_{\mathrm{at}}^{\mathrm{cut}} (SSCS) or ρmax⁡\rho_{\max} (SCCS), see § 3.3) to FHI-aims.

  • At the beginning of the potential update, Environ sends its grid points and meta-data to FHI-aims. FHI-aims computes the smoothened electron density on those grid points and sends it to Environ. Parallelization is trivial at this point. While each FHI-aims process handles only a part of the 3-dimensional grids, the 1-dimensional tabulated multipole components of every atom are synchronized across all processes. Each FHI-aims process simply computes the smoothened density on the grid points of the Environ process with the same process ID. Environ computes potential, energy, and, if requested, force components. Energy (and force) are sent to FHI-aims. Each Environ process writes the potential on its part of the grid to a separate temporary file.

  • During the potential update, FHI-aims interpolates the potential contribution from Environ back onto its own grid using tricubic interpolation and adds it to its own potential contribution. The latter is computed in the same way that FHI-aims would if no continuum embedding was used. Each FHI-aims process loads the Environ potential only from those temporary files which it needs for its part of the grid as determined using the stored grid meta-data. A double counting energy correction is integrated on-the-fly as described in § 3.6.

Multipole-conserving smoothing

While at first it may seem straightforward to evaluate eq. (4) on a regular grid and pass this data to Environ, this would lead to inconsistencies. In all-electron DFT, a substantial amount of charge is localized in a narrow cusp around the core which is smaller than the volume element corresponding to one regular grid point. Therefore, when integrating the total charge or computing the electrostatic potential, the result would depend on where exactly or whether at all a grid point happens to lie in the cusp region.

A solution to this problem becomes apparent as we realize that when combining continuum embedding with DFT, we do not actually need the full potential of the former. The DFT program can compute the nuclear and electronic potentials as usual and requires only the solvent contribution from the embedding program. For the electrostatic part of the potential, this contribution is simply defined as

ΔΦsolv=Φsolv−Φvac(13)\Delta\Phi^{\mathrm{solv}} = \Phi^{\mathrm{solv}} - \Phi^{\mathrm{vac}} \tag*{(13)}

where Φvac\Phi^{\mathrm{vac}} is the solution of PE (5) in vacuum and Φsolv\Phi^{\mathrm{solv}} is the solution of the electrostatic problem defined by the user, e.g. eq. (7) or eqs. (8) and (9). ‘Vacuum’ in this context refers to the energy and potential without any solvent contributions but not necessarily of the vacuum ground state. The ground state electron density in solution or, in fact, any instantaneous electron density may be used in eq. (13), as long as the same density is used for both terms. The different electrostatic models can generally be described as variations of eq. (8) distinguished by the definition of ε\varepsilon on the left hand side and by the source terms in addition to ρ\rho on the right hand side. However, all of these models locally reduce to eq. (5) inside the cavity, leading to

∇2ΔΦsolv(r)=0∀r:s(r)=1(14)\nabla^{2}\Delta\Phi^{\mathrm{solv}}(\mathbf{r}) = 0 \quad\forall\mathbf{r} : s(\mathbf{r}) = 1 \tag*{(14)}

In other words, the solvent potential ΔΦsolv\Delta\Phi^{\mathrm{solv}} inside does not locally depend on ρ\rho, and it is the harmonic continuation of the outside part of ΔΦsolv\Delta\Phi^{\mathrm{solv}}. This leads to the idea of using a smoothened charge density ρˉ\bar{\rho} to compute smoothened potentials Φˉsolv\bar{\Phi}^{\mathrm{solv}}, Φˉvac\bar{\Phi}^{\mathrm{vac}}, and ultimately ΔΦˉsolv\Delta\bar{\Phi}^{\mathrm{solv}} in complete analogy to eq. (13). As long as Φˉsolv\bar{\Phi}^{\mathrm{solv}} and Φˉvac\bar{\Phi}^{\mathrm{vac}} are equal to their non-smoothened counterparts outside, ΔΦˉsolv\Delta\bar{\Phi}^{\mathrm{solv}} will be equal to ΔΦsolv\Delta\Phi^{\mathrm{solv}} both inside and outside because eq. (14) together with the value and derivatives at the cavity boundary uniquely defines the behavior inside and it does not locally depend on ρ\rho, ρˉ\bar{\rho}, or any other quantity. The full electrostatic potential in solution can then be obtained as

Φsolv=Φvac+ΔΦˉsolv(15)\Phi^{\mathrm{solv}} = \Phi^{\mathrm{vac}} + \Delta\bar{\Phi}^{\mathrm{solv}} \tag*{(15)}

where Φvac\Phi^{\mathrm{vac}} can be computed in the way that the DFT program normally would. Here and in the following, the bar  ˉ\bar{\ } indicates quantities which are computed using the smoothened charge density ρˉ\bar{\rho}.

It is sufficient for ρˉ\bar{\rho} to be =ρ= \rho outside and conserve the long range atomic multipole moments of the portion of ρ\rho that is inside. If this is the case, then Φˉvac\bar{\Phi}^{\mathrm{vac}} reproduces Φvac\Phi^{\mathrm{vac}} outside as will be shown below, cf. eq. (18). ∇2Φsolv\nabla^{2}\Phi^{\mathrm{solv}} is generally a semi-local function of ρ\rho and of Φsolv\Phi^{\mathrm{solv}} itself, implying that it has to be found iteratively. Using Φvac\Phi^{\mathrm{vac}} as an initial guess for Φsolv\Phi^{\mathrm{solv}}, this means that Φˉsolv\bar{\Phi}^{\mathrm{solv}} reproduces Φsolv\Phi^{\mathrm{solv}} outside if Φˉvac=Φvac\bar{\Phi}^{\mathrm{vac}} = \Phi^{\mathrm{vac}} and ρˉ=ρ\bar{\rho} = \rho, both outside. This is described in more detail in section S1.1 of the supplementary information.

(SI) of the present article.

Furthermore, if ρˉ\bar{\rho} is =ρ=\rho outside and smoothly increases moving inside from the cavity boundary, then ss will be unaltered in SCCS. In field-aware SSCS, the scaling factors depend on the electric flux through the exposed surfaces of the individual soft spheres which at the point of determining the factors are not yet scaled by these same factors. These scaling factors and, consequently, ss are unaltered if ∇Φˉsolv=∇Φsolv\nabla\bar{\Phi}^{\mathrm{solv}}=\nabla\Phi^{\mathrm{solv}} at the cavity surface. We reiterate that the cavity surface in Environ is a smeared out region defined by ∣∇s∣≠0|\nabla s|\ne0 which we consider to be outside in this work.

These considerations allow us to modify the multipole components δρ~at,lm(rat)\delta\widetilde{\rho}_{at,lm}(r_{at}) within a certain cutoff radius ratcutr_{at}^{\mathrm{cut}} around the nuclei which lies safely inside, as illustrated in Figure 2. The choice of this radius is discussed in § 3.3. The modified multipole components should reproduce the long range potential of the unmodified δρ~at,lm\delta\widetilde{\rho}_{at,lm} outside ratcutr_{at}^{\mathrm{cut}}. To this end, we replace the multipole components with 6th order polynomials inside ratcutr_{at}^{\mathrm{cut}}

Image not extracted

Figure 2. Water molecule in implicit solvent. Difference (left) and overlap (right) between fH1,l≠0switchf^{\mathrm{switch}}_{\mathrm{H}^{1},l\ne0} of one hydrogen atom H1^{1} and inverted cavity function 1−s1-s of entire molecule for SCCS (top) and SSCS (bottom), cut through the molecular plane. ss computed from converged ρel\rho^{\mathrm{el}} for SCCS. Contrast in right images chosen to capture maximum value across both images. Radius rH1solvr_{\mathrm{H}^{1}}^{\mathrm{solv}} of dashed circle estimates shortest distance of H1^{1} from any point outside. Inside of a sphere with half of that radius (hatched area), δρ~l,mH1(r)\delta\tilde{\rho}^{\mathrm{H}^{1}}_{l,m}(r) is replaced by a polynomial Pl,mH1(r)P^{\mathrm{H}^{1}}_{l,m}(r). In transition region of fH1,l≠0switchf^{\mathrm{switch}}_{\mathrm{H}^{1},l\ne0}, original δρ~l,mH1(r)\delta\tilde{\rho}^{\mathrm{H}^{1}}_{l,m}(r) is used but integration errors in this region are still partially compensated in inner (hatched) region. For l=0l=0, integration errors over entire R3\mathbb{R}^{3} are compensated. Corresponding plots for the O atom, different cavity definitions, and ionic systems shown in section S4 in the SI.

δρ~at,lmsmooth(r)={Pat,lm(r),r<ratcutδρ~at,lm(r),r≥ratcut(16)\delta\widetilde{\rho}^{\mathrm{smooth}}_{at,lm}(r)= \begin{cases} P_{at,lm}(r), & r<r_{at}^{\mathrm{cut}} \\ \delta\widetilde{\rho}_{at,lm}(r), & r\ge r_{at}^{\mathrm{cut}} \end{cases} \tag*{(16)}

We choose the polynomial coefficients to fulfill two types of conditions. First, the value and first and second derivatives of ρ~at,lmsmooth(rat)Ylm(Ωat)\widetilde{\rho}^{\mathrm{smooth}}_{at,lm}(r_{at})Y_{lm}(\Omega_{at}) are continuous at rat=0r_{at}=0 and at rat=ratcutr_{at}=r_{at}^{\mathrm{cut}}. Continuity in the angular directions is fulfilled by construction, leaving only continuity in rr to be considered. This leaves us with 6 continuity conditions so far. Second, the polynomial reproduces the correct long range multipole moment of the multipole component it replaces. The electrostatic potential generated by δρ~at,lmsmooth(r)\delta\widetilde{\rho}^{\mathrm{smooth}}_{at,lm}(r) at any r′>ratcutr'>r_{at}^{\mathrm{cut}} is exactly equal to that generated by ρ~at,lm(r)\widetilde{\rho}_{at,lm}(r) if

∫0ratcutdr rl+2Pat,lm(r)=∫0ratcutdr rl+2δρ~at,lm(r)(17)\int_{0}^{r_{at}^{\mathrm{cut}}} \mathrm{d}r\,r^{l+2}P_{at,lm}(r)=\int_{0}^{r_{at}^{\mathrm{cut}}} \mathrm{d}r\,r^{l+2}\delta\widetilde{\rho}_{at,lm}(r) \tag*{(17)}

is fulfilled because the potential generated at r′r' by a multipole charge distribution confined to r<r′r < r' can be expressed exactly using a point multipole. This can be seen by inserting glg_l in eq. (6) and separating the r′r' dependent term out of the first integral

δv~at,lm(r′)=1(r′)l+1∫0r′dr rl+2δρ~at,lm(r)+∫r′∞dr r2gl(r′,r)δρ~at,lm(r)(18)\delta\widetilde{v}_{at,lm}(r') = \frac{1}{(r')^{l+1}}\int_{0}^{r'} \mathrm{d}r\,r^{l+2}\delta\widetilde{\rho}_{at,lm}(r) + \int_{r'}^{\infty}\mathrm{d}r\,r^2g_l(r',r)\delta\widetilde{\rho}_{at,lm}(r) \tag*{(18)}

When replacing δρ~at,lm(r)\delta\widetilde{\rho}_{at,lm}(r) with δρ~at,lmsmooth(r)\delta\widetilde{\rho}_{at,lm}^{\mathrm{smooth}}(r), the first integral in the above expression is unchanged if eq. (17) is fulfilled and r′>ratcutr' > r_{at}^{\mathrm{cut}}. In the second integral, the integrand itself is unchanged if r′>ratcutr' > r_{at}^{\mathrm{cut}}.

This leaves us with a total of 7 conditions, hence the use of 6th order polynomials. For the low order multipoles with l≤2l \le2, some of the continuity conditions at the origin are fulfilled by construction and do not need to be enforced, as shown in § 11 in the SI. A 4th order polynomial is thus sufficient for l=0l = 0, as is 5th order for l=1l = 1 and $l = 2. The conditions are first enforced computing the left hand side of eq. (17) analytically and the right hand side numerically on the radial grid of FHI-aims. ρatfree\rho_{at}^{\mathrm{free}} is smoothened to produce ρatfree,smooth\rho_{at}^{\mathrm{free,smooth}} in almost the exact same manner, effectively treating it like δρ~at,00\delta\widetilde{\rho}_{at,00}. The only difference is that FHI-aims uses different rr grids to store the free atom and multipole densities.

In a second step, defining the smoothened atomic multipole density

ρatMP,smooth(r)=ρatfree,smooth(rat)+∑l′=0lmax⁡′∑m′=−l′l′δρ~at,l′m′smooth(rat)Yl′m′(Ωat)(19)\rho_{at}^{\mathrm{MP,smooth}}(\mathbf{r}) = \rho_{at}^{\mathrm{free,smooth}}(r_{at}) + \sum_{l'=0}^{l'_{\max}}\sum_{m'=-l'}^{l'}\delta\widetilde{\rho}_{at,l'm'}^{\mathrm{smooth}}(r_{at})Y_{l'm'}(\Omega_{at}) \tag*{(19)}

we check the similar condition

∫R3dr (rat)lρatMP,smooth(r)Ylm(Ωat)fat,lswitch(ξat(rat))=?δl014πZat+∫0∞dr rl+2δρ~at,lm(r)fat,lswitch(ξat(r))(20)\int_{\mathbb{R}^3}\mathrm{d}\mathbf{r}\,(r_{at})^l\rho_{at}^{\mathrm{MP,smooth}}(\mathbf{r})Y_{lm}(\Omega_{at})f_{at,l}^{\mathrm{switch}}(\xi_{at}(r_{at})) \mathrel{\overset{?}{=}}\delta_{l0}\sqrt{\frac{1}{4\pi}}Z_{at}+\int_{0}^{\infty}\mathrm{d}r\,r^{l+2}\delta\widetilde{\rho}_{at,lm}(r)f_{at,l}^{\mathrm{switch}}(\xi_{at}(r)) \tag*{(20)}

evaluating the left hand side on the regular grid and, again, the integral on the right hand

side on the radial grid. δl0\delta_{l0} is the Kronecker delta and ZatZ_{at} is the nuclear charge. The switching function fat,lswitchf^{\mathrm{switch}}_{at,l} for l≠0l \ne0 smoothly switches from 1 inside ratcutr^{\mathrm{cut}}_{at} to 0 outside of it and is discussed in section 3.4. For l=0l = 0, fat,l=0switch=1f^{\mathrm{switch}}_{at,l=0} = 1 everywhere to conserve the total charge exactly. Equation (20) checks the apparent atomic multipole moments when the smoothened atomic multipole density is evaluated on the regular grid, and it compares them to the exact atomic multipole moments obtained from δρ~at,lm\widetilde{\delta\rho}_{at,lm}. The residual error in eq. (20) is computed, and the polynomial coefficients are adjusted to correct for it while still conserving continuity conditions.

The adjustment of the polynomial coefficients due to eq. (20) is made using once again analytical integrals for the polynomials, which leaves room for residual errors when evaluated on the regular grid. To reproduce the atomic multipole moments exactly, the correction scheme needs to be iterated to self-consistency. In principle, this could be done at each step of the encompassing SCF procedure. In practice, we find the following scheme which requires only one density evaluation per SCF step to be sufficient: Keep record of the residual errors in eq. (20) cumulatively over SCF steps. At each SCF step, use eq. (17) to get polynomial coefficients. Using the cumulative errors from the previous SCF steps, add a correction to the coefficients. Compute ρˉel=∑atρatMP,smooth\bar{\rho}^{\mathrm{el}} = \sum_{at} \rho_{at}^{\mathrm{MP, smooth}} on the regular grid and pass it to Environ. On the fly, check the new residual errors in eq. (20). Add these new residual errors to the stored cumulative errors. Before the first SCF step, assume that ∑atρatfree\sum_{at} \rho_{at}^{\mathrm{free}} is the electron density, get ρatfree,smooth\rho_{at}^{\mathrm{free, smooth}} using eq. (17), set all δρ~at,lm=0\widetilde{\delta\rho}_{at,lm} = 0, and compute eq. (20) to get the stored residual errors for the first SCF step. This update scheme effectively converges the residual error as the encompassing SCF procedure converges. In fact, the residual errors are typically small already in the initial SCF step and remain small throughout the procedure.

Choice of cutoff radii

We choose

ratcut=12ratsolv(21)r_{at}^{\mathrm{cut}} = \frac{1}{2}r_{at}^{\mathrm{solv}} \tag*{(21)}

where ratsolvr_{at}^{\mathrm{solv}} is an estimate of the shortest distance of nucleus atat from any point outside. In practice, ratcutr_{at}^{\mathrm{cut}} is slightly adjusted to coincide with the halfway point (in parameter space, cf. ref. 9: parameter ii in r(i)r(i), sec. 3.1., and parameter ss in eq. (18)) between two shells of the radial grid of FHI-aims. For SCCS, we choose ratsolvr_{at}^{\mathrm{solv}} such that

ρatfree(ratsolv)=ρmax⁡(22)\rho_{at}^{\mathrm{free}}\left(r_{at}^{\mathrm{solv}}\right) = \rho_{\max} \tag*{(22)}

As the electron density relaxes to the molecular geometry and the solvent potential, sSCCSs_{\mathrm{SCCS}} can become <1< 1 at points with shorter distances from Rat\mathbf{R}_{at} than ratsolvr_{at}^{\mathrm{solv}} especially for cations and atoms with positive partial charges. Nonetheless, ratcutr_{at}^{\mathrm{cut}} stays contained inside by setting it to half of ratsolvr_{at}^{\mathrm{solv}}, as illustrated in fig. 2 as well as section S4 in the SI. For SSCS, we choose

ratsolv=αratvdW−2Δ(23)r_{at}^{\mathrm{solv}} = \alpha r_{at}^{\mathrm{vdW}} - 2\Delta \tag*{(23)}

If the solute consists of only one atom, then sSSCS(ratsolv)=1/2⋅erfc⁡(−2)=0.998≃1s_{\mathrm{SSCS}}\left(r_{at}^{\mathrm{solv}}\right) = 1/2 \cdot\operatorname{erfc}(-2) = 0.998 \simeq1. Any additional atoms will push the solvent boundary away from nucleus atat, never towards it. Although 1−sSSCS1 - s_{\mathrm{SSCS}} is never analytically zero, we find that it is numerically zero inside ratcutr_{at}^{\mathrm{cut}}, cf. fig. 2 as well as section S4 in the SI. Field-aware and solvent-aware modifications of ss as well as additional dielectric regions are not taken into account when computing ratsolvr_{at}^{\mathrm{solv}}. For the ‘system’ cavity eq. (12), we use eq. (22) with default SCCS parameters. Alternatively, the user may specify ratcutr_{at}^{\mathrm{cut}} for each species manually regardless of cavity definition.

Switching function for integration error check

Including fat,lswitchf_{at,l}^{\mathrm{switch}} in eq. (20) is necessary because small errors at large rr (far outside ratcutr_{at}^{\mathrm{cut}}) have a strong impact on the multipole moment, whereas small corrections at small rr (inside ratcutr_{at}^{\mathrm{cut}}) only have a much smaller impact. This is due to the factor (rat)l(r_{at})^l or rl+2r^{l+2}, respectively, in the integrand and is accordingly more pronounced for higher ll. This would require large correction terms for small errors which, paradoxically, would lead exactly to those steep variations of the density in the core region which we want to avoid and, consequently, integration errors on the regular grid. Moreover, if integration errors do occur outside, then corrections inside will not fully recover the correct ΔΦ‾solv\overline{\Delta\Phi}^{\mathrm{solv}} outside, cf. the integration boundaries in eq. (18). If a numerical error occurs in the first integral, the correct potential at r′r' can still be recovered by adjusting the integrand in the same integral. However, if an error occurs in the second integral, no single adjustment in the first integral will generally recover the correct potential for all possible r′r'. The appropriate remedy for such errors is a tighter integration grid. In this spirit, fat,lswitchf^{\mathrm{switch}}_{at,l} also ensures that we only attempt to correct those errors which we actually can correct. The only exception to these considerations is l=0l = 0 for which fat,0switch=1f^{\mathrm{switch}}_{at,0} = 1 because we want the total charge of the entire system to be conserved exactly.

The reason why we do not sharply switch fat,lswitchf^{\mathrm{switch}}_{at,l} from 1 to 0 at ratcutr^{\mathrm{cut}}_{at} is because it would lead to inconsistencies when, due to a small geometry change, this radius moves across a point on the regular grid. The density at that grid point would then sharply switch from being fully included in the left hand side integral in eq. (20) to being fully excluded. A smeared out switching function allows for smoothly varying results with small geometry changes. The switching function is defined such that it is continuous and continuously differentiable to second order.

fat,lswitch(ξ)={1,ξ≤0orl=01−10ξ3+15ξ4−6ξ5,0<ξ<1andl≠00,ξ≥1andl≠0(24)f^{\mathrm{switch}}_{at,l}(\xi) = \begin{cases} 1, & \xi\le0 \quad\text{or} \quad l = 0 \\ 1 - 10\xi^{3} + 15\xi^{4} - 6\xi^{5}, & 0 < \xi< 1 \quad\text{and} \quad l \ne0 \\ 0, & \xi\ge1 \quad\text{and} \quad l \ne0 \end{cases} \tag*{(24)}

with a shifted and scaled radius

ξat(r)=r−ratcut2ddiag(25)\xi_{at}(r) = \frac{r-r^{\mathrm{cut}}_{at}}{2d_{\mathrm{diag}}} \tag*{(25)}

with

ddiag=3max⁡idi(26)d_{\mathrm{diag}} = \sqrt{3}\max_i d_i \tag*{(26)}

where did_i is the grid spacing along lattice vector ii. In the case of an orthorhombic cell and equal spacing of the regular grid along all three lattice vectors, the volume element corresponding to one grid point is a cube and ddiagd_{\mathrm{diag}} is the length of its space diagonal. Assuming such cubic volume elements, we consider a case where a grid point r\mathbf{r} exists such that r−Rat\mathbf{r}-\mathbf{R}_{\mathrm{at}} is pointing along the space diagonal and ξat(rat)=0\xi_{\mathrm{at}}(r_{\mathrm{at}})=0, i.e., the sphere with radius ratcutr_{\mathrm{at}}^{\mathrm{cut}} around Rat\mathbf{R}_{\mathrm{at}} cuts exactly through r\mathbf{r}. In such a case, fat,lswitchf_{\mathrm{at},l}^{\mathrm{switch}} will be =1=1 at gridpoint r\mathbf{r}, it will be =1/2=1/2 at the diagonally next neighboring grid point, and it will be =0=0 at the diagonally second neighbor.

Low-pass filter

In addition to the smoothing which happens before the electron density is passed to Environ as described in the previous sections, we introduce a second modification in Environ itself. This modification is a low-pass filter in the FFT based core subroutines which compute the derivatives of a function on the regular grid. While our smoothing scheme makes ρel\rho^{\mathrm{el}} representable on the real space regular grid, high frequency artifacts may occur in the discrete Fourier transform. The ∇\nabla operator transforms into a multiplication with the frequency vector igi\mathbf{g} in Fourier space. The imaginary unit ii in the prefactor corresponds to a phase shift which makes oscillations visible in ∇ρel\nabla\rho^{\mathrm{el}} which are hidden in ρel\rho^{\mathrm{el}} because they pass through zero at the grid points before the phase shift. In addition, artifacts at a high frequency are amplified in the gradient by that same frequency.

For our purposes, this mainly affects the computation of the atomic forces, as well as the gradient, Laplacian, and Hessian of ss in SCCS. The latter terms enter the KS potential (cf. § 3.6) and are themselves obtained from the derivatives of ρˉel\bar{\rho}^{\mathrm{el}} via the chain rule. Artifacts and instabilities in the derivatives of ss therefore directly translate to the energy, KS potential and forces. It would, in principle, be possible to compute the derivatives of ρˉel\bar{\rho}^{\mathrm{el}} in FHI-aims using the analytical derivatives of eq. (4). To keep communication minimal, we choose to address both issues in Environ’s core FFT subroutines instead. For consistency, this affects all FFT based derivatives, not just when applied to ρˉel\bar{\rho}^{\mathrm{el}}. We replace these four

subroutines (gradient, Laplacian, Hessian, and forces) with modified versions which include a low-pass filter. g\mathbf{g} space in Environ is confined to a sphere with

∣g∣2≤∣gcut∣2(27)\lvert\mathbf{g} \rvert^2 \le\lvert\mathbf{g}_{\mathrm{cut}} \rvert^2 \tag*{(27)}

We choose a filter

filter⁡(g)=12erfc⁡(p1∣g∣2∣gcut∣2−p2)(28)\operatorname{filter}(\mathbf{g}) = \frac{1}{2}\operatorname{erfc}\left(p_1\frac{\lvert\mathbf{g} \rvert^2}{\lvert\mathbf{g}_{\mathrm{cut}} \rvert^2} - p_2\right) \tag*{(28)}

with two tunable parameters p1>p2>0p_1 > p_2 > 0. As illustrated in Figure 3, this effectively removes artifacts in ∇s\nabla s. If inaccuracies arise due to actual data (as opposed to artifacts) being filtered, these errors can be systematically reduced by choosing a denser grid which corresponds to a higher ∣gcut∣\lvert\mathbf{g}_{\mathrm{cut}} \rvert.

Gradient component $\partial s/\partial x$ for the same system as in Fig. 2

Figure 3. Gradient component ∂s/∂x\partial s/\partial x for the same system as in fig. 2, SCCS. Red and blue show positive and negative values, respectively, at an arbitrary scale. ∇s\nabla s computed from ∇ρˉel\nabla\bar{\rho}^{\mathrm{el}} via chain rule after SCF convergence. Titles refer to computation of ∇ρel\nabla\rho^{\mathrm{el}}. Top left: FFT with low-pass. Top right: FFT without low-pass. Bottom left: computed in FHI-aims using the analytical derivative of eq. (4). Filtered FFT version correctly reproduces this reference. Bottom right: for reference, FFT without low-pass, the DFT program being Quantum Espresso8 instead of FHI-aims. While the overall less smooth shape of the cavity in FHI-aims is a result of its atom-centered basis set and is consistently present, cf. also Figure 2, the ripples in the unfiltered FFT derivative are an artifact that is absent in the analytical derivatives and can be removed by a low-pass filter. Corresponding plots for ∇2s\nabla^{2}s and differences of filtered to unfiltered and direct gradients shown in figs. S49 and S50 in the SI.

Full energy, force and potential expressions

The full free energy in solution GsolvG^{\mathrm{solv}}, the force Fatsolv\mathbf{F}^{\mathrm{solv}}_{at} acting on atom atat, and the effective potential VeffsolvV^{\mathrm{solv}}_{\mathrm{eff}} which enters the KS operator are obtained by summing up the respective vacuum contributions computed by FHI-aims and the solvent contributions computed by Environ.

Gsolv=Evac+ΔGˉsolv(29)G^{\mathrm{solv}} = E^{\mathrm{vac}} + \Delta\bar{G}^{\mathrm{solv}} \tag*{(29)}
Fatsolv=Fatvac+ΔFˉatsolv(30)\mathbf{F}^{\mathrm{solv}}_{at} = \mathbf{F}^{\mathrm{vac}}_{at} + \Delta\bar{\mathbf{F}}^{\mathrm{solv}}_{at} \tag*{(30)}
Veffsolv=Veffvac+ΔVˉeffsolv(31)V^{\mathrm{solv}}_{\mathrm{eff}} = V^{\mathrm{vac}}_{\mathrm{eff}} + \Delta\bar{V}^{\mathrm{solv}}_{\mathrm{eff}} \tag*{(31)}

GsolvG^{\mathrm{solv}} is formally a Gibbs free energy since simplifying the solvent degrees of freedom into a dielectric model formally amounts to an (approximate) integration over these degrees of freedom and we generally consider the pressure to be a constant property of the model solvent. We reiterate that the ‘vacuum’ contributions are calculated using the pure DFT Hamiltonian without embedding but on the ground state electron density in solution. In this context, ΔG‾solv\Delta\overline{G}^{\mathrm{solv}} is not the experimentally accessible free energy of solvation which would be the difference between the free energies of the respective ground state densities.

The exact definition of GsolvG^{\mathrm{solv}} as a functional of ρel\rho^{\mathrm{el}} depends on the specific solvent model.2

We refrain from stating all possible energy, potential, and force expressions here and refer to the respective original publications. We do not need to concern ourselves with this because Environ provides the functionality to compute ΔG‾solv=Gsolv−Evac\Delta\overline{G}^{\mathrm{solv}} = G^{\mathrm{solv}} - E^{\mathrm{vac}} for any implemented GsolvG^{\mathrm{solv}}. Similarly, ΔV‾effsolv\Delta\overline{V}_{\mathrm{eff}}^{\mathrm{solv}} is computed such that the energy functional GsolvG^{\mathrm{solv}} is minimized when using VeffsolvV_{\mathrm{eff}}^{\mathrm{solv}} according to eq. (29c) in the KS operator. The forces can be decomposed in a similar manner. It is worth noting that the inclusion of ΔV‾effsolv\Delta\overline{V}_{\mathrm{eff}}^{\mathrm{solv}} in the KS operator automatically yields a corresponding contribution to the Pulay forces, i.e., the correction to the Hellmann-Feynman forces which arises from the dependence of the atom centered electronic basis functions on the nuclear positions.[9] [27]

The vacuum and solvent parts of eqs. (29b) and (29c) as well as ΔG‾solv\Delta\overline{G}^{\mathrm{solv}} can be computed straightforwardly without any further modification to either program beyond the already described electron density smoothing, low-pass filter in the FFT derivatives, and potential interpolation. Only EvacE^{\mathrm{vac}} requires one additional term compared to a calculation without embedding.

Evac=∑ifiϵi−∫dr ρel(r)vxc(r)+Exc[ρel]−12∫dr ρMP(r)Φvac(r)+12∑at−ZatΦvac(Rat)−∫dr ρMP(r)ΔV‾effsolv(r)(32)\begin{aligned} E^{\mathrm{vac}} ={}& \sum_i f_i\epsilon_i - \int\mathrm{d}r\,\rho^{\mathrm{el}}(\mathbf{r})v_{\mathrm{xc}}(\mathbf{r}) + E_{\mathrm{xc}}[\rho^{\mathrm{el}}] \\ &- \frac{1}{2}\int\mathrm{d}r\,\rho^{\mathrm{MP}}(\mathbf{r})\Phi^{\mathrm{vac}}(\mathbf{r}) + \frac{1}{2}\sum_{at}-Z_{at}\Phi^{\mathrm{vac}}(\mathbf{R}_{at}) - \int\mathrm{d}r\,\rho^{\mathrm{MP}}(\mathbf{r})\Delta\overline{V}_{\mathrm{eff}}^{\mathrm{solv}}(\mathbf{r}) \tag*{(32)} \end{aligned}

The first five terms are how FHI-aims normally defines the total energy. In order, these terms are the sum of KS eigenvalues ϵi\epsilon_i weighted by occupation numbers fif_i, the removal of the interaction of the electron density with the exchange-correlation (xc) potential vxcv_{\mathrm{xc}}, the xc energy ExcE_{\mathrm{xc}}, the removal of the double-counted electron-electron interaction, and the nuclear-nuclear interaction. It is implied here that for any given atat, Φvac(Rat)\Phi^{\mathrm{vac}}(\mathbf{R}_{at}) does not include the singularity of atat itself. The formulation with the fourth and fifth term containing the total potential Φvac\Phi^{\mathrm{vac}} instead of, respectively, the electronic and nuclear potentials is obtained by subtracting and adding half of the electron-nuclear interaction. The additional sixth term removes the interaction of the electrons with the solvent contribution to the KS potential. The actual interaction energy is contained in ΔGˉsolv\Delta\bar{G}^{\mathrm{solv}}, similarly to how the interaction with vxcv_{\mathrm{xc}} is replaced with the actual ExcE_{\mathrm{xc}}. The integration of this additional term is performed in the same loop as the interpolation of ΔVˉeffsolv\Delta\bar{V}_{\mathrm{eff}}^{\mathrm{solv}} onto the atom-centered grids. Note that the double counting correction for the electron-electron interaction (second integral above) is computed using the multipole density ρMP\rho^{\mathrm{MP}} (cf. eq. (4)) rather than the exact electron density ρel\rho^{\mathrm{el}}. This is a deliberate choice in FHI-aims and leads to a faster convergence of the total energy with multipole expansion order.[9] We find that using ρMP\rho^{\mathrm{MP}} also in the solvent potential correction (last integral) similarly leads to faster convergence with multipole order, as shown in § 4.3 A more detailed derivation of eq. (32) is given in § 12 in the SI.

It can be shown that the exact solvent contributions in eq. (29) calculated with a smoothened electron density and smeared cores are equal to the same quantities for the original electron density and nuclear point charges. In practice, Environ can compute a numerical solution only for the smoothened density, which we can use without further modification due to this equality. The equality follows from the fact that the solvent contribution to the electrostatic potential can be represented by an additional polarization charge density which is =0=0 in regions of space where the potentials of the original and smoothened explicit density differ, i.e., inside. Similarly, any terms beyond classical electrostatics can be reduced to semilocal expressions which vanish inside by construction. A detailed discussion of each of these terms is given section S1 in the SI.

Results and discussion

Computational details

All calculations were carried out with modified versions based on FHI-aims version 241018 and Environ version 3.1. except for the CO on Pt(111) system in section 4.4 and all calculations in sections 4.5 and 4.6 for which FHI-aims version 250822 and Environ version 3.1.1 were used. Unless mentioned otherwise, for FHI-aims we used the Perdew-Burke-Ernzerhof exchange correlation functional,28 tight species defaults (2020 variant),[9] no spin-polarization, atomwise scalar zeroth-order regular approximation (ZORA) for relativistic effects,[9] and a Gaussian broadening scheme with a width of 0.01 eV for the KS states.29 Unless mentioned otherwise, for Environ we used a parabolic correction for periodic boundary conditions,30,31 a value of εbulk=78.3\varepsilon_{\mathrm{bulk}} = 78.3 for the bulk permittivity of water, and, respectively, the fitg03+β\beta parameters for SCCS[6] or the UFF32 parameters for neutral molecules for SSCS with the exception of the systems containing Pt, for which we used the Bondi33 parameters to avoid the extremely small radius of Pt in the UFF parameterization.20 In any case where two parameterizations were available, one with a non-zero effective pressure and one without but otherwise equivalent, we used the former option. We used Environ’s fixed-point iterative solver for the electrostatic problem throughout, as we found the conjugate-gradient solver to yield inconsistent forces in preliminary calculations.

The water molecule, NaF dimer, F−\mathrm{F}^{-} anion, and Na+\mathrm{Na}^{+} cation used in figs. 2 and 3, the following sections, and various examples in section S6 in the SI were placed in 15 A˚×15 A˚×15 A˚15\,\mathrm{\AA} \times15\,\mathrm{\AA} \times15\,\mathrm{\AA} unit cells. The PtCO trimer was placed in a 20 A˚×20 A˚×20 A˚20\,\mathrm{\AA} \times20\,\mathrm{\AA} \times20\,\mathrm{\AA} cell. Only the Gamma point of kk space was sampled. The bounding boxes of the figures do not represent the unit cell.

Energy and force convergence with grid density, low-pass filter

We tested the convergence of the total energy and forces and their respective components with increasing Environ grid density for different low-pass filter parameters. The three test systems were a water molecule as a simple base example, a NaF dimer at 2 Å separation as an extreme case of a polarized system, and a linear PtCO trimer with bond lengths of 1.85 Å (Pt-C) and 1.1 Å (C-O) in anticipation of the CO on Pt(111) example discussed in § 4.4. We tested the parameterizations of SSCS and SCCS described in § 4.1. In Environ, the grid density is controlled by the ecute_{\mathrm{cut}} parameter where higher values correspond to denser grids. We sampled ecute_{\mathrm{cut}} in steps of 50 Ry over a range from 300 Ry to 800 Ry. For PtCO in SCCS, we started from 500 Ry instead, as some of the initial low ecute_{\mathrm{cut}} calculations did not result in SCF convergence. For NaF in SCCS, we extended the ecute_{\mathrm{cut}} range to 1200 Ry and for PtCO in SCCS to 1400 Ry, as results up to 800 Ry were not entirely conclusive. For the low-pass filter, we reduced the number of free parameters from 2 to 1 by fixing p2=p1−3p_2=p_1-3 (implied throughout this section), which corresponds to filter⁡(gcut)=1/2⋅erfc⁡(3)≈10−5\operatorname{filter}(g_{\mathrm{cut}})=1/2\cdot\operatorname{erfc}(3)\approx10^{-5}. We tested filters with p1=6,7,8p_1=6,7,8, as well as no filter. The primary results are shown in Figure 4 and Figure 5. Complete results including the forces on all atoms as well as all individual energy and force components are shown in § 15.1 to S6.4 in the SI. For better comparison, all plots throughout this and the following section are shown on the same energy or force scale, respectively, unless mentioned otherwise.

Convergence plots of total energy with Environ grid density parameter $e_{\mathrm{cut}}$ for water, NaF, and PtCO using SSCS and SCCS solvent models

Figure 4. Convergence of total energy with Environ grid density parameter ecute_{\mathrm{cut}} for different test systems and solvent models. Dashed lines only as visual guideline.

Convergence of total forces of selected atoms in different test systems and solvent models

Figure 5. Convergence of total forces of selected atoms in different test systems and solvent models with Environ grid density parameter ecute_{\mathrm{cut}}. Dashed lines only as visual guideline.

In SSCS, the total energies and their components did not exhibit any noticeable dependencies on ecute_{\mathrm{cut}} for NaF and water. For PtCO, minor changes in the eigenvalues and the Hartree and solvent potentials occur which do, however, cancel in the total and kinetic energy. The forces on the Pt and Na atoms exhibit small fluctuations originating from the Pulay force term which converge around ecut=500e_{\mathrm{cut}}=500 Ry, with some small but noticeable residual fluctuations <10<10 meV/Å on the Pt atom. The forces on the other atoms appear to be already converged at ecut=300e_{\mathrm{cut}}=300 Ry. The low-pass filters do not have any impact on the energies, as they do not enter the energy and potential in SSCS. In the forces, they do not appear to reduce fluctuations. On the contrary, the most aggressive filter (p1=6p_1 = 6) actively introduces an error for low ecute_{\mathrm{cut}}. We conclude that converged energies and forces in SSCS can be obtained simply by choosing high enough ecute_{\mathrm{cut}}. For all SSCS calculations in the following, we use no low-pass filter and ecut=500e_{\mathrm{cut}} = 500 Ry.

In SCCS, the kinetic, xc, and total energies appear to converge around ecut=900e_{\mathrm{cut}} = 900 Ry for NaF and significantly faster for water and PtCO. In PtCO, a systematic error cancellation between the Hartree and solvent potentials becomes apparent, with neither of the terms individually converging in the sampled range of ecute_{\mathrm{cut}}. While residual fluctuations are observed also in the eigenvalues and, to a lesser extent, the kinetic energy of PtCO, the total energy does converge. The forces of the water and CO molecules do not exhibit any noticeable fluctuations as long as any low-pass filter is applied. The total forces appear to converge around ecut=700e_{\mathrm{cut}} = 700 Ry for the NaF dimer and around ecut=900e_{\mathrm{cut}} = 900 Ry for the Pt atom, with the residual fluctuations on the metal atoms Na and Pt significantly higher than on any of the nonmetals. Again, the individual force contributions on the Pt atom do not converge in the sampled range of ecute_{\mathrm{cut}}. Nonetheless, total force convergence to below 10 meV/Å accuracy is possible for all tested systems with the more aggressive low-pass filters (p1=6p_1 = 6, p1=7p_1 = 7).

Even the most conservative of the tested filters (p1=8p_1 = 8) significantly reduces energy and force fluctuations. Without a filter, we observe massive fluctuations in the energies and forces. In the converged range of ecute_{\mathrm{cut}}, the grid dependent fluctuations of the energy and force components are much more pronounced than the differences between different low-pass filters as long as any filter is used. However, in the total forces on the Pt atom, a subtle systematic error originating from the Environ force contribution can be observed with the most aggressive filter (p1=6p_1 = 6) compared to the other two filters. We conclude that the use of a low-pass filter is necessary to ensure consistent results between different grid densities in SCCS. Too aggressive filters can lead to systematic errors. For more conservative filters, a safe regime exists where the exact choice of parameters has little impact when used with a sufficiently dense grid. p1=7p_1 = 7 appears to produce slightly faster and more stable convergence than p1=8p_1 = 8. For all SCCS calculations in the following, we use p1=7p_1 = 7 and ecut=1000e_{\mathrm{cut}} = 1000 Ry as a safe choice.

Energy and force convergence with multipole order

Using the such determined grid and low-pass filter settings for Environ, we tested energy and force convergence with the multipole order lmax⁡l_{\max} in eq. (4). To ensure an appropriate representation of the higher order multipoles on the angular grids of FHI-aims, we used the really tight species defaults for this series of tests. For the tested elements, these defaults use the same electronic basis functions and radial grids as tight, but denser angular grids and a higher multipole order lmax⁡=8l_{\max} = 8 instead of lmax⁡=6l_{\max} = 6, the latter being the tight default value. We varied lmax⁡l_{\max} in the range from 5 to 10 and used the really tight basis sets and grids otherwise unmodified. We also use this opportunity to test three possible ways of computing the solvent-electron double counting correction, i.e., the last term in eq. (32): Using ρMP\rho^{\mathrm{MP}} and performing the integration in FHI-aims (as written in eq. (32)), using the exact ρel\rho^{\mathrm{el}} instead of its multipole-decomposed counterpart and performing the integration in FHI-aims, and using the smoothened multipole density and performing the integration on Environ’s regular grid. The primary results are shown in Figure 6 and Figure 7. Complete results including the forces on all atoms as well as all individual energy and force components are shown in sections S6.5 to § 15.8 in the SI.

Image not extracted

Figure 6. Convergence of total energy with multipole expansion order lmax⁡l_{\max} for different test systems, solvent models, and schemes for the solvent-electron double counting correction. Dashed lines only as visual guideline.

Image not extracted

Figure 7. Convergence of total forces of selected atoms in different test systems and solvent models with multipole expansion order lmax⁡l_{\max}. Dashed lines only as visual guideline.

In SSCS, total energies and forces are converged at lmax⁡=6l_{\max} = 6 for all tested systems to good accuracy. Only the forces on the C atom in PtCO show small fluctuations which converge at lmax⁡=8l_{\max} = 8. These fluctuations are, however, of the same order of magnitude <10< 10 meV/Å as the ecute_{\mathrm{cut}} dependent fluctuations on the Pt reported in the previous section and can thus be considered converged within the overall accuracy of our method. By contrast, the individual energy and force contributions exhibit a clear dependence on lmax⁡l_{\max}. This demonstrates that Environ can be seamlessly integrated into the intrinsic correction and error cancellation schemes of FHI-aims. In the following, we use the tight species defaults for all SSCS calculations.

In SCCS, the energy of water and the forces in NaF and PtCO are not converged at lmax⁡=6l_{\max} = 6. At lmax⁡=8l_{\max} = 8, almost all total energies and forces are converged. At this value, only the total forces on the Na and Pt atoms still exhibit some small error, of the same order of magnitude as the residual fluctuations with increasing grid density for these atoms (< 10 meV/A˚\mathring{\mathrm{A}}). Energies and forces become unstable for lmax⁡>10l_{\max} > 10 using the really tight angular grids, precluding any definitive statement about the convergence of the forces on these two atoms. However, increasing lmax⁡l_{\max} from 8 to 10, the residual net force on the center of mass of the total systems, which should be zero, reduced from 5.2 meV/A˚\mathring{\mathrm{A}} to 2.4 meV/A˚\mathring{\mathrm{A}} for PtCO and remained constant at 1.5 meV/A˚\mathring{\mathrm{A}} for NaF. Of course, the interpretability of these few data points is limited. It appears intuitively reasonable that SCCS, in which the cavity definition depends on the electron density, requires a more precise representation of this density compared to SSCS, which has no such dependency. In the following, we use the really tight species defaults for all SCCS calculations.

Across both solvent models it becomes apparent that of the three possible ways to compute the solvent-electron double counting correction, using ρel\rho^{\mathrm{el}} and performing the integration in FHI-aims does not lead to reliable energy convergence. This is particularly pronounced for NaF. The other two options both yield fast and reliable convergence to approximately the same value, with a minor difference < 1 meV for NaF and PtCO in SSCS. We opt to use ρMP\rho^{\mathrm{MP}} and perform the integration in FHI-aims as it allows us to use Environ’s existing functions for computing ΔGˉsolv\Delta\bar{G}^{\mathrm{solv}} without modification.

Consistency between energies and forces, surfaces

Using the such determined settings, we confirmed the consistency between energies and forces by checking the residual force on the center of mass of each system, which should be zero. Additionally, we displaced one atom in each system by 0.005 A˚\mathring{\mathrm{A}} away from the central (water, PtCO) / other (NaF) atom to compute finite difference numerical forces and compared them to the analytical forces. The results are shown in Table 1.

systemmodelresidual totalatomnumericalanalytical
waterSSCS0.84H558.2559.1
NaFSSCS1.3F1290.51290.3
PtCOSSCS4.3O6842.26846.1
CO@Pt(111)SSCS10.0O3063.6 (3072.5)3086.0
waterSCCS0.80H505.1504.7
NaFSCCS1.5F1065.41068.2
PtCOSCCS5.2O6853.46857.6
CO@Pt(111)SCCS4.8O2841.7 (2850.8)2864.0

Table 1. Forces in meV/Å for different systems in SSCS and SCCS. Center column: Residual total force (Euclidean norm) on center of mass of system (should be zero). Right columns: Forces along bond axis (unsigned) acting on specific atoms, computed numerically from total energy change on small displacement, and computed analytically (mean value between undisplaced and displaced geometry). Numerical forces in brackets are derived from the extrapolated energies at zero broadening of occupation numbers for CO@Pt(111).

We also test the applicability of our method in the context of computational surface science by including in the test systems a CO molecule (bond length 1.12 A˚\mathring{\mathrm{A}}) adsorbed at the top site of a Pt(111) surface (Pt-C distance 1.85 A˚\mathring{\mathrm{A}}). The Pt surface was represented by a slab consisting of 3 layers of 4×44 \times4 Pt atoms in an orthorhombic cell with cell parameters 11.10 Å and 9.61 Å in plane, corresponding to a nearest neighbor distance of 2.77 Å. In the direction perpendicular to the surface, the cell had an extent of 27.50 Å. We used the 2 dimensional version of Environ’s parabolic periodic boundary correction. We increased the broadening width for the occupation numbers to 0.1 eV to allow for convergence of the electronic structure of the metal substrate. We used a kk grid of 15×15×115 \times15 \times1 for which we found energies to be converged to 1 meV accuracy for the undisplaced geometry in both SSCS and SCCS, cf. section S5 in the SI.

We consistently find the residual force on the center of mass to be ≤10\le10 meV/Å. The same accuracy is also found in the agreement between numerical and analytical forces for the isolated systems. For CO on Pt(111), a larger disagreement is found. This is likely due to the non-zero broadening of the occupation numbers in the metal part of the system. If the derivatives of the occupation numbers are not explicitly accounted for, the analytical forces no longer correspond to the total energy.3 FHI-aims also outputs the extrapolated energy at zero broadening. Computing the numerical forces from these extrapolated energies reduces the disagreement with the analytical forces to <20< 20 meV/Å. Implementing explicit derivatives of the occupation numbers taking the solvent into account is beyond the scope of this article and left for future work.

Behavior in the no-smoothing limit

So far, we have only shown that for a given set of ratcutr_{at}^{\mathrm{cut}} there exists a free energy and corresponding forces to which a calculation converges with sufficiently tight numerical settings.

However, we have not yet empirically shown that this is, indeed, the correct free energy of the original electron density in the chosen solvent model. The theory of the equivalence between original and smoothened quantities is discussed in section S1 in the SI, but only in terms of exact analytical solutions. It is worth verifying how accurately this equivalence holds for the practically obtainable numerical solutions.

An exact reference using the original electron density is elusive because the cusps of this density near the nuclei cannot be resolved on any regular grid with a feasible grid density due to the discontinuity of the derivatives at the cusp. Conversely, implementing Environ’s models in an overlapping atom-centered grid formalism lies beyond the scope of this article and is, in fact, exactly what we want to avoid.

However, we can make use of the fact that the original electron density is recovered in the limit of small ratcutr_{at}^{\mathrm{cut}}

lim⁡ratcut→0+δρ~at,lmsmooth=δρ~at,lm(33)\lim_{r_{at}^{\mathrm{cut}} \to0^{+}} \delta\tilde{\rho}_{at,lm}^{\mathrm{smooth}} = \delta\tilde{\rho}_{at,lm} \tag*{(33)}

and equivalently for ρatfree\rho_{at}^{\mathrm{free}}. Although this limit cannot be reached, we can get arbitrarily close to it by choosing arbitrarily dense regular grids.

To verify that the energy of in the no-smoothing limit is the same as with the choice of ratcutr_{at}^{\mathrm{cut}} described in § 3.3, we systematically scale these radii by a factor fscalef_{\mathrm{scale}}

ratcut=12fscaleratsolv(34)r_{at}^{\mathrm{cut}} = \frac{1}{2} f_{\mathrm{scale}} r_{at}^{\mathrm{solv}} \tag*{(34)}

where fscale=1f_{\mathrm{scale}} = 1 reproduces the default eq. (21).

On this occasion, we also demonstrate how errors emerge once smoothing and solvent regions overlap. Starting at fscale=3f_{\mathrm{scale}} = 3, we decreased the scaling factor in steps of 0.1 until the SCF procedure no longer converged. The same factor was applied to all atoms in a given system. We repeated this process for different ecute_{\mathrm{cut}}, starting at the previously determined default values and increasing it in steps of 500 Ry up to 3500 Ry for water and NaF and 2000 Ry for PtCO.

The results are shown in Figure 8. Across all test systems, we consistently observe a stable regime up to around fscale=1f_{\mathrm{scale}} = 1. Around fscale=2f_{\mathrm{scale}} = 2, a steep deviation of the energy from this stable regime is found. This is expected as at this value, ratcutr_{\mathrm{at}}^{\mathrm{cut}} is equal to the estimated solvation radius ratsolvr_{\mathrm{at}}^{\mathrm{solv}}, cf. eq. (34). For larger ratcutr_{\mathrm{at}}^{\mathrm{cut}}, the smoothing region overlaps noticeably with the outside region and the assumptions made in § 3.2 no longer hold. Remarkably, for water both in SSCS and SCCS the fscalef_{\mathrm{scale}} value at which the energy starts to deviate from the converged value is smaller for denser grids. Nonetheless, at fscale=1f_{\mathrm{scale}} = 1, the error was <1< 1 meV for all tested grid densities.

Image not extracted

Figure 8. Convergence of total energy with scaling factor for ratcutr_{\mathrm{at}}^{\mathrm{cut}} for different test systems, solvent models, and Environ grid densities as defined by ecute_{\mathrm{cut}}. Markers indicate the lowest fscalef_{\mathrm{scale}} at which SCF convergence was still achieved. Dashed lines only as visual guideline.

In the direction of smaller smoothing regions, stable SCF convergence can be achieved down to fscalef_{\mathrm{scale}} between 0.3 and 0.5 with the default grid densities. Smaller fscalef_{\mathrm{scale}} down to 0.2 (except for water in SCCS, for which only 0.3 was possible with the tested grid densities) can be reached but require a steeply increasing Environ grid density. In most cases, the SCF procedure simply does not converge below a certain scaling factor. For water and NaF in SCCS, however, the lowest possible fscalef_{\mathrm{scale}} for some ecute_{\mathrm{cut}} resulted in outliers instead. All of these outliers are associated with additional SCF steps compared to the stable fscalef_{\mathrm{scale}} region. Furthermore, in NaF it can be seen how increasing the grid density further can remedy these outliers. At fscale=0.3f_{\mathrm{scale}} = 0.3, ecute_{\mathrm{cut}} values of 1000 Ry and 1500 Ry resulted in outliers, but ecut=2000e_{\mathrm{cut}} = 2000 recovers the stable energy. Similarly, fscale=0.2f_{\mathrm{scale}} = 0.2 and ecut=2500e_{\mathrm{cut}} = 2500 Ry also results in an outlier which is recovered at higher ecute_{\mathrm{cut}}. These outliers can thus be attributed to the SCF just narrowly converging to a spurious state. The outliers for the two highest ecute_{\mathrm{cut}} and fscale=0.2f_{\mathrm{scale}} = 0.2 in water in SCCS are not recovered within the sampled ecute_{\mathrm{cut}} range. However, the considerable number of additional SCF steps (45 for ecut=3000e_{\mathrm{cut}} = 3000 Ry and 22 for 3500 Ry compared to 10 for fscale=0.3f_{\mathrm{scale}} = 0.3) also suggests a spurious state which could presumably be recovered with an even denser grid.

Apart from these outliers, our results suggest that the no-smoothing limit of the total energy is already reached at fscale=1f_{\mathrm{scale}} = 1 for the default grid densities. We thus find eq. (21) to be a reasonable choice which avoids both spurious states for very small smoothing regions and overlap with the outside region for very large smoothing regions.

Computational overhead

The relative computational overhead of adding solvent effects via Environ into an FHI-aims calculation depends strongly on the methods used in both programs. The computational cost of different electronic structure methods famously differs by orders of magnitude. In Environ, we have shown that different models require different grid densities. Furthermore, the Poisson-Boltzmann model for electrolytes, cf. eqs. (8) and (9), requires a nested iterative solver scheme which takes more computational time than the generalized Poisson model for pure dielectrics, cf. eq. (7). It follows from these wide varieties within both parts of the simulation that either part may be the computational bottleneck, depending on the simulated system and the chosen models.

Nonetheless, a very rough estimate of the computational overhead is possible based on the dimensionality of the system. In Environ, the grid is uniform throughout the cell. Environ’s computational cost is, thus, dictated primarily by the cell size but not by the atoms inside it. By contrast, the grids in FHI-aims are attached to atoms. Therefore, its computational cost is dictated by the number (and species) of atoms but not by the cell size. This means that empty space in the cell increases the cost of Environ but not of FHI-aims. Empty space typically occurs in combination with periodic boundary corrections, as a buffer between the system and the cell boundary. Accordingly, we find the relative overhead on isolated systems where empty space is added in three directions to be significantly higher than on slab calculations where empty space is added only in one direction. Adding to this difference is the fact that for slab calculations in FHI-aims, kk space integration is necessary while in Environ, this is not the case because only charge densities and electrostatic potentials are considered, but no wavefunctions.

Table 2 shows the total calculation time, average time for one SCF step, and number of SCF steps for our test systems in SSCS, SCCS, and without continuum embedding. We note that some part of the overhead for SCCS is caused not by Environ itself but rather by the use of really tight instead of tight species defaults in FHI-aims. As expected from the considerations above, for each solvent model the overheads on one SCF step were all in a similar order of magnitude across all systems, 9 - 18 s for SSCS and 22 - 106 s for SCCS. This is because the simulation cells all had similar sizes, between 2933 and 8000 A˚3\mathrm{\AA}^3. By contrast,

systemvacuumSSCSSCCS
wateravg. step0.0349.226
watertotal0.6488273
watersteps201011
NaFavg. step0.0441122
NaFtotal2.7132227
NaFsteps241211
PtCOavg. step0.0561857
PtCOtotal1.5198670
PtCOsteps261213
CO@Pt(111)avg. step248265354
CO@Pt(111)total127292215729489
CO@Pt(111)steps508282

Table 2. Wall clock time in s for average SCF step except first and last, total calculation time, and number of SCF steps for different systems and solvent models as well as without solvent. All calculations were performed on 36 Intel(R) Xeon(R) CPU E5-2695 v4 @ 2.10GHz CPU cores. Both FHI-aims and Environ were built with Intel oneAPI compilers and libraries, version 2022.0.2. For the vacuum calculation of CO@Pt(111), periodic boundary conditions in zz direction were removed using the dipole correction implemented in FHI-aims. The same 15×15×115 \times15 \times1 k\mathbf{k} point grid was used as in the calculations with Environ. For the isolated systems, vacuum calculations were performed without periodic boundary conditions. All vacuum calculations used tight species defaults.

FHI-aims can take full advantage of the non-periodicity of the isolated systems, resulting in one SCF step of the water molecule being almost four orders of magnitude faster than for the CO@Pt(111) slab. Additionally, with FHI-aims being an all-electron code, heavy elements like Pt are intrinsically more computationally expensive than lighter elements.

In summary, the relative overhead on a single SCF step is small to moderate for the CO@Pt(111) test system. The total calculation time is still noticeably increased because more SCF steps were necessary with continuum embedding than without. This may possibly be remedied by optimizing the mixing parameters. However, for the isolated systems, Environ is clearly the bottleneck of the calculation. The intrinsic continuum embedding models of FHI-aims which can take advantage of non-periodic systems are significantly faster for these systems, albeit more limited in scope. For example, the MPE model was shown to not be the bottleneck of the calculation even for small isolated systems,[3] but it lacks most of Environ’s features like electrolyte models.

Conclusion and outlook

We have presented an interface between the all-electron full-potential DFT program FHI-aims and the regular grid based continuum embedding package Environ. FHI-aims passes a modified electron density to Environ which returns contributions to the KS potential, energy, and forces, allowing for integration of Environ into the SCF loop of FHI-aims. To overcome the complication of representing the narrow cusps of the electron density around the nuclei on an evenly spaced grid, we have introduced a smoothing scheme which conserves the charge density and electrostatic potential outside the solvation cavity, resulting in the correct solvent potential. Furthermore, we have included a low-pass filter in the FFT based derivatives in Environ to suppress high frequency artifacts in the electron density passed from FHI-aims.

The resulting method allows for reliable convergence of energies to <1< 1 meV and forces to <10< 10 meV/A˚\mathring{\mathrm{A}} accuracy. For SSCS, the tight species defaults of FHI-aims are sufficient and no low-pass filter is necessary. For SCCS, the higher multipole order of the really tight defaults is required as well as a low-pass filter, for which we found parameters p1=7p_1 = 7, p2=4p_2 = 4 to be a safe choice. Even higher multipole orders and accordingly denser angular grids than in the really tight defaults might possibly be necessary in some cases. The required grid density in Environ depends strongly on the system and the solvent model. For all systems which were tested in this work, a parameter of ecut=500e_{\mathrm{cut}} = 500 Ry appeared to be a safe choice for SSCS and 1000 Ry for SCCS. However, we stress here that the chosen applications intentionally cover challenging systems, and much smaller values may be sufficient in many cases. As in most electronic structure applications, testing convergence of energies and forces with ecute_{\mathrm{cut}} for each specific system is recommended.

The presented work showcases a robust scheme for coupling simulation methods with very different numerical domains. Given the accuracy and transferability of the proposed methodology, we expect the proposed scheme to have a positive impact on the further development of modular libraries for electronic structure and multiscale/multiphysics calculations. Other forms of environment/electrostatic embedding, in particular density embedding, subsystem DFT, and polarizable QM/MM models, may benefit from the possibility of combining grid-based solvers with accurate full-electron calculators that rely on atom-centered numerical domains.

Acknowledgments

We thank Volker Blum for his useful suggestions on potential representation on different grids. We acknowledge funding from the NSF Cybertraining program, award #2321102 and from the NSF CAREER award #2306929.

Data availability

Data sharing is not applicable to this article as no new data were created or analyzed in this study.

References

Supplementary information: Coupling all-electron full-potential density functional theory with regular grid based continuum embeddings

Jakob Filser; Edan Bainglass; Karsten Reuter; Oliviero Andreussi

Equivalence of certain solvent terms derived from original and smoothened density

In this section, we discuss the solvent contributions to the potential and their interaction with the solute. We consider the exact solution of the electrostatic problem and non-electrostatic model for the original explicit charge density ρ\rho and its smoothened counterpart ρˉ\bar{\rho}. Most equations are expressed in terms of ρˉ\bar{\rho} and quantities derived from it since this is what we compute in practice. However, for the exact solution, the same equations hold for ρ\rho and its derived quantities. The numerical solution on the regular grid is a good approximation to this (unknown) exact solution for ρˉ\bar{\rho} but not for ρ\rho. We will show that the exact solvent potential is equal for both densities, allowing us to use the numerical solution for the smoothened density and treat it as if it was the solution for the original density.

Throughout this and the following sections, the superscript ‘vac’ is used to denote any quantities resulting from the Poisson equation without any embedding. Note that such quantities are still derived from a charge density which may be the converged result of an embedded calculation rather than a vacuum calculation or, in fact, any instantaneous charge density. The superscript ‘solv’ indicates any quantities resulting from an embedded calculation. The bar  ˉ\bar{\ } is used to denote smoothened electron densities as described in the main article, smeared nuclear charge densities according to Environ’s[1] intrinsic procedures, as well as any total or other charge densities, potentials, energies, and forces derived from the former two quantities. The corresponding quantities without the bar and the term original refer to the non-smoothened electron density from FHI-aims[2] and nuclear point charges as well as any derived quantities. Unless mentioned otherwise, any equations presented here refer to the (unknown) exact solutions of the respective models rather than the numeric solutions on the regular (or any other) grid.

Electrostatic potential

Environ implements a variety of electrostatic problems, not just the generalized Poisson and Poisson-Boltzmann models.[3, 4, 5, 6] However, all of these models are defined in a way which allows Φˉsolv\bar{\Phi}^{\mathrm{solv}} to be computed as the solution of the Poisson equation with an additional polarization source term. In the original literature on Environ, the dielectric polarization and the electrolyte charge are considered separately. Such a distinction is not necessary for the derivation here. Instead, we summarize both into ρˉpol\bar{\rho}^{\mathrm{pol}}.

∇2Φˉsolv(r)=−4π(ρˉ(r)+ρˉpol(r))(35)\nabla^2 \bar{\Phi}^{\mathrm{solv}}(\mathbf{r}) = -4\pi\left(\bar{\rho}(\mathbf{r}) + \bar{\rho}^{\mathrm{pol}}(\mathbf{r})\right) \tag*{(35)}

The linearity of the ∇2\nabla^2 operator allows us to separate

Φˉsolv=Φˉvac+Φˉpol(36)\bar{\Phi}^{\mathrm{solv}} = \bar{\Phi}^{\mathrm{vac}} + \bar{\Phi}^{\mathrm{pol}} \tag*{(36)}
∇2Φˉpol(r)=−4πρˉpol(r)(37)\nabla^2 \bar{\Phi}^{\mathrm{pol}}(\mathbf{r}) = -4\pi\bar{\rho}^{\mathrm{pol}}(\mathbf{r}) \tag*{(37)}

Here, we have renamed the quantity which is called ΔΦˉsolv\Delta\bar{\Phi}^{\mathrm{solv}} in the main article to Φˉpol\bar{\Phi}^{\mathrm{pol}} to make the relation to ρˉpol\bar{\rho}^{\mathrm{pol}} more apparent and avoid confusion with Φˉsolv\bar{\Phi}^{\mathrm{solv}} in the following. We can use eq. (15) in the main article to obtain the non-smoothened potential in solution as long as

Φˉpol=Φpol(38)\bar{\Phi}^{\mathrm{pol}}=\Phi^{\mathrm{pol}} \tag*{(38)}

The iterative solver finds ρˉpol\bar{\rho}^{\mathrm{pol}} such that Φˉsolv\bar{\Phi}^{\mathrm{solv}} solves the specified problem for the explicit source term ρˉ\bar{\rho}. All implemented electrostatic problems allow for ρˉpol\bar{\rho}^{\mathrm{pol}} to be computed as a semi-local function

ρˉ(i)pol(r)=ρˉpol(Φˉ(i)solv(r),∇Φˉ(i)solv(r),ρˉ(r),∇ρˉ(r),s(r),∇s(r))(39)\bar{\rho}^{\mathrm{pol}}_{(i)}(\mathbf{r})=\bar{\rho}^{\mathrm{pol}}\left(\bar{\Phi}^{\mathrm{solv}}_{(i)}(\mathbf{r}),\nabla\bar{\Phi}^{\mathrm{solv}}_{(i)}(\mathbf{r}),\bar{\rho}(\mathbf{r}),\nabla\bar{\rho}(\mathbf{r}),s(\mathbf{r}),\nabla s(\mathbf{r})\right) \tag*{(39)}

at each iteration step ii, using Φˉsolv\bar{\Phi}^{\mathrm{solv}} at that step which is computed from the polarization at the previous step

∇2Φˉ(i)pol(r)=−4πρˉ(i−1)pol(r)(40)\nabla^{2}\bar{\Phi}^{\mathrm{pol}}_{(i)}(\mathbf{r})=-4\pi\bar{\rho}^{\mathrm{pol}}_{(i-1)}(\mathbf{r}) \tag*{(40)}

For all implemented models, we can generally say that ρˉpol=0\bar{\rho}^{\mathrm{pol}}=0 everywhere inside. This means that at any given iteration step, the polarization density for the original and smoothened explicit density are equal

ρˉpol(Φˉ(i)solv(r),∇Φˉ(i)solv(r),ρˉ(r),∇ρˉ(r),s(r),∇s(r))=ρpol(Φ(i)solv(r),∇Φ(i)solv(r),ρ(r),∇ρ(r),s(r),∇s(r))(41)\begin{aligned} \bar{\rho}^{\mathrm{pol}}\left(\bar{\Phi}^{\mathrm{solv}}_{(i)}(\mathbf{r}),\nabla\bar{\Phi}^{\mathrm{solv}}_{(i)}(\mathbf{r}),\bar{\rho}(\mathbf{r}),\nabla\bar{\rho}(\mathbf{r}),s(\mathbf{r}),\nabla s(\mathbf{r})\right)\\ =\rho^{\mathrm{pol}}\left(\Phi^{\mathrm{solv}}_{(i)}(\mathbf{r}),\nabla\Phi^{\mathrm{solv}}_{(i)}(\mathbf{r}),\rho(\mathbf{r}),\nabla\rho(\mathbf{r}),s(\mathbf{r}),\nabla s(\mathbf{r})\right) \tag*{(41)} \end{aligned}

under the condition that

ρˉ(r)=ρ(r)(42)\bar{\rho}(\mathbf{r})=\rho(\mathbf{r}) \tag*{(42)}
Φˉ(i)solv(r)=Φˉvac(r)+Φˉ(i)pol(r)=Φvac(r)+Φ(i)pol(r)=Φ(i)solv(r)(43)\bar{\Phi}^{\mathrm{solv}}_{(i)}(\mathbf{r})=\bar{\Phi}^{\mathrm{vac}}(\mathbf{r})+\bar{\Phi}^{\mathrm{pol}}_{(i)}(\mathbf{r})=\Phi^{\mathrm{vac}}(\mathbf{r})+\Phi^{\mathrm{pol}}_{(i)}(\mathbf{r})=\Phi^{\mathrm{solv}}_{(i)}(\mathbf{r}) \tag*{(43)}

for all rr outside. The equality of ss and sˉ\bar{s} is discussed in section 3.2 the main article. Inside, eq. (41) is trivially fulfilled by being =0=0. Equation (S7a) is always fulfilled outside because we defined our smoothing scheme to only manipulate the density inside. By conserving the long range multipole moments of the smoothened regions, Φˉvac(r)=Φvac(r)\bar{\Phi}^{\mathrm{vac}}(r)=\Phi^{\mathrm{vac}}(r) outside. By simply choosing

Φˉ(1)pol(r)=Φ(1)pol(r)=0(44)\bar{\Phi}^{\mathrm{pol}}_{(1)}(r)=\Phi^{\mathrm{pol}}_{(1)}(r)=0 \tag*{(44)}

as an initial guess, we find that eq. (S7b) is fulfilled outside for i=1i=1. This means that eq. (41) is fulfilled in this step and, according to eqs. (39) and (40), eq. (S7b) remains fulfilled in the next step etc., eventually converging to the same result eq. (38). It does not matter which initial guess for Φˉ(1)pol\bar{\Phi}^{\mathrm{pol}}_{(1)} is actually used as long as the iteration converges to the same result as when starting from eq. (44).

Free energy

The exact definition of the free energy functional differs between models.1 Nonetheless, we can make some general statements about the equivalence of the solvent contribution to the free energy for the original and smoothened density.

The electrostatic interaction between the explicit charge and the solvent potential is a term that occurs as a part of ΔGˉsolv\Delta\bar{G}^{\mathrm{solv}} in all of these models. It can equivalently expressed as the interaction between the potential of the explicit charge, i.e., the vacuum potential, and the polarization density.

∫dr ρˉ(r)Φˉpol(r)=∫dr Φˉvac(r)ρˉpol(r)(45)\int\mathrm{d}r\,\bar{\rho}(r)\bar{\Phi}^{\mathrm{pol}}(r)=\int\mathrm{d}r\,\bar{\Phi}^{\mathrm{vac}}(r)\bar{\rho}^{\mathrm{pol}}(r) \tag*{(45)}

As established in the previous section, ρˉpol=ρpol=0\bar{\rho}^{\mathrm{pol}}=\rho^{\mathrm{pol}}=0 everywhere inside for all models implemented in Environ and Φˉvac=Φvac\bar{\Phi}^{\mathrm{vac}}=\Phi^{\mathrm{vac}} and ρˉpol=ρpol\bar{\rho}^{\mathrm{pol}}=\rho^{\mathrm{pol}} everywhere outside. This means that the integrand in the right hand side expression of the above equation vanishes everywhere inside both for the smoothened and original potential and density, and it is equal to its nonsmoothened counterpart everywhere outside. The electrostatic solute-solvent interactions for the original and smoothened density are, thus, equal.

Beyond these electrostatic interactions, the total free energy may contain a confining potential,4 the electrostatic energy, chemical potential and entropy of an electrolyte, or a non-electrostatic contribution in the form of an effective pressure and an effective surface tension1 applied to the cavity volume and surface area. All of these terms are computed as volume integrals. In all of them, the integrand depends locally only on quantities which we have already established to be equivalent between the smoothened and non-smoothened case everywhere outside. Specifically, these are ss and ρˉel\bar{\rho}^{\mathrm{el}} for the confining potential, ss and Φˉsolv\bar{\Phi}^{\mathrm{solv}} for the electrolyte terms, ss for the volume, and ∣∇s∣|\nabla s| for the surface area. Furthermore, all integrands vanish inside by construction except for the cavity volume. However, the integrand inside is simply =s=1=s=1 in this case, both in the smoothened and the non-smoothened case. Therefore, ΔGˉsolv=ΔGsolv\bar{\Delta G}^{\mathrm{solv}}=\Delta G^{\mathrm{solv}}.

Kohn-Sham potential

The KS potential is given by the functional derivative

Veff=δEpotδρel(46)V_{\mathrm{eff}}=\frac{\delta E_{\mathrm{pot}}}{\delta\rho_{\mathrm{el}}} \tag*{(46)}

where the potential energy Epot=E−TE_{\mathrm{pot}=E-T} is simply the energy without the KS kinetic energy TT, with EE being the energy expression that is minimized by using VeffV_{\mathrm{eff}} in the KS equations. In our context, this can be either E=EvacE=E^{\mathrm{vac}} in vacuum or E=GsolvE=G^{\mathrm{solv}} in solution. In the former case, the potential is given by

Veffvac=Φvac+vxc(47)V_{\mathrm{eff}}^{\mathrm{vac}}=\Phi^{\mathrm{vac}}+v_{\mathrm{xc}} \tag*{(47)}

with the functional derivative of the exchange-correlation (xc) energy vxc=δExc/δρelv_{\mathrm{xc}} = \delta E_{\mathrm{xc}}/\delta\rho^{\mathrm{el}}. With continuum embedding, it is given by

Veffsolv=Φvac+vxc+ΔV‾effsolv(48)V_{\mathrm{eff}}^{\mathrm{solv}} = \Phi^{\mathrm{vac}} + v_{\mathrm{xc}} + \Delta\overline{V}_{\mathrm{eff}}^{\mathrm{solv}} \tag*{(48)}

ΔV‾effsolv\Delta\overline{V}_{\mathrm{eff}}^{\mathrm{solv}} contains Φ‾pol\overline{\Phi}^{\mathrm{pol}}. Additionally, it may contain any functional derivatives due to an electron density dependent cavity definition in SCCS2 including non-electrostatic terms as well as the confining potential if the respective methods are used.

TT depends only on ρel\rho^{\mathrm{el}} and is computed in FHI-aims, without any smoothing. It is, therefore, fully contained in EvacE^{\mathrm{vac}}. Furthermore, VeffvacV_{\mathrm{eff}}^{\mathrm{vac}} is actually the functional derivative of EvacE^{\mathrm{vac}}, see also section S3.

Gsolv=Epotvac+T+ΔG‾solv(49)G^{\mathrm{solv}} = E_{\mathrm{pot}}^{\mathrm{vac}} + T + \Delta\overline{G}^{\mathrm{solv}} \tag*{(49)}
Veffsolv=Veffvac+δΔG‾solvδρel(50)V_{\mathrm{eff}}^{\mathrm{solv}} = V_{\mathrm{eff}}^{\mathrm{vac}} + \frac{\delta\Delta\overline{G}^{\mathrm{solv}}}{\delta\rho_{\mathrm{el}}} \tag*{(50)}

This allows us to directly relate ΔV‾effsolv\Delta\overline{V}_{\mathrm{eff}}^{\mathrm{solv}} to ΔG‾solv\Delta\overline{G}^{\mathrm{solv}}

ΔV‾effsolv=δΔG‾solvδρel(51)\Delta\overline{V}_{\mathrm{eff}}^{\mathrm{solv}} = \frac{\delta\Delta\overline{G}^{\mathrm{solv}}}{\delta\rho_{\mathrm{el}}} \tag*{(51)}

We have already established that ΔG‾solv=ΔGsolv\Delta\overline{G}^{\mathrm{solv}} = \Delta G^{\mathrm{solv}}. This is true for any electron density, not just ground- or other eigenstates. Therefore, δΔG‾solv=δΔGsolv\delta\Delta\overline{G}^{\mathrm{solv}} = \delta\Delta G^{\mathrm{solv}} regardless of the chosen perturbation, and consequently ΔV‾effsolv=ΔVeffsolv\Delta\overline{V}_{\mathrm{eff}}^{\mathrm{solv}} = \Delta V_{\mathrm{eff}}^{\mathrm{solv}}.

Forces

The electrostatic forces in Environ can equivalently be expressed through the solute charge density and solvent potential or vice versa

−∫dr Φ‾pol(r)∇atρ‾(r)=−∫dr ρ‾pol(r)∇atΦ‾vac(r)(52)-\int\mathrm{d}r\,\overline{\Phi}^{\mathrm{pol}}(\mathbf{r})\nabla_{\mathrm{at}}\overline{\rho}(\mathbf{r}) = -\int\mathrm{d}r\,\overline{\rho}^{\mathrm{pol}}(\mathbf{r})\nabla_{\mathrm{at}}\overline{\Phi}^{\mathrm{vac}}(\mathbf{r}) \tag*{(52)}

∇at\nabla_{at} is the gradient with respect to Rat\mathbf{R}_{at}. It can be seen in the right hand side formulation that, in analogy to eq. (45), the integrand vanishes inside and is equal to its original counterpart outside.

Additional terms may emerge due to an explicit dependency of ss on the nuclear coordinates. Similarly to the additional free energy contributions discussed in section S1.2, these are evaluated as volume integrals the integrands of which vanish inside and locally depend only on smoothened quantities which are equal to their original counterparts outside. Therefore, ΔFˉatsolv=ΔFatsolv\Delta\bar{F}_{at}^{\mathrm{solv}} = \Delta F_{at}^{\mathrm{solv}}.

Continuity of multipole components and their derivatives at the origin

The smoothened multipole components follow the general form

δρat,lmsmooth(r)=f(r)Ylm(Ω)(53)\delta\rho_{at,lm}^{\mathrm{smooth}}(\mathbf{r}) = f(r)Y_{lm}(\Omega) \tag*{(53)}

with a polynomial

f(r)=a0+a1r+a2r2+…+anmax⁡rnmax⁡(54)f(r) = a_0 + a_1r + a_2r^2 + \ldots+ a_{n_{\max}}r^{n_{\max}} \tag*{(54)}

Throughout this section, we use the shorthand notation f(r)f(r) for the polynomial that is called Pat,lm(r)P_{at,lm}(r) in the main article, do not explicitly denote 0≤r<ratcut0 \leq r < r_{at}^{\mathrm{cut}}, and drop the subscript atat in the spherical coordinates rr, Ω\Omega for reasons of clarity. It is implied that f(r)f(r) depends on atat, ll and mm, that rr lies inside the cutoff radius, and that the coordinate system is shifted to have atom atat at the origin. The gradient of eq. (53) is given by

∇(f(r)Ylm(Ω))=f(r)r∇Ylm(Ω)+f′(r)Ylm(Ω)e^r(55)\nabla\left(f(r)Y_{lm}(\Omega)\right) = \frac{f(r)}{r}\nabla Y_{lm}(\Omega) + f'(r)Y_{lm}(\Omega)\hat{\mathbf{e}}_r \tag*{(55)}

with f′=∂f∂rf^{\prime}=\frac{\partial f}{\partial r} and the unit vector e^r\hat{\mathbf{e}}_r pointing in the direction of the point r\mathbf{r}. We point out that the index rr does not denote a dependency and the unit vector is, in fact, a function e^r(Ω)\hat{\mathbf{e}}_r(\Omega) only of Ω\Omega. The Hessian is given by

∇⊗∇(f(r)Ylm(Ω))=f(r)r2r2∇⊗∇Ylm(Ω)+f′(r)r(e^r⊗r∇Ylm(Ω)+r∇Ylm(Ω)⊗e^r+Ylm(Ω)(1−e^r⊗e^r))+f′′(r)Ylm(Ω)e^r⊗e^r(56)\nabla\otimes\nabla\left(f(r)Y_{lm}(\Omega)\right)=\frac{f(r)}{r^2}r^2\nabla\otimes\nabla Y_{lm}(\Omega) +\frac{f^{\prime}(r)}{r}\left(\hat{\mathbf{e}}_r\otimes r\nabla Y_{lm}(\Omega)+r\nabla Y_{lm}(\Omega)\otimes\hat{\mathbf{e}}_r+Y_{lm}(\Omega)\left(\mathbf{1}-\hat{\mathbf{e}}_r\otimes\hat{\mathbf{e}}_r\right)\right) +f^{\prime\prime}(r)Y_{lm}(\Omega)\hat{\mathbf{e}}_r\otimes\hat{\mathbf{e}}_r \tag*{(56)}

with the 3×33\times3 identity matrix 1\mathbf{1} and f′′=∂2f∂r2f^{\prime\prime}=\frac{\partial^2f}{\partial r^2}. We want δρ~at,lmsmooth(r)\delta\tilde{\rho}^{\mathrm{smooth}}_{at,lm}(\mathbf{r}) to be continuous and twice continuously differentiable. Because f(r)f(r) fulfills these continuities ∀r\forall r and Ylm(Ω)Y_{lm}(\Omega) fulfills them ∀r≠0\forall r\ne0, their product also fulfills them ∀r\forall r as long as it fulfills them for r=0\mathbf{r}=0. In other words, we want the limit of δρ~at,lmsmooth(r)\delta\tilde{\rho}^{\mathrm{smooth}}_{at,lm}(\mathbf{r}) and its gradient and Hessian for r→0+r\to0^+ to exist and be independent of Ω\Omega:

lim⁡r→0+F(r)∣Ω=Ω1=lim⁡r→0+F(r)∣Ω=Ω2∀Ω1,Ω2(57)\left.\lim_{r\to0^+}F(\mathbf{r})\right|_{\Omega=\Omega_1} = \left.\lim_{r\to0^+}F(\mathbf{r})\right|_{\Omega=\Omega_2} \qquad\forall\Omega_1,\Omega_2 \tag*{(57)}

where for F(r)F(\mathbf{r}) we insert eqs. (S16), (S18), and (S19). We note that while Ylm(Ω)Y_{lm}(\Omega) and e^r\hat{\mathbf{e}}_r are discontinuous at r=0\mathbf{r}=0, they do not depend on rr and can be separated out of the limit. The gradient of the spherical harmonics is given by

∇Ylm(Ω)=(e^r∂∂r+1r(e^θ∂∂θ+e^ϕ1sin⁡θ∂∂ϕ))Ylm(Ω)(58)\nabla Y_{lm}(\Omega)=\left(\hat{\mathbf{e}}_r\frac{\partial}{\partial r}+\frac{1}{r}\left(\hat{\mathbf{e}}_\theta\frac{\partial}{\partial\theta}+\hat{\mathbf{e}}_\phi\frac{1}{\sin\theta}\frac{\partial}{\partial\phi}\right)\right)Y_{lm}(\Omega) \tag*{(58)}

where θ\theta and ϕ\phi are the polar and azimuthal components of Ω\Omega and e^θ/ϕ\hat{\mathbf{e}}_{\theta/\phi} are the corresponding unit vectors. We point out that, like e^r\hat{\mathbf{e}}_r, these unit vectors are functions only of Ω\Omega but not of rr. Realizing that the derivative with respect to rr vanishes because Ylm(Ω)Y_{lm}(\Omega) does not depend on it, we find that the gradient can be rewritten as

∇Ylm(Ω)=1rGlm(Ω)(59)\nabla Y_{lm}(\Omega) = \frac{1}{r}\mathbf{G}_{lm}(\Omega) \tag*{(59)}

with some vector valued function Glm(Ω)\mathbf{G}_{lm}(\Omega) which does not depend on rr. For the same reasons of vanishing dependencies, we find the Hessian of the spherical harmonics to be

∇⊗∇Ylm(Ω)=−1r2e^r⊗Glm(Ω)+1r2Hlm(Ω)(60)\nabla\otimes\nabla Y_{lm}(\Omega) = -\frac{1}{r^2}\hat{\mathbf{e}}_r \otimes\mathbf{G}_{lm}(\Omega) + \frac{1}{r^2}\mathbf{H}_{lm}(\Omega) \tag*{(60)}

with some matrix valued function Hlm(Ω)\mathbf{H}_{lm}(\Omega) which does not depend on rr. We notice that the limits

lim⁡r→0+r∇Ylm(Ω)=Glm(Ω)(61)\lim_{r\to0^+} r\nabla Y_{lm}(\Omega) = \mathbf{G}_{lm}(\Omega) \tag*{(61)}
lim⁡r→0+r2∇⊗∇Ylm(Ω)=−e^r⊗Glm(Ω)+Hlm(Ω)(62)\lim_{r\to0^+} r^2\nabla\otimes\nabla Y_{lm}(\Omega) = -\hat{\mathbf{e}}_r \otimes\mathbf{G}_{lm}(\Omega) + \mathbf{H}_{lm}(\Omega) \tag*{(62)}

exist because all dependencies on rr cancel. This means that the limits in eq. (57) exist as long as the rr-dependent terms in eqs. (53), (S18), and (S19)

f(r)=a0+a1r+a2r2+…(63)f(r) = a_0 + a_1r + a_2r^2 + \ldots \tag*{(63)}
f(r)r=a0r+a1+a2r+…(64)\frac{f(r)}{r} = \frac{a_0}{r} + a_1 + a_2r + \ldots \tag*{(64)}
f′(r)=a1+2a2r+…(65)f'(r) = a_1 + 2a_2r + \ldots \tag*{(65)}
f(r)r2=a0r2+a1r+a2+…(66)\frac{f(r)}{r^2} = \frac{a_0}{r^2} + \frac{a_1}{r} + a_2 + \ldots \tag*{(66)}
f′(r)r=a1r+2a2+…(67)\frac{f'(r)}{r} = \frac{a_1}{r} + 2a_2 + \ldots \tag*{(67)}
f′′(r)=2a2+…(68)f''(r) = 2a_2 + \ldots \tag*{(68)}

do not diverge at r=0r = 0. This is the case if a0=a1=0a_0 = a_1 = 0. This is also sufficient for the limits of the value and gradient of δρ~at,lmsmooth(r)\delta\tilde{\rho}^{\mathrm{smooth}}_{at,lm}(r) to be zero at the origin, fulfilling eq. (57). If, additionally, a2=0a_2 = 0, the Hessian is also zero and therefore continuous at the origin.

While a0=a1=a2=0a_0 = a_1 = a_2 = 0 is a sufficient condition for δρ~at,lmsmooth(r)\delta\widetilde{\rho}^{\mathrm{smooth}}_{at,lm}(\mathbf{r}) to be continuous and twice continuously differentiable, it may not always be a necessary one. This can be shown using a substitution

g(r)=Nl−1f(r)rl=Nl−1(a0r−l+a1r1−l+a2r2−l+…)(69)g(r) = N_l^{-1}\frac{f(r)}{r^l} = N_l^{-1}\left(a_0r^{-l} + a_1r^{1-l} + a_2r^{2-l} + \ldots\right) \tag*{(69)}

We can rewrite

δρ~at,lmsmooth(r)=g(r)Rlm(r)(70)\delta\widetilde{\rho}^{\mathrm{smooth}}_{at,lm}(\mathbf{r}) = g(r)\mathcal{R}_{lm}(\mathbf{r}) \tag*{(70)}

with the regular solid harmonic function

Rlm(r)=NlrlYlm(Ω)(71)\mathcal{R}_{lm}(\mathbf{r}) = N_l r^l Y_{lm}(\Omega) \tag*{(71)}

where NlN_l is a normalization constant. Rlm(r)\mathcal{R}_{lm}(\mathbf{r}) are continuous and continuously differentiable to infinite order ∀r\forall r, including r=0\mathbf{r} = \mathbf{0}. The gradient of eq. (70) is given by

∇(g(r)Rlm(r))=g(r)∇Rlm(r)+g′(r)rRlm(r)r(72)\nabla\left(g(r)\mathcal{R}_{lm}(\mathbf{r})\right) = g(r)\nabla\mathcal{R}_{lm}(\mathbf{r}) + \frac{g'(r)}{r}\mathcal{R}_{lm}(\mathbf{r})\mathbf{r} \tag*{(72)}

The Hessian is given by

∇⊗∇(g(r)Rlm(r))=g(r)∇⊗∇Rlm(r)+g′(r)r(r⊗∇Rlm(r)+∇Rlm(r)⊗r+Rlm(r)1)+(g′′(r)r2−g′(r)r3)Rlm(r)r⊗r(73)\begin{aligned} \nabla\otimes\nabla\left(g(r)\mathcal{R}_{lm}(\mathbf{r})\right) ={}& g(r)\nabla\otimes\nabla\mathcal{R}_{lm}(\mathbf{r}) \\ &+ \frac{g'(r)}{r}\left(\mathbf{r} \otimes\nabla\mathcal{R}_{lm}(\mathbf{r}) + \nabla\mathcal{R}_{lm}(\mathbf{r}) \otimes\mathbf{r} + \mathcal{R}_{lm}(\mathbf{r})\mathbf{1}\right) \\ &+ \left(\frac{g''(r)}{r^2} - \frac{g'(r)}{r^3}\right)\mathcal{R}_{lm}(\mathbf{r})\mathbf{r} \otimes\mathbf{r} \tag*{(73)} \end{aligned}

There is a difference in eqs. (53), (55), and (56) compared to eqs. (70), (72), and (73). While the limits r→0+r \to0^+ of the terms e^r\hat{\mathbf{e}}_r, Ylm(Ω)Y_{lm}(\Omega), r∇Ylm(Ω)r\nabla Y_{lm}(\Omega) and r2∇⊗∇Ylm(Ω)r^2\nabla\otimes\nabla Y_{lm}(\Omega) exist, they do depend on Ω\Omega. In other words, these terms are discontinuous at r=0\mathbf{r} = \mathbf{0}. By contrast, the terms r\mathbf{r}, Rlm(r)\mathcal{R}_{lm}(\mathbf{r}), ∇Rlm(r)\nabla\mathcal{R}_{lm}(\mathbf{r}) and ∇⊗∇Rlm(r)\nabla\otimes\nabla\mathcal{R}_{lm}(\mathbf{r}) are continuous at the origin, making the check. for a condition equivalent to eq. (57) trivial. We can directly see that eqs. (70), (S29), and (S30) are continuous if the terms

g(r)=Nl−1(a0rl+a1rl−1+⋯+al−1r+al+al+1r+al+2r2+al+3r3+al+4r4+⋯ )(74)g(r)=N_l^{-1}\left(\frac{a_0}{r^l}+\frac{a_1}{r^{l-1}}+\cdots+\frac{a_{l-1}}{r}+a_l+a_{l+1}r+a_{l+2}r^2+a_{l+3}r^3+a_{l+4}r^4+\cdots\right) \tag*{(74)}
g′(r)r=Nl−1(−la0rl+2−(l−1)a1rl+1+⋯−al−1r3+al+1r+2al+2+3al+3r+4al+4r2+⋯ )(75)\frac{g'(r)}{r}=N_l^{-1}\left(-l\frac{a_0}{r^{l+2}}-(l-1)\frac{a_1}{r^{l+1}}+\cdots-\frac{a_{l-1}}{r^3}+\frac{a_{l+1}}{r}+2a_{l+2}+3a_{l+3}r+4a_{l+4}r^2+\cdots\right) \tag*{(75)}
g′′(r)r2−g′(r)r3=Nl−1(l(l+2)a0rl+4+(l+1)(l−1)a1rl+3+⋯+3al−1r5−al+1r3+3al+3r+8al+4+⋯ )(76)\frac{g''(r)}{r^2}-\frac{g'(r)}{r^3}=N_l^{-1}\left(l(l+2)\frac{a_0}{r^{l+4}}+(l+1)(l-1)\frac{a_1}{r^{l+3}}+\cdots+3\frac{a_{l-1}}{r^5}-\frac{a_{l+1}}{r^3}+3\frac{a_{l+3}}{r}+8a_{l+4}+\cdots\right) \tag*{(76)}

are continuous. There are three kinds of coefficients ana_n which never occur as coefficients of a diverging term in the above formulas. First, ala_l occurs only as a constant in g(r)g(r) and vanishes in the derivatives. Second, al+2a_{l+2} occurs as the coefficient of r2r^2 in g(r)g(r), as a constant in g′(r)r\frac{g'(r)}{r}, and cancels in g′′(r)r2−g′(r)r3\frac{g''(r)}{r^2}-\frac{g'(r)}{r^3}. Finally, ana_n with n≥l+4n\geq l+4 occur as coefficients of rn′r^{n'} with n′≥0n'\geq0 in all three terms.

Therefore, δρ~at,lmsmooth(r)\delta\widetilde{\rho}^{\mathrm{smooth}}_{at,lm}(r) is continuous and twice continuously differentiable at r=0\mathbf{r}=0 if

an=0∀n∈{n:n<l+4}∖{l,l+2}.a_n=0\quad\forall n\in\{n:n<l+4\}\setminus\{l,l+2\}.

This is, again, a sufficient but not necessary condition. For most ll, this is more restrictive than a0=a1=a2=0a_0=a_1=a_2=0, as we determined using eqs. (53) and (S18) to (S20). For l≤2l\leq2, however, we find additional terms which may be non-zero. By separating the low and high order terms

δρ~at,lmsmooth(r)=g~(r)Rlm(r)+f~(r)Ylm(Ω)(77)\delta\widetilde{\rho}^{\mathrm{smooth}}_{at,lm}(r)=\widetilde{g}(r)\mathcal{R}_{lm}(r)+\widetilde{f}(r)Y_{lm}(\Omega) \tag*{(77)}

with

g~(r)=Nl−1(a0r−l+a1r1−l+a2r2−l)(78)\widetilde{g}(r)=N_l^{-1}\left(a_0r^{-l}+a_1r^{1-l}+a_2r^{2-l}\right) \tag*{(78)}
f~(r)=a3r3+a4r4+…+anmax⁡rnmax⁡(79)\widetilde{f}(r)=a_3r^3+a_4r^4+\ldots+a_{n_{\max}}r^{n_{\max}} \tag*{(79)}

we can see that f~(r)Ylm(Ω)\widetilde{f}(r)Y_{lm}(\Omega) is continuous and twice continuously differentiable at the origin.

g~(r)Rlm(r)\widetilde{g}(r)\mathbf{R}_{lm}(\mathbf{r}) and its derivatives are trivially continuous if a0=a1=a2=0a_0=a_1=a_2=0. In the special cases of l≤2l\leq2, however, g~(r)Rlm(r)\widetilde{g}(r)\mathbf{R}_{lm}(\mathbf{r}) is still continuous if ala_l (and al+2a_{l+2} for l=0l=0) is non-zero.

We have four additional conditions to enforce, namely the continuity of the value, gradient, and Hessian of δρat,lmsmooth(r)\delta\rho_{at,lm}^{\mathrm{smooth}}(\mathbf{r}) at r=ratcutr=r_{at}^{\mathrm{cut}} and the conservation of the long range multipole moment. Note that the continuities in angular direction are always fulfilled due to the continuity of Ylm(Ω)Y_{lm}(\Omega), so only the continuity in rr needs to be enforced. In order to have 4 free parameters, we choose nmax⁡=4n_{\max}=4 for l=0l=0, nmax⁡=5n_{\max}=5 for l=1l=1 and l=2l=2, and nmax⁡=6n_{\max}=6 for l≥3l\geq3.

Energy in vacuum

The total energy of a KS DFT calculation in vacuum, i.e., without continuum embedding, is given by

Evac=12∫drρ(r)Φvac(r)+T[ρel]+Exc[ρel](80)E^{\mathrm{vac}}=\frac{1}{2}\int d\mathbf{r}\rho(\mathbf{r})\Phi^{\mathrm{vac}}(\mathbf{r})+T[\rho^{\mathrm{el}}]+E_{\mathrm{xc}}[\rho^{\mathrm{el}}] \tag*{(80)}

where ρ\rho is the full explicit charge density ρel+ρnuc\rho^{\mathrm{el}}+\rho^{\mathrm{nuc}} with the nuclear charge density ρnuc\rho^{\mathrm{nuc}}, TT is the Kohn-Sham kinetic energy of the electrons, ExcE_{\mathrm{xc}} is the xc energy, and Φ\Phi is the electrostatic potential generated by ρ\rho. It is implied here and in the following that the first integral and similar terms do not include the interaction of any nucleus with its own singularity. In practice, EvacE^{\mathrm{vac}} is obtained from the sum of KS eigenvalues ϵi\epsilon_i weighted by occupation numbers fif_i

∑ifiϵi=∫drρel(r)Veff(r)+T[ρel](81)\sum_i f_i\epsilon_i=\int d\mathbf{r}\rho^{\mathrm{el}}(\mathbf{r})V_{\mathrm{eff}}(\mathbf{r})+T[\rho^{\mathrm{el}}] \tag*{(81)}

which follows from the KS equations and contains TT as well as the interaction of the electrons with the effective potential VeffV_{\mathrm{eff}} which enters the KS operator. Equation (S35) holds for any VeffV_{\mathrm{eff}}. To arrive at eq. (S34) in a vacuum calculation, the interaction with vxcv_{\mathrm{xc}} is replaced with ExcE_{\mathrm{xc}}, the double counting of the electron-electron interaction is removed, and the electrostatic interaction between the nuclei is added.

Evac=∑ifiϵi−∫dr ρel(r)(Veff(r)−Φvac(r))+Exc[ρel]−12∫dr ρel(r)Φvac(r)+12∫dr ρnuc(r)Φvac(r)(82)E^{\mathrm{vac}} = \sum_i f_i \epsilon_i - \int\mathrm{d}r\, \rho^{\mathrm{el}}(r) \left(V_{\mathrm{eff}}(r) - \Phi^{\mathrm{vac}}(r)\right) + E_{\mathrm{xc}}[\rho^{\mathrm{el}}] - \frac{1}{2} \int\mathrm{d}r\, \rho^{\mathrm{el}}(r)\Phi^{\mathrm{vac}}(r) + \frac{1}{2} \int\mathrm{d}r\, \rho^{\mathrm{nuc}}(r)\Phi^{\mathrm{vac}}(r) \tag*{(82)}

The first integral is more general than the more conventional formulation ∫dr ρel(r)vxc(r)\int\mathrm{d}r\, \rho^{\mathrm{el}}(r)v_{\mathrm{xc}}(r), and ensures that eq. (S36) yields eq. (S34) for any VeffV_{\mathrm{eff}}, not just eq. (S11). In practice, Veff−ΦvacV_{\mathrm{eff}}-\Phi^{\mathrm{vac}} is not computed as a difference but rather by considering individually any terms that enter VeffV_{\mathrm{eff}}, except Φvac\Phi^{\mathrm{vac}}. In the case of a vacuum calculation using eq. (S11), the conventional formulation is recovered. In the case of an embedded calculation using eq. (S12), however, an additional term −∫dr ρel(r)ΔV‾effsolv(r)-\int\mathrm{d}r\, \rho^{\mathrm{el}}(r)\Delta\overline{V}_{\mathrm{eff}}^{\mathrm{solv}}(r) emerges.

FHI-aims uses the above formulation for the second and third integral which conveniently uses only the full electrostatic potential Φvac\Phi^{\mathrm{vac}} rather than considering the electronic and nuclear potentials separately. To arrive at this formulation, half of the electron-nuclear interaction is subtracted from the electron-electron double counting correction and added to the nuclear-nuclear term, effectively adding zero to the overall expression.

In practice, replacing the electron density ρel\rho^{\mathrm{el}} with the multipole density ρMP\rho^{\mathrm{MP}} in the double counting correction for the electron-electron interaction as well as the solvent potential correction leads to a faster convergence with the multipole expansion order, as discussed in ref. 2 as well as § 4.3 in the main article.

Separation of smoothing region from solvent

We tested whether our choice of ratcutr_{at}^{\mathrm{cut}} safely remains inside for the standard parameterizations of SCCS[1] and SSCS[8], a reparameterization of SCCS for electrochemical applications,[9] and the field-aware modification of SSCS.[10] The test systems were a water molecule and a NaF dimer at 22 Å separation. The field-aware SSCS was only tested for the water molecule, as no parameterization for systems containing both anions and cations was available. Additionally, we tested the anion/cation specific parameterizations of SCCS,[11] SSCS, and field-aware SSCS on a single F−^{-}/Na+^{+} ion, respectively. We did not test the solvent-aware modification[12] of either method as it generally only excludes points from the solvent and assigns them to the cavity but not vice versa. For these initial tests, we used values of ecut=350e_{\mathrm{cut}} = 350 Ry for the g\mathbf{g} space cutoff, p1=8⋅π/3p_{1} = 8 \cdot\pi/3, p2=5⋅π/3p_{2} = 5 \cdot\pi/3 for the low-pass filter, and the conjugate-gradient electrostatic solver throughout, with one exception described in Figure S7. As shown in section 4.2 in the main article, we later found that these settings are not sufficient to yield converged energies and forces for some of the parameterizations and systems. However, ratcutr_{at}^{\mathrm{cut}} does not depend on these parameters, and fat,l≠0switchf_{at,l\ne0}^{\mathrm{switch}} will only get narrower with increased ecute_{\mathrm{cut}}, cf. eq. (26) in the main article. Therefore, these tests are sufficient to demonstrate that ratcutr_{at}^{\mathrm{cut}} remains inside.

Image not extracted

Figure S7. Like Figure S1 for an Na+\mathrm{Na}^{+} cation. SCCS with cation specific parameters[11] (top), SSCS with cation specific parameters[8] (middle), field-aware SSCS with ‘water (+)’ parameters[10] (bottom). For SCCS, Environ’s ‘env ecut’ parameter had to be increased to 450 Ry for the SCF procedure to converge.

The results for the water H atom in SCCS and SSCS are shown in fig. 2 in the main article. The results for the O atom in the same systems, as well as for all other systems and solvent parameterizations are shown below. The only cases where the solvent region was found to penetrate into ratcutr_{at}^{\mathrm{cut}} were the ion specific parameterizations of field-aware SSCS. However, these were originally parameterized using only a single OH−^{-}/H3_3O+^{+} ion as a reference. Once a general parameterization of field-aware SSCS becomes available, it may be worth revisiting our choice of ratcutr_{at}^{\mathrm{cut}}. At the present time, we refer the user to the option of manually choosing ratcutr_{at}^{\mathrm{cut}} if any issues arise. Even with our default choice, the overlap of the smoothing region with the cavity function is rather small. For all other cases, we found ratcutr_{at}^{\mathrm{cut}} to be at a safe distance from the cavity boundary.

We do, however, observe an overlap of fat,l≠0switchf^{\mathrm{switch}}_{at,l\ne0} with the solvent in some cases. This is generally not a desirable feature because, as elaborated in section 3.4 in the main article, one of the purposes of the switching function is to exclude integration errors outside which cannot be exactly compensated by corrections inside ratsolvr^{\mathrm{solv}}_{at}. Nonetheless, we point out that fat,l≠0switchf^{\mathrm{switch}}_{at,l\ne0} enters eq. (20) in the main article merely as a weighting function for integration errors. The errors themselves may still be systematically reduced by choosing a denser grid in Environ. In addition, this will also lead to a narrower transition region of fat,l≠0switchf^{\mathrm{switch}}_{at,l\ne0} beyond ratsolvr^{\mathrm{solv}}_{at}, reducing its overlap with the solvent.

Image not extracted

Figure S2. Like Figure S1 with the switching function and radii of one H atom. Electrochemical parameterization of SCCS from ref. 9 (top) and field-aware modification of SSCS, cf. ref. 10, ‘water’ parameters in Table 1 therein (bottom).

Image not extracted

Figure S1. Like Figure 2 in the main article but with the switching function and radii of the O atom. Contrast in left subfigures identical to Figure 2. Contrast in right subfigures set to maximum value of displayed data and indicated by colorbar (or 10−1610^{-16} if numerically zero as is the case here, but non-zero in some of the cases below).

Image not extracted

Figure S3. Like fig. S2 with the switching function and radii of the O atom.

Image not extracted

Figure S5. Like Figure S4 with the switching function and radii of the Na atom.

Switching function and radii of F atom for a NaF dimer

Figure S4. Like fig. S2 for a NaF dimer at 2 Å separation (Na: violet, F: green). SCCS (top), electrochemical reparameterization of SCCS[9] (middle), and SSCS (bottom). Switching function and radii of F atom.

Image not extracted

Figure S6. Like Figure S1 for an F−^{-} anion. SCCS with anion specific parameters[11] (top), SSCS with anion specific parameters[8] (middle), field-aware SSCS with ‘water (-)’ parameters[10] (bottom).

k grid convergence for CO on Pt(111)

Starting from the Gamma point, we increased the number of k\mathbf{k} grid points on both in-plane axes simultaneously in steps of 2 up to 19. This was tested separately for SSCS and SCCS. As shown in Figure S8, total energies are converged to 1 meV accuracy with a 15×15×115 \times15 \times1 grid.

Convergence of total energy with number of in-plane k points for CO on Pt(111)

Figure S8. Convergence of total energy with number of in-plane k\mathbf{k} points for CO on Pt(111). Dashed lines at energy for 19×19×119 \times19 \times1 grid as visual guidelines.

Additional figures

Energy convergence with grid density, low-pass filter (SSCS)

Eight-panel energy plots for a NaF dimer in SSCS

Figure S10. Like Figure S9, for a NaF dimer in SSCS.

Image not extracted

Figure S9. Convergence with ecute_{\mathrm{cut}} of total energy and its contributions as reported in the FHI-aims2{}^{2} output file using different low-pass filter settings for a water molecule in SSCS. Constant ‘free atom’ contribution not shown. Dashed line shows mean value across p1=8p_1 = 8 and p1=7p_1 = 7 filters over the three highest ecute_{\mathrm{cut}}. Note the different energy scales of the second and third row of subfigures. Shaded area indicates the energy scale covered in the other subfigures (10 meV)

Eight-panel plot showing total energy, Environ energy, Hartree energy correction, solvent-electron interaction correction, sum of eigenvalues, kinetic energy, xc energy, and xc potential correction as functions of $e_{\mathrm{cut}}$ in Ry. The legend shows no low-pass, $p_1=8$, $p_2=5$; $p_1=7$, $p_2=4$; and $p_1=6$, $p_2=3$.

Figure S11. Like fig. S9, for a PtCO trimer in SSCS.

Force convergence with grid density, low-pass filter (SSCS)

Image not extracted

Figure S13. Like Figure S12, for the O atom.

Image not extracted

Figure S12. Convergence with ecute_{\mathrm{cut}} of total force (Euclidean norm) acting on one H atom (other H atom equivalent) and its contributions as reported in the FHI-aims2 output file using different low-pass filter settings for a water molecule in SSCS. Dashed line shows mean value across p1=8p_1 = 8 and p1=7p_1 = 7 filters over the three highest ecute_{\mathrm{cut}}.

Six-panel plot showing total force, Environ force, Hellmann-Feynman force, Pulay + GGA correction, multipole correction, and SCF incompleteness correction as functions of $e_{\mathrm{cut}}$ in Ry

Figure S14. Like Figure S12, for the Na atom in a NaF dimer.

Six-panel plot showing force and correction components for an F atom in a NaF dimer

Figure S15. Like Figure S12, for the F atom in a NaF dimer.

Six-panel plot of force corrections for the Pt atom in a PtCO trimer

Figure S16. Like fig. S12, for the Pt atom in a PtCO trimer.

Six-panel plot showing total force, Environ force, Hellmann-Feynman force, Pulay + GGA correction, multipole correction, and SCF incompleteness correction as functions of $e_{\mathrm{cut}}$ in Ry. The total force panel has y-axis label eV/Å and ticks 9.750, 9.775, 9.800, 9.825. The Environ force panel has ticks 0.500, 0.525, 0.550, 0.575. The Hellmann-Feynman force panel has y-axis label eV/Å and ticks 7.42, 7.44, 7.46, 7.48, 7.50. The Pulay + GGA correction panel has ticks 1.675, 1.700, 1.725, 1.750. The multipole correction panel has y-axis label eV/Å and ticks 0.04, 0.06, 0.08, 0.10, 0.12. The SCF incompleteness correction panel has ticks −0.06, −0.04, −0.02, 0.00, 0.02 and legend entries no low-pass; $p_1 = 8$, $p_2 = 5$; $p_1 = 7$, $p_2 = 4$; $p_1 = 6$, $p_2 = 3$. All panels have x-axis ticks 300, 400, 500, 600, 700, 800; the bottom panels are labelled $e_{\mathrm{cut}}$ in Ry.

Figure S17. Like fig. S12, for the C atom in a PtCO trimer.

Six-panel plot. Top left: total force, y-axis in $\mathrm{eV}/\mathring{\mathrm{A}}$, ticks 7.16, 7.18, 7.20, 7.22, 7.24. Top right: Environ force, y-axis ticks 1.500, 1.525, 1.550, 1.575. Middle left: Hellmann-Feynman force, y-axis in $\mathrm{eV}/\mathring{\mathrm{A}}$, ticks 18.275, 18.300, 18.325, 18.350. Middle right: Pulay + GGA correction, y-axis ticks 8.850, 8.875, 8.900, 8.925. Bottom left: multipole correction, y-axis in $\mathrm{eV}/\mathring{\mathrm{A}}$, ticks 0.675, 0.700, 0.725, 0.750. Bottom right: SCF incompleteness correction, y-axis ticks 0.02, 0.00, 0.02, 0.04, 0.06, with legend no low-pass; $p_1 = 8$, $p_2 = 5$; $p_1 = 7$, $p_2 = 4$; $p_1 = 6$, $p_2 = 3$. The x-axis of the bottom panels is $e_{\mathrm{cut}}$ in Ry; all panels have x-axis ticks 300, 400, 500, 600, 700, 800.

Figure S18. Like Figure S12, for the O atom in a PtCO trimer.

Energy convergence with grid density, low-pass filter (SCCS)

Eight-panel convergence plots for total energy, Environ energy, Hartree energy correction, solvent-electron interaction correction, sum of eigenvalues, kinetic energy, xc energy, and xc potential correction as a function of $e_{\mathrm{cut}}$ in Ry; curves labeled no low-pass, $p_1=8$, $p_2=5$; $p_1=7$, $p_2=4$; and $p_1=6$, $p_2=3$

Figure S20. Like Figure S19, for a NaF dimer in SCCS.

Eight-panel convergence plots showing total energy, Environ energy, Hartree energy correction, solvent-electron interaction correction, sum of eigenvalues, kinetic energy, xc energy, and xc potential correction versus $e_{\mathrm{cut}}$ in Ry, with curves for no low-pass and filters $p_1=8$, $p_2=5$; $p_1=7$, $p_2=4$; and $p_1=6$, $p_2=3$.

Figure S19. Convergence with ecute_{\mathrm{cut}} of total energy and its contributions as reported in the FHI-aims2^{2} output file using different low-pass filter settings for a water molecule in SCCS. Constant ‘free atom’ contribution not shown. Dashed line shows mean value across p1=8p_1 = 8 and p1=7p_1 = 7 filters over the three highest ecute_{\mathrm{cut}}. Note the different energy scales of the second and third row of subfigures. Shaded area indicates the energy scale covered in the other subfigures (10 meV)

Image not extracted

Figure S21. Like Figure S19, for a PtCO trimer in SCCS.

Force convergence with grid density, low-pass filter (SCCS)

Image not extracted

Figure S23. Like fig. S22, for the O atom.

Six-panel plots showing total force, Environ force, Hellmann-Feynman force, Pulay + GGA correction, multipole correction, and SCF incompleteness correction

Figure S24. Like Figure S22, for the Na atom in a NaF dimer.

Six-panel plots showing convergence with ecut of total force, Environ force, Hellmann–Feynman force, Pulay + GGA correction, multipole correction, and SCF incompleteness correction for different low-pass filter settings

Figure S22. Convergence with ecute_{\mathrm{cut}} of total force (Euclidean norm) acting on one H atom (other H atom equivalent) and its contributions as reported in the FHI-aims2{}^{2} output file using different low-pass filter settings for a water molecule in SCCS. Dashed line shows mean value across p1=8p_1 = 8 and p1=7p_1 = 7 filters over the three highest ecute_{\mathrm{cut}}.

Six-panel plot showing total force, Environ force, Hellmann-Feynman force, Pulay + GGA correction, multipole correction, and SCF incompleteness correction as functions of $e_{\mathrm{cut}}$ in Ry, with curves for no low-pass, $p_1=8$, $p_2=5$, $p_1=7$, $p_2=4$, and $p_1=6$, $p_2=3$

Figure S25. Like Figure S22, for the F atom in a NaF dimer.

Six-panel plot showing total force, Environ force, Hellmann-Feynman force, Pulay + GGA correction, multipole correction, and SCF incompleteness correction, with legend entries no low-pass, $p_1 = 8$, $p_2 = 5$, $p_1 = 7$, $p_2 = 4$, $p_1 = 6$, $p_2 = 3$

Figure S26. Like Figure S22, for the Pt atom in a PtCO trimer.

Six-panel plots showing total force, Environ force, Hellmann-Feynman force, Pulay + GGA correction, multipole correction, and SCF incompleteness correction as functions of $e_{\mathrm{cut}}$ in Ry; legend entries are no low-pass, $p_1 = 8$, $p_2 = 5$, $p_1 = 7$, $p_2 = 4$, and $p_1 = 6$, $p_2 = 3

Figure S27. Like Figure S22, for the C atom in a PtCO trimer.

Six-panel force-convergence plots for the O atom in a PtCO trimer

Figure S28. Like Figure S22, for the O atom in a PtCO trimer.

Energy convergence with multipole order (SSCS)

Eight-panel plots showing total energy, Environ energy, Hartree energy correction, solvent-electron interaction correction, sum of eigenvalues, kinetic energy, xc energy, and xc potential correction as functions of $l_{\max}$; legends: total, FHI-aims; multipole, FHI-aims; smooth multipole, Environ

Figure S30. Like Figure S29, for a NaF dimer in SSCS.

Eight-panel convergence plots showing total energy, Environ energy, Hartree energy correction, solvent-electron interaction correction, sum of eigenvalues, kinetic energy, xc energy, and xc potential correction as functions of $l_{\max}$

Figure S29. Convergence with lmax⁡l_{\max} of total energy and its contributions as reported in the FHI-aims{sup}2` output file using different ways of computing the solvent-electron double counting correction for a water molecule in SSCS. Constant ‘free atom’ contribution not shown. Note the different energy scales of the second and third row of subfigures. Shaded area indicates the energy scale covered in the other subfigures (10 meV)

Eight-panel energy convergence plots for a PtCO trimer in SSCS

Figure S31. Like Figure S29, for a PtCO trimer in SSCS.

Force convergence with multipole order (SSCS)

Six-panel force correction plots for the O atom

Figure S33. Like Figure S32, for the O atom.

Six-panel convergence plots showing total force, Environ force, Hellmann-Feynman force, Pulay + GGA correction, multipole correction, and SCF incompleteness correction versus $l_{\max}$

Figure S32. Convergence with lmax⁡l_{\max} of total force (Euclidean norm) acting on one H atom (other H atom equivalent) and its contributions as reported in the FHI-aims2 output file using different low-pass filter settings for a water molecule in SSCS.

Six-panel force-correction plots for the Na atom in a NaF dimer

Figure S34. Like Figure S32, for the Na atom in a NaF dimer.

Six-panel plot showing total force, Environ force, Hellmann-Feynman force, Pulay + GGA correction, multipole correction, and SCF incompleteness correction as functions of $l_{\max}$

Figure S35. Like fig. S32, for the F atom in a NaF dimer.

Six-panel plot showing total force, Environ force, Hellmann-Feynman force, Pulay + GGA correction, multipole correction, and SCF incompleteness correction

Figure S36. Like Figure S32, for the Pt atom in a PtCO trimer.

Image not extracted

Figure S37. Like fig. S32, for the C atom in a PtCO trimer.

Image not extracted

Figure S38. Like Figure S32, for the O atom in a PtCO trimer.

Energy convergence with multipole order (SCCS)

Image not extracted

Figure S40. Like Figure S39, for a NaF dimer in SCCS.

Image not extracted

Figure S39. Convergence with ℓmax⁡\ell_{\max} of total energy and its contributions as reported in the FHI-aims[2] output file using different ways of computing the solvent-electron double counting correction for a water molecule in SCCS. Constant ‘free atom’ contribution not shown. Note the different energy scales of the second and third row of subfigures. Shaded area indicates the energy scale covered in the other subfigures (10 meV)

Image not extracted

Figure S41. Like fig. S39, for a PtCO trimer in SCCS.

Force convergence with multipole order (SCCS)

Image not extracted

Figure S43. Like Figure S42, for the O atom.

Image not extracted

Figure S42. Convergence with lmax⁡l_{\max} of total force (Euclidean norm) acting on one H atom (other H atom equivalent) and its contributions as reported in the FHI-aims2^{2} output file using different low-pass filter settings for a water molecule in SCCS.

Image not extracted

Figure S44. Like Figure S42, for the Na atom in a NaF dimer.

Image not extracted

Figure S45. Like Figure S42, for the F atom in a NaF dimer.

Image not extracted

Figure S46. Like Figure S42, for the Pt atom in a PtCO trimer.

Image not extracted

Figure S47. Like Figure S42, for the C atom in a PtCO trimer.

Image not extracted

Figure S48. Like Figure S42, for the O atom in a PtCO trimer.

Low-pass filter

Image not extracted

Figure S49. Differences between ‘FHI-aims, FFT, low-pass’ and ‘FHI-aims, FFT’ (left) as well as ‘FHI-aims, FFT, low-pass’ and ‘FHI-aims, direct’ (right) subfigures of Figure 3 in the main article in the main article. Contrast of colormaps arbitrary but identical to Figure 3 in the main article.

Image not extracted

Figure S50. Like Figure 3 in the main article but showing ∇2s\nabla^2 s instead of ∂s/∂x\partial s/\partial x. In the bottom left, ∇ρˉel\nabla\bar{\rho}_{\mathrm{el}} was computed by FHI-aims directly and passed to Environ but ∇2ρˉel\nabla^2 \bar{\rho}_{\mathrm{el}} was computed using unfiltered FFT, leading to artifacts.

References

References

  1. [1]Andreussi, O.; Dabo, I.; Marzari, N. Revised self-consistent continuum solvation in electronic-structure calculations. The Journal of Chemical Physics 2012, 136, 064102.DOI
  2. [2]Blum, V.; Gehrke, R.; Hanke, F.; Havu, P.; Havu, V.; Ren, X.; Reuter, K.; Scheffler, M. Ab initio molecular simulations with numeric atom-centered orbitals. Computer Physics Communications 2009, 180, 2175–2196.DOI
  3. [3]Dabo, I.; Cancès, E.; Li, Y. L.; Marzari, N. Towards First-principles Electrochemistry. 2010; https://arxiv.org/abs/0901.0096.
  4. [4]Ringe, S.; Oberhofer, H.; Hille, C.; Matera, S.; Reuter, K. Function-Space-Based Solution Scheme for the Size-Modified Poisson–Boltzmann Equation in Full-Potential DFT. Journal of Chemical Theory and Computation 2016, 12, 4052–4066.DOI
  5. [5]Nattino, F.; Truscott, M.; Marzari, N.; Andreussi, O. Continuum models of the electrochemical diffuse layer in electronic-structure calculations. The Journal of Chemical Physics 2018, 150, 041722.DOI
  6. [6]Andreussi, O.; Fisicaro, G. Continuum embeddings in condensed-matter simulations. International Journal of Quantum Chemistry 2019, 119, e25725.DOI
  7. [7]Nattino, F.; Dupont, C.; Marzari, N.; Andreussi, O. Functional Extrapolations to Tame Unbound Anions in Density-Functional Theory Calculations. Journal of Chemical Theory and Computation 2019, 15, 6313–6322.DOI
  8. [8]Fisicaro, G.; Genovese, L.; Andreussi, O.; Mandal, S.; Nair, N. N.; Marzari, N.; Goedecker, S. Soft-Sphere Continuum Solvation in Electronic-Structure Calculations. Journal of Chemical Theory and Computation 2017, 13, 3829–3845.DOI
  9. [9]Hörmann, N. G.; Andreussi, O.; Marzari, N. Grand canonical simulations of electro- chemical interfaces in implicit solvation models. The Journal of Chemical Physics 2019, 150, 041730.
  10. [10]Truscott, M.; Andreussi, O. Field-Aware Interfaces in Continuum Solvation. The Journal of Physical Chemistry B 2019, 123, 3513–3524.
  11. [11]Dupont, C.; Andreussi, O.; Marzari, N. Self-consistent continuum solvation (SCCS): The case of charged systems. The Journal of Chemical Physics 2013, 139, 214110.DOI
  12. [12]Andreussi, O.; Hörmann, N. G.; Nattino, F.; Fisicaro, G.; Goedecker, S.; Marzari, N. Solvent-Aware Interfaces in Continuum Solvation. Journal of Chemical Theory and Computation 2019, 15, 1996–2009.arxiv.org/abs/1901.08138

Paper details

vlnc:W_6zvy3s4k
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Physics and Astronomy

Not recorded for this paper

View statement
Looking for related papers…
Contents