Continuum Solvent Model (CSM)
Theoretical Background
A continuum solvent model (CSM), as described in [HW14], can be used as a GPAW extension. The model is based on a smooth cavity \(g(\br)\) represented on a real-space grid, although the CSM now works in both grid and plane-wave modes. The electrostatic screening effect of the solvent is modeled as a spatially varying permittivity (relative dielectric constant) \(\epsilon(\br)\), which is related to the cavity by
The bulk static dielectric constant \(\epsilon_{\infty}\) is taken from experiment for the solvent in use (e.g., \(\epsilon_{\infty} \approx 80\) for water at room temperature). The electrostatic energy for the total charge distribution \(\rho(\br)\) of the solute (electron density + atomic nuclei) is calculated as
where \(\phi(\br)\) is the electrostatic potential in the presence of the dielectric. It is obtained by solving a generalized Poisson equation including the spatially varying permittivity:
In grid mode, this is solved numerically with a finite-difference multi-grid solver as outlined in [SSS09]. In plane-wave mode, a preconditioned conjugate-gradient Poisson solver is used.
As not only the electrostatic interaction but also cavity formation and short-range interactions between the solute and the solvent contribute to the solvation Gibbs energy, additional short-range interactions can be included in the calculation. The ansatz chosen in [HW14] is to describe the cavity formation energy and all short-range interactions as a term proportional to the surface area of the cavity. The surface area is not well defined for a smooth cavity \(g(\br)\). The approach of [IBR98] is taken, where the surface area \(A\) is calculated from the gradient of the cavity:
The cavity formation energy and short-range interaction are then given as \(G_{\mathrm{cav+sr}} = \gamma A\) with a proportionality constant \(\gamma\) that has the dimensions of a surface tension.
The cavity is constructed from an effective repulsive potential \(u(\br)\) via the Boltzmann equation
The effective potential is taken as the repulsive part of the Lennard-Jones potential and constructed from the positions \(\mathbf{R}_a\) of the atomic nuclei and a set of atomic radii \(R_a^{\mathrm{vdW}}\) as
The single free parameter \(u_0\) describes the strength of the repulsion at the atomic radii. It controls the size of the cavity and can be fitted to experimental partial molar volumes (per atom) \(\bar{v}_M^{\infty}\) at infinite dilution via the compressibility equation
where \(\kappa_T\) is the isothermal compressibility of the bulk solvent (usually negligible compared to \(\bar{v}_M^{\infty}\) except for very small molecules). For water as a solvent, Bondi van der Waals radii with a modified value for hydrogen (1.09 Å) are a good choice for the atomic radii of the effective repulsive potential [HW14].
Altogether, the model has three parameters. The static dielectric constant \(\epsilon_{\infty}\) of the solvent is taken directly from experimental data. The parameter \(u_0\) is fitted to experimental volumes. Afterwards, the parameter \(\gamma\) can be fitted to experimental solvation Gibbs energies. Parameters for water (at room temperature) as a solvent are given in [HW14]. A preliminary parameterization for dimethylsulfoxide (DMSO) is also given there. The accuracy for aqueous solvation Gibbs energies compared to experimental values is about 5 kJ per mole for neutral molecules and 13 kJ per mole for cations. It is not recommended to apply the model to anions in water without further modification as short-range interactions between anions and water are not well represented using the parameters optimized for neutral molecules [HW14].
A lot of the parts that make up the model (cavity, dielectric function, Poisson solver, non-electrostatic interactions) can be replaced easily by alternative implementations as they are represented as Python classes in the source code. Some alternative models already exist in the GPAW source code, yet they are not well tested and therefore not recommended for production use. Nevertheless, they can serve as an example of how to add your own solvation interactions/models to GPAW. Also refer to Section III of [HW14] for a more precise description of the general framework of continuum solvent models with a smooth cavity employed in the GPAW implementation. In the following section, the usage of the model described above is documented in terms of a use case.
Example: Ethanol in Water
The calculation of the solvation Gibbs energy of ethanol in water is demonstrated. For simplicity, the solvation Gibbs energy is calculated as the total energy difference of a calculation with the continuum solvent model and a gas-phase calculation using a fixed geometry of the ethanol molecule. In principle, a relaxation of the solute can be done also with the continuum solvent model. The following annotated script demonstrates how to perform the calculation using the continuum solvent model:
from gpaw import GPAW
from ase.build import molecule
from ase.units import mol, kJ, kcal, Pascal, m
from ase.parallel import parprint
from gpaw.solvation import (
Solvation, # the solvation extension
EffectivePotentialCavity, # cavity using an effective potential
Power12Potential, # a specific effective potential
LinearDielectric, # rule to construct permittivity func from the cavity
GradientSurface, # rule to calculate the surface area from the cavity
SurfaceInteraction # rule to calculate non-electrostatic interactions
)
# all parameters on the user side of the solvation API follow the ASE
# unit conventions (eV, Angstrom, ...)
# non-solvent related DFT parameters
h = 0.2
vac = 5.0
# solvent parameters for water from J. Chem. Phys. 141, 174108 (2014)
u0 = 0.180 # eV
epsinf = 78.36 # dimensionless
gamma = 18.4 * 1e-3 * Pascal * m # convert from dyne / cm to eV / Angstrom**2
T = 298.15 # Kelvin
atomic_radii = {'H': 1.09}
# create Atoms object for ethanol and add vacuum
atoms = molecule('CH3CH2OH')
atoms.center(vacuum=vac)
# perform gas phase calculation
atoms.calc = GPAW(mode='fd', xc='PBE', h=h, txt='gasphase.txt')
Egasphase = atoms.get_potential_energy()
# perform calculation with continuum solvent model from
# J. Chem. Phys. 141, 174108 (2014)
solvation = Solvation(
cavity=EffectivePotentialCavity(
effective_potential=Power12Potential(atomic_radii, u0),
temperature=T,
surface_calculator=GradientSurface()),
dielectric=LinearDielectric(epsinf=epsinf),
interactions=[SurfaceInteraction(surface_tension=gamma)])
atoms.calc = GPAW(
mode='fd', xc='PBE', h=h, txt='water.txt',
extensions=[solvation])
Ewater = atoms.get_potential_energy()
# calculate solvation Gibbs energy in various units
DGSol_eV = Ewater - Egasphase
DGSol_kJ_per_mol = DGSol_eV / (kJ / mol)
DGSol_kcal_per_mol = DGSol_eV / (kcal / mol)
parprint('calculated Delta Gsol = %.0f meV = %.1f kJ / mol = %.1f kcal / mol' %
(DGSol_eV * 1000., DGSol_kJ_per_mol, DGSol_kcal_per_mol))
The calculated value for the solvation Gibbs energy should be about -4.5 kcal per mole. The experimental value is -5.0 kcal per mole [KCT06].
There is also a helper function to use the solvation parameters for water as in the above example:
from gpaw.solvation import Solvation, get_HW14_water_kwargs
solvation = Solvation(**get_HW14_water_kwargs())
Dipole Corrections
Dipole corrections work with the variable-dielectric field that is inherent to continuum solvation calculations, in both plane-wave and grid mode. When an implicit solvent is present, the correction is made by creating a neutrally-charged region in the shape of a Gaussian derivative, then solving the generalized Poisson equation for the potential field resulting from this charge, with the same variable-dielectric field as the actual problem. The potential from this dipole-layer calculation is superimposed on top of the potential field produced from the generalized Poisson equation that was run on the atomic system, to produce a decoupled, dipole-corrected potential profile with flat slopes in both the top and bottom regions of the cell, and meaningful top and bottom work functions. This also enables the potential to be inferred in the Solvated Jellium Method. The corrected profile is propagated through the SCF cycle, ultimately producing an electronic structure that is dipole corrected. Note the dipole correction is only implemented in the z direction; e.g., the typical slab + vacuum system where the slab extends in the x and y directions, and the vacuum padding is in the z direction.
An example is shown below for the same sodium-on-aluminum-slab system used in the dipole-correction tutorial. The figure below shows the atomic system in use. The blue shaded region shows where the implicit solvent exists, with the color intensity proportional to solvent cavity.
If we run a simulation without a dipole correction, we get a potential profile that has a non-zero slope in the vacuum region, as shown below.
The dipole correction works by creating a charge distribution in the shape of a Gaussian derivative, as shown by the blue-shaded region below. The potential profile that the Poisson equation produces from this charge profile, in the same solvent cavity as the atoms, is also shown in the figure. This potential field is added to the physical atomic potential field, and fed through the SCF cycle.
The final, corrected potential profile is shown below, giving flat slopes in the vacuum region and unambiguous values for the top and bottom work functions, shown on the plot.
To turn on the dipole correction, use the dipolelayer keyword:
calc = GPAW(...,
extensions=[Solvation(...,
dipolelayer=True)])
The cell must be non-periodic along z (atoms.pbc = (True, True, False)), even in plane-wave mode.
(This is the same requirement as in the standard dipole correction.)
You can adjust the geometry of the Gaussian derivative by instead supplying a GaussianDerivativeDipole, like dipolelayer=GaussianDerivativeDipole(center=1.1, width=0.35), or a dictionary of the same keywords, like dipolelayer={'center': 1.1, 'width': 0.35}.
To use a different dipole correction, which can be written in your own script, supply an object with build() and todict() methods; see from_param().
Legacy GPAW
The legacy-GPAW calculator, SolvationGPAW, is still available from gpaw.old.solvation, but new calculations should use the Solvation extension described above.
Docstrings
- class gpaw.solvation.Solvation(cavity, dielectric, interactions=None, dipolelayer=False)[source]
Implicit solvation.
- Parameters:
cavity (Cavity or dict) – Where the solvent is, e.g. an
EffectivePotentialCavity(seegpaw.solvation.cavity). A dict is passed as keyword arguments toEffectivePotentialCavity.dielectric (Dielectric or dict) – The solvent’s permittivity inside the cavity, e.g.
LinearDielectric(epsinf=78.36). A dict is passed as keyword arguments toLinearDielectric.interactions (list of Interaction or dict) – Non-electrostatic energy terms, e.g.
[SurfaceInteraction(surface_tension=...)]. A dict entry needs a'name'key giving the class, plus its keyword arguments. Default: none.dipolelayer (bool, dict or GaussianDerivativeDipole) – Cancel a z-oriented dipole moment so that the potential is flat on both top and bottom.
Truegives the defaultGaussianDerivativeDipole, and a dict is passed to it as keyword arguments. Your own correction can be supplied as an object withbuild()andtodict()methods; seeGaussianDerivativeDipole.from_param. Default: no layer.
Notes
The cavity, dielectric and interactions for water are given by
gpaw.solvation.get_HW14_water_kwargs(), e.g.Solvation(**get_HW14_water_kwargs()).Cavities and interactions that depend upon the electron density are only supported in fd mode.
- class gpaw.solvation.GaussianDerivativeDipole(center=1.1, width=0.35, zero_vacuum=False)[source]
Gaussian-derivative dipole correction for solvated slabs.
Cancels a z-oriented dipole moment with a neutral dipole layer placed in the vacuum at the bottom of the cell:
drho(z) = 4 alpha^(3/2) / sqrt(pi) * (z - center) * exp(-alpha (z - center)^2), alpha = 1 / width^2
Each SCF step, the layer is scaled so that the xy-averaged field at the bottom face of the cell vanishes; since the layer is neutral, this flattens the potential on both sides of the slab. The layer’s potential is solved with the same dielectric-weighted operator as the physical charge, so the correction is also valid for laterally varying dielectrics. Works in fd and pw mode.
This object holds only the settings; the correction itself is a Poisson solver that wraps the solvation Poisson solver, made by build() once the mode is known.
- Parameters:
center (float) – Height (Å) of the layer above the bottom of the cell (default 1.1 Å).
width (float) – Width (Å) of the layer (default 0.35 Å).
zero_vacuum (bool) – If True, set the potential in the vacuum at the top of the cell to zero. Otherwise uses the internal default potential reference from each mode.
- classmethod from_param(dipolelayer)[source]
Turn Solvation’s dipolelayer input into a dipole-layer description, or None for no layer.
True gives the default GaussianDerivativeDipole; False or None, no layer. A dict is passed as keyword arguments to GaussianDerivativeDipole (an optional ‘name’ key, as written by todict(), must name it). Any other object is returned as is: this is how to supply your own correction. It needs build(ps), which returns a Poisson solver wrapping the solvation Poisson solver ps, and todict(). That wrapper may define vacuum_levels() (see gpaw.new.poisson.PoissonSolver), used for the work functions, and a dipole_region_problem attribute (a message, or None), which the solvation extension warns about after the SCF.
References
A. Held and M. Walter, Simplified continuum solvent model with a smooth cavity based on volumetric data, J. Chem. Phys. 141, 174108 (2014).
V. M. Sanchez, M. Sued and D. A. Scherlis, First-principles molecular dynamics simulations at solid-liquid interfaces with a continuum solvent, J. Chem. Phys. 131, 174108 (2009).
W. Im, D. Beglov and B. Roux, Continuum solvation model: Computation of electrostatic forces from numerical solutions to the Poisson-Boltzmann equation, Comput. Phys. Commun. 111, 59 (1998).
C. P. Kelly, C. J. Cramer and D. G. Truhlar, Aqueous Solvation Free Energies of Ions and Ion-Water Clusters Based on an Accurate Value for the Absolute Aqueous Solvation Free Energy of the Proton, J. Phys. Chem. B 110, 16066 (2006).