PySCF Support#
Compatibility layer for supporting DFT-D4 in pyscf.
- class dftd4.pyscf.DFTD4Dispersion(*args, **kwargs)[source]#
Implementation of the interface for using DFT-D4 in pyscf.
Examples
>>> from pyscf import gto >>> import dftd4.pyscf as disp >>> mol = gto.M( ... atom=''' ... C -0.755422531 -0.796459123 -1.023590391 ... C 0.634274834 -0.880017014 -1.075233285 ... C 1.406955202 0.199695367 -0.653144334 ... C 0.798863737 1.361204515 -0.180597909 ... C -0.593166787 1.434312023 -0.133597923 ... C -1.376239198 0.359205222 -0.553258516 ... I -1.514344238 3.173268101 0.573601106 ... H 1.110906949 -1.778801728 -1.440619836 ... H 1.399172302 2.197767355 0.147412751 ... H 2.486417780 0.142466525 -0.689380574 ... H -2.454252250 0.422581120 -0.512807958 ... H -1.362353593 -1.630564523 -1.348743149 ... S -3.112683203 6.289227834 1.226984439 ... H -4.328789697 5.797771251 0.973373089 ... C -2.689135032 6.703163830 -0.489062886 ... H -1.684433029 7.115457372 -0.460265708 ... H -2.683867206 5.816530502 -1.115183775 ... H -3.365330613 7.451201412 -0.890098894 ... ''' ... ) >>> d4 = disp.DFTD4Dispersion(mol, xc="r2SCAN") >>> d4.kernel()[0] array(-0.0050011)
- dftd4.pyscf.energy(mf, model='d4')[source]#
Apply DFT-D4 corrections to SCF or MCSCF methods by returning an instance of a new class built from the original instances class.
- Parameters:
mf – The method to which DFT-D4 corrections will be applied.
model – The DFT-D4 model to use (D4S or D4 (default)).
- Return type:
The method with DFT-D4 corrections applied.
Examples
>>> from pyscf import gto, scf >>> import dftd4.pyscf as disp >>> mol = gto.M( ... atom=''' ... N -1.57871857 -0.04661102 0.00000000 ... N 1.57871857 0.04661102 0.00000000 ... H -2.15862174 0.13639605 0.80956529 ... H -0.84947130 0.65819321 0.00000000 ... H -2.15862174 0.13639605 -0.80956529 ... H 2.15862174 -0.13639605 -0.80956529 ... H 0.84947130 -0.65819321 0.00000000 ... H 2.15862174 -0.13639605 0.80956529 ... ''' ... ) >>> mf = disp.energy(scf.RHF(mol)).run() converged SCF energy = -110.917424528592 >>> mf.kernel() -110.917424528592
- dftd4.pyscf.grad(mfgrad)[source]#
Apply DFT-D4 corrections to SCF or MCSCF nuclear gradients methods by returning an instance of a new class built from the original class.
- Parameters:
mfgrad – The method to which DFT-D4 corrections will be applied.
- Return type:
The method with DFT-D4 corrections applied.
Examples
>>> from pyscf import gto, scf >>> import dftd4.pyscf as disp >>> mol = gto.M( ... atom=''' ... O -1.65542061 -0.12330038 0.00000000 ... O 1.24621244 0.10268870 0.00000000 ... H -0.70409026 0.03193167 0.00000000 ... H -2.03867273 0.75372294 0.00000000 ... H 1.57598558 -0.38252146 -0.75856129 ... H 1.57598558 -0.38252146 0.75856129 ... ''' ... ) >>> grad = disp.energy(scf.RHF(mol)).run().nuc_grad_method() converged SCF energy = -149.939098424774 >>> g = grad.kernel() --------------- DFTD4 gradients --------------- x y z 0 O 0.0172438133 0.0508406920 0.0000000000 1 O 0.0380018285 -0.0460223790 -0.0000000000 2 H -0.0305058266 -0.0126478132 -0.0000000000 3 H 0.0069233858 -0.0382898692 -0.0000000000 4 H -0.0158316004 0.0230596847 0.0218908543 5 H -0.0158316004 0.0230596847 -0.0218908543 ----------------------------------------------