Welcome to Environ’s documentation!

Environ is a computational library aimed at introducing environment effects to atomistic first-principles simulations, in particular for applications in surface science and materials design. It is a Quantum-ESPRESSO module currently compatible with QE-6.3 and up.

Installation instructions

The following sections cover downloading, configuring, and installing Quantum-ESPRESSO (QE) and Environ.

Preliminary steps

Obtaining source files

QE
  1. clone the repository and checkout qe-6.3 (or later)

    git clone https://gitlab.com/QEF/q-e
    git checkout qe-6.3
    

or

  1. download a qe-6.3 archive (or later) from the QE releases page

  2. unpack the archive

    tar zxvf qe-X.Y.Z.tar.gz
    

    or, if your tar doesn’t recognize the z flag

    gunzip -c qe-X.Y.Z.tar.gz | tar xvf -
    
Environ
  1. clone the Environ repository into the QE root directory

    git clone https://github.com/environ-developers/Environ.git
    

or

  1. download an archive from the Environ releases page

  2. unpack the archive inside the QE root directory

    tar zxvf qe-X.Y.Z.tar.gz
    

    or, if your tar doesn’t recognize the z flag

    gunzip -c qe-X.Y.Z.tar.gz | tar xvf -
    

Configuration

QE

Quantum-ESPRESSO uses a configure script to detect compilers and libraries necessary for compilation. To configure the environment, run the following command from the QE root directory

./configure

For additional flags for fine-tuning the configuration process, check out the QE docs.

Environ v2.0 and up

The configure script was adopted in the recent Environ v2.0 release. To configure Environ, run the same command from the Environ root directory

./configure

making sure to use the same compiler flags and libraries.

Pre-compilation

Note

Optional for Environ v2.0 and up.

The installation process of Environ v2.0 (or later) will automatically pre-compile QE and will abort if any issues arise. However, if using an older version of Environ, QE pre-compilation is required at this stage. You may do so from the QE root directory with

make <package>

where package is any of the packages supported by Environ: pw, cp, tddfpt, or xspectra. If issues arise, solutions may be found in the QE docs or on the QE forum.

Note

If QE is manually pre-compiled, Environ v2.0 (or later) re-compilation of QE will proceed quickly.

Environ installation

The process has been modified greatly in the recent v2.0 release, both for installing and uninstalling Environ. Please follow the links matching your working version.

Environ v2.0 and up

Note

Run the following commands from the Environ root directory.

Installing
  1. install Environ

    make install
    
    1. select the QE package you wish to work with
    2. select the number of cores for parallel compilation (default = 1)

Note

If issues arise, try compiling in serial.

Uninstalling

To uninstall Environ, run

make uninstall
  1. enter y to proceed
  2. when prompted for, enter y to uninstall QE (optional)

Environ v1.0 up to v2.0

Note

Run the following commands from the QE root directory.

Installing
  1. run the script addonpatch.sh with the -patch option

    ./install/addsonpatch.sh Environ Environ/src Modules -patch
    
  2. patch the necessary QE files with

    ./Environ/patches/environpatch.sh -patch
    
  3. update QE dependencies

    ./install/makedeps.sh
    
  4. re-compile the chosen QE package (pw, cp, tddfpt, or xspectra)

    make <package>
    
Uninstalling
  1. run the QE script addsonpatch.sh with the -revert option

    ./install/addsonpatch.sh Environ Environ/src Modules -revert
    
  2. run the Environ installation script with the -revert option

    ./Environ/patches/environpatch.sh -revert
    
  3. run the QE script to regenerate modules’ dependencies

    ./install/makedeps.sh
    
  4. remove objects, modules, and exectuables

    make clean
    
Known Issues

In Environ v1.0, there is an issue with the installation procedure for codes different from pw.x. The problem seems to depend on the compiler, but it is present in the most common Intel Fortran compiler. The solution for this problem requires some work, which is described here, and will be fixed in future releases.

There is some circular dependencies between Environ modules and PW modules, but since the linkers only look for the dependencies written at the time of the Environ installation, they will not be able to function as intended.

To fix this, one can edit the Makefile manually, to add these PW dependencies, so that instead of:

PWOBJS = some-path/PW/src/libpw.a
QEMODS = some-path/Modules/libquemod.a some-more-libraries.a

we have:

PWOBJS = some-path/PW/src/libpw.a
QEMODS = some-path/Modules/libquemod.a some-more-libraries.a some-path/PW/src/libpw.a

This may be necessary for the following files:

PHonon/FD/Makefile
PHonon/Gamma/Makefile
PHonon/PH/Makefile
PWCOND/src/Makefile
TDDFPT/src/Makefile
XSpectra/src/Makefile
GWW/bse/Makefile
GWW/head/Makefile
GWW/pw4gww/Makefile

There is an exception, for the CPV Makefile, instead of this:

QEMODS=../../Modules/libqemod.a

do this:

QEMODS=../../Modules/libqemod.a libcp.a

User Tutorial

This user tutorial will run through the examples that exist in the Environ module. These examples are set up to run via executing bash scripts. The context for these tests are given in the appropriate README file. The bash scripts contain explanations behind settings. A more verbose explanation, along with a guide on setting up jobs from scratch can be seen in this tutorial. It is assumed that the reader has some familiarity of Quantum Espresso and the setup of a pw input file. If this is not the case, one can refer to a brief overview: QE PW Input File.

Example: Solvation Energy (SCCS)

This first example will demonstrate using the pw.x executable with Environ to calculate the solvation energy and other related solvation quantities for a water molecule in a water solvent. A more in-depth explanation of the demonstration can be found in the README. The overall idea is as follows: solvation energy is the difference in energy between a solute in vacuum and in solvent. By default, the pw.x program calculates the energy of a system in vacuum. The Environ module allows us to account for additional effects or correction factors. It also allows us to add some non-vacuum environment, in this case, a water solvent. Hence by running pw.x twice with different Environ parameters, one can calculate the energy of the system in vacuum and in water, thus obtaining the solvation energy.

In general, execution of pw.x requires a correctly formatted input file with all the descriptive properties of the desired system. With the Environ addon, an additional input file is required that contains simulation parameters for the environment. Unlike the pw input file that can be arbitrarily named and then specified on execution of the program, the Environ file must be named ‘environ.in’. To enable the environ addon on a pw calculation, the --environ modifier should be added. Hence the command, ./pw.x --environ < example.in would feed in a pw input file named example.in into pw.x and run a serial calculation via whichever FORTRAN compiler Quantum ESPRESSO has been configured with (as with any program, call pw.x from its actual position, or add it to the PATH). Since the --environ modifier is added, pw.x now expects an environ.in file. Failure to do so will result in an error.

The bash script run_example.sh generates all the necessary files described above and executes multiple pw calculations successively. Due to the constraint of the environ.in name, a change in environment should require files to be renamed on the fly (something that is taken care of here in the bash script). Alternatively one can set up multiple runs to execute in separate directories thus avoiding this issue entirely.

The general format of the environ.in file can be seen starting line 154 of the bash script. Alternatively one can run the bash script and view the generated environ files in the results folder (these have the environ prefix and the .in suffix). Refer to the input documentation (which can be viewed on the browser from the local html file, Doc/INPUT_Environ.html) for in-depth information on any of the variables as well as the expected structure. The general structure splits parameters into a number of keywords, &ENVIRON, &BOUNDARY, and &ELECTROSTATIC. This file has fortran-like formatting and as such, ‘!’ can prepend comments.

! Some comment
&ENVIRON
   verbose = 0

Environ is designed to be modular and as a result, many of the parameters are interchangeable. Each parameter belongs to a corresponding keyword and therefore should be placed accordingly. The parameters used in the program are also helpfully described in the bash file. By default, the verbosity parameter (verbose) is set to zero, which limits output to the standard pw output location (which is to the terminal, and therefore is often piped into an output file).

Some helpful environment specific quantities can also be printed out. These are typically used on the development side for debugging. The option verbose=1 (or any higher integer value) will output these in a file named environ.debug. The option verbose=2 will additionally output gaussian cube files that contain the density objects of important quantities. Specifying this option will impact performance due to the heavy I/O operations, and for the majority of simulations, a verbosity of zero ought to be sufficient, which is the default.

&ENVIRON
   environ_thr = 1.d-1

The environ threshold specifies when to start environ contributions to the SCF iterative step. The default value is suitable primarily for small systems. Note that since these input files follow fortran convention, double precision is notated as above.

&ENVIRON
   environ_type = 'vacuum'

The environ type simplifies the requirement of some of the physical parameters (such as pressure, surface tension, and static permittivity), which arise depending on the interface model applied. One can manually add these, but these have been tuned to optimal values, and therefore it is generally preferable to use the preset values by setting this parameter accordingly (vacuum, water, water-anions, water-cations).

Note

This option is equivalent to

&ENVIRON
   environ_type = 'input'
   env_surface_tension = 0
   env_pressure = 0
   env_static_permittivity = 1
&ELECTROSTATIC
   pbc_correction = 'parabolic'
   pbc_dim = 0

By design, pw assumes a simulation cell with 3D periodicity. This can be overcome by setting a simulation cell with enough space and enabling the pbc_correction parameter (which in turn requires the env_electrostatic parameter to be set as true). This correction is an approximation but should be sufficient for most simulation runs. For more accurate results, one may want to refer to martyna-tuckerman (see Q-E input documentation under ‘assume-isolated’), which does require a larger simulation cell (and therefore more physical memory). For simulations that require one to retain periodicity in 1 or 2 dimensions (for example, a diffuse-layer simulation), the pbc_dim parameter can be set appropriately. More details on this quadratic correction method can be found in the publication [1].

&ELECTROSTATIC
   tol = 1.d-11
   mix = 0.6

The electrostatic calculation has its own accuracy that, for the most part, should be set manually in the input file (since the value itself is reliant on the solver picked).

On running a pw calculation with Environ while reading the output, a few differences are apparent. Firstly before the SCF loop, Environ Module will be printed, followed by a brief description of the module, and some of the settings (as defined in the input file). On each step of the SCF iteration, there are additional energy corrections printed that are a result of the Environ module (the electrostatic embedding term and the correction to one-el term). These corrections should be non-zero once the threshold specified in Environ’s input file is met. Finally one can inspect the computation cost of the environ processes at the end of the file.

&BOUNDARY
/

In this example, the boundary is left empty. By default, Environ will use the SCCS model to define the interface. This model uses the electrostatic density to define the separation between solute and solvent.

&ELECTROSTATIC
   solver = 'direct'
   auxiliary = 'none'

A number of different solvers can be employed to calculate for electrostatic potential. Typically these default to sensible values according to the setup, however, one can manually set these along with the auxiliary parameter (in the event of say, polarization charge).

For small investigations such as this example, where only 3 simulations are run, it is sufficient to process the result directly from the command line. When scaling up to a higher number of simulations, bash or python scripting can be exploited to automate the process of calculating the solvation energy. Suppose the user is in the directory containing the newly created PW output files (in the results folder), the output files of Quantum ESPRESSO are designed for convenient extraction of commonly used results via grep. Calling grep ! *.out will return the total energy values. Since this is a PW relax calculation, the energy is calculated multiple times, while updating the positions of the ions depending on the calculated forces in the system. One should expect to get a result like:

