pyscf 2.6.2__py3-none-macosx_11_0_arm64.whl → 2.7.0__py3-none-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyscf/__init__.py +2 -2
- pyscf/adc/__init__.py +3 -8
- pyscf/adc/dfadc.py +22 -6
- pyscf/adc/radc.py +106 -15
- pyscf/adc/radc_amplitudes.py +7 -1
- pyscf/adc/radc_ao2mo.py +4 -2
- pyscf/adc/radc_ea.py +524 -8
- pyscf/adc/radc_ip.py +492 -60
- pyscf/adc/radc_ip_cvs.py +4 -2
- pyscf/adc/uadc.py +116 -27
- pyscf/adc/uadc_amplitudes.py +215 -20
- pyscf/adc/uadc_ao2mo.py +30 -9
- pyscf/adc/uadc_ea.py +34 -44
- pyscf/adc/uadc_ip.py +9 -4
- pyscf/adc/uadc_ip_cvs.py +4 -1
- pyscf/agf2/__init__.py +2 -2
- pyscf/agf2/aux_space.py +1 -1
- pyscf/agf2/chkfile.py +1 -1
- pyscf/ao2mo/outcore.py +6 -4
- pyscf/cc/__init__.py +21 -3
- pyscf/cc/bccd.py +0 -46
- pyscf/cc/ccsd.py +16 -8
- pyscf/cc/uccsd.py +1 -1
- pyscf/data/elements.py +1 -1
- pyscf/df/__init__.py +2 -1
- pyscf/df/addons.py +79 -51
- pyscf/df/autoaux.py +191 -0
- pyscf/df/df.py +5 -1
- pyscf/df/grad/casscf.py +0 -41
- pyscf/df/hessian/rhf.py +2 -10
- pyscf/df/hessian/rks.py +1 -7
- pyscf/df/hessian/uhf.py +3 -13
- pyscf/df/hessian/uks.py +1 -8
- pyscf/df/incore.py +17 -5
- pyscf/dft/dks.py +1 -1
- pyscf/dft/libxc.py +65 -639
- pyscf/dft/numint.py +7 -3
- pyscf/dft/radi.py +39 -5
- pyscf/dft/rks.py +1 -1
- pyscf/dft/xc_deriv.py +1 -1
- pyscf/dft/xcfun.py +53 -2
- pyscf/eph/eph_fd.py +1 -1
- pyscf/eph/rhf.py +6 -36
- pyscf/eph/rks.py +0 -4
- pyscf/eph/uhf.py +1 -7
- pyscf/eph/uks.py +1 -7
- pyscf/fci/addons.py +117 -2
- pyscf/fci/cistring.py +1 -1
- pyscf/fci/direct_nosym.py +3 -3
- pyscf/fci/direct_spin0_symm.py +22 -43
- pyscf/fci/direct_spin1.py +65 -9
- pyscf/fci/direct_spin1_symm.py +49 -14
- pyscf/fci/direct_uhf.py +4 -4
- pyscf/fci/selected_ci_symm.py +1 -1
- pyscf/grad/lagrange.py +11 -3
- pyscf/grad/mp2.py +1 -1
- pyscf/grad/sacasscf.py +1 -1
- pyscf/grad/tdrks.py +1 -1
- pyscf/gto/basis/__init__.py +7 -0
- pyscf/gto/basis/bse.py +68 -15
- pyscf/gto/basis/parse_cp2k_pp.py +1 -1
- pyscf/gto/basis/parse_nwchem.py +1 -1
- pyscf/gto/basis/parse_nwchem_ecp.py +2 -1
- pyscf/gto/basis/sap_grasp_large.dat +2438 -0
- pyscf/gto/basis/sap_grasp_small.dat +1434 -0
- pyscf/gto/mole.py +99 -44
- pyscf/gw/gw_ac.py +2 -2
- pyscf/gw/gw_cd.py +2 -2
- pyscf/gw/rpa.py +2 -2
- pyscf/gw/ugw_ac.py +2 -2
- pyscf/gw/urpa.py +1 -1
- pyscf/hessian/rhf.py +30 -128
- pyscf/hessian/rks.py +1 -6
- pyscf/hessian/uhf.py +28 -138
- pyscf/hessian/uks.py +1 -8
- pyscf/lib/ao2mo/nr_ao2mo.c +1 -1
- pyscf/lib/ao2mo/nrr_ao2mo.c +1 -1
- pyscf/lib/ao2mo/r_ao2mo.c +1 -1
- pyscf/lib/cc/ccsd_pack.c +1 -1
- pyscf/lib/cc/ccsd_t.c +6 -6
- pyscf/lib/cc/uccsd_t.c +4 -4
- pyscf/lib/deps/include/XCFun/XCFunExport.h +1 -0
- pyscf/lib/dft/grid_common.c +1 -1
- pyscf/lib/dft/libxc_itrf.c +4 -1
- pyscf/lib/dft/xcfun_itrf.c +1 -1
- pyscf/lib/diis.py +1 -1
- pyscf/lib/exceptions.py +3 -0
- pyscf/lib/gto/fill_grids_int2c.c +11 -9
- pyscf/lib/gto/fill_int2e.c +7 -5
- pyscf/lib/gto/fill_r_4c.c +1 -1
- pyscf/lib/gto/ft_ao.c +1 -1
- pyscf/lib/gto/ft_ao.h +1 -1
- pyscf/lib/gto/gto.h +2 -2
- pyscf/lib/gto/nr_ecp.c +3 -2
- pyscf/lib/libagf2.dylib +0 -0
- pyscf/lib/libao2mo.dylib +0 -0
- pyscf/lib/libcc.dylib +0 -0
- pyscf/lib/libcgto.dylib +0 -0
- pyscf/lib/libcvhf.dylib +0 -0
- pyscf/lib/libdft.dylib +0 -0
- pyscf/lib/libfci.dylib +0 -0
- pyscf/lib/libmcscf.dylib +0 -0
- pyscf/lib/libnp_helper.dylib +0 -0
- pyscf/lib/libpbc.dylib +0 -0
- pyscf/lib/libri.dylib +0 -0
- pyscf/lib/libxc_itrf.dylib +0 -0
- pyscf/lib/libxcfun_itrf.dylib +0 -0
- pyscf/lib/linalg_helper.py +112 -192
- pyscf/lib/mcscf/fci_contract.c +2 -2
- pyscf/lib/misc.py +47 -14
- pyscf/lib/numpy_helper.py +1 -1
- pyscf/lib/pbc/nr_ecp.c +10 -3
- pyscf/lib/pbc/pbc.h +1 -1
- pyscf/lib/vhf/nr_sgx_direct.c +8 -6
- pyscf/lib/vhf/optimizer.c +2 -2
- pyscf/lo/iao.py +1 -1
- pyscf/lo/ibo.py +3 -3
- pyscf/lo/pipek_jacobi.py +1 -1
- pyscf/mcscf/__init__.py +2 -2
- pyscf/mcscf/addons.py +3 -3
- pyscf/mcscf/apc.py +2 -2
- pyscf/mcscf/casci.py +8 -6
- pyscf/mcscf/chkfile.py +70 -41
- pyscf/mcscf/dmet_cas.py +2 -2
- pyscf/mcscf/mc1step.py +62 -38
- pyscf/mcscf/newton_casscf.py +5 -5
- pyscf/mcscf/ucasci.py +1 -1
- pyscf/mcscf/umc1step.py +44 -25
- pyscf/md/integrators.py +3 -3
- pyscf/mp/mp2.py +6 -5
- pyscf/mp/ump2.py +7 -6
- pyscf/pbc/adc/kadc_rhf.py +1 -1
- pyscf/pbc/adc/kadc_rhf_amplitudes.py +2 -2
- pyscf/pbc/ao2mo/eris.py +1 -1
- pyscf/pbc/cc/kccsd_rhf.py +3 -3
- pyscf/pbc/cc/kccsd_t_rhf.py +2 -2
- pyscf/pbc/ci/kcis_rhf.py +2 -2
- pyscf/pbc/df/aft.py +2 -2
- pyscf/pbc/df/aft_ao2mo.py +1 -1
- pyscf/pbc/df/df.py +84 -11
- pyscf/pbc/df/df_jk.py +2 -1
- pyscf/pbc/df/fft.py +6 -2
- pyscf/pbc/df/fft_ao2mo.py +4 -0
- pyscf/pbc/df/fft_jk.py +11 -3
- pyscf/pbc/df/ft_ao.py +4 -3
- pyscf/pbc/df/gdf_builder.py +5 -4
- pyscf/pbc/df/incore.py +1 -1
- pyscf/pbc/df/mdf.py +6 -3
- pyscf/pbc/df/rsdf.py +2 -2
- pyscf/pbc/df/rsdf_builder.py +11 -6
- pyscf/pbc/df/rsdf_helper.py +1 -1
- pyscf/pbc/dft/cdft.py +5 -5
- pyscf/pbc/dft/multigrid/multigrid.py +19 -26
- pyscf/pbc/dft/multigrid/multigrid_pair.py +1 -1
- pyscf/pbc/dft/multigrid/pp.py +1 -1
- pyscf/pbc/dft/numint.py +30 -21
- pyscf/pbc/eph/eph_fd.py +1 -1
- pyscf/pbc/geomopt/geometric_solver.py +1 -1
- pyscf/pbc/gto/cell.py +37 -19
- pyscf/pbc/gto/ecp.py +12 -12
- pyscf/pbc/gto/eval_gto.py +2 -2
- pyscf/pbc/gto/pseudo/pp.py +1 -1
- pyscf/pbc/gw/krgw_ac.py +4 -4
- pyscf/pbc/gw/krgw_cd.py +4 -4
- pyscf/pbc/gw/kugw_ac.py +3 -3
- pyscf/pbc/lib/kpts_helper.py +4 -3
- pyscf/pbc/lib/linalg_helper.py +1 -1
- pyscf/pbc/mp/kmp2.py +1 -1
- pyscf/pbc/mpitools/mpi.py +1 -1
- pyscf/pbc/scf/addons.py +15 -11
- pyscf/pbc/scf/cphf.py +1 -1
- pyscf/pbc/scf/ghf.py +1 -1
- pyscf/pbc/scf/hf.py +21 -24
- pyscf/pbc/scf/kghf.py +33 -29
- pyscf/pbc/scf/khf.py +71 -26
- pyscf/pbc/scf/krohf.py +5 -7
- pyscf/pbc/scf/kuhf.py +53 -22
- pyscf/pbc/scf/rsjk.py +13 -9
- pyscf/pbc/scf/scfint.py +1 -1
- pyscf/pbc/scf/stability.py +1 -1
- pyscf/pbc/scf/uhf.py +3 -1
- pyscf/pbc/symm/symmetry.py +2 -2
- pyscf/pbc/tdscf/kproxy.py +1 -1
- pyscf/pbc/tdscf/kproxy_supercell.py +2 -2
- pyscf/pbc/tdscf/krhf.py +215 -133
- pyscf/pbc/tdscf/krhf_slow_supercell.py +1 -1
- pyscf/pbc/tdscf/krks.py +1 -45
- pyscf/pbc/tdscf/kuhf.py +58 -105
- pyscf/pbc/tdscf/kuks.py +0 -56
- pyscf/pbc/tdscf/proxy.py +1 -1
- pyscf/pbc/tdscf/rhf.py +111 -3
- pyscf/pbc/tdscf/rks.py +2 -1
- pyscf/pbc/tdscf/uhf.py +203 -1
- pyscf/pbc/tdscf/uks.py +2 -1
- pyscf/pbc/tools/k2gamma.py +7 -4
- pyscf/pbc/tools/pbc.py +63 -56
- pyscf/pbc/tools/pyscf_ase.py +0 -1
- pyscf/pbc/tools/pywannier90.py +1 -1
- pyscf/qmmm/mm_mole.py +1 -1
- pyscf/scf/_response_functions.py +2 -2
- pyscf/scf/_vhf.py +14 -10
- pyscf/scf/addons.py +29 -15
- pyscf/scf/cphf.py +14 -52
- pyscf/scf/dhf.py +39 -10
- pyscf/scf/dispersion.py +9 -8
- pyscf/scf/ghf.py +25 -13
- pyscf/scf/ghf_symm.py +2 -2
- pyscf/scf/hf.py +245 -29
- pyscf/scf/rohf.py +37 -5
- pyscf/scf/stability.py +142 -112
- pyscf/scf/ucphf.py +21 -16
- pyscf/scf/uhf.py +95 -58
- pyscf/sgx/sgx.py +1 -1
- pyscf/sgx/sgx_jk.py +4 -4
- pyscf/solvent/_ddcosmo_tdscf_grad.py +1 -1
- pyscf/solvent/ddcosmo.py +1 -1
- pyscf/solvent/pol_embed.py +1 -1
- pyscf/soscf/ciah.py +1 -1
- pyscf/soscf/newton_ah.py +1 -1
- pyscf/symm/__init__.py +1 -1
- pyscf/symm/addons.py +5 -5
- pyscf/tdscf/_lr_eig.py +505 -0
- pyscf/tdscf/common_slow.py +1 -1
- pyscf/tdscf/dhf.py +41 -37
- pyscf/tdscf/dks.py +0 -4
- pyscf/tdscf/ghf.py +91 -71
- pyscf/tdscf/gks.py +16 -16
- pyscf/tdscf/proxy.py +2 -2
- pyscf/tdscf/rhf.py +143 -96
- pyscf/tdscf/rks.py +15 -14
- pyscf/tdscf/uhf.py +117 -70
- pyscf/tdscf/uks.py +17 -18
- pyscf/tools/fcidump.py +3 -0
- pyscf/x2c/sfx2c1e.py +1 -1
- pyscf/x2c/tdscf.py +4 -4
- pyscf/x2c/x2c.py +15 -11
- {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/METADATA +24 -24
- {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/NOTICE +3 -1
- {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/RECORD +242 -240
- {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/WHEEL +1 -1
- pyscf/dft/gen_libxc_param.py +0 -35
- pyscf/dft/gen_xcfun_param.py +0 -209
- {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/LICENSE +0 -0
- {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/top_level.txt +0 -0
|
@@ -13,7 +13,7 @@ regular `numpy.linalg.eig` can be used to retrieve TD roots. Several variants of
|
|
|
13
13
|
* (this module) `pyscf.pbc.tdscf.kproxy_supercell`: PBC implementation constructing supercells. Works with an arbitrary number of
|
|
14
14
|
k-points but has an overhead due to ignoring the momentum conservation law. In addition, works only with
|
|
15
15
|
time reversal invariant (TRI) models: i.e. the k-point grid has to be aligned and contain at least one TRI momentum.
|
|
16
|
-
* `pyscf.pbc.tdscf.kproxy`: same as the above but respect the momentum conservation and, thus,
|
|
16
|
+
* `pyscf.pbc.tdscf.kproxy`: same as the above but respect the momentum conservation and, thus, diagonalizes smaller
|
|
17
17
|
matrices (the performance gain is the total number of k-points in the model).
|
|
18
18
|
"""
|
|
19
19
|
|
|
@@ -495,7 +495,7 @@ def orb2ov(space, nocc, nmo):
|
|
|
495
495
|
"""
|
|
496
496
|
Converts orbital active space specification into ov-pairs space spec.
|
|
497
497
|
Args:
|
|
498
|
-
space (ndarray): the
|
|
498
|
+
space (ndarray): the orbital space. Basis order: [k, orb=o+v];
|
|
499
499
|
nocc (Iterable): the numbers of occupied orbitals per k-point;
|
|
500
500
|
nmo (Iterable): the total numbers of orbitals per k-point;
|
|
501
501
|
|
pyscf/pbc/tdscf/krhf.py
CHANGED
|
@@ -26,10 +26,11 @@ from pyscf import lib
|
|
|
26
26
|
from pyscf.lib import linalg_helper
|
|
27
27
|
from pyscf.lib import logger
|
|
28
28
|
from pyscf.tdscf import rhf
|
|
29
|
+
from pyscf.tdscf._lr_eig import eigh as lr_eigh, eig as lr_eig
|
|
29
30
|
from pyscf.pbc import scf
|
|
30
31
|
from pyscf.pbc.tdscf.rhf import TDBase
|
|
31
32
|
from pyscf.pbc.scf import _response_functions # noqa
|
|
32
|
-
from pyscf.pbc.lib.kpts_helper import
|
|
33
|
+
from pyscf.pbc.lib.kpts_helper import is_gamma_point, get_kconserv_ria, conj_mapping
|
|
33
34
|
from pyscf.pbc.df.df_ao2mo import warn_pbc2d_eri
|
|
34
35
|
from pyscf.pbc import df as pbcdf
|
|
35
36
|
from pyscf.data import nist
|
|
@@ -37,8 +38,139 @@ from pyscf import __config__
|
|
|
37
38
|
|
|
38
39
|
REAL_EIG_THRESHOLD = getattr(__config__, 'pbc_tdscf_rhf_TDDFT_pick_eig_threshold', 1e-3)
|
|
39
40
|
|
|
41
|
+
def get_ab(mf, kshift=0):
|
|
42
|
+
r'''A and B matrices for TDDFT response function.
|
|
43
|
+
|
|
44
|
+
A[i,a,j,b] = \delta_{ab}\delta_{ij}(E_a - E_i) + (ia||bj)
|
|
45
|
+
B[i,a,j,b] = (ia||jb)
|
|
46
|
+
|
|
47
|
+
Ref: Chem Phys Lett, 256, 454
|
|
48
|
+
|
|
49
|
+
Kwargs:
|
|
50
|
+
kshift : integer
|
|
51
|
+
The index of the k-point that represents the transition between
|
|
52
|
+
k-points in the excitation coefficients.
|
|
53
|
+
'''
|
|
54
|
+
cell = mf.cell
|
|
55
|
+
mo_energy = scf.addons.mo_energy_with_exxdiv_none(mf)
|
|
56
|
+
mo = numpy.asarray(mf.mo_coeff)
|
|
57
|
+
mo_occ = numpy.asarray(mf.mo_occ)
|
|
58
|
+
kpts = mf.kpts
|
|
59
|
+
nkpts, nao, nmo = mo.shape
|
|
60
|
+
noccs = numpy.count_nonzero(mo_occ==2, axis=1)
|
|
61
|
+
nocc = noccs[0]
|
|
62
|
+
nvir = nmo - nocc
|
|
63
|
+
assert all(noccs == nocc)
|
|
64
|
+
orbo = mo[:,:,:nocc]
|
|
65
|
+
orbv = mo[:,:,nocc:]
|
|
66
|
+
|
|
67
|
+
kconserv = get_kconserv_ria(cell, kpts)[kshift]
|
|
68
|
+
e_ia = numpy.asarray(_get_e_ia(mo_energy, mo_occ, kconserv)).astype(mo.dtype)
|
|
69
|
+
a = numpy.diag(e_ia.ravel()).reshape(nkpts,nocc,nvir,nkpts,nocc,nvir)
|
|
70
|
+
b = numpy.zeros_like(a)
|
|
71
|
+
weight = 1./nkpts
|
|
72
|
+
|
|
73
|
+
def add_hf_(a, b, hyb=1):
|
|
74
|
+
eri = mf.with_df.ao2mo_7d([orbo,mo,mo,mo], kpts)
|
|
75
|
+
eri *= weight
|
|
76
|
+
eri = eri.reshape(nkpts,nkpts,nkpts,nocc,nmo,nmo,nmo)
|
|
77
|
+
for ki, ka in enumerate(kconserv):
|
|
78
|
+
for kj, kb in enumerate(kconserv):
|
|
79
|
+
a[ki,:,:,kj] += numpy.einsum('iabj->iajb', eri[ki,ka,kb,:nocc,nocc:,nocc:,:nocc]) * 2
|
|
80
|
+
a[ki,:,:,kj] -= numpy.einsum('ijba->iajb', eri[ki,kj,kb,:nocc,:nocc,nocc:,nocc:]) * hyb
|
|
81
|
+
|
|
82
|
+
for kb, kj in enumerate(kconserv):
|
|
83
|
+
b[ki,:,:,kj] += numpy.einsum('iajb->iajb', eri[ki,ka,kj,:nocc,nocc:,:nocc,nocc:]) * 2
|
|
84
|
+
b[ki,:,:,kj] -= numpy.einsum('ibja->iajb', eri[ki,kb,kj,:nocc,nocc:,:nocc,nocc:]) * hyb
|
|
85
|
+
|
|
86
|
+
if isinstance(mf, scf.hf.KohnShamDFT):
|
|
87
|
+
assert kshift == 0
|
|
88
|
+
ni = mf._numint
|
|
89
|
+
omega, alpha, hyb = ni.rsh_and_hybrid_coeff(mf.xc, cell.spin)
|
|
90
|
+
|
|
91
|
+
add_hf_(a, b, hyb)
|
|
92
|
+
if omega != 0: # For RSH
|
|
93
|
+
raise NotImplementedError
|
|
94
|
+
|
|
95
|
+
xctype = ni._xc_type(mf.xc)
|
|
96
|
+
dm0 = mf.make_rdm1(mo, mo_occ)
|
|
97
|
+
make_rho = ni._gen_rho_evaluator(cell, dm0, hermi=1, with_lapl=False)[0]
|
|
98
|
+
mem_now = lib.current_memory()[0]
|
|
99
|
+
max_memory = max(2000, mf.max_memory*.8-mem_now)
|
|
100
|
+
cmap = conj_mapping(cell, kpts)
|
|
101
|
+
|
|
102
|
+
if xctype == 'LDA':
|
|
103
|
+
ao_deriv = 0
|
|
104
|
+
for ao, _, mask, weight, coords \
|
|
105
|
+
in ni.block_loop(cell, mf.grids, nao, ao_deriv, kpts, None, max_memory):
|
|
106
|
+
rho = make_rho(0, ao, mask, xctype)
|
|
107
|
+
fxc = ni.eval_xc_eff(mf.xc, rho, deriv=2, xctype=xctype)[2]
|
|
108
|
+
wfxc = fxc[0,0] * weight
|
|
109
|
+
|
|
110
|
+
rho_o = lib.einsum('krp,kpi->kri', ao, orbo)
|
|
111
|
+
rho_v = lib.einsum('krp,kpi->kri', ao, orbv)
|
|
112
|
+
rho_ov = numpy.einsum('kri,kra->kria', rho_o, rho_v)
|
|
113
|
+
w_ov = numpy.einsum('kria,r->kria', rho_ov, wfxc) * (2/nkpts)
|
|
114
|
+
rho_vo = rho_ov.conj()[cmap]
|
|
115
|
+
a += lib.einsum('kria,lrjb->kialjb', w_ov, rho_vo)
|
|
116
|
+
b += lib.einsum('kria,lrjb->kialjb', w_ov, rho_ov)
|
|
117
|
+
|
|
118
|
+
elif xctype == 'GGA':
|
|
119
|
+
ao_deriv = 1
|
|
120
|
+
for ao, _, mask, weight, coords \
|
|
121
|
+
in ni.block_loop(cell, mf.grids, nao, ao_deriv, kpts, None, max_memory):
|
|
122
|
+
rho = make_rho(0, ao, mask, xctype)
|
|
123
|
+
fxc = ni.eval_xc_eff(mf.xc, rho, deriv=2, xctype=xctype)[2]
|
|
124
|
+
wfxc = fxc * weight
|
|
125
|
+
rho_o = lib.einsum('kxrp,kpi->kxri', ao, orbo)
|
|
126
|
+
rho_v = lib.einsum('kxrp,kpi->kxri', ao, orbv)
|
|
127
|
+
rho_ov = numpy.einsum('kxri,kra->kxria', rho_o, rho_v[:,0])
|
|
128
|
+
rho_ov[:,1:4] += numpy.einsum('kri,kxra->kxria', rho_o[:,0], rho_v[:,1:4])
|
|
129
|
+
w_ov = numpy.einsum('xyr,kxria->kyria', wfxc, rho_ov) * (2/nkpts)
|
|
130
|
+
rho_vo = rho_ov.conj()[cmap]
|
|
131
|
+
a += lib.einsum('kxria,lxrjb->kialjb', w_ov, rho_vo)
|
|
132
|
+
b += lib.einsum('kxria,lxrjb->kialjb', w_ov, rho_ov)
|
|
133
|
+
|
|
134
|
+
elif xctype == 'HF':
|
|
135
|
+
pass
|
|
136
|
+
|
|
137
|
+
elif xctype == 'NLC':
|
|
138
|
+
raise NotImplementedError('NLC')
|
|
139
|
+
|
|
140
|
+
elif xctype == 'MGGA':
|
|
141
|
+
ao_deriv = 1
|
|
142
|
+
for ao, _, mask, weight, coords \
|
|
143
|
+
in ni.block_loop(cell, mf.grids, nao, ao_deriv, kpts, None, max_memory):
|
|
144
|
+
rho = make_rho(0, ao, mask, xctype)
|
|
145
|
+
fxc = ni.eval_xc_eff(mf.xc, rho, deriv=2, xctype=xctype)[2]
|
|
146
|
+
wfxc = fxc * weight
|
|
147
|
+
rho_o = lib.einsum('kxrp,kpi->kxri', ao, orbo)
|
|
148
|
+
rho_v = lib.einsum('kxrp,kpi->kxri', ao, orbv)
|
|
149
|
+
rho_ov = numpy.einsum('kxri,kra->kxria', rho_o, rho_v[:,0])
|
|
150
|
+
rho_ov[:,1:4] += numpy.einsum('kri,kxra->kxria', rho_o[:,0], rho_v[:,1:4])
|
|
151
|
+
tau_ov = numpy.einsum('kxri,kxra->kria', rho_o[:,1:4], rho_v[:,1:4]) * .5
|
|
152
|
+
rho_ov = numpy.concatenate([rho_ov, tau_ov[:,numpy.newaxis]], axis=1)
|
|
153
|
+
w_ov = numpy.einsum('xyr,kxria->kyria', wfxc, rho_ov) * (2/nkpts)
|
|
154
|
+
rho_vo = rho_ov.conj()[cmap]
|
|
155
|
+
a += lib.einsum('kxria,lxrjb->kialjb', w_ov, rho_vo)
|
|
156
|
+
b += lib.einsum('kxria,lxrjb->kialjb', w_ov, rho_ov)
|
|
157
|
+
else:
|
|
158
|
+
add_hf_(a, b)
|
|
159
|
+
|
|
160
|
+
return a, b
|
|
161
|
+
|
|
40
162
|
class KTDBase(TDBase):
|
|
41
|
-
|
|
163
|
+
'''
|
|
164
|
+
Attributes:
|
|
165
|
+
kshift_lst : list of integers
|
|
166
|
+
Each element in the list is the index of the k-point that
|
|
167
|
+
represents the transition between k-points in the excitation
|
|
168
|
+
coefficients.
|
|
169
|
+
'''
|
|
170
|
+
|
|
171
|
+
conv_tol = getattr(__config__, 'pbc_tdscf_rhf_TDA_conv_tol', 1e-4)
|
|
172
|
+
|
|
173
|
+
_keys = {'kshift_lst'}
|
|
42
174
|
|
|
43
175
|
def __init__(self, mf, kshift_lst=None):
|
|
44
176
|
assert isinstance(mf, scf.khf.KSCF)
|
|
@@ -46,8 +178,6 @@ class KTDBase(TDBase):
|
|
|
46
178
|
warn_pbc2d_eri(mf)
|
|
47
179
|
|
|
48
180
|
if kshift_lst is None: kshift_lst = [0]
|
|
49
|
-
|
|
50
|
-
self.kconserv = get_kconserv_ria(mf.cell, mf.kpts)
|
|
51
181
|
self.kshift_lst = kshift_lst
|
|
52
182
|
|
|
53
183
|
def dump_flags(self, verbose=None):
|
|
@@ -67,7 +197,6 @@ class KTDBase(TDBase):
|
|
|
67
197
|
log.info('conv_tol = %g', self.conv_tol)
|
|
68
198
|
log.info('eigh lindep = %g', self.lindep)
|
|
69
199
|
log.info('eigh level_shift = %g', self.level_shift)
|
|
70
|
-
log.info('eigh max_space = %d', self.max_space)
|
|
71
200
|
log.info('eigh max_cycle = %d', self.max_cycle)
|
|
72
201
|
log.info('chkfile = %s', self.chkfile)
|
|
73
202
|
log.info('max_memory %d MB (current use %d MB)',
|
|
@@ -79,7 +208,7 @@ class KTDBase(TDBase):
|
|
|
79
208
|
def check_sanity(self):
|
|
80
209
|
TDBase.check_sanity(self)
|
|
81
210
|
mf = self._scf
|
|
82
|
-
if any(
|
|
211
|
+
if any(k != 0 for k in self.kshift_lst):
|
|
83
212
|
if mf.rsjk is not None or not isinstance(mf.with_df, pbcdf.df.DF):
|
|
84
213
|
logger.error(self, 'Solutions with non-zero kshift for %s are '
|
|
85
214
|
'only supported by GDF/RSDF')
|
|
@@ -98,14 +227,22 @@ class KTDBase(TDBase):
|
|
|
98
227
|
get_nto = lib.invalid_method('get_nto')
|
|
99
228
|
|
|
100
229
|
class TDA(KTDBase):
|
|
101
|
-
conv_tol = getattr(__config__, 'pbc_tdscf_rhf_TDA_conv_tol', 1e-6)
|
|
102
230
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
231
|
+
@lib.with_doc(get_ab.__doc__)
|
|
232
|
+
def get_ab(self, mf=None, kshift=0):
|
|
233
|
+
if mf is None: mf = self._scf
|
|
234
|
+
return get_ab(mf, kshift)
|
|
235
|
+
|
|
236
|
+
def gen_vind(self, mf, kshift=0):
|
|
237
|
+
'''Compute Ax
|
|
238
|
+
|
|
239
|
+
Kwargs:
|
|
240
|
+
kshift : integer
|
|
241
|
+
The index of the k-point that represents the transition between
|
|
242
|
+
k-points in the excitation coefficients.
|
|
243
|
+
'''
|
|
107
244
|
singlet = self.singlet
|
|
108
|
-
kconserv =
|
|
245
|
+
kconserv = get_kconserv_ria(mf.cell, mf.kpts)[kshift]
|
|
109
246
|
|
|
110
247
|
mo_coeff = mf.mo_coeff
|
|
111
248
|
mo_occ = mf.mo_occ
|
|
@@ -114,7 +251,7 @@ class TDA(KTDBase):
|
|
|
114
251
|
occidx = [numpy.where(mo_occ[k]==2)[0] for k in range(nkpts)]
|
|
115
252
|
viridx = [numpy.where(mo_occ[k]==0)[0] for k in range(nkpts)]
|
|
116
253
|
orbo = [mo_coeff[k][:,occidx[k]] for k in range(nkpts)]
|
|
117
|
-
orbv = [mo_coeff[
|
|
254
|
+
orbv = [mo_coeff[k][:,viridx[k]] for k in range(nkpts)]
|
|
118
255
|
e_ia = _get_e_ia(scf.addons.mo_energy_with_exxdiv_none(mf), mo_occ, kconserv)
|
|
119
256
|
hdiag = numpy.hstack([x.ravel() for x in e_ia])
|
|
120
257
|
|
|
@@ -127,10 +264,10 @@ class TDA(KTDBase):
|
|
|
127
264
|
z1s = [_unpack(z, mo_occ, kconserv) for z in zs]
|
|
128
265
|
dmov = numpy.empty((nz,nkpts,nao,nao), dtype=numpy.complex128)
|
|
129
266
|
for i in range(nz):
|
|
130
|
-
for k in
|
|
267
|
+
for k, kp in enumerate(kconserv):
|
|
131
268
|
# *2 for double occupancy
|
|
132
269
|
dm1 = z1s[i][k] * 2
|
|
133
|
-
dmov[i,k] = reduce(numpy.dot, (orbo[k], dm1, orbv[
|
|
270
|
+
dmov[i,k] = reduce(numpy.dot, (orbo[k], dm1, orbv[kp].conj().T))
|
|
134
271
|
|
|
135
272
|
with lib.temporary_env(mf, exxdiv=None):
|
|
136
273
|
v1ao = vresp(dmov, kshift)
|
|
@@ -138,8 +275,8 @@ class TDA(KTDBase):
|
|
|
138
275
|
for i in range(nz):
|
|
139
276
|
dm1 = z1s[i]
|
|
140
277
|
v1 = []
|
|
141
|
-
for k in
|
|
142
|
-
v1vo = reduce(numpy.dot, (orbo[k].conj().T, v1ao[i,k], orbv[
|
|
278
|
+
for k, kp in enumerate(kconserv):
|
|
279
|
+
v1vo = reduce(numpy.dot, (orbo[k].conj().T, v1ao[i,k], orbv[kp]))
|
|
143
280
|
v1vo += e_ia[k] * dm1[k]
|
|
144
281
|
v1.append(v1vo.ravel())
|
|
145
282
|
v1s.append( numpy.concatenate(v1) )
|
|
@@ -151,13 +288,13 @@ class TDA(KTDBase):
|
|
|
151
288
|
|
|
152
289
|
mo_energy = mf.mo_energy
|
|
153
290
|
mo_occ = mf.mo_occ
|
|
154
|
-
kconserv =
|
|
291
|
+
kconserv = get_kconserv_ria(mf.cell, mf.kpts)[kshift]
|
|
155
292
|
e_ia = numpy.concatenate( [x.reshape(-1) for x in
|
|
156
293
|
_get_e_ia(mo_energy, mo_occ, kconserv)] )
|
|
157
294
|
|
|
158
295
|
nov = e_ia.size
|
|
159
296
|
nstates = min(nstates, nov)
|
|
160
|
-
e_threshold = numpy.
|
|
297
|
+
e_threshold = numpy.partition(e_ia, nstates-1)[nstates-1]
|
|
161
298
|
e_threshold += self.deg_eia_thresh
|
|
162
299
|
|
|
163
300
|
idx = numpy.where(e_ia <= e_threshold)[0]
|
|
@@ -188,13 +325,12 @@ class TDA(KTDBase):
|
|
|
188
325
|
return w[idx], v[:,idx], idx
|
|
189
326
|
|
|
190
327
|
log = logger.Logger(self.stdout, self.verbose)
|
|
191
|
-
precision = self.cell.precision * 1e-2
|
|
192
328
|
|
|
193
329
|
self.converged = []
|
|
194
330
|
self.e = []
|
|
195
331
|
self.xy = []
|
|
196
332
|
for i,kshift in enumerate(self.kshift_lst):
|
|
197
|
-
kconserv =
|
|
333
|
+
kconserv = get_kconserv_ria(mf.cell, mf.kpts)[kshift]
|
|
198
334
|
|
|
199
335
|
vind, hdiag = self.gen_vind(self._scf, kshift)
|
|
200
336
|
precond = self.get_precond(hdiag)
|
|
@@ -204,14 +340,10 @@ class TDA(KTDBase):
|
|
|
204
340
|
else:
|
|
205
341
|
x0k = x0[i]
|
|
206
342
|
|
|
207
|
-
converged, e, x1 =
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
nroots=self.nstates, lindep=self.lindep,
|
|
212
|
-
max_space=self.max_space, pick=pickeig,
|
|
213
|
-
fill_heff=purify_krlyov_heff(precision, 0, log),
|
|
214
|
-
verbose=self.verbose)
|
|
343
|
+
converged, e, x1 = lr_eigh(
|
|
344
|
+
vind, x0k, precond, tol_residual=self.conv_tol, lindep=self.lindep,
|
|
345
|
+
nroots=self.nstates, pick=pickeig, max_cycle=self.max_cycle,
|
|
346
|
+
max_memory=self.max_memory, verbose=log)
|
|
215
347
|
self.converged.append( converged )
|
|
216
348
|
self.e.append( e )
|
|
217
349
|
# 1/sqrt(2) because self.x is for alpha excitation amplitude and 2(X^+*X) = 1
|
|
@@ -223,14 +355,21 @@ class TDA(KTDBase):
|
|
|
223
355
|
CIS = KTDA = TDA
|
|
224
356
|
|
|
225
357
|
|
|
226
|
-
class TDHF(
|
|
227
|
-
|
|
358
|
+
class TDHF(KTDBase):
|
|
359
|
+
|
|
360
|
+
@lib.with_doc(get_ab.__doc__)
|
|
361
|
+
def get_ab(self, mf=None, kshift=0):
|
|
362
|
+
if mf is None: mf = self._scf
|
|
363
|
+
return get_ab(mf, kshift)
|
|
364
|
+
|
|
365
|
+
def gen_vind(self, mf, kshift=0):
|
|
228
366
|
'''
|
|
229
367
|
[ A B ][X]
|
|
230
368
|
[-B* -A*][Y]
|
|
231
369
|
'''
|
|
370
|
+
assert kshift == 0
|
|
371
|
+
|
|
232
372
|
singlet = self.singlet
|
|
233
|
-
kconserv = self.kconserv[kshift]
|
|
234
373
|
|
|
235
374
|
mo_coeff = mf.mo_coeff
|
|
236
375
|
mo_occ = mf.mo_occ
|
|
@@ -239,7 +378,9 @@ class TDHF(TDA):
|
|
|
239
378
|
occidx = [numpy.where(mo_occ[k]==2)[0] for k in range(nkpts)]
|
|
240
379
|
viridx = [numpy.where(mo_occ[k]==0)[0] for k in range(nkpts)]
|
|
241
380
|
orbo = [mo_coeff[k][:,occidx[k]] for k in range(nkpts)]
|
|
242
|
-
orbv = [mo_coeff[
|
|
381
|
+
orbv = [mo_coeff[k][:,viridx[k]] for k in range(nkpts)]
|
|
382
|
+
|
|
383
|
+
kconserv = numpy.arange(nkpts)
|
|
243
384
|
e_ia = _get_e_ia(scf.addons.mo_energy_with_exxdiv_none(mf), mo_occ, kconserv)
|
|
244
385
|
hdiag = numpy.hstack([x.ravel() for x in e_ia])
|
|
245
386
|
tot_x = hdiag.size
|
|
@@ -253,31 +394,36 @@ class TDHF(TDA):
|
|
|
253
394
|
nz = len(xys)
|
|
254
395
|
z1xs = [_unpack(xy[:tot_x], mo_occ, kconserv) for xy in xys]
|
|
255
396
|
z1ys = [_unpack(xy[tot_x:], mo_occ, kconserv) for xy in xys]
|
|
256
|
-
dmov = numpy.
|
|
397
|
+
dmov = numpy.zeros((nz,nkpts,nao,nao), dtype=numpy.complex128)
|
|
257
398
|
for i in range(nz):
|
|
258
399
|
for k in range(nkpts):
|
|
259
400
|
# *2 for double occupancy
|
|
260
401
|
dmx = z1xs[i][k] * 2
|
|
261
402
|
dmy = z1ys[i][k] * 2
|
|
262
|
-
dmov[i,k]
|
|
263
|
-
dmov[i,k]+= reduce(numpy.dot, (orbv[k], dmy.T, orbo[k].T.conj()))
|
|
403
|
+
dmov[i,k] += reduce(numpy.dot, (orbo[k], dmx , orbv[k].T.conj()))
|
|
404
|
+
dmov[i,k] += reduce(numpy.dot, (orbv[k], dmy.T, orbo[k].T.conj()))
|
|
264
405
|
|
|
265
406
|
with lib.temporary_env(mf, exxdiv=None):
|
|
266
|
-
v1ao = vresp(dmov, kshift)
|
|
407
|
+
v1ao = vresp(dmov, kshift) # = <mb||nj> Xjb + <mj||nb> Yjb
|
|
267
408
|
v1s = []
|
|
268
409
|
for i in range(nz):
|
|
269
410
|
dmx = z1xs[i]
|
|
270
411
|
dmy = z1ys[i]
|
|
271
|
-
v1xs = []
|
|
272
|
-
v1ys = []
|
|
412
|
+
v1xs = [0] * nkpts
|
|
413
|
+
v1ys = [0] * nkpts
|
|
273
414
|
for k in range(nkpts):
|
|
415
|
+
# AX + BY
|
|
416
|
+
# = <ib||aj> Xjb + <ij||ab> Yjb
|
|
417
|
+
# = (<mb||nj> Xjb + <mj||nb> Yjb) Cmi* Cna
|
|
274
418
|
v1x = reduce(numpy.dot, (orbo[k].T.conj(), v1ao[i,k], orbv[k]))
|
|
419
|
+
# (B*)X + (A*)Y
|
|
420
|
+
# = <ab||ij> Xjb + <aj||ib> Yjb
|
|
421
|
+
# = (<mb||nj> Xjb + <mj||nb> Yjb) Cma* Cni
|
|
275
422
|
v1y = reduce(numpy.dot, (orbv[k].T.conj(), v1ao[i,k], orbo[k])).T
|
|
276
|
-
v1x+= e_ia[k] * dmx[k]
|
|
277
|
-
v1y+= e_ia[k] * dmy[k]
|
|
278
|
-
v1xs
|
|
279
|
-
v1ys
|
|
280
|
-
# v1s += v1xs + v1ys
|
|
423
|
+
v1x += e_ia[k] * dmx[k]
|
|
424
|
+
v1y += e_ia[k].conj() * dmy[k]
|
|
425
|
+
v1xs[k] += v1x.ravel()
|
|
426
|
+
v1ys[k] -= v1y.ravel()
|
|
281
427
|
v1s.append( numpy.concatenate(v1xs + v1ys) )
|
|
282
428
|
return lib.asarray(v1s).reshape(nz,-1)
|
|
283
429
|
return vind, hdiag
|
|
@@ -285,7 +431,9 @@ class TDHF(TDA):
|
|
|
285
431
|
def init_guess(self, mf, kshift, nstates=None):
|
|
286
432
|
x0 = TDA.init_guess(self, mf, kshift, nstates)
|
|
287
433
|
y0 = numpy.zeros_like(x0)
|
|
288
|
-
return numpy.
|
|
434
|
+
return numpy.hstack([x0, y0])
|
|
435
|
+
|
|
436
|
+
get_precond = rhf.TDHF.get_precond
|
|
289
437
|
|
|
290
438
|
def kernel(self, x0=None):
|
|
291
439
|
'''TDHF diagonalization with non-Hermitian eigenvalue solver
|
|
@@ -299,9 +447,21 @@ class TDHF(TDA):
|
|
|
299
447
|
mf = self._scf
|
|
300
448
|
mo_occ = mf.mo_occ
|
|
301
449
|
|
|
302
|
-
real_system = (
|
|
450
|
+
real_system = (is_gamma_point(self._scf.kpts) and
|
|
303
451
|
self._scf.mo_coeff[0].dtype == numpy.double)
|
|
304
452
|
|
|
453
|
+
if any(k != 0 for k in self.kshift_lst):
|
|
454
|
+
# It's not clear how to define the Y matrix for kshift!=0 .
|
|
455
|
+
# When the A tensor is constructed against the X(kshift) matrix,
|
|
456
|
+
# the diagonal terms e_ia are calculated as e_i[k] - e_k[k+kshift].
|
|
457
|
+
# Given the k-conserve relation in the A tensor, the j-b indices in
|
|
458
|
+
# the A tensor should follow j[k'], b[k'+kshift]. This leads to the
|
|
459
|
+
# j-b indices in the B tensor being defined as (j[k'+shift], b[k']).
|
|
460
|
+
# To form the square A-B-B-A matrix, the diagonal terms for the
|
|
461
|
+
# -A* part need to be constructed as e_i[k+kshift] - e_a[k], which
|
|
462
|
+
# conflict to the diagonal terms of the A tensor.
|
|
463
|
+
raise RuntimeError('kshift != 0 for TDHF')
|
|
464
|
+
|
|
305
465
|
# We only need positive eigenvalues
|
|
306
466
|
def pickeig(w, v, nroots, envs):
|
|
307
467
|
realidx = numpy.where((abs(w.imag) < REAL_EIG_THRESHOLD) &
|
|
@@ -309,8 +469,6 @@ class TDHF(TDA):
|
|
|
309
469
|
return lib.linalg_helper._eigs_cmplx2real(w, v, realidx, real_system)
|
|
310
470
|
|
|
311
471
|
log = logger.Logger(self.stdout, self.verbose)
|
|
312
|
-
precision = self.cell.precision * 1e-2
|
|
313
|
-
hermi = 0
|
|
314
472
|
|
|
315
473
|
def norm_xy(z, kconserv):
|
|
316
474
|
x, y = z.reshape(2,-1)
|
|
@@ -324,7 +482,7 @@ class TDHF(TDA):
|
|
|
324
482
|
self.e = []
|
|
325
483
|
self.xy = []
|
|
326
484
|
for i,kshift in enumerate(self.kshift_lst):
|
|
327
|
-
kconserv =
|
|
485
|
+
kconserv = get_kconserv_ria(mf.cell, mf.kpts)[kshift]
|
|
328
486
|
|
|
329
487
|
vind, hdiag = self.gen_vind(self._scf, kshift)
|
|
330
488
|
precond = self.get_precond(hdiag)
|
|
@@ -334,15 +492,10 @@ class TDHF(TDA):
|
|
|
334
492
|
else:
|
|
335
493
|
x0k = x0[i]
|
|
336
494
|
|
|
337
|
-
converged, e, x1 =
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
nroots=self.nstates,
|
|
342
|
-
lindep=self.lindep,
|
|
343
|
-
max_space=self.max_space, pick=pickeig,
|
|
344
|
-
fill_heff=purify_krlyov_heff(precision, hermi, log),
|
|
345
|
-
verbose=self.verbose)
|
|
495
|
+
converged, e, x1 = lr_eig(
|
|
496
|
+
vind, x0k, precond, tol_residual=self.conv_tol, lindep=self.lindep,
|
|
497
|
+
nroots=self.nstates, pick=pickeig, max_cycle=self.max_cycle,
|
|
498
|
+
max_memory=self.max_memory, verbose=log)
|
|
346
499
|
self.converged.append( converged )
|
|
347
500
|
self.e.append( e )
|
|
348
501
|
self.xy.append( [norm_xy(z, kconserv) for z in x1] )
|
|
@@ -366,87 +519,16 @@ def _get_e_ia(mo_energy, mo_occ, kconserv=None):
|
|
|
366
519
|
def _unpack(vo, mo_occ, kconserv):
|
|
367
520
|
z = []
|
|
368
521
|
p1 = 0
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
nv =
|
|
522
|
+
no_kpts = [numpy.count_nonzero(occ) for occ in mo_occ]
|
|
523
|
+
for k, no in enumerate(no_kpts):
|
|
524
|
+
kp = kconserv[k]
|
|
525
|
+
nv = mo_occ[kp].size - no_kpts[kp]
|
|
373
526
|
p0, p1 = p1, p1 + no * nv
|
|
374
527
|
z.append(vo[p0:p1].reshape(no,nv))
|
|
375
528
|
return z
|
|
376
529
|
|
|
377
|
-
def purify_krlyov_heff(precision, hermi, log):
|
|
378
|
-
def fill_heff(heff, xs, ax, xt, axt, dot):
|
|
379
|
-
if hermi == 1:
|
|
380
|
-
heff = linalg_helper._fill_heff_hermitian(heff, xs, ax, xt, axt, dot)
|
|
381
|
-
else:
|
|
382
|
-
heff = linalg_helper._fill_heff(heff, xs, ax, xt, axt, dot)
|
|
383
|
-
space = len(axt)
|
|
384
|
-
# TODO: PBC integrals has larger errors than molecule systems.
|
|
385
|
-
# purify the effective Hamiltonian with symmetry and other
|
|
386
|
-
# possible conditions.
|
|
387
|
-
if abs(heff[:space,:space].imag).max() < precision:
|
|
388
|
-
log.debug('Remove imaginary part of the Krylov space effective Hamiltonian')
|
|
389
|
-
heff[:space,:space].imag = 0
|
|
390
|
-
return heff
|
|
391
|
-
return fill_heff
|
|
392
|
-
|
|
393
530
|
|
|
394
531
|
scf.khf.KRHF.TDA = lib.class_as_method(KTDA)
|
|
395
532
|
scf.khf.KRHF.TDHF = lib.class_as_method(KTDHF)
|
|
396
533
|
scf.krohf.KROHF.TDA = None
|
|
397
534
|
scf.krohf.KROHF.TDHF = None
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
if __name__ == '__main__':
|
|
401
|
-
from pyscf.pbc import gto
|
|
402
|
-
from pyscf.pbc import scf
|
|
403
|
-
from pyscf.pbc import df
|
|
404
|
-
cell = gto.Cell()
|
|
405
|
-
cell.unit = 'B'
|
|
406
|
-
cell.atom = '''
|
|
407
|
-
C 0. 0. 0.
|
|
408
|
-
C 1.68506879 1.68506879 1.68506879
|
|
409
|
-
'''
|
|
410
|
-
cell.a = '''
|
|
411
|
-
0. 3.37013758 3.37013758
|
|
412
|
-
3.37013758 0. 3.37013758
|
|
413
|
-
3.37013758 3.37013758 0.
|
|
414
|
-
'''
|
|
415
|
-
|
|
416
|
-
cell.basis = 'gth-szv'
|
|
417
|
-
cell.pseudo = 'gth-pade'
|
|
418
|
-
cell.mesh = [25]*3
|
|
419
|
-
cell.build()
|
|
420
|
-
mf = scf.KRHF(cell, cell.make_kpts([2,1,1])).set(exxdiv=None)
|
|
421
|
-
#mf.with_df = df.MDF(cell, cell.make_kpts([2,1,1]))
|
|
422
|
-
#mf.with_df.auxbasis = 'weigend'
|
|
423
|
-
#mf.with_df._cderi = 'eri3d-mdf.h5'
|
|
424
|
-
#mf.with_df.build(with_j3c=False)
|
|
425
|
-
mf.run()
|
|
426
|
-
#mesh=9 -8.65192427146353
|
|
427
|
-
#mesh=12 -8.65192352289817
|
|
428
|
-
#mesh=15 -8.6519235231529
|
|
429
|
-
#MDF mesh=5 -8.6519301815144
|
|
430
|
-
|
|
431
|
-
td = TDA(mf)
|
|
432
|
-
td.verbose = 5
|
|
433
|
-
print(td.kernel()[0][0] * 27.2114)
|
|
434
|
-
#mesh=9 [ 6.0073749 6.09315355 6.3479901 ]
|
|
435
|
-
#mesh=12 [ 6.00253282 6.09317929 6.34799109]
|
|
436
|
-
#mesh=15 [ 6.00253396 6.09317949 6.34799109]
|
|
437
|
-
#MDF mesh=5 [ 6.09317489 6.09318265 6.34798637]
|
|
438
|
-
|
|
439
|
-
#from pyscf.pbc import tools
|
|
440
|
-
#scell = tools.super_cell(cell, [2,1,1])
|
|
441
|
-
#mf = scf.RHF(scell).run()
|
|
442
|
-
#td = rhf.TDA(mf)
|
|
443
|
-
#td.verbose = 5
|
|
444
|
-
#print(td.kernel()[0] * 27.2114)
|
|
445
|
-
|
|
446
|
-
td = TDHF(mf)
|
|
447
|
-
td.verbose = 5
|
|
448
|
-
print(td.kernel()[0][0] * 27.2114)
|
|
449
|
-
#mesh=9 [ 6.03860914 6.21664545 8.20305225]
|
|
450
|
-
#mesh=12 [ 6.03868259 6.03860343 6.2167623 ]
|
|
451
|
-
#mesh=15 [ 6.03861321 6.03861324 6.21675868]
|
|
452
|
-
#MDF mesh=5 [ 6.03861693 6.03861775 6.21675694]
|
|
@@ -94,7 +94,7 @@ class PhysERI(PeriodicMFMixin, TDERIMatrixBlocks):
|
|
|
94
94
|
"""
|
|
95
95
|
Retrieves the merged diagonal block with specified or all possible k-index pairs.
|
|
96
96
|
Args:
|
|
97
|
-
pairs (Iterable): pairs of k-points to
|
|
97
|
+
pairs (Iterable): pairs of k-points to assemble;
|
|
98
98
|
|
|
99
99
|
Returns:
|
|
100
100
|
The diagonal block.
|
pyscf/pbc/tdscf/krks.py
CHANGED
|
@@ -43,7 +43,7 @@ RPA = KTDDFT = TDDFT
|
|
|
43
43
|
def _rebuild_df(td):
|
|
44
44
|
log = lib.logger.new_logger(td)
|
|
45
45
|
mf = td._scf
|
|
46
|
-
if any(
|
|
46
|
+
if any(k != 0 for k in td.kshift_lst):
|
|
47
47
|
if isinstance(mf.with_df, df.df.DF):
|
|
48
48
|
if mf.with_df._j_only:
|
|
49
49
|
log.warn(f'Non-zero kshift is requested for {td.__class__.__name__}, '
|
|
@@ -57,47 +57,3 @@ dft.krks.KRKS.TDDFT = lib.class_as_method(TDDFT)
|
|
|
57
57
|
dft.kroks.KROKS.TDA = None
|
|
58
58
|
dft.kroks.KROKS.TDHF = None
|
|
59
59
|
dft.kroks.KROKS.TDDFT = None
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if __name__ == '__main__':
|
|
63
|
-
from pyscf.pbc import gto
|
|
64
|
-
from pyscf.pbc import dft
|
|
65
|
-
cell = gto.Cell()
|
|
66
|
-
cell.unit = 'B'
|
|
67
|
-
cell.atom = '''
|
|
68
|
-
C 0. 0. 0.
|
|
69
|
-
C 1.68506879 1.68506879 1.68506879
|
|
70
|
-
'''
|
|
71
|
-
cell.a = '''
|
|
72
|
-
0. 3.37013758 3.37013758
|
|
73
|
-
3.37013758 0. 3.37013758
|
|
74
|
-
3.37013758 3.37013758 0.
|
|
75
|
-
'''
|
|
76
|
-
cell.basis = 'gth-szv'
|
|
77
|
-
cell.pseudo = 'gth-pade'
|
|
78
|
-
cell.mesh = [25]*3
|
|
79
|
-
cell.build()
|
|
80
|
-
|
|
81
|
-
mf = dft.KRKS(cell, cell.make_kpts([2,1,1]))
|
|
82
|
-
#mf.with_df = df.MDF(cell, cell.make_kpts([2,1,1]))
|
|
83
|
-
#mf.with_df.auxbasis = 'weigend'
|
|
84
|
-
#mf.with_df._cderi = 'eri3d-mdf.h5'
|
|
85
|
-
#mf.with_df.build(with_j3c=False)
|
|
86
|
-
mf.xc = 'lda,'
|
|
87
|
-
mf.kernel()
|
|
88
|
-
#mesh=12 -10.3077341607895
|
|
89
|
-
#mesh=5 -10.3086623157515
|
|
90
|
-
|
|
91
|
-
td = TDDFT(mf)
|
|
92
|
-
td.nstates = 5
|
|
93
|
-
td.verbose = 5
|
|
94
|
-
print(td.kernel()[0][0] * 27.2114)
|
|
95
|
-
#mesh=12 [ 6.08108297 6.10231481 6.10231478 6.38355803 6.38355804]
|
|
96
|
-
#MDF mesh=5 [ 6.07919157 6.10251718 6.10253961 6.37202499 6.37565246]
|
|
97
|
-
|
|
98
|
-
td = TDA(mf)
|
|
99
|
-
td.singlet = False
|
|
100
|
-
td.verbose = 5
|
|
101
|
-
print(td.kernel()[0][0] * 27.2114)
|
|
102
|
-
#mesh=12 [ 4.01539192 5.1750807 5.17508071]
|
|
103
|
-
#MDF mesh=5 [ 4.01148649 5.18043397 5.18043459]
|