Skip to content

ajz34/vdw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vdw (my naïve wrapper of existing vDW packages for PySCF)

This package is my naïve wrapper of various existing vDW libraries for PySCF. Should be able to evaluate energy or force (gradient) of van der Waals correction to density functional methods.

This package is not aimed to be a pyscf extension module. It's just a wrapper.

Install

To install this package, you may download from pypi:

pip install pyvdw

To use DFTD3, DFTD4, or TS-vDW (from libmbd) or MBD methods, you may also manually install those libraries. This package is only an interface to those existing libraries.

conda install simple-dftd3 dftd3-python dftd4 dftd4-python libmbd -c conda-forge
pip install pyscf pymbd

I know that leaving the task of dependency packages installation to user is really inconvenient, but currently I don't know how to handle conda, pip and advanced packaging elegently. So if any pratical ideas on this, raise your issue >w<

Included vDW models

DFTD3

  • Package: simple-dftd3, https://github.com/awvwgk/simple-dftd3

  • Usage:

    from pyscf import gto, dft
    from vdw import to_dftd3
    mol = gto.Mole(atom="O; H 1 0.94; H 1 0.94 2 104.5", basis="cc-pVDZ").build()
    # Modified/Revisited BJ/Rational damping
    mf = to_dftd3(dft.RKS(mol, xc="PBE"), version="bjm").run()
    print(mf.e_vdw)  # -0.000347885
  • Versions and Citations:

    For any version of DFTD3, please first cite 10.1063/1.3382344. This is not formal citation recommendation, thus refer to original site DFTD3 and package simple-dftd3 for formal citation guide.

DFTD4

  • Package: dftd4, https://github.com/dftd4/dftd4

  • Usage:

    from pyscf import gto, dft
    from vdw import to_dftd4
    mol = gto.Mole(atom="O; H 1 0.94; H 1 0.94 2 104.5", basis="cc-pVDZ").build()
    # DFTD4 default bj-eeq-atm version
    mf = to_dftd4(dft.RKS(mol, xc="PBE")).run()
    print(mf.e_vdw)  # -0.000192782
  • Citations:

    For any version of DFTD4, please first cite 10.1063/1.5090222. This is not formal citation recommendation, thus refer to package dftd4 for formal citation guide.

TS and MBD

  • Package: libmbd, https://github.com/libmbd/libmbd

  • Usage:

    from pyscf import gto, dft
    from vdw import to_mbd
    mol = gto.Mole(atom="""
        O  0.  0.  0.
        H  0.  0.  1.
        H  0.  1.  0.
        O  0.  0.  2.
        H  0.  0.  3.
        H  0.  1.  2.""", basis="cc-pVDZ").build()
    # Tkatchenko-Scheffler 
    mf = to_mbd(dft.RKS(mol, xc="PBE"), variant="ts").run()
    print(mf.e_vdw)  # -0.000212847
    # MBD@rsSCS
    mf = to_mbd(dft.RKS(mol, xc="PBE"), variant="rsscs").run()
    print(mf.e_vdw)  # -0.001245831
  • Notice

    To calculate MBD or TS-vDW, free atomic volume is required. This is calculated, instead of preloaded, using basis set aug-cc-pVQZ. Value of this volume may be close to FHI-aims and Quantum Espresso. However, this calculation is relatively costly if your molecule and basis set is not large. Basis set error also occurs (where FHI-aims give free folume by highly efficient numerical radial Schrödinger equation).

  • Citations:

    This is not formal citation recommendation

More Examples

Refer to example folder for more examples.

Code Sources

This package uses or modifies existing codes.

The author is aware of previous efforts to implement vDW for PySCF, such as pyscf/dftd3 and pyscf/mbd. However, due to my own requirement for usage and API convenience, as well as my need to use TS-vDW, this simple hundreds-lines-of-code tiny package is built from existing various libraries.