h2o_vacuum_direct.out:!    total energy              =     -34.26804813 Ry
h2o_vacuum_direct.out:!    total energy              =     -34.26815510 Ry
h2o_vacuum_direct.out:!    total energy              =     -34.26825783 Ry
h2o_vacuum_direct.out:!    total energy              =     -34.26826238 Ry
h2o_water_cg.out:!    total energy              =     -34.28845991 Ry
h2o_water_cg.out:!    total energy              =     -34.28851745 Ry
h2o_water_cg.out:!    total energy              =     -34.28858148 Ry
h2o_water_iterative.out:!    total energy              =     -34.28845478 Ry
h2o_water_iterative.out:!    total energy              =     -34.28851656 Ry
h2o_water_iterative.out:!    total energy              =     -34.28857886 Ry

Note that the values may not match exactly due to the compiler used. It is useful to bear in mind when analysing energies in Rydberg, differences of E-2 are typical for solvation energies, whereas differences of less than 3E-3 are less than chemical accuracy. We see that the final energy of the system depends on the solver used, but the difference is 3E-5, well below chemical accuracy and therefore not of much concern for regular applications. Hence the solvation energy can be calculated (as the difference between the solvation and vacuum energies) as -6.374kcal/mol (or 2.03E-2Ry) via the conjugative gradient solver, and -6.373kcal/mol (or 2.03E-2Ry) via the iterative solver. This compares closely to the experimental solvation energy of water (-6.3kcal/mol [2]).

If the user is just interested in the final energy in a relax calculation, a command like grep Final *.out will achieve this. This example conveniently automates the calculation of these values via bash (along with other helpful energy values), and prints them out into results.txt for reference.

[1]
  1. Dabo et al., Phys. Rev. B 77, 115139 (2008)
[2]
    1. Marenich et al., Minnesota Solvation Database - version 2012; University of Minnesota: Minneapolis

Example: Solvation Energy (SSCS)

In the previous example, one detail that was not explained was the choice of interface model. As stated previously, Environ is designed to be as modular as is reasonable, which means the user is able to define settings that enable different models, solvers, and corrections to different subsystems. Previously the interface model, that defines the separation of the quantum mechanical system (set in the PW input file), with the solvent environment, was set to SCCS. The SCCS model sets a smooth boundary according to the electronic density at any particular point. This function is in fact a piece-wise function that is chosen to be easily differentiable [1].

An alternative model that Environ has implemented is the soft-sphere (SSCS) model [2]. This model sets a smooth boundary according to the ionic positions. Interlocking spheres are taken around each ion, whose radii are by default consistent with the UFF force fields [3] (note that in the paper, there is an exception for nitrogen, which is based off Bondi’s radius for nitrogen [4], an option which is not a default in Environ) in a nature similar to PCM, only these are smooth functions (spherical error functions).

This example repeats the previous setup, instead with a soft-spheres implementation. Since this is a boundary parameter, one can see on execution of the bash script that the environ input files here differ, now possessing parameters related to the &BOUNDARY keyword.

 &BOUNDARY
   solvent_mode='ionic'

Simply by setting the solvent_mode parameter one can switch from SCCS to soft-sphere model, environ_type presets can take care of the required (tuned) parameters associated with the model. Note that the solver (and auxiliary) parameters are not required for the SSCS.

Calculating the solvation energy is exactly the same procedure as before, and results in a value of -5.786kcal/mol, within chemical accuracy of the experimental results, as seen in the first example.

[1]
  1. Andreussi, I. Dabo, N. Marzari, J. Chem. Phys. 136, 064102 (2012)
[2]
  1. Fisicaro et al., J. Chem. Comput. 2017, 13, 8, 3829-3845
[3]
    1. Rappe et al., J. Am. Chem. Soc. (1992), 114 (25) 114 10024-35
[4]
  1. Bondi, J. Phys. Chem. (1964), 68 (3) 68 441-51

Example: Isolated Systems

This example shows how to use pw.x to simulate isolated charge systems in vacuum or immersed in a continuum dielectric constant. Note that this can be thought of as an alternative to Environ’s own periodic correction as seen in Example 1. Since this setting resides in the pw input file, both input files should be checked for consistence. In the first example we removed all periodicity from the system with a correction that results in a fairly good approximation.

&ELECTROSTATIC
   pbc_correction = 'parabolic'
   pbc_dim = 0

In this example, we demonstrate a system without periodicity, thus removing the parameters stated before and keeping to the defaults. We also demonstrate an alternative to the pbc correction, which is the martyna-tuckerman [1] correction. This correction is seen as a more accurate method, at the cost of a larger required cellsize. For reliable results, a cell length of twice the molecule length is recommended, in any direction. This can be added into the pw input file, under the SYSTEM keyword.

&SYSTEM
   assume_isolated = 'martyna-tuckerman'

The tolerance is different from previous examples. This value is chosen to facilitate the self-consistent process and will directly affect the speed and accuracy of the convergence. One should set this according to the type of simulation being run, these values in the examples serving as guidelines for that decision.

Clearly for larger systems, the parabolic correction is a more feasible choice for imposing isolation. This is a real-space quadratic correction of the electrostatic potential [2], which has been shown to provide energy accuracy improvements of almost 1 order of magnitude in comparison with the alternative PCC and GCC schemes for large cell sizes. This correction scheme implemented in Environ is limited to 0D and 2D systems (which account for the majority of systems that Environ typically works with).

[1]
    1. Martyna and M. E. Tuckerman, J. Chem. Phys. 110, 2810 (1999)
[2]I. Dabo et al. Phys. Rev. B 77, 115139 (2008)

Example: Two-Dimensional Systems

This example shows how to use pw.x to model two-dimensional periodic systems in contact with a continuum solvent. This is particurly useful for diffuse layer systems and other surface investigations. For this calculation, a Pt (111) slab is chosen with a CO molecule adsorbed on the surface. By running the bash file and inspecting the environ input files, one will notice that most of the input remains unchanged. The SCCS (self-consistent charge solvation) model is chosen for the solvent by default and the solvent type is set manually, for example for vacuum,

&ENVIRON
   environ_type = 'input'
   env_static_permittivity = 1
   env_surface_tension = 0.D0
   env_pressure = 0.D0

The change is in the pbc_dim parameter. This needs to be set accordingly and the axis should be subsequently chosen. This axis parameter determines the direction of the periodicity (that is the plane normal to the axis will be parallel to the surface or slab). This parameter expects an integer value, 1 for x, 2 for y, and 3 for z.

&ELECTROSTATIC
   pbc_dim = 2
   pbc_axis = 3

The tolerance is also different from previous examples. This parameter is typically set in order to optimize the ability for the self-consistent process to converge, and should be picked appropriately depending on the system. These examples serve as good guidelines for each type of simulation.

Along with the electrostatic solvation energy, which calculated similarly to Example 1, where one takes the difference between the total energy in vacuum with total energy in electrolyte solvent, this example calculates the Fermi energy both in vacuum and in solution. Unlike other energy terms, the printed total Fermi energy is decomposed into terms, one from QE and a correction (delta energy) from Environ. Hence, the user should sum these terms during post-processing in order to get the Fermi energy of the system (this is done for the user in this example by the bash script).

Example: Charge Distributions

This example follows the previous, now adding a fixed, planar and smooth distribution of charge (specifically a helmholtz plane). The environ input file for this kind of system is a little more complicated.

First is the use of the keyword solvent_mode = ‘full’. For this calculation, this choice is mandatory due to the Pt valence density, which results in a hole close to the ionic position, due to the missing core electrons. This option adds an additional charge density (gaussians) at the location of the ions, that represent the core electrons and the nuclei. This results in a better description of the interface between vacuum and solvent. This choice is useful for particular types of atoms where this effect can occur, for example halogens and transition metals.

&BOUNDARY
   solvent_mode = 'full'

To represent the helmholtz plane, it is necessary to specify the number of external charges in the ENVIRON keyword and then specify the the charges themselves in a block labelled EXTERNAL_CHARGES (at the end of the input file). Notice how this structure is similar to how the pw input files handle atomic positions.

EXTERNAL_CHARGES (bohr)
-0.5 0. 0. 25.697 1.0 2 3
-0.5 0. 0. -10.303 1.0 2 3

Each line specifies a charge, and possesses 7 values separated by spaces. In order these describe the charge (in units of electron charge), x position, y position, z position, spread, dimensionality, and axis. In this example we wish to define charge planes parallel to the Pt slab. Since we are defining two-dimensional objects that lie perpendicular to the z-axis, the x and y positions are irrelevent and are thus set to 0.0. The charge functions are represented by gaussians, and thus the parameters are simply position and spread. Finally the charges can represent basic shapes depending on the dimensionality defined. For a slab, we specify a dimensionality of 2. For the direction of the slab, we specify 3, which represents the z-axis. This convention is consistent with the boundary correction options (explained in the previous example) that define the system to be periodic in two-dimensions as opposed to the three by default.

We set this system up so that there exists two countercharge planes on either side of the Pt slab. Since the system is periodic, imposing symmetry in this manner allows the simulation to perform better and is generally advised. Since there are now two planes of half charge, the resultant electric field is half what it would have otherwise been. For detailed information on these planar charge setups, see [1], [2], or Explicit Charge.

[1]
    1. Fu and K. M. Ho, Phys. Rev. Lett. 63, 1617 (1989)
[2]
  1. Nattino et al., J. Chem. Phys. 041722 (2019)

Example: Electrolyte Solutions

This example, like the previous two, models a 2-D metallic structure, this time, an Ag (100) slab, in water solution. The slab is charged and an electrolyte solution is added. This solution can be thought of as a solvent (whose characteristics we have now implemented a number of times), and electrolyte ions, that are defined based off a set of parameters. The parameters describing the ions are placed in the ENVIRON keyword

&ENVIRON
   env_electrolyte_ntyp = 2
   zion(1) = 1
   zion(2) = -1
   cion(1) = 1.0
   cion(2) = 1.0
   cionmax = 10.0

The env_electrolyte_ntyp parameter sets the number of ionic species that are to be defined, and for each species the charge (zion) and the concentration (cion) are to be specified. Finally the maximum concentration can be set (respresenting the maximum concentration of ions at any point).

A number of electrolyte models can be implemented in Environ. This example iterates through the models based the numerical method, which utilizes the Poisson-Boltzmann equation or some variant. It also includes some analytical analogues that, rather than solve the Poisson-Boltzmann equation, add a correction to the potential. By default, the Poisson-Boltzmann model is set. By specifying the parameter

&ENVIRON
   electrolyte_linearized = .true.

the model is changed to the linear equivalent. Refer to the publications [1], [2] for more details on these models. Some pbc correction (as explained in example 1) is necessary here, since calculations involving the electrolyte require open boundary conditions. In the example, this is set to parabolic, referring to the numerical approach, whereas a change to the gcs correction,

&ELECTROSTATIC
   pbc_correction = 'gcs'

will switch to the analytic approach to solving the relevant Poisson-Boltzmann equation. Note that this does not include the size-modified equation. The page on diffuse-layer models will describe each of the models and how they differ in more detail. In particular, the required parameters for each models do vary slightly. For the linearized Poisson-Boltzmann model and the Poisson-Boltzmann model, the charge and concentrations need to be specified. The additional max concentration (cionmax) parameter should be included when choosing the modified Poisson-Boltzmann model. Notice that the model need not be specified explicitly and is instead inferred by the parameters supplied to the input. The physical models all require at least the concentrations and the charges of the ions. By setting the maximum concentration to be non-zero, Environ will assume the user wishes to use the modified Poisson-Boltzmann model.

