Skip to content
/ dh Public

A trial to implement doubly-hybrid interface to PySCF

License

Notifications You must be signed in to change notification settings

ajz34/dh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dh

Doubly hybrid methods for PySCF.

SCF must run in RI-JK currently. Correlation part (PT2 part) is definitely density fitting. Runs in disk-based way by default.

Usage

Energy evaluation

from pyscf import gto, dh
mol = gto.Mole(atom="O; H 1 0.94; H 1 0.94 2 104.5", basis="cc-pVDZ", verbose=0).build()
mf = dh.DFDH(mol, xc="XYG3").run()
print(mf.e_tot)  # -76.36230265411723 in Hartree

Name dh refers to Doubly Hybrid. DFDH refers to Density Fitting Doubly Hybrid.

Geometric optimization

from pyscf import gto, dh, data
from pyscf.geomopt.berny_solver import optimize  # or geometric_solver
mol = gto.Mole(atom="O; H 1 1.0; H 1 1.0 2 104.5", basis="cc-pVDZ", verbose=0).build()
mf = dh.DFDH(mol, xc="XYG3").nuc_grad_method()
mol_eq = optimize(mf)  # optimized molecule object
# print geom coordinates in Angstrom
print(mol_eq.atom_coords() * data.nist.BOHR)
# [[ 0.00573557  0.          0.00740783]
#  [ 0.9649555   0.          0.02121004]
#  [-0.22107107  0.          0.93952977]]

Polarizability

from pyscf import gto, dh
mol = gto.Mole(atom="O; H 1 0.94; H 1 0.94 2 104.5", basis="cc-pVDZ", verbose=0).build()
mf = dh.DFDH(mol, xc="XYG3").polar_method().run()
print(mf.pol_tot.trace() / 3)  # 4.9747082620200915 in a.u.

Hessian is currently not implemented.

Install

Pre-requisites

  • python >= 3.7

dh as PySCF extension

Refer to installation of PySCF Extension modules. Declare PYSCF_EXT_PATH=$PYSCF_EXT_PATH:/path/to/dh should work.

pyscf-tblis extension

This extension overwhelmingly relies on pyscf/pyscf-tblis. Also recommands modifing EINSUM_MAX_SIZE (in tblis_einsum.py) and lib_einsum_max_size (in your PySCF config, refer to PYSCF_CONFIG_FILE) to much smaller value for dh extension.

dftd3 extension

If you are not using functionals with "-D3" suffix, you can safely omit this part.

To calculate functionals that includes D3 dispersion correction, user may need to install pyscf/dftd3 as an extension of PySCF.

Furthermore, this extension requires a dynamic library libdftd3.so, which should be compiled by user.

  • Source code of the library could be accessed from ajz34/libdftd3;
  • Make the library in folder lib;
  • Copy the generated file libdftd3.so to path_to_pyscf_dftd3/pyscf/dftd3, where itrf.py exists.

A reminder to experienced PySCF users is that, the library ajz34/libdftd3 is not identical to it's original form cuanto/libdftd3. So please do not copy your old libdftd3.so to extension pyscf/dftd3.

Deprecation Notice

Version 0.1.3 of this extension dh corresponds to PySCF versions before 2022. For newer PySCF versions, dh v0.1.3 will not work due to code change of pyscf.dft.numint.cache_xc_kernel.

Version 0.1.4 of this extension dh corresponds to newer PySCF versions (v2.1.0).

Availibility and Limitations

  • Supported features: Res/Unrestricted single point energy, gradient, static polarizability for XYG3-like and B2PLYP-like doubly functionals
  • Supported doubly hybrid functional (and MP2, certainly) keywords:
    • MP2

    • Early XYG3 family: XYG3, XYGJ-OS, xDH-PBE0

    • xDH@B3LYP family: revXYG3, revXYGJ-OS, XYG5, XYGJ-OS5, XYG6, XYG7

    • B2P family: B2PLYP, B2PLYP-D3, B2GPPLYP, mPW2PLYP

    • PBE related: PBE0-DH, LS1DH-PBE, PBE0-2, PBE-QIDH

    • DSD family with D3(BJ) dispersion correction (version 2013): DSD-PBEP86-D3, DSD-PBEPBE-D3, DSD-BLYP-D3, DSD-PBEB95-D3

    • Non-consistent functionals: HF-B3LYP, HF-PBE0 (no PT2 contribution)

    • Self-defined functionals (only supports pure HF or hybrid GGA functionals, if gradient/electric property is required)

      Format: ("xc_SCF", "xc_energy", coef_PT2, coef_OS_PT2, coef_SS_PT2)

Default functional is XYG3 currently.

Warning: Energy of DFT-D3(BJ) dispersion functionals haven't been tested and compared to other softwares thoroughly!

Near Future Plans

  • Quadrupole;
  • Rectify APIs, and more formal logging and timing;
  • API document and user document;
  • Efficiency benchmarking
    • Preliminary tests shows good performance for small molecules with large basis sets;
    • Polarizability should gain much speedup due to its algorithm implementation.

Future Plans?

  • Another independent module (maybe called dheng) handling only energy evaluation for more doubly-hybrid functionals, such as Laplace-transformation, long-range corrected PT2, renormalization based methods, random-phase-approximation (RPA) based methods, etc.;
  • Hessian and dipole-derivative;
  • Frozen core;
  • RIJONX, RICOSX and conventional SCF method supports;
  • Laplace-transformation method derivatives;
  • PBC energy;
  • Other derivative properties ...

Bibliography

  • For functional energy evaluation, refers to the origin paper of those functionals.

  • For first order properties (xDH atom nuclear gradient, dipole moment first implemented in local NWChem):

    Neil Qiang Su, Igor Ying Zhang, Xin Xu. J. Comput. Chem. 2013, 34, 1759-1774. doi: 10.1002/jcc.23312

    Analytic Derivatives for the XYG3 Type of Doubly Hybrid Density Functionals: Theory, Implementation, and Assessment

  • For second order properties (hessian of xDH obtained from conventional SCF/PT2 in local Gaussian 09, where polarizability is also implemented) that relates to this work:

    Yonghao Gu, Zhenyu Zhu, Xin Xu. submitted.

Predecessor of this work is Py_xDH.

About

A trial to implement doubly-hybrid interface to PySCF

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages