GPAW

Mailist

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.

Parameters

PBC

zero PBC

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

2D PBC

[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

BadAxesError

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]

Eigensolver

Density mixing

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

xc

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),
            txt='gpaw.txt')
atoms.set_calculator(calc)
atoms.get_potential_energy()

atoms.calc.set(xc='optB88-vdW')
opt = BFGS(atoms, trajectory='opt.traj', logfile='opt.log')
opt.run(fmax=0.01)

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/init.py and xc/vdw.py to use optB86b-vdW.

# gpaw/xc/__init__.py
...
        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/vdw.py
...
    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'))

install

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 https://gitlab.com/gpaw/gpaw.git 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 setup.py build_ext 2>&1 | tee gpaw_compile.txt
pip install .

GPAW v19.8.1 uses the following customize.py

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

libraries = []
library_dirs = []
include_dirs = []
extra_link_args = []
extra_compile_args = ['-xSSE4.2',
                      '-O3',
                      '-ipo',
                      '-no-prec-div',
                      '-fPIC']

# 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:
        libraries.remove('xc')

# - 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:
        libraries.append('xc')