pyscf 2.6.2__py3-none-macosx_11_0_arm64.whl → 2.8.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/__init__.py +13 -2
- pyscf/ao2mo/_ao2mo.py +10 -1
- pyscf/ao2mo/incore.py +3 -0
- pyscf/ao2mo/nrr_outcore.py +2 -2
- pyscf/ao2mo/outcore.py +9 -7
- pyscf/ao2mo/r_outcore.py +2 -2
- pyscf/cc/__init__.py +21 -3
- pyscf/cc/bccd.py +0 -46
- pyscf/cc/ccsd.py +29 -13
- pyscf/cc/ccsd_rdm.py +6 -1
- pyscf/cc/gccsd.py +2 -2
- pyscf/cc/uccsd.py +7 -7
- pyscf/cc/uccsd_rdm.py +2 -2
- pyscf/data/elements.py +1 -1
- pyscf/df/__init__.py +2 -1
- pyscf/df/addons.py +79 -51
- pyscf/df/autoaux.py +195 -0
- pyscf/df/df.py +5 -1
- pyscf/df/df_jk.py +27 -25
- pyscf/df/grad/casscf.py +0 -41
- pyscf/df/grad/rhf.py +31 -1
- 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 +18 -6
- pyscf/df/outcore.py +6 -6
- pyscf/dft/dks.py +1 -1
- pyscf/dft/gks.py +25 -21
- pyscf/dft/libxc.py +91 -645
- pyscf/dft/numint.py +40 -19
- pyscf/dft/radi.py +48 -7
- pyscf/dft/rks.py +29 -25
- pyscf/dft/roks.py +7 -1
- pyscf/dft/uks.py +34 -25
- 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 -10
- 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/ccsd.py +3 -7
- pyscf/grad/ccsd_slow.py +2 -3
- pyscf/grad/lagrange.py +11 -3
- pyscf/grad/mp2.py +13 -4
- pyscf/grad/sacasscf.py +1 -1
- pyscf/grad/tdrks.py +1 -1
- pyscf/grad/uccsd.py +3 -7
- pyscf/grad/ump2.py +2 -4
- pyscf/gto/basis/__init__.py +17 -4
- pyscf/gto/basis/bse.py +68 -15
- pyscf/gto/basis/def2-mtzvp.dat +4719 -0
- pyscf/gto/basis/def2-mtzvpp.dat +4739 -0
- pyscf/gto/basis/dyall-basis/__init__.py +0 -0
- pyscf/gto/basis/dyall-basis/dyall_2zp.py +6492 -0
- pyscf/gto/basis/dyall-basis/dyall_3zp.py +8343 -0
- pyscf/gto/basis/dyall-basis/dyall_4zp.py +10055 -0
- pyscf/gto/basis/dyall-basis/dyall_aae2z.py +1818 -0
- pyscf/gto/basis/dyall-basis/dyall_aae3z.py +2521 -0
- pyscf/gto/basis/dyall-basis/dyall_aae4z.py +3351 -0
- pyscf/gto/basis/dyall-basis/dyall_acv2z.py +1790 -0
- pyscf/gto/basis/dyall-basis/dyall_acv3z.py +2417 -0
- pyscf/gto/basis/dyall-basis/dyall_acv4z.py +3085 -0
- pyscf/gto/basis/dyall-basis/dyall_ae2z.py +6619 -0
- pyscf/gto/basis/dyall-basis/dyall_ae3z.py +9027 -0
- pyscf/gto/basis/dyall-basis/dyall_ae4z.py +11839 -0
- pyscf/gto/basis/dyall-basis/dyall_av2z.py +1742 -0
- pyscf/gto/basis/dyall-basis/dyall_av3z.py +2318 -0
- pyscf/gto/basis/dyall-basis/dyall_av4z.py +2905 -0
- pyscf/gto/basis/dyall-basis/dyall_cv2z.py +6558 -0
- pyscf/gto/basis/dyall-basis/dyall_cv3z.py +8767 -0
- pyscf/gto/basis/dyall-basis/dyall_cv4z.py +11098 -0
- pyscf/gto/basis/dyall-basis/dyall_v2z.py +6472 -0
- pyscf/gto/basis/dyall-basis/dyall_v3z.py +8539 -0
- pyscf/gto/basis/dyall-basis/dyall_v4z.py +10658 -0
- pyscf/gto/basis/ma-def2-qzvp.dat +5959 -0
- pyscf/gto/basis/ma-def2-qzvpp.dat +6195 -0
- pyscf/gto/basis/ma-def2-svp.dat +3504 -0
- pyscf/gto/basis/ma-def2-svpp.dat +3504 -0
- pyscf/gto/basis/ma-def2-tzvp.dat +4347 -0
- pyscf/gto/basis/ma-def2-tzvpp.dat +4549 -0
- pyscf/gto/basis/parse_cp2k.py +8 -7
- pyscf/gto/basis/parse_cp2k_pp.py +1 -1
- pyscf/gto/basis/parse_nwchem.py +26 -11
- 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/eval_gto.py +1 -1
- pyscf/gto/ft_ao.py +6 -6
- pyscf/gto/mole.py +123 -71
- pyscf/gto/moleintor.py +1 -1
- pyscf/gw/gw_ac.py +2 -2
- pyscf/gw/gw_cd.py +2 -2
- pyscf/gw/rpa.py +135 -246
- pyscf/gw/ugw_ac.py +2 -2
- pyscf/gw/urpa.py +80 -131
- 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/CMakeLists.txt +6 -2
- 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/config.h +0 -1
- pyscf/lib/config.h.in +0 -1
- pyscf/lib/deps/include/XCFun/XCFunExport.h +1 -0
- pyscf/lib/deps/include/xc.h +28 -18
- pyscf/lib/deps/include/xc_funcs.h +50 -2
- pyscf/lib/deps/include/xc_version.h +3 -3
- pyscf/lib/deps/lib/libcint.6.dylib +0 -0
- pyscf/lib/deps/lib/{libxc.12.dylib → libxc.15.dylib} +0 -0
- pyscf/lib/deps/lib/libxcfun.2.dylib +0 -0
- pyscf/lib/dft/grid_common.c +1 -1
- pyscf/lib/dft/libxc_itrf.c +10 -7
- pyscf/lib/dft/nr_numint_sparse.c +3 -3
- pyscf/lib/dft/xcfun_itrf.c +1 -1
- pyscf/lib/diis.py +2 -2
- pyscf/lib/exceptions.py +6 -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/libmp.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 +117 -198
- pyscf/lib/logger.py +2 -1
- pyscf/lib/mcscf/fci_contract.c +10 -3
- pyscf/lib/misc.py +63 -22
- pyscf/lib/mp/CMakeLists.txt +22 -0
- pyscf/lib/mp/mp2.c +518 -0
- pyscf/lib/mp/mp2.h +44 -0
- pyscf/lib/np_helper/CMakeLists.txt +1 -1
- pyscf/lib/np_helper/imatcopy.c +360 -0
- pyscf/lib/np_helper/np_helper.c +94 -0
- pyscf/lib/np_helper/np_helper.h +26 -0
- pyscf/lib/numpy_helper.py +195 -11
- pyscf/lib/pbc/nr_direct.c +2 -7
- pyscf/lib/pbc/nr_ecp.c +10 -3
- pyscf/lib/pbc/pbc.h +1 -1
- pyscf/lib/vhf/fblas.h +3 -0
- pyscf/lib/vhf/nr_sgx_direct.c +8 -6
- pyscf/lib/vhf/nr_sr_vhf.c +8 -12
- pyscf/lib/vhf/optimizer.c +2 -2
- pyscf/lib/vhf/rkb_screen.c +139 -0
- 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 +13 -7
- pyscf/mcscf/chkfile.py +69 -41
- pyscf/mcscf/dmet_cas.py +2 -2
- pyscf/mcscf/mc1step.py +72 -44
- pyscf/mcscf/newton_casscf.py +5 -5
- pyscf/mcscf/ucasci.py +1 -1
- pyscf/mcscf/umc1step.py +49 -28
- pyscf/md/integrators.py +3 -3
- pyscf/mp/__init__.py +1 -0
- pyscf/mp/dfmp2.py +498 -59
- pyscf/mp/dfmp2_native.py +11 -1
- pyscf/mp/dfmp2_slow.py +133 -0
- pyscf/mp/dfump2.py +672 -0
- pyscf/mp/dfump2_native.py +9 -0
- pyscf/mp/dfump2_slow.py +161 -0
- pyscf/mp/gmp2.py +6 -47
- pyscf/mp/mp2.py +25 -10
- pyscf/mp/ump2.py +30 -24
- 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 +8 -9
- pyscf/pbc/df/aft_ao2mo.py +1 -1
- pyscf/pbc/df/df.py +85 -12
- pyscf/pbc/df/df_jk.py +6 -2
- pyscf/pbc/df/fft.py +9 -5
- pyscf/pbc/df/fft_ao2mo.py +4 -0
- pyscf/pbc/df/fft_jk.py +18 -10
- pyscf/pbc/df/ft_ao.py +4 -3
- pyscf/pbc/df/gdf_builder.py +5 -4
- pyscf/pbc/df/incore.py +2 -2
- pyscf/pbc/df/mdf.py +6 -3
- pyscf/pbc/df/mdf_jk.py +2 -1
- pyscf/pbc/df/outcore.py +10 -10
- pyscf/pbc/df/rsdf.py +2 -2
- pyscf/pbc/df/rsdf_builder.py +13 -8
- pyscf/pbc/df/rsdf_helper.py +6 -6
- pyscf/pbc/df/rsdf_jk.py +2 -1
- pyscf/pbc/dft/cdft.py +5 -5
- pyscf/pbc/dft/gen_grid.py +3 -2
- pyscf/pbc/dft/gks.py +14 -3
- pyscf/pbc/dft/kgks.py +15 -4
- pyscf/pbc/dft/krks.py +28 -10
- pyscf/pbc/dft/krks_ksymm.py +21 -9
- pyscf/pbc/dft/krkspu.py +1 -30
- pyscf/pbc/dft/krkspu_ksymm.py +0 -30
- pyscf/pbc/dft/kuks.py +30 -13
- pyscf/pbc/dft/kuks_ksymm.py +22 -10
- pyscf/pbc/dft/kukspu.py +0 -27
- pyscf/pbc/dft/kukspu_ksymm.py +0 -30
- pyscf/pbc/dft/multigrid/multigrid.py +36 -33
- pyscf/pbc/dft/multigrid/multigrid_pair.py +7 -2
- pyscf/pbc/dft/multigrid/pp.py +1 -1
- pyscf/pbc/dft/numint.py +56 -31
- pyscf/pbc/dft/rks.py +16 -24
- pyscf/pbc/dft/uks.py +21 -4
- pyscf/pbc/eph/eph_fd.py +1 -1
- pyscf/pbc/geomopt/geometric_solver.py +1 -1
- pyscf/pbc/gto/_pbcintor.py +1 -0
- pyscf/pbc/gto/cell.py +194 -23
- pyscf/pbc/gto/ecp.py +12 -12
- pyscf/pbc/gto/eval_gto.py +3 -3
- pyscf/pbc/gto/neighborlist.py +4 -1
- 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/_response_functions.py +141 -34
- 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 -32
- pyscf/pbc/scf/kghf.py +33 -29
- pyscf/pbc/scf/khf.py +103 -29
- pyscf/pbc/scf/khf_ksymm.py +15 -1
- pyscf/pbc/scf/krohf.py +5 -7
- pyscf/pbc/scf/kuhf.py +54 -23
- pyscf/pbc/scf/kuhf_ksymm.py +1 -1
- pyscf/pbc/scf/rsjk.py +14 -10
- pyscf/pbc/scf/scfint.py +1 -1
- pyscf/pbc/scf/stability.py +27 -15
- pyscf/pbc/scf/uhf.py +3 -1
- pyscf/pbc/symm/symmetry.py +2 -2
- pyscf/pbc/tdscf/krhf.py +238 -154
- pyscf/pbc/tdscf/krks.py +1 -45
- pyscf/pbc/tdscf/kuhf.py +319 -171
- pyscf/pbc/tdscf/kuks.py +0 -56
- pyscf/pbc/tdscf/rhf.py +116 -3
- pyscf/pbc/tdscf/rks.py +2 -1
- pyscf/pbc/tdscf/uhf.py +214 -1
- pyscf/pbc/tdscf/uks.py +2 -1
- pyscf/pbc/tools/k2gamma.py +20 -6
- pyscf/pbc/tools/lattice.py +3 -3
- pyscf/pbc/tools/pbc.py +111 -91
- 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 +87 -46
- pyscf/scf/_vhf.py +15 -10
- pyscf/scf/addons.py +29 -15
- pyscf/scf/cphf.py +14 -52
- pyscf/scf/dhf.py +121 -38
- pyscf/scf/dispersion.py +10 -9
- pyscf/scf/ghf.py +25 -13
- pyscf/scf/ghf_symm.py +2 -2
- pyscf/scf/hf.py +262 -30
- pyscf/scf/rohf.py +37 -5
- pyscf/scf/stability.py +142 -112
- pyscf/scf/ucphf.py +21 -16
- pyscf/scf/uhf.py +104 -61
- pyscf/sgx/sgx.py +1 -1
- pyscf/sgx/sgx_jk.py +4 -4
- pyscf/solvent/__init__.py +2 -2
- pyscf/solvent/_attach_solvent.py +2 -0
- pyscf/solvent/_ddcosmo_tdscf_grad.py +1 -1
- pyscf/solvent/cosmors.py +366 -0
- pyscf/solvent/ddcosmo.py +1 -1
- pyscf/solvent/pcm.py +4 -4
- pyscf/solvent/pol_embed.py +1 -1
- pyscf/solvent/smd.py +5 -3
- pyscf/soscf/ciah.py +3 -11
- pyscf/soscf/newton_ah.py +5 -2
- pyscf/symm/__init__.py +1 -1
- pyscf/symm/addons.py +5 -5
- pyscf/symm/geom.py +1 -5
- pyscf/tdscf/_lr_eig.py +1002 -0
- pyscf/tdscf/dhf.py +84 -87
- pyscf/tdscf/dks.py +0 -4
- pyscf/tdscf/ghf.py +139 -127
- pyscf/tdscf/gks.py +27 -25
- pyscf/tdscf/rhf.py +194 -147
- pyscf/tdscf/rks.py +26 -22
- pyscf/tdscf/uhf.py +166 -118
- pyscf/tdscf/uks.py +32 -31
- pyscf/tools/fcidump.py +3 -0
- pyscf/tools/qcschema.py +265 -0
- pyscf/x2c/sfx2c1e.py +1 -1
- pyscf/x2c/tdscf.py +41 -41
- pyscf/x2c/x2c.py +15 -11
- {pyscf-2.6.2.dist-info → pyscf-2.8.0.dist-info}/METADATA +39 -36
- {pyscf-2.6.2.dist-info → pyscf-2.8.0.dist-info}/NOTICE +14 -1
- {pyscf-2.6.2.dist-info → pyscf-2.8.0.dist-info}/RECORD +348 -316
- {pyscf-2.6.2.dist-info → pyscf-2.8.0.dist-info}/WHEEL +1 -1
- pyscf/dft/gen_libxc_param.py +0 -35
- pyscf/dft/gen_xcfun_param.py +0 -209
- pyscf/pbc/tdscf/kproxy.py +0 -189
- pyscf/pbc/tdscf/kproxy_supercell.py +0 -664
- pyscf/pbc/tdscf/krhf_slow.py +0 -300
- pyscf/pbc/tdscf/krhf_slow_gamma.py +0 -175
- pyscf/pbc/tdscf/krhf_slow_supercell.py +0 -250
- pyscf/pbc/tdscf/proxy.py +0 -39
- pyscf/pbc/tdscf/rhf_slow.py +0 -35
- pyscf/tdscf/common_slow.py +0 -799
- pyscf/tdscf/proxy.py +0 -258
- pyscf/tdscf/rhf_slow.py +0 -181
- {pyscf-2.6.2.dist-info → pyscf-2.8.0.dist-info}/LICENSE +0 -0
- {pyscf-2.6.2.dist-info → pyscf-2.8.0.dist-info}/top_level.txt +0 -0
pyscf/pbc/gto/cell.py
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
# Timothy Berkelbach <tim.berkelbach@gmail.com>
|
|
18
18
|
#
|
|
19
19
|
|
|
20
|
+
import os
|
|
20
21
|
import sys
|
|
21
22
|
import json
|
|
22
23
|
import ctypes
|
|
@@ -66,6 +67,7 @@ def pack(cell):
|
|
|
66
67
|
'''
|
|
67
68
|
cldic = mole.pack(cell)
|
|
68
69
|
cldic['a'] = cell.a
|
|
70
|
+
cldic['fractional'] = cell.fractional
|
|
69
71
|
cldic['precision'] = cell.precision
|
|
70
72
|
cldic['ke_cutoff'] = cell.ke_cutoff
|
|
71
73
|
cldic['exp_to_discard'] = cell.exp_to_discard
|
|
@@ -87,23 +89,20 @@ def unpack(celldic):
|
|
|
87
89
|
def dumps(cell):
|
|
88
90
|
'''Serialize Cell object to a JSON formatted str.
|
|
89
91
|
'''
|
|
90
|
-
exclude_keys = {'output', 'stdout', '_keys', '
|
|
91
|
-
|
|
92
|
+
exclude_keys = {'output', 'stdout', '_keys', '_ctx_lock',
|
|
93
|
+
'symm_orb', 'irrep_id', 'irrep_name', 'lattice_symmetry'}
|
|
92
94
|
|
|
93
95
|
celldic = dict(cell.__dict__)
|
|
94
96
|
for k in exclude_keys:
|
|
95
97
|
if k in celldic:
|
|
96
98
|
del (celldic[k])
|
|
97
99
|
for k in celldic:
|
|
98
|
-
if isinstance(celldic[k], np.ndarray):
|
|
100
|
+
if isinstance(celldic[k], (np.ndarray, np.generic)):
|
|
99
101
|
celldic[k] = celldic[k].tolist()
|
|
100
102
|
celldic['atom'] = repr(cell.atom)
|
|
101
103
|
celldic['basis']= repr(cell.basis)
|
|
102
104
|
celldic['pseudo'] = repr(cell.pseudo)
|
|
103
105
|
celldic['ecp'] = repr(cell.ecp)
|
|
104
|
-
# Explicitly convert mesh because it is often created as numpy array
|
|
105
|
-
if isinstance(cell.mesh, np.ndarray):
|
|
106
|
-
celldic['mesh'] = cell.mesh.tolist()
|
|
107
106
|
|
|
108
107
|
try:
|
|
109
108
|
return json.dumps(celldic)
|
|
@@ -120,6 +119,8 @@ def dumps(cell):
|
|
|
120
119
|
dic1[k] = list(v)
|
|
121
120
|
elif isinstance(v, dict):
|
|
122
121
|
dic1[k] = skip_value(v)
|
|
122
|
+
elif isinstance(v, np.generic):
|
|
123
|
+
dic1[k] = v.tolist()
|
|
123
124
|
else:
|
|
124
125
|
msg =('Function cell.dumps drops attribute %s because '
|
|
125
126
|
'it is not JSON-serializable' % k)
|
|
@@ -497,7 +498,7 @@ def error_for_ke_cutoff(cell, ke_cutoff, omega=None):
|
|
|
497
498
|
def get_bounding_sphere(cell, rcut):
|
|
498
499
|
'''Finds all the lattice points within a sphere of radius rcut.
|
|
499
500
|
|
|
500
|
-
Defines a
|
|
501
|
+
Defines a parallelepiped given by -N_x <= n_x <= N_x, with x in [1,3]
|
|
501
502
|
See Martin p. 85
|
|
502
503
|
|
|
503
504
|
Args:
|
|
@@ -1012,6 +1013,142 @@ def rcut_by_shells(cell, precision=None, rcut=0,
|
|
|
1012
1013
|
return shell_radius, pgf_radius
|
|
1013
1014
|
return shell_radius
|
|
1014
1015
|
|
|
1016
|
+
def tostring(cell, format='poscar'):
|
|
1017
|
+
'''Convert cell geometry to a string of the required format.
|
|
1018
|
+
|
|
1019
|
+
Supported output formats:
|
|
1020
|
+
| poscar: VASP POSCAR
|
|
1021
|
+
| xyz: Extended XYZ with Lattice information
|
|
1022
|
+
'''
|
|
1023
|
+
format = format.lower()
|
|
1024
|
+
output = []
|
|
1025
|
+
if format == 'poscar' or format == 'vasp' or format == 'xyz':
|
|
1026
|
+
lattice_vectors = cell.lattice_vectors() * param.BOHR
|
|
1027
|
+
coords = cell.atom_coords() * param.BOHR
|
|
1028
|
+
if format == 'poscar' or format == 'vasp':
|
|
1029
|
+
output.append('Written by PySCF, units are A')
|
|
1030
|
+
output.append('1.0')
|
|
1031
|
+
for lattice_vector in lattice_vectors:
|
|
1032
|
+
ax, ay, az = lattice_vector
|
|
1033
|
+
output.append('%14.5f %14.5f %14.5f' % (ax, ay, az))
|
|
1034
|
+
unique_atoms = dict()
|
|
1035
|
+
for atom in cell.elements:
|
|
1036
|
+
if atom not in unique_atoms:
|
|
1037
|
+
unique_atoms[atom] = 1
|
|
1038
|
+
else:
|
|
1039
|
+
unique_atoms[atom] += 1
|
|
1040
|
+
output.append(' '.join(unique_atoms))
|
|
1041
|
+
output.append(' '.join(str(count) for count in unique_atoms.values()))
|
|
1042
|
+
output.append('Cartesian')
|
|
1043
|
+
for atom_type in unique_atoms:
|
|
1044
|
+
for atom, coord in zip(cell.elements, coords):
|
|
1045
|
+
if atom == atom_type:
|
|
1046
|
+
x, y, z = coord
|
|
1047
|
+
output.append('%14.5f %14.5f %14.5f' % (x, y, z))
|
|
1048
|
+
return '\n'.join(output)
|
|
1049
|
+
elif format == 'xyz':
|
|
1050
|
+
output.append('%d' % cell.natm)
|
|
1051
|
+
output.append('Lattice="'+' '.join(f'{ax:14.5f}' for ax in lattice_vectors.ravel())
|
|
1052
|
+
+'" Properties=species:S:1:pos:R:3')
|
|
1053
|
+
for i in range(cell.natm):
|
|
1054
|
+
symb = cell.atom_pure_symbol(i)
|
|
1055
|
+
x, y, z = coords[i]
|
|
1056
|
+
output.append('%-4s %14.5f %14.5f %14.5f' %
|
|
1057
|
+
(symb, x, y, z))
|
|
1058
|
+
return '\n'.join(output)
|
|
1059
|
+
else:
|
|
1060
|
+
raise NotImplementedError(f'format={format}')
|
|
1061
|
+
|
|
1062
|
+
def tofile(cell, filename, format=None):
|
|
1063
|
+
if format is None: # Guess format based on filename
|
|
1064
|
+
if filename.lower() == 'poscar':
|
|
1065
|
+
format = 'poscar'
|
|
1066
|
+
else:
|
|
1067
|
+
format = os.path.splitext(filename)[1][1:]
|
|
1068
|
+
string = tostring(cell, format)
|
|
1069
|
+
with open(filename, 'w', encoding='utf-8') as f:
|
|
1070
|
+
f.write(string)
|
|
1071
|
+
f.write('\n')
|
|
1072
|
+
return string
|
|
1073
|
+
|
|
1074
|
+
def fromfile(filename, format=None):
|
|
1075
|
+
'''Read cell geometry from a file
|
|
1076
|
+
(in testing)
|
|
1077
|
+
|
|
1078
|
+
Supported formats:
|
|
1079
|
+
| poscar: VASP POSCAR file format
|
|
1080
|
+
| xyz: Extended XYZ with Lattice information
|
|
1081
|
+
'''
|
|
1082
|
+
if format is None: # Guess format based on filename
|
|
1083
|
+
if filename.lower() == 'poscar':
|
|
1084
|
+
format = 'poscar'
|
|
1085
|
+
else:
|
|
1086
|
+
format = os.path.splitext(filename)[1][1:].lower()
|
|
1087
|
+
if format not in ('poscar', 'vasp', 'xyz'):
|
|
1088
|
+
format = 'raw'
|
|
1089
|
+
with open(filename, 'r') as f:
|
|
1090
|
+
return fromstring(f.read(), format)
|
|
1091
|
+
|
|
1092
|
+
def fromstring(string, format='poscar'):
|
|
1093
|
+
'''Convert the string of the specified format to internal format
|
|
1094
|
+
(in testing)
|
|
1095
|
+
|
|
1096
|
+
Supported formats:
|
|
1097
|
+
| poscar: VASP POSCAR file format
|
|
1098
|
+
| xyz: Extended XYZ with Lattice information
|
|
1099
|
+
|
|
1100
|
+
Returns:
|
|
1101
|
+
a: Lattice vectors
|
|
1102
|
+
atom: Atomic elements and xyz coordinates
|
|
1103
|
+
'''
|
|
1104
|
+
format = format.lower()
|
|
1105
|
+
if format == 'poscar' or format == 'vasp':
|
|
1106
|
+
lines = string.splitlines()
|
|
1107
|
+
scale = float(lines[1])
|
|
1108
|
+
a = lines[2:5]
|
|
1109
|
+
lattice_vectors = np.array([np.fromstring(ax, sep=' ') for ax in a])
|
|
1110
|
+
lattice_vectors *= scale
|
|
1111
|
+
a = []
|
|
1112
|
+
for i in range(3):
|
|
1113
|
+
a.append(' '.join(str(ax) for ax in lattice_vectors[i]))
|
|
1114
|
+
atom_position_type = lines[7].strip()
|
|
1115
|
+
unique_atoms = dict()
|
|
1116
|
+
natm = 0
|
|
1117
|
+
for atom, count in zip(lines[5].split(), lines[6].split()):
|
|
1118
|
+
unique_atoms[atom] = int(count)
|
|
1119
|
+
natm += int(count)
|
|
1120
|
+
atoms = []
|
|
1121
|
+
start = 8
|
|
1122
|
+
for atom_type in unique_atoms:
|
|
1123
|
+
end = start + unique_atoms[atom_type]
|
|
1124
|
+
for line in lines[start:end]:
|
|
1125
|
+
coords = np.fromstring(line, sep=' ')
|
|
1126
|
+
if atom_position_type.lower() == 'cartesian':
|
|
1127
|
+
x, y, z = coords * scale
|
|
1128
|
+
elif atom_position_type.lower() == 'direct':
|
|
1129
|
+
x, y, z = np.dot(coords, lattice_vectors)
|
|
1130
|
+
else:
|
|
1131
|
+
raise RuntimeError('Error reading VASP geometry due to '
|
|
1132
|
+
f'atom position type "{atom_position_type}". Atom '
|
|
1133
|
+
'positions must be Direct or Cartesian.')
|
|
1134
|
+
atoms.append('%s %14.5f %14.5f %14.5f'
|
|
1135
|
+
% (atom_type, x, y, z))
|
|
1136
|
+
start = end
|
|
1137
|
+
return '\n'.join(a), '\n'.join(atoms)
|
|
1138
|
+
elif format == 'xyz':
|
|
1139
|
+
lines = string.splitlines()
|
|
1140
|
+
natm = int(lines[0])
|
|
1141
|
+
lattice_vectors = lines[1].split('Lattice=')[1].split('"')[1].split()
|
|
1142
|
+
a = []
|
|
1143
|
+
for i in range(3):
|
|
1144
|
+
a.append(" ".join(lattice_vectors[3*i:3*i+3]))
|
|
1145
|
+
return '\n'.join(a), '\n'.join(lines[2:natm+2])
|
|
1146
|
+
elif format == 'raw':
|
|
1147
|
+
lines = string.splitlines()
|
|
1148
|
+
return '\n'.join(lines[:3]), '\n'.join(lines[4:])
|
|
1149
|
+
else:
|
|
1150
|
+
raise NotImplementedError
|
|
1151
|
+
|
|
1015
1152
|
|
|
1016
1153
|
class Cell(mole.MoleBase):
|
|
1017
1154
|
'''A Cell object holds the basic information of a crystal.
|
|
@@ -1075,11 +1212,14 @@ class Cell(mole.MoleBase):
|
|
|
1075
1212
|
|
|
1076
1213
|
_keys = {
|
|
1077
1214
|
'precision', 'exp_to_discard',
|
|
1078
|
-
'a', 'ke_cutoff', 'pseudo', 'dimension', 'low_dim_ft_type',
|
|
1215
|
+
'a', 'ke_cutoff', 'pseudo', 'fractional', 'dimension', 'low_dim_ft_type',
|
|
1079
1216
|
'space_group_symmetry', 'symmorphic', 'lattice_symmetry', 'mesh', 'rcut',
|
|
1080
1217
|
'use_loose_rcut', 'use_particle_mesh_ewald',
|
|
1081
1218
|
}
|
|
1082
1219
|
|
|
1220
|
+
tostring = tostring
|
|
1221
|
+
tofile = tofile
|
|
1222
|
+
|
|
1083
1223
|
def __init__(self, **kwargs):
|
|
1084
1224
|
mole.MoleBase.__init__(self)
|
|
1085
1225
|
self.a = None # lattice vectors, (a1,a2,a3)
|
|
@@ -1087,6 +1227,7 @@ class Cell(mole.MoleBase):
|
|
|
1087
1227
|
# of fourier components, with .5 * G**2 < ke_cutoff
|
|
1088
1228
|
self.ke_cutoff = None
|
|
1089
1229
|
|
|
1230
|
+
self.fractional = False
|
|
1090
1231
|
self.dimension = 3
|
|
1091
1232
|
# TODO: Simple hack for now; the implementation of ewald depends on the
|
|
1092
1233
|
# density-fitting class. This determines how the ewald produces
|
|
@@ -1105,6 +1246,20 @@ class Cell(mole.MoleBase):
|
|
|
1105
1246
|
for key, val in kwargs.items():
|
|
1106
1247
|
setattr(self, key, val)
|
|
1107
1248
|
|
|
1249
|
+
def fromstring(self, string, format='poscar'):
|
|
1250
|
+
'''Update the Cell object based on the input geometry string'''
|
|
1251
|
+
a, atom = fromstring(string, format)
|
|
1252
|
+
self.a = a
|
|
1253
|
+
self.set_geom_(atom, unit='Angstrom', inplace=True)
|
|
1254
|
+
return self
|
|
1255
|
+
|
|
1256
|
+
def fromfile(self, filename, format=None):
|
|
1257
|
+
'''Update the Cell object based on the input geometry file'''
|
|
1258
|
+
a, atom = fromfile(filename, format)
|
|
1259
|
+
self.a = a
|
|
1260
|
+
self.set_geom_(atom, unit='Angstrom', inplace=True)
|
|
1261
|
+
return self
|
|
1262
|
+
|
|
1108
1263
|
@property
|
|
1109
1264
|
def mesh(self):
|
|
1110
1265
|
return self._mesh
|
|
@@ -1265,13 +1420,23 @@ class Cell(mole.MoleBase):
|
|
|
1265
1420
|
self._mesh_from_build = _mesh_from_build
|
|
1266
1421
|
return self
|
|
1267
1422
|
|
|
1423
|
+
@lib.with_doc(mole.format_atom.__doc__)
|
|
1424
|
+
def format_atom(self, atoms, origin=0, axes=None,
|
|
1425
|
+
unit=getattr(__config__, 'UNIT', 'Ang')):
|
|
1426
|
+
if not self.fractional:
|
|
1427
|
+
return mole.format_atom(atoms, origin, axes, unit)
|
|
1428
|
+
_atoms = mole.format_atom(atoms, origin, axes, unit=1.)
|
|
1429
|
+
_a = self.lattice_vectors()
|
|
1430
|
+
c = np.array([a[1] for a in _atoms]).dot(_a)
|
|
1431
|
+
return [(a[0], r) for a, r in zip(_atoms, c.tolist())]
|
|
1432
|
+
|
|
1268
1433
|
#Note: Exculde dump_input, parse_arg, basis from kwargs to avoid parsing twice
|
|
1269
1434
|
def build(self, dump_input=True, parse_arg=mole.ARGPARSE,
|
|
1270
1435
|
a=None, mesh=None, ke_cutoff=None, precision=None, nimgs=None,
|
|
1271
1436
|
h=None, dimension=None, rcut= None, low_dim_ft_type=None,
|
|
1272
1437
|
space_group_symmetry=None, symmorphic=None,
|
|
1273
1438
|
use_loose_rcut=None, use_particle_mesh_ewald=None,
|
|
1274
|
-
*args, **kwargs):
|
|
1439
|
+
fractional=None, *args, **kwargs):
|
|
1275
1440
|
'''Setup Mole molecule and Cell and initialize some control parameters.
|
|
1276
1441
|
Whenever you change the value of the attributes of :class:`Cell`,
|
|
1277
1442
|
you need call this function to refresh the internal data of Cell.
|
|
@@ -1280,6 +1445,10 @@ class Cell(mole.MoleBase):
|
|
|
1280
1445
|
a : (3,3) ndarray
|
|
1281
1446
|
The real-space cell lattice vectors. Each row represents
|
|
1282
1447
|
a lattice vector.
|
|
1448
|
+
fractional : bool
|
|
1449
|
+
Whether the atom postions are specified in fractional coordinates.
|
|
1450
|
+
The default value is False, which means the coordinates are
|
|
1451
|
+
interpreted as Cartesian coordinate.
|
|
1283
1452
|
mesh : (3,) ndarray of ints
|
|
1284
1453
|
The number of *positive* G-vectors along each direction.
|
|
1285
1454
|
ke_cutoff : float
|
|
@@ -1318,6 +1487,7 @@ class Cell(mole.MoleBase):
|
|
|
1318
1487
|
if mesh is not None: self.mesh = mesh
|
|
1319
1488
|
if nimgs is not None: self.nimgs = nimgs
|
|
1320
1489
|
if dimension is not None: self.dimension = dimension
|
|
1490
|
+
if fractional is not None: self.fractional = fractional
|
|
1321
1491
|
if precision is not None: self.precision = precision
|
|
1322
1492
|
if rcut is not None: self.rcut = rcut
|
|
1323
1493
|
if ke_cutoff is not None: self.ke_cutoff = ke_cutoff
|
|
@@ -1331,8 +1501,11 @@ class Cell(mole.MoleBase):
|
|
|
1331
1501
|
if symmorphic is not None:
|
|
1332
1502
|
self.symmorphic = symmorphic
|
|
1333
1503
|
|
|
1334
|
-
|
|
1335
|
-
|
|
1504
|
+
if self.a is None:
|
|
1505
|
+
raise RuntimeError('Lattice parameters not specified')
|
|
1506
|
+
|
|
1507
|
+
_built = self._built
|
|
1508
|
+
mole.MoleBase.build(self, False, parse_arg, *args, **kwargs)
|
|
1336
1509
|
|
|
1337
1510
|
exp_min = np.array([self.bas_exp(ib).min() for ib in range(self.nbas)])
|
|
1338
1511
|
if self.exp_to_discard is None:
|
|
@@ -1409,11 +1582,6 @@ class Cell(mole.MoleBase):
|
|
|
1409
1582
|
'%d contracted functions', nprim_drop, nctr_drop)
|
|
1410
1583
|
#logger.debug1(self, 'Old shells %s', steep_shls)
|
|
1411
1584
|
|
|
1412
|
-
# The rest initialization requires lattice parameters. If .a is not
|
|
1413
|
-
# set, pass the rest initialization.
|
|
1414
|
-
if self.a is None:
|
|
1415
|
-
return self
|
|
1416
|
-
|
|
1417
1585
|
if self.rcut is None or self._rcut_from_build:
|
|
1418
1586
|
self._rcut = estimate_rcut(self, self.precision)
|
|
1419
1587
|
self._rcut_from_build = True
|
|
@@ -1449,7 +1617,8 @@ class Cell(mole.MoleBase):
|
|
|
1449
1617
|
_check_mesh_symm = not self._mesh_from_build
|
|
1450
1618
|
self.build_lattice_symmetry(check_mesh_symmetry=_check_mesh_symm)
|
|
1451
1619
|
|
|
1452
|
-
if dump_input:
|
|
1620
|
+
if dump_input and not _built and self.verbose > logger.NOTE:
|
|
1621
|
+
self.dump_input()
|
|
1453
1622
|
logger.info(self, 'lattice vectors a1 [%.9f, %.9f, %.9f]', *_a[0])
|
|
1454
1623
|
logger.info(self, ' a2 [%.9f, %.9f, %.9f]', *_a[1])
|
|
1455
1624
|
logger.info(self, ' a3 [%.9f, %.9f, %.9f]', *_a[2])
|
|
@@ -1536,7 +1705,7 @@ class Cell(mole.MoleBase):
|
|
|
1536
1705
|
rcut_guess = estimate_rcut(self, self.precision)
|
|
1537
1706
|
if self.rcut > rcut_guess*1.5:
|
|
1538
1707
|
msg = ('.nimgs is a deprecated attribute. It is replaced by .rcut '
|
|
1539
|
-
'attribute for
|
|
1708
|
+
'attribute for lattice sum cutoff radius. The given nimgs '
|
|
1540
1709
|
'%s is far over the estimated cutoff radius %s. ' %
|
|
1541
1710
|
(x, rcut_guess))
|
|
1542
1711
|
warnings.warn(msg)
|
|
@@ -1742,12 +1911,14 @@ class Cell(mole.MoleBase):
|
|
|
1742
1911
|
'''Return a Mole object using the same atoms and basis functions as
|
|
1743
1912
|
the Cell object.
|
|
1744
1913
|
'''
|
|
1745
|
-
#FIXME: should cell be converted to mole object? If cell is converted
|
|
1746
|
-
# and a mole object is returned, many attributes (e.g. the GTH basis,
|
|
1747
|
-
# gth-PP) will not be recognized by mole.build function.
|
|
1748
1914
|
mol = self.view(mole.Mole)
|
|
1749
|
-
|
|
1750
|
-
|
|
1915
|
+
del mol.a
|
|
1916
|
+
mol.__dict__.pop('fractional', None)
|
|
1917
|
+
mol.__dict__.pop('ke_cutoff', None)
|
|
1918
|
+
mol.__dict__.pop('_mesh', None)
|
|
1919
|
+
mol.__dict__.pop('_rcut', None)
|
|
1920
|
+
mol.__dict__.pop('dimension', None)
|
|
1921
|
+
mol.__dict__.pop('low_dim_ft_type', None)
|
|
1751
1922
|
mol.enuc = None #reset nuclear energy
|
|
1752
1923
|
if mol.symmetry:
|
|
1753
1924
|
mol._build_symmetry()
|
pyscf/pbc/gto/ecp.py
CHANGED
|
@@ -21,29 +21,29 @@ Short range part of ECP under PBC
|
|
|
21
21
|
'''
|
|
22
22
|
|
|
23
23
|
from functools import reduce
|
|
24
|
-
import numpy
|
|
24
|
+
import numpy as np
|
|
25
25
|
from pyscf import lib
|
|
26
|
-
from pyscf
|
|
27
|
-
from pyscf.gto import
|
|
26
|
+
from pyscf import gto
|
|
27
|
+
from pyscf.pbc.gto.cell import _split_basis
|
|
28
|
+
from pyscf.pbc.df import incore
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
def ecp_int(cell, kpts=None):
|
|
31
|
-
from pyscf.pbc.df import incore
|
|
32
32
|
lib.logger.debug(cell, 'PBC-ECP integrals')
|
|
33
33
|
if kpts is None:
|
|
34
|
-
kpts_lst =
|
|
34
|
+
kpts_lst = np.zeros((1,3))
|
|
35
35
|
else:
|
|
36
|
-
kpts_lst =
|
|
36
|
+
kpts_lst = np.reshape(kpts, (-1,3))
|
|
37
37
|
|
|
38
|
-
cell, contr_coeff =
|
|
38
|
+
cell, contr_coeff = _split_basis(cell)
|
|
39
39
|
lib.logger.debug1(cell, 'nao %d -> nao %d', *(contr_coeff.shape))
|
|
40
40
|
|
|
41
41
|
ecpcell = cell.copy(deep=False)
|
|
42
42
|
# append a fake s function to mimic the auxiliary index in pbc.incore.
|
|
43
|
-
exp_ptr = cell._ecpbas[-1,PTR_EXP]
|
|
44
|
-
ecpcell._bas =
|
|
43
|
+
exp_ptr = cell._ecpbas[-1,gto.PTR_EXP]
|
|
44
|
+
ecpcell._bas = np.array([[0, 0, 1, 1, 0, exp_ptr, 0, 0]], dtype=np.int32)
|
|
45
45
|
# _env[AS_ECPBAS_OFFSET] is to be determined in pbc.incore
|
|
46
|
-
cell._env[AS_NECPBAS] = len(cell._ecpbas)
|
|
46
|
+
cell._env[gto.AS_NECPBAS] = len(cell._ecpbas)
|
|
47
47
|
# shls_slice of auxiliary index (0,1) corresponds to the fake s function
|
|
48
48
|
shls_slice = (0, cell.nbas, 0, cell.nbas, 0, 1)
|
|
49
49
|
|
|
@@ -57,7 +57,7 @@ def ecp_int(cell, kpts=None):
|
|
|
57
57
|
v = lib.unpack_tril(buf[k], lib.HERMITIAN)
|
|
58
58
|
if abs(kpt).max() < 1e-9: # gamma_point:
|
|
59
59
|
v = v.real
|
|
60
|
-
mat.append(reduce(
|
|
61
|
-
if kpts is None or
|
|
60
|
+
mat.append(reduce(np.dot, (contr_coeff.T, v, contr_coeff)))
|
|
61
|
+
if kpts is None or np.shape(kpts) == (3,):
|
|
62
62
|
mat = mat[0]
|
|
63
63
|
return mat
|
pyscf/pbc/gto/eval_gto.py
CHANGED
|
@@ -167,8 +167,8 @@ def eval_gto(cell, eval_name, coords, comp=None, kpts=None, kpt=None,
|
|
|
167
167
|
pbc_eval_gto = eval_gto
|
|
168
168
|
|
|
169
169
|
def _estimate_rcut(cell):
|
|
170
|
-
'''Cutoff
|
|
171
|
-
required
|
|
170
|
+
'''Cutoff radius, above which each shell decays to a value less than the
|
|
171
|
+
required precision'''
|
|
172
172
|
vol = cell.vol
|
|
173
173
|
weight_penalty = vol # ~ V[r] * (vol/ngrids) * ngrids
|
|
174
174
|
precision = cell.precision / max(weight_penalty, 1)
|
|
@@ -248,6 +248,6 @@ def get_lattice_Ls(cell, nimgs=None, rcut=None, dimension=None, discard=True):
|
|
|
248
248
|
grids2atm[~edge_filter2[:,:,1],1] -= edge_ub[1]
|
|
249
249
|
grids2atm[~edge_filter2[:,:,2],2] -= edge_ub[2]
|
|
250
250
|
grids2atm[edge_filter1 & edge_filter2] = 0.
|
|
251
|
-
Ls_mask = (np.linalg.norm(grids2atm, axis=2) < rcut).any(axis=0)
|
|
251
|
+
Ls_mask = (np.linalg.norm(grids2atm[:,:,:dimension], axis=2) < rcut).any(axis=0)
|
|
252
252
|
Ls = Ls[Ls_mask]
|
|
253
253
|
return np.asarray(Ls, order='C')
|
pyscf/pbc/gto/neighborlist.py
CHANGED
|
@@ -24,6 +24,7 @@ from pyscf.lib import logger
|
|
|
24
24
|
libpbc = lib.load_library('libpbc')
|
|
25
25
|
|
|
26
26
|
class _CNeighborPair(ctypes.Structure):
|
|
27
|
+
__slots__ = []
|
|
27
28
|
_fields_ = [("nimgs", ctypes.c_int),
|
|
28
29
|
("Ls_list", ctypes.POINTER(ctypes.c_int)),
|
|
29
30
|
("q_cond", ctypes.POINTER(ctypes.c_double)),
|
|
@@ -31,6 +32,7 @@ class _CNeighborPair(ctypes.Structure):
|
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
class _CNeighborList(ctypes.Structure):
|
|
35
|
+
__slots__ = []
|
|
34
36
|
_fields_ = [("nish", ctypes.c_int),
|
|
35
37
|
("njsh", ctypes.c_int),
|
|
36
38
|
("nimgs", ctypes.c_int),
|
|
@@ -38,6 +40,7 @@ class _CNeighborList(ctypes.Structure):
|
|
|
38
40
|
|
|
39
41
|
|
|
40
42
|
class _CNeighborListOpt(ctypes.Structure):
|
|
43
|
+
__slots__ = []
|
|
41
44
|
_fields_ = [("nl", ctypes.POINTER(_CNeighborList)),
|
|
42
45
|
('fprescreen', ctypes.c_void_p)]
|
|
43
46
|
|
|
@@ -54,7 +57,7 @@ def build_neighbor_list_for_shlpairs(cell, cell1=None, Ls=None,
|
|
|
54
57
|
cell1 : :class:`pbc.gto.cell.Cell`, optional
|
|
55
58
|
The :class:`Cell` instance for the ket basis functions.
|
|
56
59
|
If not given, both bra and ket basis functions come from cell.
|
|
57
|
-
Ls : (*,3) array, optional
|
|
60
|
+
Ls : ``(*,3)`` array, optional
|
|
58
61
|
The cartesian coordinates of the periodic images.
|
|
59
62
|
Default is calculated by :func:`cell.get_lattice_Ls`.
|
|
60
63
|
ish_rcut : (nish,) array, optional
|
pyscf/pbc/gto/pseudo/pp.py
CHANGED
|
@@ -227,7 +227,7 @@ def cart2polar(rvec):
|
|
|
227
227
|
|
|
228
228
|
|
|
229
229
|
def get_pp(cell, kpt=np.zeros(3)):
|
|
230
|
-
'''Get the periodic
|
|
230
|
+
'''Get the periodic pseudopotential nuc-el AO matrix
|
|
231
231
|
'''
|
|
232
232
|
from pyscf.pbc import tools
|
|
233
233
|
coords = cell.get_uniform_grids()
|
pyscf/pbc/gw/krgw_ac.py
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
PBC spin-restricted G0W0-AC QP eigenvalues with k-point sampling
|
|
21
21
|
This implementation has N^4 scaling, and is faster than GW-CD (N^4)
|
|
22
22
|
and analytic GW (N^6) methods.
|
|
23
|
-
GW-AC is recommended for valence states only, and is
|
|
23
|
+
GW-AC is recommended for valence states only, and is inaccurate for core states.
|
|
24
24
|
|
|
25
25
|
Method:
|
|
26
26
|
See T. Zhu and G.K.-L. Chan, arxiv:2007.03148 (2020) for details
|
|
@@ -277,7 +277,7 @@ def get_sigma_diag(gw, orbs, kptlist, freqs, wts, iw_cutoff=None, max_memory=800
|
|
|
277
277
|
for LpqR, LpqI, sign \
|
|
278
278
|
in mydf.sr_loop([kpti, kptj], max_memory=0.1*gw._scf.max_memory, compact=False):
|
|
279
279
|
Lpq.append(LpqR+LpqI*1.0j)
|
|
280
|
-
# support
|
|
280
|
+
# support unequal naux on different k points
|
|
281
281
|
Lpq = np.vstack(Lpq).reshape(-1,nmo**2)
|
|
282
282
|
tao = []
|
|
283
283
|
ao_loc = None
|
|
@@ -389,7 +389,7 @@ def get_rho_response_wing(gw, omega, mo_energy, Lpq, qij):
|
|
|
389
389
|
def get_qij(gw, q, mo_coeff, uniform_grids=False):
|
|
390
390
|
'''
|
|
391
391
|
Compute qij = 1/Omega * |< psi_{ik} | e^{iqr} | psi_{ak-q} >|^2 at q: (nkpts, nocc, nvir)
|
|
392
|
-
through kp
|
|
392
|
+
through kp perturbation theory
|
|
393
393
|
Ref: Phys. Rev. B 83, 245122 (2011)
|
|
394
394
|
'''
|
|
395
395
|
nocc = gw.nocc
|
|
@@ -442,7 +442,7 @@ def _get_scaled_legendre_roots(nw):
|
|
|
442
442
|
|
|
443
443
|
def _get_clenshaw_curtis_roots(nw):
|
|
444
444
|
"""
|
|
445
|
-
Clenshaw-Curtis
|
|
445
|
+
Clenshaw-Curtis quadrature on [0,inf)
|
|
446
446
|
Ref: J. Chem. Phys. 132, 234114 (2010)
|
|
447
447
|
Returns:
|
|
448
448
|
freqs : 1D ndarray
|
pyscf/pbc/gw/krgw_cd.py
CHANGED
|
@@ -237,7 +237,7 @@ def get_WmnI_diag(gw, orbs, kptlist, freqs, max_memory=8000):
|
|
|
237
237
|
for LpqR, LpqI, sign \
|
|
238
238
|
in mydf.sr_loop([kpti, kptj], max_memory=0.1*gw._scf.max_memory, compact=False):
|
|
239
239
|
Lpq.append(LpqR+LpqI*1.0j)
|
|
240
|
-
# support
|
|
240
|
+
# support unequal naux on different k points
|
|
241
241
|
Lpq = np.vstack(Lpq).reshape(-1,nmo**2)
|
|
242
242
|
tao = []
|
|
243
243
|
ao_loc = None
|
|
@@ -338,7 +338,7 @@ def get_rho_response_R(gw, omega, mo_energy, Lpq, kL, kidx):
|
|
|
338
338
|
|
|
339
339
|
def get_sigmaR_diag(gw, omega, kn, orbp, ef, freqs, qij, q_abs):
|
|
340
340
|
'''
|
|
341
|
-
Compute self-energy for poles inside
|
|
341
|
+
Compute self-energy for poles inside contour
|
|
342
342
|
(more and more expensive away from Fermi surface)
|
|
343
343
|
'''
|
|
344
344
|
mo_energy = np.array(gw._scf.mo_energy)
|
|
@@ -394,7 +394,7 @@ def get_sigmaR_diag(gw, omega, kn, orbp, ef, freqs, qij, q_abs):
|
|
|
394
394
|
for LpqR, LpqI, sign \
|
|
395
395
|
in mydf.sr_loop([kpti, kptj], max_memory=0.1*gw._scf.max_memory, compact=False):
|
|
396
396
|
Lpq.append(LpqR+LpqI*1.0j)
|
|
397
|
-
# support
|
|
397
|
+
# support unequal naux on different k points
|
|
398
398
|
Lpq = np.vstack(Lpq).reshape(-1,nmo**2)
|
|
399
399
|
tao = []
|
|
400
400
|
ao_loc = None
|
|
@@ -577,7 +577,7 @@ def _get_scaled_legendre_roots(nw):
|
|
|
577
577
|
|
|
578
578
|
def _get_clenshaw_curtis_roots(nw):
|
|
579
579
|
"""
|
|
580
|
-
Clenshaw-Curtis
|
|
580
|
+
Clenshaw-Curtis quadrature on [0,inf)
|
|
581
581
|
Ref: J. Chem. Phys. 132, 234114 (2010)
|
|
582
582
|
Returns:
|
|
583
583
|
freqs : 1D ndarray
|
pyscf/pbc/gw/kugw_ac.py
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
'''
|
|
20
20
|
PBC spin-unrestricted G0W0-AC QP eigenvalues with k-point sampling
|
|
21
|
-
GW-AC is recommended for valence states only, and is
|
|
21
|
+
GW-AC is recommended for valence states only, and is inaccurate for core states.
|
|
22
22
|
|
|
23
23
|
Method:
|
|
24
24
|
See T. Zhu and G.K.-L. Chan, arxiv:2007.03148 (2020) for details
|
|
@@ -448,7 +448,7 @@ def get_rho_response_wing(gw, omega, mo_energy, Lpq, qij):
|
|
|
448
448
|
def get_qij(gw, q, mo_coeff, uniform_grids=False):
|
|
449
449
|
'''
|
|
450
450
|
Compute qij = 1/Omega * |< psi_{ik} | e^{iqr} | psi_{ak-q} >|^2 at q: (nkpts, nocc, nvir)
|
|
451
|
-
through kp
|
|
451
|
+
through kp perturbation theory
|
|
452
452
|
Ref: Phys. Rev. B 83, 245122 (2011)
|
|
453
453
|
'''
|
|
454
454
|
nocca, noccb = gw.nocc
|
|
@@ -507,7 +507,7 @@ def _get_scaled_legendre_roots(nw):
|
|
|
507
507
|
|
|
508
508
|
def _get_clenshaw_curtis_roots(nw):
|
|
509
509
|
"""
|
|
510
|
-
Clenshaw-Curtis
|
|
510
|
+
Clenshaw-Curtis quadrature on [0,inf)
|
|
511
511
|
Ref: J. Chem. Phys. 132, 234114 (2010)
|
|
512
512
|
Returns:
|
|
513
513
|
freqs : 1D ndarray
|
pyscf/pbc/lib/kpts_helper.py
CHANGED
|
@@ -30,7 +30,7 @@ KPT_DIFF_TOL = getattr(__config__, 'pbc_lib_kpts_helper_kpt_diff_tol', 1e-6)
|
|
|
30
30
|
|
|
31
31
|
def is_zero(kpt):
|
|
32
32
|
return abs(np.asarray(kpt)).sum() < KPT_DIFF_TOL
|
|
33
|
-
gamma_point = is_zero
|
|
33
|
+
is_gamma_point = gamma_point = is_zero
|
|
34
34
|
|
|
35
35
|
def round_to_fbz(kpts, wrap_around=False, tol=KPT_DIFF_TOL):
|
|
36
36
|
'''
|
|
@@ -91,6 +91,7 @@ def unique(kpts):
|
|
|
91
91
|
kpts.round(digits), return_index=True, return_inverse=True, axis=0)[1:3]
|
|
92
92
|
idx = uniq_index.argsort()
|
|
93
93
|
rank = idx.argsort()
|
|
94
|
+
uniq_inverse = uniq_inverse.ravel()
|
|
94
95
|
return kpts[uniq_index[idx]], uniq_index[idx], rank[uniq_inverse]
|
|
95
96
|
except TypeError:
|
|
96
97
|
# Old numpy does not support unique of 2D array
|
|
@@ -261,7 +262,7 @@ def get_kconserv(cell, kpts):
|
|
|
261
262
|
r'''Get the momentum conservation array for a set of k-points.
|
|
262
263
|
|
|
263
264
|
Given k-point indices (k, l, m) the array kconserv[k,l,m] returns
|
|
264
|
-
the index n that
|
|
265
|
+
the index n that satisfies momentum conservation,
|
|
265
266
|
|
|
266
267
|
(k(k) - k(l) + k(m) - k(n)) \dot a = 2n\pi
|
|
267
268
|
|
|
@@ -287,7 +288,7 @@ def get_kconserv_ria(cell, kpts):
|
|
|
287
288
|
for a set of k-points with appropriate k-shift.
|
|
288
289
|
|
|
289
290
|
Given k-point indices m the array kconserv[kshift,m] returns the index n that
|
|
290
|
-
|
|
291
|
+
satisfies a shifted momentum conservation,
|
|
291
292
|
|
|
292
293
|
(k(m) - k(n) - k(kshift)) \dot a = 2n\pi
|
|
293
294
|
|
pyscf/pbc/lib/linalg_helper.py
CHANGED
|
@@ -649,7 +649,7 @@ class DavidsonZL:
|
|
|
649
649
|
if tmp <= self.crit_e: nconv1+=1
|
|
650
650
|
if VERBOSE: print(' No. of converged eigval:',nconv1)
|
|
651
651
|
if nconv1 == neig:
|
|
652
|
-
if VERBOSE: print(' Cong: all
|
|
652
|
+
if VERBOSE: print(' Cong: all eigenvalues converged ! ')
|
|
653
653
|
eigs = teig.copy()
|
|
654
654
|
|
|
655
655
|
# Full Residuals: Res[i]=Res'[i]-w[i]*X[i]
|
pyscf/pbc/mp/kmp2.py
CHANGED
|
@@ -380,7 +380,7 @@ def _frozen_sanity_check(frozen, mo_occ, kpt_idx):
|
|
|
380
380
|
|
|
381
381
|
Args:
|
|
382
382
|
frozen (array_like of int): The orbital indices that will be frozen.
|
|
383
|
-
mo_occ (:obj:`ndarray` of int): The
|
|
383
|
+
mo_occ (:obj:`ndarray` of int): The occupation number for each orbital
|
|
384
384
|
resulting from a mean-field-like calculation.
|
|
385
385
|
kpt_idx (int): The k-point that `mo_occ` and `frozen` belong to.
|
|
386
386
|
|
pyscf/pbc/mpitools/mpi.py
CHANGED
|
@@ -67,7 +67,7 @@ INQUIRY = 50050
|
|
|
67
67
|
TASK = 50051
|
|
68
68
|
def work_share_partition(tasks, interval=.02, loadmin=1):
|
|
69
69
|
loadmin = max(loadmin, len(tasks)//50//pool.size)
|
|
70
|
-
rest_tasks =
|
|
70
|
+
rest_tasks = list(tasks[loadmin*pool.size:])
|
|
71
71
|
tasks = tasks[loadmin*rank:loadmin*rank+loadmin]
|
|
72
72
|
def distribute_task():
|
|
73
73
|
while True:
|