Using the Skala functional in PySCF#
The Skala functional can be used in PySCF by creating a new Kohn-Sham calculator based on the SkalaKS constructor.
This allows to perform self-consistent field calculations with most of the features available in PySCF, such as density fitting and Newton’s method.
from pyscf import gto
from skala.pyscf import SkalaKS
The Kohn-Sham calculator for the Skala functional is created from a regular PySCF molecule object.
By specifying the xc parameter as "skala-1.1", the Skala functional is automatically loaded and used for the calculations.
mol = gto.M(
atom="""H 0 0 0; H 0 0 1.4""",
basis="def2-tzvp",
)
ks = SkalaKS(mol, xc="skala-1.1")
ks.kernel()
print(ks.dump_scf_summary())
converged SCF energy = -1.07427604242999
**** SCF Summaries ****
Total Energy = -1.074276042429992
Nuclear Repulsion Energy = 0.377654773327513
One-electron Energy = -1.893183564405399
Two-electron Coulomb Energy = 0.989038385771856
DFT Exchange-Correlation Energy = -0.547785637123963
Empirical Dispersion Energy = -0.000328948758201
None
Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF_TOKEN to enable higher rate limits and faster downloads.
Note that using the Skala functional will automatically enable the D3 dispersion correction, which is a part of the Skala functional.
To disable the D3 correction, you can pass the with_dftd3 parameter as False when creating the Kohn-Sham calculator.
The Skala functional can be used with density fitting by calling the density_fit() method on the Kohn-Sham calculator or by setting the with_density_fit parameter to True when creating the calculator.
This will set up the necessary integrals and approximations for efficient calculations.
mol = gto.M(
atom="""H 0 0 0; H 0 0 1.4""",
basis="def2-tzvp",
)
ks = SkalaKS(
mol, xc="skala-1.1", with_density_fit=True, auxbasis="def2-universal-jkfit"
)
ks.kernel()
print(ks.dump_scf_summary())
converged SCF energy = -1.07439124085417
**** SCF Summaries ****
Total Energy = -1.074391240854174
Nuclear Repulsion Energy = 0.377654773327513
One-electron Energy = -1.893533472258385
Two-electron Coulomb Energy = 0.989527621479656
DFT Exchange-Correlation Energy = -0.548040163402957
Empirical Dispersion Energy = -0.000328948758201
None
Overwritten attributes nuc_grad_method Gradients of <class 'pyscf.df.df_jk.DFSkalaRKS'>
For challenging to converge systems, the Newton’s method can be used by calling the newton() method on the Kohn-Sham calculator.
Note, that you need to call density_fit() before using Newton’s method, to apply the density fitting to the Kohn-Sham calculator.
The calculator will automatically use the density fitting integrals for the Newton’s method if the with_density_fit and with_newton parameters are set to True.
mol = gto.M(
atom="""H 0 0 0; H 0 0 1.4""",
basis="def2-tzvp",
)
ks = SkalaKS(
mol,
xc="skala-1.1",
with_density_fit=True,
auxbasis="def2-universal-jkfit",
with_newton=True,
)
ks.kernel()
print(ks.dump_scf_summary())
converged SCF energy = -1.07439124117399
**** SCF Summaries ****
Total Energy = -1.074391241173994
Nuclear Repulsion Energy = 0.377654773327513
One-electron Energy = -1.893532234983623
Two-electron Coulomb Energy = 0.989524882290721
DFT Exchange-Correlation Energy = -0.548038661808606
Empirical Dispersion Energy = -0.000328948758201
None
Overwritten attributes nuc_grad_method Gradients of <class 'pyscf.soscf.newton_ah.SecondOrderDFSkalaRKS'>