21.7. Mixing PBC and molecular modules¶
The post-HF methods, as a standalone numerical solver, do not require the knowledge of the boundary condition. The calculations of finite-size systems and extend systems are distinguished by the boundary condition of integrals (and basis). The same post-HF solver can be used for both the finite-size problem and the periodic boundary problem if they have the similar Hamiltonian structure.
In PySCF, many molecular post-HF solvers has two implementations: incore and
outcore versions. They are differed by the treatments on the 2-electron
integrals. The incore solver takes the
df — Density fitting) from the underlying mean-field object as the two-electron
interaction part of the Hamiltonian while the outcore solver generates the
2-electron integrals (with free boundary condition) on the fly.
To use the molecular post-HF solvers in PBC code, we need ensure the incore
version solver being called.
_eri in mean-filed object is the straightforward way to
trigger the incore post-HF solver. If the allowed memory is big enough to
hold the entire 2-electron integral array, the gamma point HF solver always
generates and holds this array. A second choice is to set
cell which forces the program generating and holding
If the problem is big,
incore_anyway may overflow the available
Holding the full integral array
_eri in memory limits the problem size
one can treat. Using the density fitting object
with_df to hold the
integrals can overcome this problem. This architecture has been bound to PBC
and molecular mean-field modules. But the relevant post-HF density fitting
solvers are still in development thus this feature is not available in PySCF 1.2
Aside from the 2-electron integrals, there are some attributes and methods
required by the post-HF solver. They are
get_ovlp() for 1-electron integrals,
the numerical integration of DFT exchange-correlation functionals. They are all
overloaded in PBC mean-field object to produce the PBC integrals.
#!/usr/bin/env python ''' Gamma point post-HF calculation needs only real integrals. Methods implemented in finite-size system can be directly used here without any modification. ''' import numpy from pyscf.pbc import gto, scf cell = gto.M( a = numpy.eye(3)*3.5668, atom = '''C 0. 0. 0. C 0.8917 0.8917 0.8917 C 1.7834 1.7834 0. C 2.6751 2.6751 0.8917 C 1.7834 0. 1.7834 C 2.6751 0.8917 2.6751 C 0. 1.7834 1.7834 C 0.8917 2.6751 2.6751''', basis = '6-31g', verbose = 4, ) mf = scf.RHF(cell).density_fit() mf.with_df.mesh = *3 mf.kernel() # # Import CC, TDDFT moduel from the molecular implementations # from pyscf import cc, tddft mycc = cc.CCSD(mf) mycc.kernel() mytd = tddft.TDHF(mf) mytd.nstates = 5 mytd.kernel()