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/solvent/cosmors.py
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
# Copyright 2014-2018 The PySCF Developers. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
'''
|
|
16
|
+
Provides functionality to generate COSMO files and sigma-profiles
|
|
17
|
+
for the further use in COSMO-RS/COSMO-SAC computations and/or ML
|
|
18
|
+
'''
|
|
19
|
+
|
|
20
|
+
#%% Imports
|
|
21
|
+
|
|
22
|
+
import re as _re
|
|
23
|
+
from itertools import product as _product
|
|
24
|
+
|
|
25
|
+
import numpy as _np
|
|
26
|
+
|
|
27
|
+
from pyscf import __version__
|
|
28
|
+
from pyscf.data.nist import BOHR as _BOHR
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
#%% SAS volume
|
|
33
|
+
|
|
34
|
+
def _get_line_atom_intersection(x, y, atom, r):
|
|
35
|
+
'''Returns z-coordinates of boundaries of intersection of
|
|
36
|
+
the (x,y,0) + t(0,0,1) line and vdW sphere
|
|
37
|
+
|
|
38
|
+
Arguments:
|
|
39
|
+
x (float): x parameter of the line
|
|
40
|
+
y (float): y parameter of the line
|
|
41
|
+
atom (np.ndarray): xyz-coordinates of the atom
|
|
42
|
+
r (float): van der Waals radii of the atom
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
_tp.Optional[_tp.List[float, float]]: z-coordinates
|
|
46
|
+
of the line/sphere intersection, and None
|
|
47
|
+
if they do not intersect
|
|
48
|
+
|
|
49
|
+
'''
|
|
50
|
+
# check distance between line and atom
|
|
51
|
+
d = _np.linalg.norm(_np.array([x,y]) - atom[:2])
|
|
52
|
+
if d >= r:
|
|
53
|
+
return None
|
|
54
|
+
# find interval
|
|
55
|
+
dz = (r**2 - d**2)**0.5
|
|
56
|
+
interval = [atom[2] - dz, atom[2] + dz]
|
|
57
|
+
|
|
58
|
+
return interval
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _unite_intervals(intervals):
|
|
62
|
+
'''Unites float intervals
|
|
63
|
+
|
|
64
|
+
Arguments:
|
|
65
|
+
intervals (_tp.List[_tp.List[float, float]]): list of intervals
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
_tp.List[_tp.List[float, float]]: list of united intervals
|
|
69
|
+
|
|
70
|
+
'''
|
|
71
|
+
united = []
|
|
72
|
+
for begin, end in sorted(intervals):
|
|
73
|
+
if united and united[-1][1] >= begin:
|
|
74
|
+
united[-1][1] = end
|
|
75
|
+
else:
|
|
76
|
+
united.append([begin, end])
|
|
77
|
+
|
|
78
|
+
return united
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _get_line_sas_intersection_length(x, y, coords, radii):
|
|
82
|
+
'''Finds total length of all (x,y,0) + t(0,0,1) line's intervals
|
|
83
|
+
enclosed by intersections with solvent-accessible surface
|
|
84
|
+
|
|
85
|
+
Arguments:
|
|
86
|
+
x (float): x parameter of the line
|
|
87
|
+
y (float): y parameter of the line
|
|
88
|
+
atoms (_np.ndarray): (n*3) array of atomic coordinates
|
|
89
|
+
radii (_np.ndarray): array of vdW radii
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
float: total length of all line's intervals enclosed by SAS
|
|
93
|
+
|
|
94
|
+
'''
|
|
95
|
+
intervals = [_get_line_atom_intersection(x, y, atom, r) for atom, r in zip(coords, radii)]
|
|
96
|
+
intervals = _unite_intervals([_ for _ in intervals if _])
|
|
97
|
+
length = sum([end - begin for begin, end in intervals])
|
|
98
|
+
|
|
99
|
+
return length
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def get_sas_volume(surface, step=0.2):
|
|
103
|
+
'''Computes volume [A**3] of space enclosed by solvent-accessible surface
|
|
104
|
+
|
|
105
|
+
Arguments:
|
|
106
|
+
surface (dict): dictionary containing SAS parameters (mc.with_solvent.surface)
|
|
107
|
+
step (float): grid spacing parameter, [Bohr]
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
float: SAS-defined volume of the molecule [A**3]
|
|
111
|
+
|
|
112
|
+
'''
|
|
113
|
+
# get parameters
|
|
114
|
+
coords = surface['atom_coords']
|
|
115
|
+
radii = _np.array([surface['R_vdw'][i] for i, j in surface['gslice_by_atom']])
|
|
116
|
+
# compute minimaxes of SAS coordinates
|
|
117
|
+
bounds = _np.array([(coords - radii[:, _np.newaxis]).min(axis = 0),
|
|
118
|
+
(coords + radii[:, _np.newaxis]).max(axis = 0)])
|
|
119
|
+
# swap axes to minimize integration mesh
|
|
120
|
+
axes = [(val, idx) for idx, val in enumerate(bounds[1] - bounds[0])]
|
|
121
|
+
axes = [idx for val, idx in sorted(axes)]
|
|
122
|
+
coords = coords[:,axes]
|
|
123
|
+
bounds = bounds[:,axes]
|
|
124
|
+
# mesh parameters
|
|
125
|
+
xs = _np.linspace(bounds[0,0], bounds[1,0],
|
|
126
|
+
int(_np.ceil((bounds[1,0] - bounds[0,0])/step)) + 1)
|
|
127
|
+
ys = _np.linspace(bounds[0,1], bounds[1,1],
|
|
128
|
+
int(_np.ceil((bounds[1,1] - bounds[0,1])/step)) + 1)
|
|
129
|
+
dxdy = (xs[1] - xs[0])*(ys[1] - ys[0])
|
|
130
|
+
# integration
|
|
131
|
+
V = sum([dxdy * _get_line_sas_intersection_length(x, y, coords, radii) for x, y in _product(xs, ys)])
|
|
132
|
+
|
|
133
|
+
return V * _BOHR**3
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
#%% COSMO-files
|
|
138
|
+
|
|
139
|
+
def _check_feps(mf, ignore_low_feps):
|
|
140
|
+
'''Checks f_epsilon value and raises ValueError for f_eps < 1
|
|
141
|
+
|
|
142
|
+
Arguments:
|
|
143
|
+
mf: processed SCF with PCM solvation
|
|
144
|
+
ignore_low_feps (bool): if True, does not raise ValueError if feps < 1
|
|
145
|
+
|
|
146
|
+
Raises:
|
|
147
|
+
ValueError: if f_epsilon < 1 and ignore_low_feps flag is set to False
|
|
148
|
+
|
|
149
|
+
'''
|
|
150
|
+
if ignore_low_feps:
|
|
151
|
+
return
|
|
152
|
+
|
|
153
|
+
f_eps = mf.with_solvent._intermediates['f_epsilon']
|
|
154
|
+
if f_eps < 1.0:
|
|
155
|
+
message = f'Low f_eps value: {f_eps}. '
|
|
156
|
+
message += 'COSMO-RS requires f_epsilon=1.0 or eps=float("inf"). '
|
|
157
|
+
message += 'Rerun computation with correct epsilon or use the ignore_low_feps argument.'
|
|
158
|
+
raise ValueError(message)
|
|
159
|
+
|
|
160
|
+
return
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def _lot(mf):
|
|
164
|
+
'''Returns level of theory in method-disp/basis/solvation format (raw solution)
|
|
165
|
+
|
|
166
|
+
Arguments:
|
|
167
|
+
mf: processed SCF
|
|
168
|
+
|
|
169
|
+
Returns:
|
|
170
|
+
str: method-dispersion/basis/solvation
|
|
171
|
+
|
|
172
|
+
'''
|
|
173
|
+
# method
|
|
174
|
+
method = mf.xc if hasattr(mf, 'xc') else None
|
|
175
|
+
if method is None:
|
|
176
|
+
match = _re.search('HF|MP2|CCSD', str(type(mf)))
|
|
177
|
+
method = match.group(0) if match else '???'
|
|
178
|
+
# dispersion
|
|
179
|
+
match = _re.search('D3|D4', str(type(mf)))
|
|
180
|
+
disp = '-' + match.group(0) if match else ''
|
|
181
|
+
# other
|
|
182
|
+
basis = mf.mol.basis
|
|
183
|
+
solv = '/' + mf.with_solvent.method if hasattr(mf, 'with_solvent') else ''
|
|
184
|
+
# approx
|
|
185
|
+
lot = f'{method}{disp}/{basis}{solv}'.lower()
|
|
186
|
+
|
|
187
|
+
return lot
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def write_cosmo_file(fout, mf, step=0.2, ignore_low_feps=False):
|
|
191
|
+
'''Saves COSMO file
|
|
192
|
+
|
|
193
|
+
Arguments:
|
|
194
|
+
fout: writable file object
|
|
195
|
+
mf: processed SCF with PCM solvation
|
|
196
|
+
step (float): grid spacing parameter to compute volume, [Bohr]
|
|
197
|
+
ignore_low_feps (bool): if True, does not raise ValueError if feps < 1
|
|
198
|
+
|
|
199
|
+
Raises:
|
|
200
|
+
ValueError: if f_epsilon < 1 and ignore_low_feps flag is set to False
|
|
201
|
+
|
|
202
|
+
'''
|
|
203
|
+
_check_feps(mf, ignore_low_feps)
|
|
204
|
+
|
|
205
|
+
# qm params
|
|
206
|
+
fout.write('$info\n')
|
|
207
|
+
fout.write(f'PySCF v. {__version__}, {_lot(mf)}\n')
|
|
208
|
+
|
|
209
|
+
# cosmo data
|
|
210
|
+
f_epsilon = mf.with_solvent._intermediates['f_epsilon']
|
|
211
|
+
n_segments = len(mf.with_solvent._intermediates['q'])
|
|
212
|
+
area = sum(mf.with_solvent.surface['area'])
|
|
213
|
+
volume = get_sas_volume(mf.with_solvent.surface, step) / _BOHR**3
|
|
214
|
+
# print
|
|
215
|
+
fout.write('$cosmo_data\n')
|
|
216
|
+
fout.write(f' fepsi = {f_epsilon:>.8f}\n')
|
|
217
|
+
fout.write(f' nps = {n_segments:>10d}\n')
|
|
218
|
+
fout.write(f' area = {area:>10.2f} # [Bohr**2]\n')
|
|
219
|
+
fout.write(f' volume = {volume:>10.2f} # [Bohr**3]\n')
|
|
220
|
+
|
|
221
|
+
# atomic coordinates
|
|
222
|
+
atoms = range(1, 1 + len(mf.mol.elements))
|
|
223
|
+
xs, ys, zs = zip(*mf.mol.atom_coords().tolist())
|
|
224
|
+
elems = [elem.lower() for elem in mf.mol.elements]
|
|
225
|
+
radii = [mf.with_solvent.surface['R_vdw'][i] for i, j in mf.with_solvent.surface['gslice_by_atom']]
|
|
226
|
+
# print
|
|
227
|
+
fout.write('$coord_rad\n')
|
|
228
|
+
fout.write('#atom x [Bohr] y [Bohr] z [Bohr] element radius [Bohr]\n')
|
|
229
|
+
for atom, x, y, z, elem, r in zip(atoms, xs, ys, zs, elems, radii):
|
|
230
|
+
fout.write(f'{atom:>4d}{x:>19.14f}{y:>19.14f}{z:>19.14f} {elem:<2}{r:>12.5f}\n')
|
|
231
|
+
|
|
232
|
+
# cosmo parameters
|
|
233
|
+
screening_charge = sum(mf.with_solvent._intermediates['q'])
|
|
234
|
+
E_tot = sum(mf.scf_summary.values())
|
|
235
|
+
E_diel = mf.scf_summary['e_solvent']
|
|
236
|
+
# print
|
|
237
|
+
fout.write('$screening_charge\n')
|
|
238
|
+
fout.write(f' cosmo = {screening_charge:>15.6f}\n')
|
|
239
|
+
fout.write('$cosmo_energy\n')
|
|
240
|
+
fout.write(f' Total energy [a.u.] = {E_tot:>19.10f}\n')
|
|
241
|
+
fout.write(f' Dielectric energy [a.u.] = {E_diel:>19.10f}\n')
|
|
242
|
+
|
|
243
|
+
# segments
|
|
244
|
+
xs, ys, zs = zip(*mf.with_solvent.surface['grid_coords'].tolist())
|
|
245
|
+
ns = range(1, len(xs) + 1)
|
|
246
|
+
atoms = []
|
|
247
|
+
for idx, (start, end) in enumerate(mf.with_solvent.surface['gslice_by_atom']):
|
|
248
|
+
atoms += [idx + 1] * (end - start)
|
|
249
|
+
qs = mf.with_solvent._intermediates['q']
|
|
250
|
+
areas = mf.with_solvent.surface['area'] * _BOHR**2
|
|
251
|
+
sigmas = qs / areas
|
|
252
|
+
pots = mf.with_solvent._intermediates['v_grids']
|
|
253
|
+
# print legend
|
|
254
|
+
fout.write('$segment_information\n')
|
|
255
|
+
fout.write('# n - segment number\n')
|
|
256
|
+
fout.write('# atom - atom associated with segment n\n')
|
|
257
|
+
fout.write('# x, y, z - segment coordinates, [Bohr]\n')
|
|
258
|
+
fout.write('# charge - segment charge\n')
|
|
259
|
+
fout.write('# area - segment area [A**2]\n')
|
|
260
|
+
fout.write('# charge/area - segment charge density [e/A**2]\n')
|
|
261
|
+
fout.write('# potential - solute potential on segment\n')
|
|
262
|
+
fout.write('#\n')
|
|
263
|
+
fout.write('# n atom position (X, Y, Z) ')
|
|
264
|
+
fout.write('charge area charge/area potential\n')
|
|
265
|
+
fout.write('#\n')
|
|
266
|
+
fout.write('#\n')
|
|
267
|
+
# print params
|
|
268
|
+
for n, x, y, z, atom, q, area, sigma, pot in zip(ns, xs, ys, zs, atoms, qs, areas, sigmas, pots):
|
|
269
|
+
line = f'{n:>5d}{atom:>5d}{x:>15.9f}{y:>15.9f}{z:>15.9f}'
|
|
270
|
+
line += f'{q:>15.9f}{area:>15.9f}{sigma:>15.9f}{pot:>15.9f}\n'
|
|
271
|
+
fout.write(line)
|
|
272
|
+
|
|
273
|
+
return
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
#%% Sigma-profile
|
|
278
|
+
|
|
279
|
+
def get_sigma_profile(mf, sigmas_grid, ignore_low_feps=False):
|
|
280
|
+
'''Computes sigma-profile in [-0.025..0.025] e/A**2 range as in
|
|
281
|
+
https://github.com/usnistgov/COSMOSAC/blob/master/profiles/to_sigma.py#L181
|
|
282
|
+
https://doi.org/10.1021/acs.jctc.9b01016
|
|
283
|
+
|
|
284
|
+
Arguments:
|
|
285
|
+
mf: processed SCF with PCM solvation
|
|
286
|
+
sigmas_grid (_np.ndarray): grid of screening charge values,
|
|
287
|
+
e.g. np.linspace(-0.025, 0.025, 51)
|
|
288
|
+
ignore_low_feps (bool): if True, does not raise ValueError if feps < 1
|
|
289
|
+
|
|
290
|
+
Returns:
|
|
291
|
+
_np.ndarray: array of 51 elements corresponding to the p(sigma) values for
|
|
292
|
+
the screening charge values in [-0.025..0.025] e/A**2 range
|
|
293
|
+
|
|
294
|
+
Raises:
|
|
295
|
+
ValueError: if f_epsilon < 1 and ignore_low_feps flag is set to False
|
|
296
|
+
|
|
297
|
+
'''
|
|
298
|
+
_check_feps(mf, ignore_low_feps)
|
|
299
|
+
|
|
300
|
+
# prepare params
|
|
301
|
+
qs = mf.with_solvent._intermediates['q']
|
|
302
|
+
areas = mf.with_solvent.surface['area'] * _BOHR**2
|
|
303
|
+
sigmas = qs / areas
|
|
304
|
+
step = sigmas_grid[1] - sigmas_grid[0]
|
|
305
|
+
max_sigma = sigmas_grid[-1] + step
|
|
306
|
+
n_bins = len(sigmas_grid)
|
|
307
|
+
|
|
308
|
+
# compute profile
|
|
309
|
+
psigma = _np.zeros(n_bins)
|
|
310
|
+
for sigma, area in zip(sigmas, areas):
|
|
311
|
+
# get index of left sigma grid value
|
|
312
|
+
left = int(_np.floor((sigma - sigmas_grid[0]) / step))
|
|
313
|
+
if left < -1 or left > n_bins - 1:
|
|
314
|
+
continue
|
|
315
|
+
# get impact of the segment to the left bin
|
|
316
|
+
val_right = sigmas_grid[left+1] if left < n_bins - 1 else max_sigma
|
|
317
|
+
w_left = (val_right - sigma) / step
|
|
318
|
+
# add areas to p(sigma)
|
|
319
|
+
if left > -1:
|
|
320
|
+
psigma[left] += area * w_left
|
|
321
|
+
if left < n_bins - 1:
|
|
322
|
+
psigma[left+1] += area * (1 - w_left)
|
|
323
|
+
|
|
324
|
+
return psigma
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
def get_cosmors_parameters(mf, sigmas_grid=_np.linspace(-0.025, 0.025, 51),
|
|
328
|
+
step=0.2, ignore_low_feps=False):
|
|
329
|
+
'''Computes main COSMO-RS parameters
|
|
330
|
+
|
|
331
|
+
Arguments:
|
|
332
|
+
mf: processed SCF with PCM solvation
|
|
333
|
+
step (float): grid spacing parameter to compute volume, [Bohr]
|
|
334
|
+
ignore_low_feps (bool): if True, does not raise ValueError if feps < 1
|
|
335
|
+
|
|
336
|
+
Returns:
|
|
337
|
+
dict: main COSMO-RS parameters, including sigma-profile, volume, surface area,
|
|
338
|
+
SCF and dielectric energies
|
|
339
|
+
|
|
340
|
+
Raises:
|
|
341
|
+
ValueError: if f_epsilon < 1 and ignore_low_feps flag is set to False
|
|
342
|
+
|
|
343
|
+
'''
|
|
344
|
+
_check_feps(mf, ignore_low_feps)
|
|
345
|
+
|
|
346
|
+
# get params
|
|
347
|
+
lot = _lot(mf)
|
|
348
|
+
area = sum(mf.with_solvent.surface['area']) * _BOHR**2
|
|
349
|
+
volume = get_sas_volume(mf.with_solvent.surface, step)
|
|
350
|
+
psigma = get_sigma_profile(mf, sigmas_grid, ignore_low_feps=True)
|
|
351
|
+
E_tot = sum(mf.scf_summary.values())
|
|
352
|
+
E_diel = mf.scf_summary['e_solvent']
|
|
353
|
+
|
|
354
|
+
# output
|
|
355
|
+
params = {'PySCF version': __version__,
|
|
356
|
+
'Level of theory': lot,
|
|
357
|
+
'Surface area, A**2': float(area), # since np.float is not json-seriazable
|
|
358
|
+
'Volume, A**3': float(volume),
|
|
359
|
+
'Total energy, a.u.': float(E_tot),
|
|
360
|
+
'Dielectric energy, a.u.': float(E_diel),
|
|
361
|
+
'Screening charge density, A**2': psigma.tolist(),
|
|
362
|
+
'Screening charge, e/A**2': sigmas_grid.tolist()}
|
|
363
|
+
|
|
364
|
+
return params
|
|
365
|
+
|
|
366
|
+
|
pyscf/solvent/ddcosmo.py
CHANGED
|
@@ -680,7 +680,7 @@ class ddCOSMO(lib.StreamObject):
|
|
|
680
680
|
@dm.setter
|
|
681
681
|
def dm(self, dm):
|
|
682
682
|
'''Set dm to enable/disable the frozen ddCOSMO solvent potential.
|
|
683
|
-
Setting dm to None will disable the frozen
|
|
683
|
+
Setting dm to None will disable the frozen potential, i.e. the
|
|
684
684
|
potential will respond to the change of the density during SCF
|
|
685
685
|
iterations.
|
|
686
686
|
'''
|
pyscf/solvent/pcm.py
CHANGED
|
@@ -328,21 +328,21 @@ class PCM(lib.StreamObject):
|
|
|
328
328
|
|
|
329
329
|
epsilon = self.eps
|
|
330
330
|
if self.method.upper() in ['C-PCM', 'CPCM']:
|
|
331
|
-
f_epsilon = (epsilon-1.)/epsilon
|
|
331
|
+
f_epsilon = (epsilon-1.)/epsilon if epsilon != float('inf') else 1.0
|
|
332
332
|
K = S
|
|
333
333
|
R = -f_epsilon * numpy.eye(K.shape[0])
|
|
334
334
|
elif self.method.upper() == 'COSMO':
|
|
335
|
-
f_epsilon = (epsilon - 1.0)/(epsilon + 1.0/2.0)
|
|
335
|
+
f_epsilon = (epsilon - 1.0)/(epsilon + 1.0/2.0) if epsilon != float('inf') else 1.0
|
|
336
336
|
K = S
|
|
337
337
|
R = -f_epsilon * numpy.eye(K.shape[0])
|
|
338
338
|
elif self.method.upper() in ['IEF-PCM', 'IEFPCM']:
|
|
339
|
-
f_epsilon = (epsilon - 1.0)/(epsilon + 1.0)
|
|
339
|
+
f_epsilon = (epsilon - 1.0)/(epsilon + 1.0) if epsilon != float('inf') else 1.0
|
|
340
340
|
DA = D*A
|
|
341
341
|
DAS = numpy.dot(DA, S)
|
|
342
342
|
K = S - f_epsilon/(2.0*PI) * DAS
|
|
343
343
|
R = -f_epsilon * (numpy.eye(K.shape[0]) - 1.0/(2.0*PI)*DA)
|
|
344
344
|
elif self.method.upper() == 'SS(V)PE':
|
|
345
|
-
f_epsilon = (epsilon - 1.0)/(epsilon + 1.0)
|
|
345
|
+
f_epsilon = (epsilon - 1.0)/(epsilon + 1.0) if epsilon != float('inf') else 1.0
|
|
346
346
|
DA = D*A
|
|
347
347
|
DAS = numpy.dot(DA, S)
|
|
348
348
|
K = S - f_epsilon/(4.0*PI) * (DAS + DAS.T)
|
pyscf/solvent/pol_embed.py
CHANGED
|
@@ -205,7 +205,7 @@ class PolEmbed(lib.StreamObject):
|
|
|
205
205
|
element_row = _get_element_row(p.element)
|
|
206
206
|
ecp_label, _ = _pe_ecps[element_row]
|
|
207
207
|
ecpatoms.append([ecp_label, p.x, p.y, p.z])
|
|
208
|
-
self.ecpmol = gto.M(atom=ecpatoms, ecp=
|
|
208
|
+
self.ecpmol = gto.M(atom=ecpatoms, ecp=dict(_pe_ecps),
|
|
209
209
|
basis={}, unit="Bohr")
|
|
210
210
|
# add the normal mol to compute integrals
|
|
211
211
|
self.ecpmol += self.mol
|
pyscf/solvent/smd.py
CHANGED
|
@@ -250,17 +250,19 @@ def smd_radii(alpha):
|
|
|
250
250
|
radii_table[53] = 2.74
|
|
251
251
|
return radii_table/radii.BOHR
|
|
252
252
|
|
|
253
|
-
import sys
|
|
254
253
|
import ctypes
|
|
255
254
|
from pyscf.lib import load_library
|
|
256
255
|
try:
|
|
257
256
|
libsolvent = load_library('libsolvent')
|
|
258
257
|
except (IOError, NameError):
|
|
259
|
-
sys.stderr.write('SMD module is not available. '
|
|
260
|
-
'You can compile this module with cmake option "-DENABLE_SMD=ON"')
|
|
261
258
|
libsolvent = None
|
|
262
259
|
|
|
263
260
|
def get_cds_legacy(smdobj):
|
|
261
|
+
if libsolvent is None:
|
|
262
|
+
raise RuntimeError(
|
|
263
|
+
'SMD module is not available. '
|
|
264
|
+
'You can compile this module with cmake option "-DENABLE_SMD=ON"')
|
|
265
|
+
|
|
264
266
|
mol = smdobj.mol
|
|
265
267
|
natm = mol.natm
|
|
266
268
|
soln, _, sola, solb, solg, _, solc, solh = smdobj.solvent_descriptors
|
pyscf/soscf/ciah.py
CHANGED
|
@@ -16,8 +16,6 @@
|
|
|
16
16
|
# Author: Qiming Sun <osirpt.sun@gmail.com>
|
|
17
17
|
#
|
|
18
18
|
|
|
19
|
-
import sys
|
|
20
|
-
|
|
21
19
|
import numpy
|
|
22
20
|
import scipy.linalg
|
|
23
21
|
from pyscf import lib
|
|
@@ -77,10 +75,7 @@ class CIAHOptimizerMixin:
|
|
|
77
75
|
|
|
78
76
|
def rotate_orb_cc(iah, u0, conv_tol_grad=None, verbose=logger.NOTE):
|
|
79
77
|
t2m = (logger.process_clock(), logger.perf_counter())
|
|
80
|
-
|
|
81
|
-
log = verbose
|
|
82
|
-
else:
|
|
83
|
-
log = logger.Logger(sys.stdout, verbose)
|
|
78
|
+
log = logger.new_logger(verbose=verbose)
|
|
84
79
|
|
|
85
80
|
if conv_tol_grad is None:
|
|
86
81
|
conv_tol_grad = iah.conv_tol_grad
|
|
@@ -163,7 +158,7 @@ def rotate_orb_cc(iah, u0, conv_tol_grad=None, verbose=logger.NOTE):
|
|
|
163
158
|
|
|
164
159
|
elif (ikf > 2 and # avoid frequent keyframe
|
|
165
160
|
(ikf >= max(iah.kf_interval, iah.kf_interval-numpy.log(norm_dr+1e-9)) or
|
|
166
|
-
# Insert keyframe if the keyframe and the
|
|
161
|
+
# Insert keyframe if the keyframe and the estimated g_orb are too different
|
|
167
162
|
norm_gorb < norm_gkf/kf_trust_region)):
|
|
168
163
|
ikf = 0
|
|
169
164
|
ukf = iah.extract_rotation(dr, ukf)
|
|
@@ -211,10 +206,7 @@ def rotate_orb_cc(iah, u0, conv_tol_grad=None, verbose=logger.NOTE):
|
|
|
211
206
|
def davidson_cc(h_op, g_op, precond, x0, tol=1e-10, xs=[], ax=[],
|
|
212
207
|
max_cycle=30, lindep=1e-14, dot=numpy.dot, verbose=logger.WARN):
|
|
213
208
|
|
|
214
|
-
|
|
215
|
-
log = verbose
|
|
216
|
-
else:
|
|
217
|
-
log = logger.Logger(sys.stdout, verbose)
|
|
209
|
+
log = logger.new_logger(verbose=verbose)
|
|
218
210
|
|
|
219
211
|
toloose = numpy.sqrt(tol)
|
|
220
212
|
# the first trial vector is (1,0,0,...), which is not included in xs
|
pyscf/soscf/newton_ah.py
CHANGED
|
@@ -413,7 +413,7 @@ def _rotate_orb_cc(mf, h1e, s1e, conv_tol_grad=None, verbose=None):
|
|
|
413
413
|
elif (ikf > 2 and # avoid frequent keyframe
|
|
414
414
|
#TODO: replace it with keyframe_scheduler
|
|
415
415
|
(ikf >= max(mf.kf_interval, mf.kf_interval-numpy.log(norm_dr+1e-9)) or
|
|
416
|
-
# Insert keyframe if the keyframe and the
|
|
416
|
+
# Insert keyframe if the keyframe and the estimated g_orb are too different
|
|
417
417
|
norm_gorb < norm_gkf/kf_trust_region)):
|
|
418
418
|
ikf = 0
|
|
419
419
|
u = mf.update_rotate_matrix(dr, mo_occ, mo_coeff=mo_coeff)
|
|
@@ -508,11 +508,15 @@ def kernel(mf, mo_coeff=None, mo_occ=None, dm=None,
|
|
|
508
508
|
# Save mo_coeff and mo_occ because they are needed by function rotate_mo
|
|
509
509
|
mf.mo_coeff, mf.mo_occ = mo_coeff, mo_occ
|
|
510
510
|
|
|
511
|
+
scf_conv = False
|
|
511
512
|
e_tot = mf._scf.energy_tot(dm, h1e, vhf)
|
|
512
513
|
fock = mf.get_fock(h1e, s1e, vhf, dm, level_shift_factor=0)
|
|
513
514
|
log.info('Initial guess E= %.15g |g|= %g', e_tot,
|
|
514
515
|
numpy.linalg.norm(mf._scf.get_grad(mo_coeff, mo_occ, fock)))
|
|
515
516
|
|
|
517
|
+
if mf.max_cycle <= 0:
|
|
518
|
+
return scf_conv, e_tot, mo_energy, mo_coeff, mo_occ
|
|
519
|
+
|
|
516
520
|
if dump_chk and mf.chkfile:
|
|
517
521
|
chkfile.save_mol(mol, mf.chkfile)
|
|
518
522
|
|
|
@@ -525,7 +529,6 @@ def kernel(mf, mo_coeff=None, mo_occ=None, dm=None,
|
|
|
525
529
|
next(rotaiter) # start the iterator
|
|
526
530
|
kftot = jktot = 0
|
|
527
531
|
norm_gorb = 0.
|
|
528
|
-
scf_conv = False
|
|
529
532
|
cput1 = log.timer('initializing second order scf', *cput0)
|
|
530
533
|
|
|
531
534
|
for imacro in range(max_cycle):
|
pyscf/symm/__init__.py
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
'''
|
|
20
20
|
This module offers the functions to detect point group symmetry, basis
|
|
21
|
-
|
|
21
|
+
symmetrization, Clebsch-Gordon coefficients. This module works as a plugin of
|
|
22
22
|
PySCF package. Symmetry is not hard coded in each method.
|
|
23
23
|
'''
|
|
24
24
|
|
pyscf/symm/addons.py
CHANGED
|
@@ -108,7 +108,7 @@ def symmetrize_orb(mol, mo, orbsym=None, s=None,
|
|
|
108
108
|
:func:`symmetrize_space` symmetrizes the entire space by mixing different
|
|
109
109
|
orbitals.
|
|
110
110
|
|
|
111
|
-
Note this function might return non-
|
|
111
|
+
Note this function might return non-orthogonal orbitals.
|
|
112
112
|
Call :func:`symmetrize_space` to find the symmetrized orbitals that are
|
|
113
113
|
close to the given orbitals.
|
|
114
114
|
|
|
@@ -197,7 +197,7 @@ def symmetrize_space(mol, mo, s=None,
|
|
|
197
197
|
'''Symmetrize the given orbital space.
|
|
198
198
|
|
|
199
199
|
This function is different to the :func:`symmetrize_orb`: In this function,
|
|
200
|
-
the given orbitals are mixed to reveal the
|
|
200
|
+
the given orbitals are mixed to reveal the symmetry; :func:`symmetrize_orb`
|
|
201
201
|
projects out non-symmetric components for each orbital.
|
|
202
202
|
|
|
203
203
|
Args:
|
|
@@ -281,7 +281,7 @@ def symmetrize_space(mol, mo, s=None,
|
|
|
281
281
|
orb_irrep = numpy.dot(orb_irrep, orth.lowdin(moso))
|
|
282
282
|
max_non_orth = abs(numpy.dot(orb_irrep.T.conj(), numpy.dot(s, orb_irrep))
|
|
283
283
|
- numpy.eye(orb_irrep.shape[1])).max()
|
|
284
|
-
logger.debug(mol, 'Non-orthogonality in irrep %3d after symmetrization and
|
|
284
|
+
logger.debug(mol, 'Non-orthogonality in irrep %3d after symmetrization and orthogonalization: %8.2e',
|
|
285
285
|
i, max_non_orth)
|
|
286
286
|
mo1.append(orb_irrep)
|
|
287
287
|
mo1 = numpy.hstack(mo1)
|
|
@@ -354,7 +354,7 @@ def symmetrize_multidim(mol, mo, s=None,
|
|
|
354
354
|
if (max_non_orth_lowdin - max_non_orth) > tol/100:
|
|
355
355
|
mo = mo_lowdin
|
|
356
356
|
s_mo = numpy.dot(s, mo)
|
|
357
|
-
logger.info(mol, 'Use Lowdin-
|
|
357
|
+
logger.info(mol, 'Use Lowdin-orthogonalized input orbitals')
|
|
358
358
|
else:
|
|
359
359
|
logger.info(mol, 'Use original input orbitals')
|
|
360
360
|
irreps_mdim = []
|
|
@@ -489,7 +489,7 @@ def irrep_id2name(gpname, irrep_id):
|
|
|
489
489
|
See IRREP_ID_TABLE in pyscf/symm/param.py
|
|
490
490
|
|
|
491
491
|
Returns:
|
|
492
|
-
Irrep
|
|
492
|
+
Irrep symbol, str
|
|
493
493
|
'''
|
|
494
494
|
gpname = std_symb(gpname)
|
|
495
495
|
if gpname == 'SO3':
|
pyscf/symm/geom.py
CHANGED
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
# method (point group detection flowchart) to detect the point group.
|
|
37
37
|
#
|
|
38
38
|
|
|
39
|
-
import sys
|
|
40
39
|
import re
|
|
41
40
|
import numpy
|
|
42
41
|
import scipy.linalg
|
|
@@ -166,10 +165,7 @@ def detect_symm(atoms, basis=None, verbose=logger.WARN):
|
|
|
166
165
|
|
|
167
166
|
Return group name, charge center, and nex_axis (three rows for x,y,z)
|
|
168
167
|
'''
|
|
169
|
-
|
|
170
|
-
log = verbose
|
|
171
|
-
else:
|
|
172
|
-
log = logger.Logger(sys.stdout, verbose)
|
|
168
|
+
log = logger.new_logger(verbose=verbose)
|
|
173
169
|
|
|
174
170
|
tol = TOLERANCE / numpy.sqrt(1+len(atoms))
|
|
175
171
|
decimals = int(-numpy.log10(tol))
|