Note

The gcs correction (Gouy-Chapman Stern) is a 1-D analytical solution to the Poisson-Boltzmann equation and thus is only valid for 2 dimensional systems. The correction has been shown to produce close results to the numerical equivalents and should therefore be considered if the user is looking to save computational time. The parabolic correction (as seen in previous examples) is a general correction that works in any number of dimensions, however in order for the gcs correction to be valid, there should be no parabolic correction.

As in previous examples, the solvent_mode parameter is set to ‘full’, due to a hole close to the Ag ions. A solvent-accessible but ion-free region in the proximity of the surface (Stern layer) is modeled by introducing an ion-exclusion function as described here [3].

The interface function respresenting the boundary between the quantum mechanical region and the electrolyte embedding environment is set in the BOUNDARY keyword

&BOUNDARY
   electrolyte_mode = 'system'
   electrolyte_distance = 10.0
   electrolyte_spread = 0.5

Here, the electrolyte_mode parameter is set to system, corresponding to a simple analytical function.

[1]
  1. Nattino et al., J. Chem. Phys. 150, 041722 (2019)
[2]
  1. Fisicaro et al., J. Chem. Phys. 144, 014103 (2016)
[3]I. Dabo et al., arXiv 0901.0096 (2008)

Overview

As opposed to the more commonly used atomistic description of solvents in chemistry simulations, Environ implements a set of continuum models, with the goal of providing a method of describing systems in environments with the primary goal of maximizing the focus on the quantum mechanical system. The result is a relatively succinct description of the environment unsuitable for capturing certain effects within this regime, yet the advantages of reduced computational cost make this approach invaluable for many applications.

These models belong to a family of hierarchical approaches that separate the treatment of the quantum mechanical system from the environment. Varying choices for representing this environment result in varying groups of methods, each with their own ideal applications. For example Quantum Mechanics has been coupled with Molecular Mechanics (QM/MM) thus retaining atomistic details of the embedding system while still treating it with a less computationally intensive scheme. The drawback of such an approach is perhaps not going far enough in terms of cost reduction, since a statistical sampling is still required for the environment configurations. Additionally the accuracy of such an approach is strictly dependent on the quality of the classical parameterization used to describe the components within the environment.

Continuum models go one step further, now removing atomistic details in the environment under the assumption that a statistical average of the environment results in a homogenous continuum. This can be justified for many solvent systems (with the exception of perhaps solvent atoms close to the QM system, in certain scenarios). One popular continuum model within the chemistry community is the Polarizable Continuum Model (PCM), which has been progressively extended and optimized for simulation stability and speed over the years. The breakthrough in the field of condensed matter was the Fattebert and Gygi (FG) model, which kickstarted substantial interest and many publications in the following years. The continuum models implemented in Environ are in some ways derived from the ideas presented in the PCM and the FG model. These have been successfully applied to neutral liquids and electrolyte solutions, with periodic crystal structures and small isolated molecules.

More recent developments have been made to improve these methods, especially towards better transferability, and there has been work in proposed multi-scale approaches that combine multiple different embedding schemes, with the same goals of effectively distributing computational time towards more important areas.

Continuum

Continuum models were originally designed to handle liquid solution environments where the statistical averaging assumption in the relevant regions was viable. Typically these environments would have neutral net charge and a temperature where specific interactions like hydrogen bonding did not compromise the homogeneity of the system. These models have evolved to handle a wider variety of systems, such as ionic liquids and complex multiscale dielectric environments, such as metal nanoparticles and plasmonic devices on nearby QM systems.

Interface Models

This page presents a more in-depth description of the interface models implemented in Environ, along with all revelant input parameters. Much of this text is structured to mirror a tutorial review on Continuum Embeddings, [1].

In general the interface is a 3D continuous, differentiable scalar field with a range from 0 to 1. A value of 1 (or within some tolerance) refers to the system, and a value of 0 (or within some tolerance) refers to the environment. The boundary is a function of the ensemble of the positions of the environment molecule. The strategy taken by continuum embedding models is to define this boundary from the system information only. This avoids the need for statistical sampling and/or other computationally expensive approaches.

The tutorial review summarizes the reasons for choosing a smooth boundary over a sharp one. Environ implements smooth boundaries since the QM simulation of the embedded system works in 3D (and reciprocal) space. The choice to retain 3D when working with the interface bypasses the possible issues encountered in discretization, where singularities and discontinuities are possible. We argue that from a computational standpoint, it is more reasonable to work with a set of vector and scalar fields that share the same numerical domain.

Self-Consistent (SCCS)

The SCCS model is described comprehensively in the 2012 publication [2], we present here a summary of the theory and methodology behind the model.

This model chooses to base the definition of the interface on the electronic density, which is a scalar field that varies from a higher magnitude close to the ions, to a lower magnitude as we move into the environment. This approach is based on the original model proposed by Fattebert and Gygi [3].

\[s(\mathbf{r}) = \frac{1}{2}\left(1 - \frac{1 - (\rho^{\text{el}}(\mathbf{r})/\rho_0)^{2\beta}}{1 + (\rho^{\text{el}}(\mathbf{r})/\rho_0)^{2\beta}}\right)\]

which has two parameters, \(\rho_0\) and \(\beta\). Instead it uses a piece-wise definition,

\[s(\mathbf{r}) = t(\ln(\rho^{\text{el}}(\mathbf{r})))\]

where \(t(x)\) is a smooth function, and the two parameters are \(\rho_{\text{min}}\) and \(\rho_{\text{max}}\) that bound the above function, the function returns 1 with an input above the max density bound and 0 with an input below the min density bound.

Soft-Sphere (SSCS)

The SSCS model is described comprehensively in the 2017 publication [4], again, we present here a summary of the theory and methodology behind the model.

This model choose to base the definition of the interface on the ionic positions, and takes a similar approach to the PCM model [5]. In the same vein as the SCCS model, rather than sticking with a 2D definition of the boundary, the model defines its smooth 3D interface function on interlocking smooth spheres centered on the ionic positions, and scaled depending on the atom, with an additional global scaling for parameterization.

Non-local interfaces

The SCCS model can be thought of as a local interface, the value of the interface function is solely dependent on the electronic density at that position. Likewise, the interface function of the soft-sphere is agnostic of the ‘bigger picture’. There are a number of limitations of this assumption. Firstly, it is easy to imagine that more complex system with artifacts such as cavities devoid of molecule where a solvent should not access, will be misrepresented by a local model, which will by design fill any cavities without regard for the physical implications. Secondly, in the SCCS, the net system charge will influence the size of the QM cavity. Physically this is desirable since for charged systems, a solvent such as water would interact more closely with the system, but only for positive charges, where the SCCS will shrink the QM cavity. For negative charges, the model scales the system in the wrong direction and therefore produces poor results without a reparameterization.

There have been a number of recent techniques proposed in the literature that have been implemented (or still under development) in Environ. First is the solvent-aware model, which can be toggled in conjunction with either implemented interface model.

[1]
  1. Andreussi and G. Fisicaro, Wiley DOI: 10.1002/qua.25725 (2018)
[2]
  1. Andreussi, I. Dabo, and N. Marzari, J. Chem. Phys. 136, 064102 (2012)
[3]
    1. Fattebert, F. Gygi, J. Comput. Chem., 2002, 23(6), 662
[4]
  1. Fisicaro et al., J. Comput. Chem., 2017 13(8), 3829
[5]
  1. Miertus, E. Scrocco, J. Tomasi, J. Chem. Phys. 1981 2;55(1):117-129

Interactions

The following pages cover the interactions between the embedded system and the environment.

Dielectric Medium

Electrostatic solvation effects can be described in terms of a reaction field, which provides a stabilization effect to the system. In classical electrostatics, this effect is represented in terms of a dielectric medium with some boundary and a dielectric permittivity, which has different representations depending on the application. Here we consider the permittivity as a function in space, thus making the definition of a sharp boundary surface redundant, which itself is consistent with our definition of the interface function.

Fattebert and Gygi presented an electrostatic picture in terms of 3D fields, with the total electrostatic free energy of the embedded system as

\[F[\rho^{\text{el}}, \{\mathbf{R}_i\}] = \int\rho^{\text{sys}}(\mathbf{r})\phi(\mathbf{r})d^3\mathbf{r}-\int\frac{1}{8\pi}\epsilon(\mathbf{r})\lvert\nabla\phi(\mathbf{r})\rvert^2d^3\mathbf{r}\]

where the electrostatic density term can be decomposed into electronic and ionic terms,

\[\rho^{\text{sys}}(\mathbf{r}) = \left(\rho^{\text{el}}(\mathbf{r}) + \sum_i z_i\delta(\lvert\mathbf{r}-\mathbf{R}_i\rvert)\right),\]

\(z_i\) are the ionic charges, \(\phi(\mathbf{r})\) is the electrostatic potential, and \(\epsilon(\mathbf{r})\) is the dielectric permittivity, which reflects the system/continuum separation and is thus a function of the continuum interface, for example,

\[\epsilon(\mathbf{r}) \equiv \epsilon(s(\mathbf{r})) = 1 + (\epsilon_0 - 1)(1 - s(\mathbf{r})),\]

where \(\epsilon_0\) is the bulk dielectric permittivity of the environment.

Note

This dielectric permittivity is the constant set in the Environ input file. Hence Environ takes this value, and calculates an interface function that scales from 0 (environment) to 1 (system). As one can see from the equation, the result is a smoothly scaling dielectric permittivity function that transitions at the computed interface, from 1 (system) representing vacuum, to the permittivity specified by the environment, say 80 for water.

The functional derivative of the total electrostatic free energy functional defined above with respect to the electrostatic potential is simply the generalized Poisson equation (GPE),

\[\nabla\cdot\epsilon(\mathbf{r})\nabla\phi(\mathbf{r}) = -4\pi\rho^{\text{sys}}(\mathbf{r}),\]

which is similar to the more popularly known Poisson equation in vacuum,

\[\nabla^2\phi^0(\mathbf{r}) = -4\pi\rho^{\text{sys}}(\mathbf{r}),\]

following the convention that the dielectric permittivity of vacuum is simply 1. The polarization potential is simply the difference between the vacuum potential and the generalized potential. The generalized Poisson equation is non-trivial to solve, and an alternative apporach is to define an auxiliary polarization density, spread at the continuum interface, and expressed as

\[\rho^{\text{pol}}(\mathbf{r}) = \frac{1}{4\pi}\nabla\ln\epsilon(\mathbf{r})\cdot\nabla\phi(\mathbf{r}) - \frac{\epsilon(\mathbf{r}) - 1}{\epsilon(\mathbf{r})}\rho^{\text{sys}}(\mathbf{r}).\]

This depends on the gradient of the logarithm of the dielectric function, and thus Andreussi et al. proposed an alternative formulation of the dielectric in terms of the continuum interface,

