2020-12-18 Reference energy

The reference energy is not important while the relative energy matters. One could use separate electrons and nuclei as the reference energy. A better solution is to have isolated atoms as reference.



zero PBC

For the isolated molecules, the cell must be orthogonal if one wants to use pbc=[0, 0, 0].


[gpaw-users] 2D PBC: 2D PBC is only implemented in LCAO and FD modes, but ignored in PW mode. Often, the dipole-layer correction isn't that important.

egg-box effect


gpaw.poisson.BadAxesError: Each axis must be periodic or orthogonal to other axes. But we have pbc=[0 0 0] and orthogonal=[0 0 1]


Density mixing

$$\rho^{in} _ {i+1} = \sum^{nmaxold} \alpha_i (\rho^{in} _ {i} + \beta (\rho^{out} _ {i} - \rho^{in} _ {i}))$$


vdW functional

optB88-vdW is not so robust in GPAW and less stable than other vdW functionals like (vdW-DF, optPBE-vdW, vdW-DF2). There are two methods to improve the SCF convergence of a optB88-vdW calculation.

calc = GPAW(mode='fd', xc='PBE',
            basis = 'dzp', kpts=(1, 1, 1),
            #mixer=Mixer(beta=0.05, nmaxold=5, weight=50),

opt = BFGS(atoms, trajectory='opt.traj', logfile='opt.log')

These strategies are working well for 'fd' mode, but not so well for the plane wave mode. For example, in the case of coronene on a 7x7 2L graphite, optB88-vdW in the following scheme always failed.

optB86b-vdW is not supported in GPAW (at least until v20.1.0). In principle, one can add something in xc/ and xc/ to use optB86b-vdW.

# gpaw/xc/
        if name in ['vdW-DF', 'vdW-DF2', 'optPBE-vdW', 'optB88-vdW', 'optB86b-vdW',
                    'C09-vdW', 'mBEEF-vdW', 'BEEF-vdW']:
            from gpaw.xc.vdw import VDWFunctional
            return VDWFunctional(name, **kwargs)

# gpaw/xc/
    elif name == 'optB88-vdW':
        kernel = LibXC('GGA_X_OPTB88_VDW+LDA_C_PW')
    elif name == 'optB86b-vdW':
        kernel = LibXC('GGA_X_OPTB86B_VDW+LDA_C_PW')

However, GGA_X_OPTB86B_VDW is only available after LibXC 5.0.0 which currently has some compatibility issues with GPAW.

Custom xc

from gpaw.xc.libxc import LibXC
from gpaw.xc.gga import GGA
from gpaw import GPAW
class MyXC(GGA):
    def __init__(self, kernel, setup_name, *args, **kwargs):
        self.setup_name = setup_name
        GGA.__init__(self, kernel, *args, **kwargs)
    def get_setup_name(self):
        return self.setup_name
calc = GPAW(xc=MyXC(LibXC('GGA_X_OPTB88_VDW+LDA_C_PW'), 'revPBE'))


virtualenv --system-site-packages py3-ase-3.18.2

source /home/tang/python-virtualenv/py3-ase-3.18.2/bin/activate

git clone -b 19.8.1 gpaw-py3.6.3-v19.8.1-intel-2019

module load intel/2019.5.281
module load mpich/3.2
module load fftw/3.3.6-pl2

cd /home/tang/opt/gpaw/gpaw-py3.6.3-v19.8.1-intel-2019
python build_ext 2>&1 | tee gpaw_compile.txt
pip install .

GPAW v19.8.1 uses the following

compiler = 'mpicc'
mpicompiler = 'mpicc'
mpilinker = 'mpicc'

libraries = []
library_dirs = []
include_dirs = []
extra_link_args = []
extra_compile_args = ['-xSSE4.2',

# Use Intel MKL
libraries += ['mkl_sequential', 'mkl_core', 'mkl_rt', ]

# FFTW3:
fftw = True
if fftw:
    libraries += ['fftw3']

# ScaLAPACK (version 2.0.1+ required):
scalapack = True
if scalapack:
    libraries += ['mkl_scalapack_lp64', 'mkl_blacs_intelmpi_lp64']
    mpi_define_macros += [('GPAW_NO_UNDERSCORE_CBLACS', '1')]
    mpi_define_macros += [('GPAW_NO_UNDERSCORE_CSCALAPACK', '1')]

# - static linking:
if 0:
    xc = '/home/tang/opt/libxc/libxc-4.3.4-intel-2019-gpaw-20.1/'
    include_dirs += [xc + 'include']
    extra_link_args += [xc + 'lib/libxc.a']
    if 'xc' in libraries:

# - dynamic linking (requires rpath or setting LD_LIBRARY_PATH at runtime):
if 1:
    xc = '/home/tang/opt/libxc/libxc-4.3.4-intel-2019-gpaw-20.1/'
    include_dirs += [xc + 'include']
    library_dirs += [xc + 'lib']
    # You can use rpath to avoid changing LD_LIBRARY_PATH:
    extra_link_args += ['-Wl,-rpath={xc}/lib'.format(xc=xc)]
    if 'xc' not in libraries: