1#! /usr/bin/env python3
2
3import numpy
4from functools import reduce
5from pyscf.pbc import gto, scf
6from pyscf.pbc import tools as pbctools
7
8alat0 = 3.6
9
10cell = gto.Cell()
11cell.a = (numpy.ones((3,3))-numpy.eye(3))*alat0/2.0
12cell.atom = (('C',0,0,0),('C',numpy.array([0.25,0.25,0.25])*alat0))
13cell.basis = 'gth-dzvp'
14cell.pseudo = 'gth-pade'
15cell.gs = [10]*3
16cell.verbose = 5
17cell.build()
18
19nk = [1,1,1]
20kpts = cell.make_kpts(nk)
21
22mf = scf.KRHF(cell)
23mf.chkfile = 'scf.dump'
24ehf = mf.kernel()
25
26import h5py
27
28from pyscftools import integrals_from_chkfile
29hcore = mf.get_hcore()                                   # obtain and store core hamiltonian
30fock = (hcore + mf.get_veff())                           # store fock matrix (required with orthoAO)
31X,nmo_per_kpt = integrals_from_chkfile.getOrthoAORotation(cell,kpts,1e-8)      # store rotation to orthogonal PAO basis
32with h5py.File(mf.chkfile) as fh5:
33  fh5['scf/hcore'] = hcore
34  fh5['scf/fock'] = fock
35  fh5['scf/orthoAORot'] = X
36  fh5['scf/nmo_per_kpt'] = nmo_per_kpt
37
38integrals_from_chkfile.eri_to_h5("choldump", "./scf.dump", orthoAO=False, gtol=1e-5, gtol_chol=1e-5)
39
40