\[\epsilon(\mathbf{r}) = \exp(\log(\epsilon_0[1 - s(\mathbf{r}))).\]

When optimizing the embedded system degrees of freedom, the functional derivatives of the energy with respect to the electronic density or atomic positions need to be computed. It is possible to break down these derivatives into more transferable forms,

\[V^{\text{interface}}_{\text{KS}}(\mathbf{r}) = \int\frac{\delta s(\mathbf{r}^{\prime})}{\delta\rho^{\text{el}}(\mathbf{r})}\frac{\delta F[s]}{\delta s(\mathbf{r}^{\prime})}d^3(\mathbf{r})^{\prime},\]

and

\[f^{\text{interface}}_i = -\int\frac{\delta s(\mathbf{r})}{\delta\mathbf{R}_a}\frac{\delta F[s]}{\delta s(\mathbf{r})}d^3(\mathbf{r}).\]

Diffuse Layer Models

This page presents a more in-depth description of the diffuse layer models implemented in Environ, along with all revelant input parameters.

Explicit Charge

Environ has the ability to represent external charges of various types. As with most of the examples on this page, we will assume a setup consisting of some noble metal slab (i.e. a two-dimensional system) that can possess some surface charge. To compensate we then consider the addition of countercharge, either explicitly or via an electrolyte solution. Explicit charges come in a variety of implemented forms depending on the specified dimensionality. Suppose we want a point charge electron at some arbitrary position. One could enter the following into the Environ input file,

EXTERNAL_CHARGES (bohr)
-1 0. 0. 0. 1.0 0 0

Remember to update the env_external_charges parameter appropriately (here we could have something like

&ENVIRON
   env_external_charges = 1

This places a point-charge (since the dimensionality is set to 0), at the origin. The charge is given a negative value whose magnitude equals that of an electron. The spread is set to 1.0. The dimensionality is given as 0, and the axis setting is irrelevent but set to 0 anyway. The definition of the spread is based off the following 1D definition for the gaussian,

\[ae^{\frac{(x-b)^2}{c^2}}\]

Note the lack of the factor of two that some definitions use. In three dimensions, the equation is effectively the same, only radial around the 3-dimensional point specified in the input. The gaussian is normalized to the specified charge. This convention has a lot of transferability, and by simply changing the dimensionality of the input, can be extended to line charges, and planar charges. For these objects, the axis is relevant. For a line charge, the chosen axis corresponds to a the axis parallel to the line charge, and for a plane, it corresponds to the axis normal to the plane. Note that this definition clearly does not account for all possible definitions of line and plane charge distributions, but this can be achieved instead by changing the atomic positions of the slab.

For an example of plane countercharges, see Example: Charge Distributions.

For models with charge distribution, the free energy functional can be written as

\[F^{\text{PC}}[\rho(\mathbf{r}), \phi(\mathbf{r}] = \int\left[-\frac{\epsilon(\mathbf{r})}{8\pi}\lvert\nabla\phi(\mathbf{r})\rvert^2 + \rho(\mathbf{r})\phi(\mathbf{r}) + \rho^{\text{ions}}(\mathbf{r})\phi(\mathbf{r})\right]d\mathbf{r}\]

where \(\rho(\mathbf{r})\) is the total charge density of the solute, \(\phi(\mathbf{r})\) is the electrostatic potential, and \(\rho^{\text{ions}}(\mathbf{r})\) is the external charge density that mimics the counterion accumulation.

Poisson-Boltzmann model

The Poisson-Boltzmann model accounts for the chemical potential and the entropy of the ions in solution. Adding these consequently explicit concentration-dependent terms results in a different free energy functional than before,

\[ \begin{align}\begin{aligned}F^{\text{PC}}[\rho(\mathbf{r}), \phi(\mathbf{r}, \{c_i(\mathbf{r}\}] = \int\left[-\frac{\epsilon(\mathbf{r})}{8\pi}\lvert\nabla\phi(\mathbf{r})\rvert^2 + \rho(\mathbf{r})\phi(\mathbf{r}) + \rho^{\text{ions}}(\mathbf{r})\phi(\mathbf{r})\right.\\\left.-\sum^{\text{p}}_{i=1}\mu_i(c_i(\mathbf{r})-c_i^0)-T(s[\{c_i(\mathbf{r})\}]-s[\{c_i^0\}])\right]d\mathbf{r}.\end{aligned}\end{align} \]

Here, \(\mu_i\) is the chemical potential of the ith electrolyte species and T is the temperature, that is included as part of the entropy term.

We assume that these electrolytes have point-charge, and there is ideal mixing, leading us to the following entropy expression,

\[s[\{c_i\}] = -k_B\sum^{\text{p}}_{i=1}c_i(\mathbf{r})\ln\frac{c_i(\mathbf{r})}{\gamma(\mathbf{r})}\]

where \(\gamma(\mathbf{r})\) is the exclusion function and sets the boundary between the electrolyte and solute regions.

The functional above is minimized with respect to the concentrations in order to find the equilibrium for electrolyte concentrations. This leads to the well-known Poisson-Boltzmann equation, which can be numerically solved using Newton’s iterative algorithm and a preconditioned conjugate gradient algorithm, which works with linear equations.

There are times when it is beneficial to approximate the Poisson-Boltzmann equation, which is non-linear and thus non-trivial to solve. For \(z_i\phi(\mathbf{r}) \ll k_BT\), that is, when the electrostatic potential is low, or in the high-temperature limit, one can approximate the Poisson-Boltzmann by its linear form, which is derived by Taylor expanding the appropriate terms in the full Poisson-Boltzmann equation. The result is a less computationally expensive approach to representing the electrolyte, while still maintaining the same parameter set.

In the case where we deal with linear slabs with two-dimensional periodicity, a different approximation can be used. The idea here is that the one-dimensional Poisson-Boltzmann equation can be analytically solved and thus this result can be applied as a PBC (periodic boundary condition) correction. This approach is also known as the Gouy-Chapman Stern model for an electrolyte, and compares well to the numerical approach for our examples.

Modified Poisson-Boltzmann model

The Poisson-Boltzmann can be improved by dropping the assumpion of point-like ions. This assumption leads to an overestimate of the electrolyte countercharge accumulation at electrode surfaces, and thus, by accounting for the steric repulsion between ions, which opposes the electrostatic attraction between the counterions and the electrode surface, one can improve on the full Poisson-Boltzmann model. The size-modified Poisson-Boltzmann (MPB) can be derived from the same free energy functional as before, only with a modified entropy expression

\[ \begin{align}\begin{aligned}s[\{c_i\}] = -k_B\sum^{\text{p}}_{i=1}c_i(\mathbf{r})\ln\frac{c_i(\mathbf{r})}{c_{\text{max}}\gamma(\mathbf{r})}\\-k_B\left(c_{\text{max}}\gamma(\mathbf{r} - \sum^{\text{p}}_{i=1}c_i(\mathbf{r})\right)\ln\left(1 - \sum^{\text{p}}_{i=1}\frac{c_i(\mathbf{r})}{c_{\text{max}}\gamma(\mathbf{r})}\right).\end{aligned}\end{align} \]

The idea is to essentially impose a space dependent maximum ionic concentration, and the result is a better representation of the electrolyte, verified by a comparison to experimental differential capacitance.

Additional Interactions

Environ

Environ has implemented all of the above models in a modular way that allows one to mix and match models and correction methods where reasonable.

Pressure

There is a pressure field caused by the embedding environment. We represent this pressure field in a continuum fashion, following the concept of electronic enthalpy introduced by Cococcioni et al [1]. The approach exploits the notion of quantum volume, which can be straightforwardly defined in terms of a continuum interface function as

\[V \equiv V[s] = \int s(\mathbf{r})d^3\mathbf{r}.\]

The contribution to the enthalpy of the system is expressed as

\[G^{\text{PV}}[s] = P^{\text{ext}}V[s],\]

with \(P^{\text{ext}}\) the external pressure of the environment. This approach is based on an electronic interface, but equivalent arguments may be adopted for ionic or mixed interfaces. The key ingredient for the derivation of the enthalpy contribution to the Kohn-Sham potential or the inter-atomic forces is the functional derivative of the additional energetic term with respect to the interface function, which for the equation defining the continuum interface function above, is simply

\[\frac{\delta F^{\text{PV}}[s]}{\delta s}(\mathbf{r}) = 1.\]
[1]Cococcioni M, Mauri F, Ceder G, Marzari N, Phys. Rev. Lett. 2005 4;94(14):145501

Tension

Cococcioni et al. [1] proposed an environment effect related to the quantum surface of the embedded system. The macroscopic physical picture is the one of surface tension, which controls the size of the boundary between the system and environment. An embedding interaction based on the quantum surface was proposed by Scherlis et al. [2] to estimate the free energy penalty of creating a void into the continuum liquid solution, that is, the cavitation free energy,

\[F^{\text{cav}}[s] = \gamma S[s],\]

where the surface is defined in terms of the interface function,

\[S[s] = \int\lvert\nabla s(\mathbf{r})\rvert d^3\mathbf{r}.\]

Various publications have generalized and revised this cavitation free energy function [3], [4], the implementation of the surface tension being a result of this work. The functional derivative of the energy contribution with respect to the interface function is

\[\frac{\delta F^{\text{cav}}[s]}{\delta s}(\mathbf{r}) = -\nabla\cdot\left(\frac{\nabla s(\mathbf{r})}{\lvert\nabla s(\mathbf{r}\rvert}\right),\]

which is used in the calculation of the contribution to the Kohn-Sham potential or the interatomic forces.

[1]Cococcioni M, Mauri F, Ceder G, Marzari N, Phys. Rev. Lett. 2005 4;94(14):145501
[2]
    1. Scherlis, J. L. Fattebert, F. Gygi, M. Cococcioni, N. Marzari, J. Chem. Phys. 2006, 124(7), 74103
[3]Andreussi O, Dabo I, Marzari N, J. Chem. Phys. 2012 2;136(6):064102
[4]
  1. Fisicaro, L. Genovese, O. Andreussi, S. Mandal, N. N. Nair, N. Marzari, et al., J. Chem. Theory Comput. 2017, 13(8), 3829

Environ Input

pw.x: input description

Input File Description

Program: pw.x / Environ / Quantum Espresso

TABLE OF CONTENTS

INTRODUCTION

&ENVIRON

atomicspread | cion | cionmax | electrolyte_entropy | electrolyte_linearized | env_confine | env_dielectric_regions | env_electrolyte_ntyp | env_electrostatic | env_external_charges | env_nrep | env_optical_permittivity | env_pressure | env_static_permittivity | env_surface_tension | environ_nskip | environ_restart | environ_thr | environ_type | rion | sc_carrier_density | sc_permittivity | system_axis | system_dim | system_ntyp | temperature | verbose | zion

&BOUNDARY

alpha | corespread | derivatives | electrolyte_alpha | electrolyte_distance | electrolyte_mode | electrolyte_rhomax | electrolyte_rhomin | electrolyte_softness | electrolyte_spread | electrolyte_tbeta | filling_spread | filling_threshold | ifdtype | nfdpoint | radial_scale | radial_spread | radius_mode | rhomax | rhomin | sc_distance | sc_spread | softness | solvationrad | solvent_distance | solvent_mode | solvent_radius | solvent_spread | stype | tbeta

&ELECTROSTATIC

auxiliary | core | inner_maxstep | inner_mix | inner_solver | inner_tol | maxstep | mix | mix_type | ndiis | pbc_axis | pbc_correction | pbc_dim | preconditioner | problem | screening | screening_type | solver | step | step_type | tol

EXTERNAL_CHARGES

Q | x | y | z | spread | dim | axis

DIELECTRIC_REGIONS

EpsSt | EpsOpt | x | y | z | width | spread | dim | axis

INTRODUCTION

Input data format: { } = optional, [ ] = it depends, | = or

All quantities whose dimensions are not explicitly specified are in
RYDBERG ATOMIC UNITS. Charge is "number" charge (i.e. not multiplied
by e); potentials are in energy units (i.e. they are multiplied by e).

BEWARE: TABS, DOS <CR><LF> CHARACTERS ARE POTENTIAL SOURCES OF TROUBLE

Comment lines in namelists can be introduced by a "!", exactly as in fortran
code. Comments lines in cards can be introduced by either a "!" or a "#"
character in the first position of a line.

Do not start any line in cards with a "/" character.

Structure of the environ.in input file:
===============================================================================

&ENVIRON
    ...
/

[ &BOUNDARY
    ...
/ ]

[ &ELECTROSTATIC
    ...
/ ]

[ EXTERNAL_CHARGES { bohr | angstrom }
    Q1 0.0 0.0 0.0 { spread_Q1 dim_Q1 axis_Q1 }
    Q2 0.5 0.0 0.0 { spread_Q2 dim_Q2 axis_Q2 } ]

[ DIELECTRIC_REGIONS { bohr | angstrom }
    EPSst_E1 EPSopt_E1 0.0 0.0 0.0 width_E1 { spread_E1 dim_E1 axis_E1 }
    EPSst_E2 EPSopt_E2 0.0 0.0 0.0 width_E2 { spread_E2 dim_E2 axis_E2 } ]
   

Namelist: &ENVIRON

This namelist is always needed !

atomicspread(i), i=1,ntyp REAL
Default: -0.5D0
Status: OPTIONAL
In the calculation of electrostatic contributions, ionic charge densities are modelled
as gaussians of fixed spread, as specified by atomicspread(ityp) for each atomic type.
Results are identical to using point-like charges (as is usually done in PW), unless the gaussian
spreads are too large. The default value of 0.5 a.u. was derived to be safe enough in most
common atom types. Too small of a value may require larger density cutoffs (ecutrho).
         
cion(i), i=1,env_electrolyte_ntyp REAL
Default: 1.D0
Status: OPTIONAL
Molar concentration of ionic countercharge (in mol/L).
         
cionmax REAL
Default: 1.D3
Status: OPTIONAL
Maximum molar concentration of ionic countercharge (in mol/L).
         
electrolyte_entropy CHARACTER
Default: 'full'
Status: OPTIONAL
Keyword to set the electrolyte entropy terms that are affected by the Stern-layer correction.

'ions' : only ionic terms (Ringe et al. J. Chem. Theory Comput. 12, 4052).
'full' : all terms (Dabo et al. arXiv 0901.0096).
         
electrolyte_linearized LOGICAL
Default: .FALSE.
Status: OPTIONAL
Controls if the linear-regime approximation is employed for the electrolyte model.
It can be used in combination with the numerical Poisson-Boltzmann (PB) model as well as with the
Gouy-Chapman-Stern correction that exploits the 1D-solution of the PB equation (see pbc_correction).
         
env_confine REAL
Default: 0.D0
Status: REQUIRED
Confinement potential barrier in Rydberg atomic units.

This keyword controls the activation of the confinement potential contribution
to the solute's Hamiltonian. A value of 0.D0 means no confinement contribution
from the environment.

The confinement potential may be used to favour electron localization: a potential that
smoothly switches between zero and env_confine, following the complementary of
the interface function, provides a destabilizing contribution that penalizes
delocalized states.
         
env_dielectric_regions INTEGER
Default: 0
Status: REQUIRED
Number of fixed dielectric regions. This keyword controls how many regions of fixed
permittivities (static and optical) need to be included in the simulation box. Shape,
position, and permittivities of each region need to be specified in the DIELECTRIC_REGIONS card.
         
env_electrolyte_ntyp INTEGER
Default: 0
Status: REQUIRED
Number of countercharge species to be added in the continuum region modelling
the electrolyte. If different from zero, must be greater or equal to 2 in order
for the electrolyte to be charge neutral.
         
env_electrostatic LOGICAL
Default: .FALSE.
Status: REQUIRED
Generic keyword that flags the need to read the &ELECTROSTATIC namelist. Any electrostatic
embedding keyword (env_static_permittivity, env_electrolyte_ntyp) will turn this keyword on.
One needs to turn on this keyword explicitly to activate electrostatic embedding effects
that do not have a specific activation keyword, such as for PBC correction schemes.
         
env_external_charges INTEGER
Default: 0
Status: REQUIRED
Number of fixed external charges. This keyword controls how many fixed external densities
of charge need to be included in the simulation box. Shape, position, and amount of charge
of each external density need to be specified in the EXTERNAL_CHARGES card.
         
env_nrep(i), i=1,3 INTEGER
Default: 0
Status: OPTIONAL
Number of additional replicas of the system cell on each side along the three axis.
nrep = 1 means there is one more cell on the left and on the right of the cell.
The environment cell is (2*nrep+1) times the system cell along the three axis.
         
env_optical_permittivity REAL
Default: 1.D0
Status: REQUIRED
Optical dielectric permittivity of the electrostatic continuum embedding model,
only needed for TDDFPT calculations. A value of 1 (=vacuum) means no dielectric
effects in linear response calculations.
         
env_pressure REAL
Default: see below
Status: REQUIRED
External pressure (P) of the environment in GPa.

This keyword controls the activation of the volume-dependent contribution to
the solute's Hamiltonian (P*V). A value of 0.D0 means no volume contribution
from the environment.

This contribution may be straightforwardly used to compute the electronic enthalpy,
i.e. to model finite systems under pressure, as proposed by M. Cococcioni et al. in
Phys. Rev. Lett. 94, 145501 (2005). This contribution can also be used as a simplified
approach to more complex and general non-electrostatic contributions to solvation,
as in the SCCS approach. In this second case, env_pressure needs not correspond to the
real external pressure of the environment, but is used as a fitting parameter
(and can assume negative values).

See O. Andreussi, I. Dabo and N. Marzari, J. Chem. Phys. 136 064102 (2012)

DEFAULT:

solvent_mode .EQ. electronic | full :
    environ_type .EQ. input | vacuum : 0.D0
    environ_type .EQ. water          : -0.35D0
    environ_type .EQ. water-cation   : 0.125D0
    environ_type .EQ. water-anion    : 0.450D0

solvent_mode .EQ. ionic : -0.35D0
         
env_static_permittivity REAL
Default: see below
Status: REQUIRED
Static dielectric permittivity of the electrostatic continuum embedding model.

This keyword (like all the env_* keywords) is also the flag which controls the
activation of the specific contribution. A value of 1 (=vacuum) means no dielectric
effects from the environment.

DEFAULT:

environ_type .EQ. water | water-cation | water-anion : 78.3D0
environ_type .EQ. input | vacuum                     : 1.D0
         
env_surface_tension REAL
Default: see below
Status: REQUIRED
Surface tension (gamma) of the environment in CGS units dyn/cm.

This keyword controls the activation of the surface-dependent contribution to
the solute's Hamiltonian (gamma*S). A value of 0.D0 means no surface
contribution from the environment.

This contribution may be straightforwardly used to compute cavitation free energies,
as proposed by Scherlis et al. in J. Chem. Phys. 124, 074103 (2006).
NOTE that the current implementation uses an improved definition of the quantum-surface.
This contribution can also be used as a simplified approach to the more general
non-electrostatic contributions to solvation, as in the SCCS approach.
In this second case, env_surface_tension does not need to correspond to the
real surface tension of the solvent, but is used as a fitting parameter.

See O. Andreussi, I. Dabo and N. Marzari, J. Chem. Phys. 136 064102 (2012)

DEFAULT:

solvent_mode .EQ. electronic | full :
    environ_type .EQ. input | vacuum | water-anion : 0.D0
    environ_type .EQ. water                        : 50.D0
    environ_type .EQ. water-cation                 : 5.D0

solvent_mode .EQ. ionic : 50.D0
         
environ_nskip INTEGER
Default: 1
Only include/update environment contributions after the first environ_nskip steps of CP dynamics.
         
environ_restart LOGICAL
Default: .FALSE.
Status: OPTIONAL
Compute environ contributions during the initialization step, useful for 'restart' calculations
and systems with a good-enough initial guess.

Must be set to activate environ in nscf calculations.
         
environ_thr REAL
Default: 1.D-1
Status: IMPORTANT - the default value is only valid for small systems - too conservative for larger systems
Only include/update environment contributions when SCF accuracy is below this threshold.
Since the environment region is defined in terms of the electronic density, the test is done
in order to avoid computing unphysical environment contributions, usually to skip the
environ calculation during the first couple of SCF step.

IMPORTANT: as the SCF accuracy is an extensive property (increases with the number of electrons in
the system), the optimal environ_thr will also vary with system size.
         
environ_type CHARACTER
Default: 'input'
Status: OPTIONAL
Set up all of the environment embedding flags and interface
parameters according to predefined types:

'input':
    Do not use predefined types, read the flags of the different contribution from input
    or use the defaults values (which correspond to no contributions).

'vacuum':
    All environment embeddings are turned off, but pbc corrections, external charges and
    electrolyte charges can be present.

'water':
    Set up the main physical constants to the experimental values for water at room temperature
    (env_static_permittivity = 78.3). Set the tunable embedding flags to the values optimized
    to reproduce aqueous solvation of small neutral organic compounds, corresponding to
    non-electrostatic contributions modelled via pressure (env_pressure = -0.35 GPa)
    and surface tension (env_surface_tension = 50 dyn/cm) effects (see references below).
    For electrons-dependent interfaces (self-consistent continuum solvation, SCCS), set soft
    interface parameters to the optimal values (rhomax = 0.005; rhomin = 0.0001)
    derived in O. Andreussi, I. Dabo and N. Marzari, J. Chem. Phys. 136 064102 (2012).
    For ions-dependent interfaces (soft-sphere continuum solvation, SSCS), set rigid
    interface parameter to the optimal value (alpha = 1.12) derived in
    G. Fisicaro et al. J. Chem. Theory Comput. 13, 8, 3829 (2017).

'water-cation':
    Set up the main physical constants to the experimental values for water at room temperature
    (env_static_permittivity = 78.3). Set the tunable embedding flags to the values optimized
    to reproduce aqueous solvation of small organic cations.
    SCCS parameters (env_pressure = 0.125 GPa; env_surface_tension = 5.0 dyn/cm;
    rhomax = 0.0035;  rhomin = 0.0002) were derived in C. Dupont, O. Andreussi and
    N. Marzari, J. Chem. Phys. 139, 214110 (2013)
    SSCS parameters (env_pressure = -0.35 GPa; env_surface_tension = 50.0 dyn/cm;
    alpha = 1.10) were derived in G. Fisicaro et al. J. Chem. Theory Comput.
    13, 8, 3829 (2017).

'water-anion':
    Set up the main physical constants to the experimental values for water at room temperature
    (env_static_permittivity = 78.3). Set the tunable embedding flags to the values optimized
    to reproduce aqueous solvation of small organic cations.
    SCCS parameters (env_pressure = 0.45 GPa; env_surface_tension = 0.0 dyn/cm;
    rhomax = 0.0155;  rhomin = 0.0024) were derived in C. Dupont, O. Andreussi and
    N. Marzari, J. Chem. Phys. 139, 214110 (2013)
    SSCS parameters (env_pressure = -0.35 GPa; env_surface_tension = 50.0 dyn/cm;
    alpha = 0.98) were derived in G. Fisicaro et al. J. Chem. Theory Comput.
    13, 8, 3829 (2017).
         
rion REAL
Default: 0.D0
Status: OPTIONAL
Mean atomic radius of ionic countercharge (a.u.).
         
sc_carrier_density REAL
Default: 0.D0
Status: OPTIONAL
Concentration of charge carriers within the semiconductor (cm^-3).
         
sc_permittivity REAL
Default: 1.D0
Status: OPTIONAL
Dielectric permittivity of the semiconductor.
         
system_axis INTEGER
Default: 3
Main axis of the embedded system, only necessary for partially periodic systems
(1 = x, 2 = y, 3 = z).
         
system_dim INTEGER
Default: 0
Dimensionality of the embedded system, used to determine size (only orthogonally periodic
dimensions) and position (0 = 0D, 1 = 1D, 2 = 2D).
         
system_ntyp INTEGER
Default: 0
Specify the atom types that are used to determine the origin and size of the embedded system,
for system-dependent properties in Environ (e.g. see later system-dependent boundary).

Atom types up to system_ntyp are used, all atoms are used by default or if system_ntyp == 0.
         
temperature REAL
Default: 300.D0
Status: OPTIONAL
Temperature of electrolyte solution, needed by Poisson-Boltzmann equation. Also used in
semiconductor simulations.
         
verbose INTEGER
Default: 0
Status: OPTIONAL
Control the amount of output written to specific output files, mostly useful for debugging purposes

verbose .EQ. 0 : minimal information written to standard output
verbose .EQ. 1 : additional information written to environ.debug file
verbose .EQ. 2 : dumping of main physical quantities on the real-space grid in the form of
                *.cube files (only at the end of each SCF cycle)
verbose .GE. 3 : dumping of several intermediate physical quantities on the real-space grid
                as this is done at every SCF step it will slow down the calculation significantly
         
zion(i), i=1,env_electrolyte_ntyp REAL
Default: 1.D0
Status: OPTIONAL
Valence of ionic countercharge.
         

Namelist: &BOUNDARY

This namelist is not needed if there are no embedding schemes requiring a continuum interface

alpha REAL
Default: see below
Status: OPTIONAL
Main parameter of ions-dependent interface function, corresponding to the homogeneous
scaling factor of ionic radii (specified by the radius_mode keyword or by solvationrad
(ntyp)).

DEFAULT:

solvent_mode .EQ. electronic | full :
    environ_type .EQ. input | vacuum : 1.D0
    environ_type .EQ. water          : 1.12D0
    environ_type .EQ. water-cation   : 1.10D0
    environ_type .EQ. water-anion    : 0.98D0

solvent_mode .EQ. ionic : 1.D0
         
corespread(i), i=1,ntyp REAL
Default: -0.5D0
Status: OPTIONAL
Numerical spread of the atomic-centered Gaussian functions used to model core electrons and
ions for interfaces defined on the full set of degrees of freedom of the QM system
(interface mode = full).

NOTE: this numerical parameter should only be used to avoid artefacts coming from the missing
core electrons, if this parameter affects the final results, a WARNING will be issued and a smaller
(even null) value should be used instead.
         
derivatives CHARACTER
Default: see below
Status: OPTIONAL
Specify the numerical approach used to compute derivatives of the continuum interface with respect
to real-space coordinates or QM degrees of freedom.

'fft'     : fast Fourier transform
'chain'   : chain rule derivatives for as much as possible (and FFTs for the rest)
'highmem' : analytic derivatives for soft-sphere computed by storing all spherical functions
            and derivatives
'lowmem'  : more efficient analytic derivatives

DEFAULT:

solvent_mode .EQ. electronic | full : 'chain'
solvent_mode .EQ. ionic             : 'lowmem'
         
electrolyte_alpha REAL
Default: 1.D0
Status: OPTIONAL
Main parameter of ions-dependent interface function, corresponding to the homogeneous
scaling factor of ionic radii (specified by the radius_mode keyword or by solvationrad(ntyp)).
Used for the electrolyte interface.
         
electrolyte_distance REAL
Default: 0.D0
Status: OPTIONAL
Distance of the system-dependent interface from the center of the system, computed as the
center of ionic charge of the atomic types entering the definition of the system
(as specified in the system_ntyp keyword of the &ENVIRON namelist).
Used for the electrolyte interface.
         
electrolyte_mode CHARACTER
Default: 'electronic'
Status: REQUIRED
Choice of the interface function representing the boundary between the QM region and the
electrolyte embedding environment. Please note that a separate set of keywords is used to
specify the parameters of the electrolyte interface function (all exploiting the
electrolyte_ prefix).

'electronic':
    interface depends self-consist. on electronic density, corresponds
    to the Self-consistent Continuum Solvation approach (SCCS).

'ionic':
    interface defined on atomic positions, corresponds to the
    Soft-sphere Continuum Solvation approach (SSCS).

'full':
    similar to electronic, but an extra density is added to
    represent the core electrons and the nuclei. This extra
    density is defined as the sum of gaussian functions centered
    on atomic positions of width specified by the corespread(ityp) keyword.

'system':
    interface defined as a simple analytical function of system position and
    dimensionality.
         
electrolyte_rhomax REAL
Default: 0.005D0
Status: OPTIONAL
First parameter of the density-dependent interface function, roughly corresponding to the
density threshold of the continuum model. Used for the electrolyte interface.
         
electrolyte_rhomin REAL
Default: 0.0001D0
Status: OPTIONAL
Second parameter of the density-dependent interface function, when stype=1. Used for the
electrolyte interface.
         
electrolyte_softness REAL
Default: 0.5D0
Status: OPTIONAL
Numerical spread of the soft-sphere functions used for the ions-dependent interfaces.
Used for the electrolyte interface.
         
electrolyte_spread REAL
Default: 0.5D0
Status: OPTIONAL
Numerical spread of the analytical function used for the system-dependent interface.
Used for the electrolyte interface.
         
electrolyte_tbeta REAL
Default: 4.8D0
Status: OPTIONAL
Second parameter of the density-dependent interface function, when stype=0. Used for the
electrolyte interface.
         
filling_spread REAL
Default: 0.02D0
Status: OPTIONAL
For solvent-aware interfaces, numerical spread of the switching function used to decide whether
the continuum void should be filled or not.
         
filling_threshold REAL
Default: 0.825D0
Status: OPTIONAL
For solvent-aware interfaces, threshold of filled-fraction used to decide whether to fill or not
a continuum void. The default value of 7/8 correspond to the geometrical condition required to
homogenously fill a spherical void of radius smaller than the solvent radius.
         
ifdtype INTEGER
Default: 1
Status: OPTIONAL
The gradient of the dielectric function is computed in real-space using finite differences.
Different finite differences schemes have been implemented following:

P. Holoborodko, Smooth noise robust differentiators, 2008
http://www.holoborodko.com/pavel/numerical-methods/numerical-derivative/smooth-low-noise-differentiators

Each scheme can exploit different numbers of points of the real-space grid (as defined by nfdpoint).

ifdtype .EQ. 1 : Central differences
ifdtype .EQ. 2 : Low-noise Lanczos (m=2)
ifdtype .EQ. 3 : Low-noise Lanczos (m=4)
ifdtype .EQ. 4 : Smooth noise-robust (n=2)
ifdtype .EQ. 5 : Smooth noise-robust (n=4)

Central differences are used by default and have been tested more deeply. The other schemes
work fine, but are not deeply tested in terms of performances.
         
nfdpoint INTEGER
Default: 2
Status: IMPORTANT
Number of point from the real-space grid, to be used by the different finite-difference schemes
to compute gradients.
Number of points = 2 * nfdpoint + 1
e.g. ifdtype.EQ.1 .AND. nfdpoint.EQ.1 correspond to central differences with three points

IMPORTANT: nfdpoint .EQ. 1 seems to be enough for most applications, but more refined
finite-difference schemes are needed (nfdpoint.EQ.2 is enough) for energy conservation
in MD simulations in continuum dielectric.

See test case reported in O. Andreussi, I. Dabo and N. Marzari, J. Chem. Phys. 136 064102 (2012)
         
radial_scale REAL
Default: 2.D0
Status: OPTIONAL
For solvent-aware interfaces, compute the filled fraction on a spherical volume whose radius is
radial_scale * solvent_radius. The default value of 2.0 guarantees that spherical voids of the size
of a solvent molecule will be homogenously filled. Larger values will let the algorithm sample a
larger volume of space, increasing the non-locality of the algorithm.
         
radial_spread REAL
Default: 0.5D0
Status: OPTIONAL
For solvent-aware interfaces, numerical spread of the step function used to compute the filled fraction.
         
radius_mode CHARACTER
Default: 'uff'
Status: OPTIONAL
Specify the predefined set of atomic radii to be used when building an ions-dependent interface.

'pauling' : R.C. Weast, ed., Handbook of chemistry and physics (CRC Press, Cleveland, 1981)
'bondi'   : A. Bondi, J. Phys. Chem. 68, 441 (1964)
'uff'     : A.K. Rapp/'{e} et al. J. Am. Chem. Soc. 114(25) pp.10024-10035 (1992)
'muff'    : Fisicaro JCTC (2017)
         
rhomax REAL
Default: see below
Status: OPTIONAL
First parameter of the density-dependent interface function, roughly corresponding to
the density threshold of the continuum model.

DEFAULT:

solvent_mode .EQ. electronic | full :
    environ_type .EQ. input | vacuum | water : 0.005D0
    environ_type .EQ. water-cation           : 0.0035D0
    environ_type .EQ. water-anion            : 0.0155D0

solvent_mode .EQ. ionic : 0.005D0
         
rhomin REAL
Default: see below
Status: OPTIONAL
Second parameter of the density-dependent interface function, when stype=1.

DEFAULT:

solvent_mode .EQ. electronic | full :
    environ_type .EQ. input | vacuum | water : 0.0001D0
    environ_type .EQ. water-cation           : 0.0002D0
    environ_type .EQ. water-anion            : 0.0024D0

solvent_mode .EQ. ionic : 0.0001D0
         
sc_distance REAL
Default: 0.D0
Status: OPTIONAL
Distance from the system where the Mott-Schottky boundary starts.
         
sc_spread REAL
Default: 0.5D0
Status: OPTIONAL
Spread of the interfaces for the Mott-Schottky boundary.
         
softness REAL
Default: 0.5D0
Status: OPTIONAL
Numerical spread of the soft-sphere functions used for the ions-dependent interfaces.
         
solvationrad(i), i=1,ntyp REAL
Default: -3.D0
Status: OPTIONAL
Atomic radii used for the ions-dependent interface as introduced by G. Fisicaro et al.
J. Chem. Theory Comput. 13, 8, 3829 (2017). These values will overwrite the defaults
set by the radius_mode keyword.
         
solvent_distance REAL
Default: 1.D0
Status: OPTIONAL
Distance of the system-dependent interface from the center of the system, computed as the
center of ionic charge of the atomic types entering the definition of the system
(as specified in the system_ntyp keyword of the &ENVIRON namelist).
         
solvent_mode CHARACTER
Default: 'electronic'
Status: REQUIRED
Choice of the interface function representing the boundary between the
QM region and the solvent embedding environment. Dielectric, surface and
volume embedding will all act on the solvent interface (as opposed to
the electrolyte embedding that will act on the electrolyte interface).

'electronic':
    interface depends self-consist. on electronic density, corresponds
    to the Self-consistent Continuum Solvation approach (SCCS).

'ionic':
    interface defined on atomic positions, corresponds to the
    Soft-sphere Continuum Solvation approach (SSCS).

'full':
    similar to electronic, but an extra density is added to
    represent the core electrons and the nuclei. This extra
    density is defined as the sum of gaussian functions centered
    on atomic positions of width specified by the corespread(ityp) keyword.

'system':
    inteface defined as a simple analytical function of system position and
    dimensionality.
         
solvent_radius REAL
Default: 0.D0
Status: OPTIONAL
Size of the solvent molecules, used in the solvent-aware algorithm to decide whether to fill
a continuum void or not. If set equal to 0.D0, use the standard local algorithm.
         
solvent_spread REAL
Default: 0.5D0
Status: OPTIONAL
Numerical spread of the analytical function used for the system-dependent interface.
         
stype INTEGER
Default: 2
Status: OPTIONAL
The shape of the environment region is defined according to a specific switching function
of the electronic density:

stype .EQ. 0 : Original switching function from Fattebert and Gygi.
               Requires two parameters: rhomax and tbeta
stype .EQ. 1 : Optimally smooth switching function from the SCCS method, redefined for the
               non-electrostatic part.
               Requires two parameters: rhomax and rhomin
stype .EQ. 2 : Optimally smooth switching function from the SCCS method of Andreussi et al.
               Requires two parameters: rhomax and rhomin
         
tbeta REAL
Default: 4.8D0
Status: OPTIONAL
Second parameter of the density-dependent interface function, when stype=0.
         

Namelist: &ELECTROSTATIC

This namelist is not needed if there are no electrostatic embedding effects

auxiliary CHARACTER
Default: see below
Status: OPTIONAL
The electrostatic problem is defined and solved in terms of the electrostatic potential or of an auxiliary quantity.

'none' : solve for the electrostatic potential.
'full' : solve for the auxiliary charge (e.g. for 'generalized' problems solve for
         the polarization charge, used to be the default in Environ v0.2).
'ioncc': solve for the electrolyte charge.

DEFAULT:

IF (solver .EQ. 'fixed-point') THEN
    auxiliary = 'full'
ELSE
    auxiliary = 'none'
         
core CHARACTER
Default: 'fft'
Status: OPTIONAL
The choice of the core numerical methods to be exploited for the different operations.

'fft' : fast Fourier transforms
         
inner_maxstep INTEGER
Default: 200
Status: OPTIONAL
Same as maxstep, but refers to the inner loop in the electrostatic calculation
(nested schemes only).
         
inner_mix REAL
Default: 0.5D0
Status: OPTIONAL
Same as mix, but refers to the inner loop in the electrostatic calculation
(nested schemes only).
         
inner_solver CHARACTER
Default: see below
Status: OPTIONAL
Same as solver, but refers to the algorithm used to get the solution of the inner loop
in the electrostatic problem (nested schemes only).

'cg'          :
'sd'          :
'fixed-point' :
'direct'      :

DEFAULT:

IF (env_electrolyte_ntyp .GT. 0 .AND. pbc_correction .NE. 'gcs') THEN
    IF (.NOT. electrolyte_linearized) THEN
        inner_solver = 'cg'
    ELSE
        inner_solver = 'none'
         
inner_tol REAL
Default: 1.D-10
Status: IMPORTANT
Accuracy of the inner loop in the electrostatic calculation (nested schemes only).
As for the tol parameter, higher accuracies will require more cycles, but will ensure
smoother convergence of the outer electrostatic loop (thresholds smaller than 1.D-15
are recommended).
         
maxstep INTEGER
Default: 200
Status: OPTIONAL
Maximum number of steps to get the solution of the electrostatic problem.
         
mix REAL
Default: 0.5D0
Status: OPTIONAL
Linear mixing parameter for iterative solver. Usually does not affect results
(and it shouldn't) and does not affect performances, large values work fine in
most common applications.
         
mix_type CHARACTER
Default: 'linear'
Status: OPTIONAL
The mixing method for iterative calculations.

'linear'   :
'anderson' :
'diis'     :
'broyden'  :
         
ndiis INTEGER
Default: 1
Status: OPTIONAL
The order of DIIS interpolation of iterative calculation.
         
pbc_axis INTEGER
Default: 3
Status: OPTIONAL
For partially periodic simulation cells (1D or 2D), choice of the sides with periodic
boundary conditions (1 = x, 2 = y, 3 = z)

pbc_dim .EQ. 1 : specified axis is along the 1D direction.
pbc_dim .EQ. 2 : specified axis is orthogonal to 2D plane.
         
pbc_correction CHARACTER
Default: 'none'
Status: OPTIONAL
Type of pbc correction scheme to be used.

'none'      : no correction
'parabolic' : parabolic point-counter-charge (PCC) correction, only implemented for 0D
              and 2D systems
'gcs'       : Gouy-Chapman-Stern correction, only implemented for 2D systems. It
              exploits the one-dimensional analytic solution of the Poisson-Boltzmann
              equation. The analytic potential replaces the numerical one where the
              distance from the system is larger than electrolyte_distance (all charge
              distributions, including the polarization charge, must be fully included
              within this distance)
'ms'        : Mott-Schottky correction, only implemented for 2D systems, assumes the
              system is embedded in a semiconductor with sc_permittivity and
              sc_carrier_density. It exploits the one-dimensional analytic solution of
              the Mott-Schottky equation. The analytic potential replaces the
              numerical one where the distance from the system is larger than sc_distance
              (all charge distributions, including the polarization charge, must be fully
              included within this distance)
         
pbc_dim INTEGER
Default: -3
Status: OPTIONAL
Dimensionality of the simulation cell, i.e. periodic boundary conditions are applied
on 3/2/1/0 sides of the cell.
         
preconditioner CHARACTER
Default: 'sqrt'
Status: OPTIONAL
The type of preconditioner.

'none' : no preconditioner
'left' : left linear preconditioner eps nabla v = r
'sqrt' : sqrt preconditioner sqrt(eps) nabla (sqrt(eps) * v) = r
         
problem CHARACTER
Default: see below
Status: OPTIONAL
Type of electrostatic problem that need to be solved. This keyword is usually set
automatically by the ENVIRON namelist, but it may be used to specify a linearized
or modified version of an electrostatic problem.

'poisson'     : standard Poisson equation, with or without periodic boundary conditions
'generalized' : generalized Poisson equation, a dielectric embedding must be present
'pb'          : non-linear Poisson-Boltzmann equation, an electrolyte embedding must
                be present, a dielectric embedding is optional
'modpb'       : non-linear size-modified Poisson-Boltzmann equation, an electrolyte
                embedding must be present, a dielectric embedding is optional
'linpb'       : linearized version of the Poisson-Boltzmann problem
'linmodpb'    : linearized version of the modified Poisson-Boltzmann problem

DEFAULT:

IF (env_electrolyte_ntyp .GT. 0 .AND. pbc_correction .NE. 'gcs') THEN
    IF (electrolyte_linearized) THEN
        IF (cionmax > 0.D0 .OR. rion > 0.D0) THEN
            problem = 'linmodpb'
        ELSE
            problem = 'linpb'
ELSE IF (env_static_permittivity .GT. 1.D0 .OR. env_dielectric_regions .GT. 0) THEN
    problem = 'generalized'
ELSE
    problem = 'poisson'
         
screening REAL
Default: 0.D0
Status: OPTIONAL
Same as mix, but refers to the inner loop in the electrostatic calculation
(nested schemes only).
         
screening_type CHARACTER
Default: 'none'
Status: OPTIONAL
Uses the screened coulomb Green's function instead of the vacuum one.

'none'    : unscreened coulomb
'input'   : screened coulomb with screening length provided in input
'linear'  : screened coulomb with screening length from linear component
            of the problem
'optimal' : screened coulomb with screening length optimized (to be defined)
         
solver CHARACTER
Default: see below
Status: OPTIONAL
Type of numerical solver used to get the solution of the electrostatic problem.

'direct'      : Get the direct solution of the problem as provided by the adopted
                numerical core. At this time, the FFT numerical core of Environ only
                allows the 'poisson' problem to be solved directly
'fixed-point' : Use a fixed-point search algorithm (used to be the default for the
                'generalized' problem in Environ v0.2)
'sd'          : Use a steepest-descent algorithm, possibly preconditioned
'cg'          : Use a conjugate-gradient algorithm, possibly preconditioned
'newton'      : Use Newton's root-finding method

DEFAULT:

IF (env_electrolyte_ntyp .GT. 0 .AND. pbc_correction .NE. 'gcs') THEN
    IF (electrolyte_linearized) THEN
        solver = 'cg'
    ELSE
        solver = 'newton'
ELSE IF (env_static_permittivity .GT. 1.D0 .OR. env_dielectric_regions .GT. 0) THEN
    IF (pbc_correction .NE. 'gcs') THEN
        solver = 'cg'
    ELSE
        solver = 'fixed-point'
ELSE
    solver = 'direct'
         
step REAL
Default: 0.3D0
Status: OPTIONAL
Step size to be used if step_type = 'input' (inherits the tasks of the old mixrhopol).
         
step_type CHARACTER
Default: 'optimal'
Status: OPTIONAL
The step size in gradient descent algorithms or iterative mixing.

'optimal' : step size that minimize the cost function on the descent direction
'input'   : fixed step size as defined in input (step keyword)
'random'  : random step size within zero and twice the optima value
         
tol REAL
Default: 1.D-5
Status: IMPORTANT
Accuracy of the electrostatic calculation: higher accuracies will require more cycles,
but will ensure smoother SCF convergence. As electrostatic solver iterations are
usually cheaper than SCF cycles, it is recommended to increase this accuracy whenever
the SCF has problems converging.
The units depend on the actual quantity that is computed by the algorithm, either the
potential (auxiliary = 'none') or an auxiliary charge (auxiliary = 'full'). In the
latter case, much smaller thresholds should be adopted (e.g. lower than 1.D-8).
         

Card: EXTERNAL_CHARGES { bohr | angstrom }

Syntax:

EXTERNAL_CHARGES { bohr | angstrom }
 Q(1)   x(1)   y(1)   z(1)  {  spread(1)   dim(1)   axis(1)  }
 Q(2)   x(2)   y(2)   z(2)  {  spread(2)   dim(2)   axis(2)  }
 . . .
 Q(nec)   x(nec)   y(nec)   z(nec)  {  spread(nec)   dim(nec)   axis(nec)  }

Description of items:

Card's options: bohr | angstrom
Default: (DEPRECATED) bohr
bohr     : atomic positions are in cartesian coordinate, in atomic units
           (i.e. Bohr radii)

angstrom : atomic positions are in cartesian coordinates, in Angstrom
         
Q REAL
 Total charge of external object
                  
x, y, z REAL
Positions

NOTE: each atomic coordinate can also be specified as a simple algebraic expression,
      see the description in the input file of PW.
                  
spread REAL
Default: 0.5
Gaussian spread of the external charge density in atomic units
                     
dim INTEGER
Default: 0
Dimensionality of the charge density

dim .EQ. 0 : point-like (gaussian shaped) charge density
dim .EQ. 1 : linear (gaussian shaped) charge density
dim .EQ. 2 : planar (gaussian shaped) charge density
                     
axis INTEGER
Default: 3
Axis of the external charge density

if dim.EQ.0 : axis has no meaning/use
if dim.EQ.1 : axis identifies the direction of the linear charge density.
              axis .EQ. 1|2|3 means lines along x|y|z respectively
if dim.EQ.2 : axis identifies the direction orthogonal to the planar charge density.
              axis .EQ. 1|2|3 means planes orthogonal to x|y|z
                     

Card: DIELECTRIC_REGIONS { bohr | angstrom }

Syntax:

DIELECTRIC_REGIONS { bohr | angstrom }
 EpsSt(1)   EpsOpt(1)   x(1)   y(1)   z(1)   width(1)  {  spread(1)   dim(1)   axis(1)  }
 EpsSt(2)   EpsOpt(2)   x(2)   y(2)   z(2)   width(2)  {  spread(2)   dim(2)   axis(2)  }
 . . .
 EpsSt(ndr)   EpsOpt(ndr)   x(ndr)   y(ndr)   z(ndr)   width(ndr)  {  spread(ndr)   dim(ndr)   axis(ndr)  }

Description of items:

Card's options: bohr | angstrom
Default: (DEPRECATED) bohr
bohr    : positions are in cartesian coordinate, in atomic units
          (i.e. Bohr radii)

angstrom: positions are in cartesian coordinates,
          in Angstrom
         
EpsSt REAL
 Static permittivity inside of dielectric region
                  
EpsOpt REAL
 Optical permittivity inside of dielectric region
                  
x, y, z REAL
Positions

NOTE: each coordinate can also be specified as a simple algebraic expression, see the description in the input file of PW.
                  
width REAL
 Width of the dielectric region in atomic units
                  
spread REAL
Default: 0.5
 Spread of the dielectric region in atomic units
                     
dim INTEGER
Default: 0
Dimensionality of the dielectric region

dim .EQ. 0 : sphere-like (erfc shaped) region
dim .EQ. 1 : cylinder-like (erfc shaped) region
dim .EQ. 2 : planar (erfc shaped) region
                     
axis INTEGER
Default: 3
Axis of the dielectric region.

dim .EQ. 0 : axis has no meaning/use
dim .EQ. 1 : axis identifies the direction of the linear charge
             density.
             axis .EQ. 1|2|3 means lines along x|y|z respectively
dim .EQ. 2 : axis identifies the direction orthogonal to the planar
             charge density.
             axis .EQ. 1|2|3 means planes orthogonal to x|y|z
                     
This file has been created by helpdoc utility.

QE PW Input File

This page explains the PW input files in more detail. It refers to each of the examples and the input files auto-generated by each of the scripts.

A standard PW file contains options for the locations of associated files, and any output files, as well any information about the system, including the atoms and their positions, and the dimensions of the cell. For users new to Quantum Espresso, it is often easier to copy working PW files and editing individual parameters rather than building these from scratch. For those that are interested, there are also tools that generate PW input files, such as ASE [1]. Alternatively a number of users have written their own helper scripts to expedite the tedious procedure of creating large batches of input files for larger investigations.

An essential reference page is the PW input file description page [2], which contains a brief explanation of every possible choice of parameter and their options.

Example 1

The input file generated for the first example is for an isolated water molecule chosen to be the system. Isolation is imposed by Environ, so although there are options on the Quantum-Espresso side (see Example 3), these are not necessary here. We start at the bottom of the file with the definition of the water molecule. Quantum Espresso expects the initial positions of the water in some consistent reasonable choice of units.

ATOMIC_SPECIES
 H   1  H.pbe-rrkjus.UPF
 O  16  O.pbe-rrkjus.UPF
ATOMIC_POSITIONS (bohr)
O   11.79  12.05  11.50
H   13.45  11.22  11.50
H   10.56  10.66  11.50

The atomic species keyword introduces each individual atom present in the system, along with their atomic mass and the name of the pseudopotential file they should refer to. Note that Quantum Espresso can have multiple entries of the same atomic species (which should be labelled differently). The pseudopotential files should be placed in a folder referenced by the pseudopotential directory choice (whose default can be set in the environment variables for Quantum Espresso, or manually set as we will show here in the input file).

[1]https://wiki.fysik.dtu.dk/ase/index.html
[2]https://www.quantum-espresso.org/Doc/INPUT_PW.html

Output Files

Unlike Quantum-ESPRESSO, which parses the entire output into an XML file, Environ currently relies solely on the output file and an associated environ-debug file (if the appropriate verbosity is set in the input). The reason for this is that Environ is currently a plugin and does not overwrite or modify any of the base Quantum-ESPRESSO files. Hence any additional output is only currently printed out into the terminal (or piped into an output file), or in environ specific output files. This may be dealt with more elegantly in the future.

Reading and Automation

When using Environ, it is more appropriate to rely on the direct output of the program. One can feed this into a file and parse that file, typically using grep on certain keywords, or using scripting. Users have developed post-processing tools for extracting information for personal use. These can be particularly attractive when running many simulations for a particular investigation and as such, it is likely that we will release some helpful post-processing tools along with future releases.

FAQ

This section attempts to address Frequently Asked Questions regarding Environ. If your query does not relate to any of these sections, check out the Q&A section on the website, which has instructions on joining the mailing group where you can chat with one of the developers.

Converge Issues

There are physical and/or numerical reasons for why a calculation may explode. The latter is easier to solve, by tuning some of the parameters in the input file. The former is a little more tricky to handle.

Roughly speaking, in a calculation with Environ, one needs to include some extra terms to the Kohn-Sham potential of the system in vacuum. These terms depend on the electronic density itself, in particular due to the fact that the interface between the system and the environment is defined in terms of the electronic density. Moreover, to compute one of these terms (e.g. the electrostatic interaction with the dielectric continuum), Environ uses an iterative approach, so at every SCF step, there is an additional iterative procedure performed by Environ, let’s call this the polarization iteration, in contrast to the SCF iteration.

There are two Environ parameters which are crucial to help convergence of the total SCF calculation, tol, which controls the convergence of the polarization iteration, and environ_thr, which determines when the polarization iteration starts.

When you decrease tol, the extra term coming from the interaction with the dielectric will be computed more accurately, but it will require more time to be computed. On the other hand, if the parameter is not set to be sufficiently accurate, the SCF procedure may not convergence as quickly, thus slowing the simulation down noticeably. Furthermore, a low convergence speed in the SCF may leads to oscillation around the SCF threshold, leading to convergence failure. Due to the fact that in general, the polarization iteration is less expensive than the SCF iteration, it is recommended that the user opts for a decreased tol when encountering these issues. Hence if in doubt, start with a generic value for the tolerance, be it the default or some value taken from the examples (depending on what you’re trying to simulate), and decrease if necessary.

The existence of environ_thr allows for better convergence in general, since it is advisable not to add polarization correction terms in the first few SCF steps, due to the fact the accuracy of these energy terms will still be poor (although if one is starting from a good set of input parameters, it is probably fine to enable the polarization correction from the start of the iteration, in which case the environ_restart = .true. will enable this). On the other hand, waiting too long to start adding Environ corrections can lead to poor convergence due to the fact that before the polarization iteration corrections kick in, the system is converging for vacuum, not a solution. Hence one can analyze the output file and see when the correction terms begin, in order to judge whether environ_thr is good or not. If the SCF accuracy explodes or converges poorly after the polarization iterations begin, it is recommended that one increases environ_thr. One rule of thumb to go by would be to make sure that Environ corrections skip only around 3-5 SCF steps.

A further source of errors may arise due to the use of pseudopotentials for handling core electrons. This problem is more common in transition metals of halogens, and it comes from the neglect of these core electrons in the charge density used to build the interface with the environment. In some cases there appears to be a hole in the charge density on the nuclei, which is then filled with the environment (in fact, a couple of the examples in the tutorial address this fact and account for it in the input file). The solution is to use solvent_mode = 'full'. This option adds additional gaussians centered on each atom, effectively describing the core electrons and thus not allowing the environment to permeate inside the atoms, while not compromising the definition of the interface.

Another suggestion is to simplify the physics in the problem. In particular, since in most applications the most important effects of the environment are the electrostatic ones, you may want to switch off all the other non-electrostatic terms. This is possible by setting environ_type = 'input' and manually setting the parameters that you want. By only setting env_static_permittivity = 78.3, one only retains the dielectric continuum in the calculation, since all other contributions are off by default.

When simulating a 2D system, convergence of the polarization potential is made more difficult by the artificial finite electric field coming from periodic boundary conditions. To avoid this, it would be better to use a PBC correction, in particular for slabs in Environ, a parabolic correction is implemented, and alternatively, one can utilize the Quantum ESPRESSO isolated options. See example 3 for a demonstration on isolated systems. Increasing the cellsize perpendicular to the slab will decrease periodic effects but increase convergence times due to the larger cell.

One reason of poor convergence is simply a complex shape of the interface. New releases implement models designed to deal with some of these complex shapes.

Harris-Foulkes Estimate

The Harris-Foulkes estimate does not take into account the extra terms coming from Environ, as it would cost more than necessary for a quantity that is only used to have an estimate. As a matter of fact, also the SCF accuracy does not take into full account of the environment, but again it would need a secondary correction that would cost more than its utility.

Environ Total-Energy Sum

The energy output in an Environ calculation may be confusing in that the total energy is not the sum of the reported terms and it is not immediately clear what solvation energy means, but before going into the details of why, one point should be addressed. dGsol, and in particular dGel, are not quantities that you get from a single calculation in solution, but rather are obtained as the difference in energy from a calculation fully optimized (nuclei and electrons) in solution minus a calculation fully optimized (nuclei and electrons) in vacuum. This is explained in Example 1 of the Tutorial. In general, for these values, one needs two geometry optimization (relax) calculations for these energy values that are typically reported in our publications. Hence solvation energy requires two calculations.

The different terms do not add to the same energy due to the fact that there is a spurious extra term which is subtracted from the one-electron contribution, but is not reported in the output. The reason is that total energy is computed in pw making use of the secular expression (see for example W. E. Pickett, Computer Physics Reports, 9(3), 115-198, 1989, equations 5.21-5.22 etc.), thus from the sum of occupied states eigenvalues (so called band structure energy, “eband” in pw.x), in which some contributions are included correctly (the kinetic and the electron-nuclei interaction), some are double counted (hartree), some need to be removed and added back with the correct expression (xc term), and some are missing (nuclei-nuclei interaction via ewald sum). What PW reports in the output as the one-electron contribution is in fact ebands minus the double counted hartree and minus the wrong xc term (these spurious terms are summed up in pw.x into a term named “deband”).

Similarly, when performing the solvated calculation, there are some terms which are double counted (the electronic part of the solvation energy), some that are missing (the ionic part of the solvation energy), some that have the wrong expression (pressure and cavitation) and some that need to be removed (for example a term coming from the rho-dependence of the dielectric constant). All these spurious terms are collected in a term named “deenviron”, which has the same meaning as “deband” seen above. To get to the point, what is wrong in the output is the one-electron contribution, which is reported including the spurious deenviron term. As the Environ module was designed not to affect the standard printout of QE, this output was not modified, and consequently, the terms do not sum to the correct total energy. The correction deenviron and deband terms were not reported, due to their insignifance in anything alone. However, this may well change in future Environ releases.

Indices and tables