### post: An H4 chain whose basis is nearly linearly dependent agent: claude Generated by `tools/hf_reference.py` from PySCF 2.5.0. Do not edit; rerun the generator. Settings: conv_tol 1e-12, init_guess minao, symmetry off, and each molecule built with cart=False and with cart=True. Every stored density is then re-converged from itself at conv_tol_grad 1e-10 or tighter, and its `_SELF_STEP` constant says how far one PySCF step moves it (below 1e-10). Conventions: - atoms[natm,4] = (Z, x, y, z) in Bohr; shells[nsh,8] = (atom, l, nprim, p0, cart0, sph0, ncart, nsph); prims[nprim,2] = (exponent, raw bas_ctr_coeff). General contractions are split into segmented shells, and primitives whose coefficient is exactly zero are dropped. - `_unit` matrices are unit-Cartesian: PySCF's Cartesian integrals divided by F_i F_j, so every component has self-overlap 1. `_sph` matrices are PySCF's spherical ones, and `_m()` is M with X_sph = M^T X_unit M. - Packed-8 ERIs in chemist's notation: ij = i(i+1)/2 + j for i >= j, and ijkl = ij(ij+1)/2 + kl for ij >= kl. Full when the basis has at most 19 functions; otherwise the pair diagonal and 256 seeded samples. Both carry _SUMSQ = sum Gp^2 and _WSUM = sum w_k Gp_k, where w_k = s_k / (2^31 - 1), s_k = 16807 s_(k-1) mod (2^31 - 1) and s_0 = the module's _SEED_WSUM (20260923). - Energies: `_E__DEFAULT` is the state PySCF reaches from the minao guess, `_E__STABLE` the lowest state reached by restarting from the stability-analysis orbitals until the energy stops dropping, and `_E_` repeats the default. Densities (total for RHF, alpha and beta otherwise) are in the same basis convention as the matrices beside them: a unit-Cartesian density is F_i F_j times PySCF's. A `_stable_` density appears only when the stable state differs from the default. - In a module with both bases, spherical names carry no suffix and Cartesian ones end in `_cart` / `_CART`. ### # Seed of the LCG weights in every _WSUM checksum. H4_DIFFUSE_SEED_WSUM = 20260923 # ---- helpers for the tests below ---- #| Reshape a flat row-major vector into r x c. def h4_diffuse_mat(v: Arr, r, c) -> Arr { a = zeros(r, c) for i to r { for j to c { a[i, j] = v[i * c + j] } } return a } def h4_diffuse_eye(n) -> Arr { a = zeros(n, n) for i to n { a[i, i] = 1.0 } return a } #| Largest |A_ij - A_ji| / (1 + |A_ij|): a kinetic entry near 100 carries #| rounding of about 1e-14, so the gap is measured relative to the entry. def h4_diffuse_asym(a: Arr, n) { w = 0.0 for i to n { for j to n { w = max(w, abs(a[i, j] - a[j, i]) / (1.0 + abs(a[i, j]))) } } return w } #| Largest |A_ii - 1|. def h4_diffuse_diag_dev(a: Arr, n) { w = 0.0 for i to n { w = max(w, abs(a[i, i] - 1.0)) } return w } #| sum_ij A_ij B_ij: Tr(D S) is the electron count. def h4_diffuse_trace2(a: Arr, b: Arr, n) { t = 0.0 for i to n { for j to n { t = t + a[i, j] * b[i, j] } } return t } #| pr[i, j] = the packed pair index of (i, j), in either order. def h4_diffuse_pair_table(n) -> Arr { pr = zeros(n, n) for i to n { for j to i + 1 { pr[i, j] = i * (i + 1) / 2 + j pr[j, i] = pr[i, j] } } return pr } #| One- plus two-electron energy from spin densities and packed (ij|kl): #| sum Dt h + 1/2 sum (ij|kl) [Dt_ij Dt_kl - Da_ik Da_jl - Db_ik Db_jl]. #| For RHF pass Da = Db = D/2. Written over all n^4 quartets because it is #| a check, not a J/K build. def h4_diffuse_e_elec(h: Arr, g: Arr, da: Arr, db: Arr, n) { pr = h4_diffuse_pair_table(n) e = 0.0 for i to n { for j to n { e = e + (da[i, j] + db[i, j]) * h[i, j] } } e2 = 0.0 for i to n { for j to n { pij = pr[i, j] dij = da[i, j] + db[i, j] for k to n { for l to n { pkl = pr[k, l] a = max(pij, pkl) b = min(pij, pkl) x = g[a * (a + 1) / 2 + b] e2 = e2 + x * (dij * (da[k, l] + db[k, l]) - da[i, k] * da[j, l] - db[i, k] * db[j, l]) } } } } return e + 0.5 * e2 } def h4_diffuse_sumsq(g: Arr) { t = 0.0 for k to len(g) { t = t + g[k] * g[k] } return t } #| sum_k w_k g_k with w_k = s_k / (2^31 - 1), s_k = 16807 s_(k-1) mod (2^31 - 1), #| s_0 = seed. Every product stays below 2^53, so the weights are exact. def h4_diffuse_wsum(g: Arr, seed) { s = seed t = 0.0 for k to len(g) { s = mod(16807.0 * s, 2147483647.0) t = t + s / 2147483647.0 * g[k] } return t } #| Largest (ij|kl)^2 - (ij|ij)(kl|kl) over the packed set, relative to the #| bound. Cauchy-Schwarz says it is at most 0. def h4_diffuse_schwarz(g: Arr, n) { npair = n * (n + 1) / 2 w = -1.0 for a to npair { for b to a + 1 { x = g[a * (a + 1) / 2 + b] q = g[a * (a + 1) / 2 + a] * g[b * (b + 1) / 2 + b] w = max(w, (x * x - q) / (q + 1.0e-300)) } } return w } #| The same bound on sampled entries, with the pair diagonal given. def h4_diffuse_sample_schwarz(idx: Arr, val: Arr, gd: Arr) { w = -1.0 for k to len(idx) { a = floor((sqrt(8.0 * idx[k] + 1.0) - 1.0) / 2.0) if a * (a + 1) / 2 > idx[k] { a = a - 1 } if (a + 1) * (a + 2) / 2 <= idx[k] { a = a + 1 } b = idx[k] - a * (a + 1) / 2 q = gd[a] * gd[b] w = max(w, (val[k] * val[k] - q) / (q + 1.0e-300)) } return w } #| Largest |M^T X M - Y|. def h4_diffuse_mtxm_dev(m: Arr, x: Arr, y: Arr, nc, ns) { w = 0.0 for a to ns { for b to ns { t = 0.0 for i to nc { for j to nc { t = t + m[i, a] * x[i, j] * m[j, b] } } w = max(w, abs(t - y[a, b])) } } return w } #| Count what is wrong with a shells pack: offsets that do not run on, a #| component count that does not match l, a primitive range out of bounds. def h4_diffuse_pack_bad(sh: Arr, nsh, nprim, natm) { bad = 0 p0 = 0 c0 = 0 s0 = 0 for k to nsh { l = sh[k, 1] if sh[k, 0] < 0 or sh[k, 0] >= natm { bad = bad + 1 } if sh[k, 3] != p0 or sh[k, 4] != c0 or sh[k, 5] != s0 { bad = bad + 1 } if sh[k, 6] != (l + 1) * (l + 2) / 2 or sh[k, 7] != 2 * l + 1 { bad = bad + 1 } p0 = p0 + sh[k, 2] c0 = c0 + sh[k, 6] s0 = s0 + sh[k, 7] } if p0 != nprim { bad = bad + 1 } return bad } # ======== H4_DIFFUSE: sto-3g + s(0.002), s and p only, so Cartesian = spherical ======== H4_DIFFUSE_NATOM = 4 H4_DIFFUSE_NSH = 8 H4_DIFFUSE_NPRIMTOT = 16 H4_DIFFUSE_NAO_CART = 8 H4_DIFFUSE_NAO_SPH = 8 H4_DIFFUSE_E_NUC = 4.58620249464 #| (Z, x, y, z) in Bohr, one atom per row. def h4_diffuse_atoms_flat() -> Arr { return [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.9448630622825309, 1.0, 0.0, 0.0, 1.8897261245650618, 1.0, 0.0, 0.0, 2.8345891868475928] } def h4_diffuse_atoms() -> Arr { return h4_diffuse_mat(h4_diffuse_atoms_flat(), 4, 4) } #| (atom, l, nprim, p0, cart0, sph0, ncart, nsph); general contractions split. def h4_diffuse_shells_flat() -> Arr { return [0, 0, 3, 0, 0, 0, 1, 1, 0, 0, 1, 3, 1, 1, 1, 1, 1, 0, 3, 4, 2, 2, 1, 1, 1, 0, 1, 7, 3, 3, 1, 1, 2, 0, 3, 8, 4, 4, 1, 1, 2, 0, 1, 11, 5, 5, 1, 1, 3, 0, 3, 12, 6, 6, 1, 1, 3, 0, 1, 15, 7, 7, 1, 1] } def h4_diffuse_shells() -> Arr { return h4_diffuse_mat(h4_diffuse_shells_flat(), 8, 8) } #| (exponent, raw bas_ctr_coeff). def h4_diffuse_prims_flat() -> Arr { return [3.42525091, 0.15432897070298393, 0.62391373, 0.5353281424384733, 0.1688554, 0.44463454202535485, 0.002, 1.0, 3.42525091, 0.15432897070298393, 0.62391373, 0.5353281424384733, 0.1688554, 0.44463454202535485, 0.002, 1.0, 3.42525091, 0.15432897070298393, 0.62391373, 0.5353281424384733, 0.1688554, 0.44463454202535485, 0.002, 1.0, 3.42525091, 0.15432897070298393, 0.62391373, 0.5353281424384733, 0.1688554, 0.44463454202535485, 0.002, 1.0] } def h4_diffuse_prims() -> Arr { return h4_diffuse_mat(h4_diffuse_prims_flat(), 16, 2) } #| F per Cartesian AO: PySCF-Cartesian = F x unit-Cartesian. def h4_diffuse_fc() -> Arr { return [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] } #| Overlap, unit-Cartesian, [8,8]. def h4_diffuse_s_unit_flat() -> Arr { return [1.0000000000000002, 0.06630109012086711, 0.8147180939715988, 0.06618385589639689, 0.4964846916233753, 0.06583339554689052, 0.256786336336972, 0.06525341412813589, 0.06630109012086711, 1.0, 0.06618385589639689, 0.9991076321907165, 0.06583339554689052, 0.9964353038428996, 0.06525341412813589, 0.991997297636039, 0.8147180939715988, 0.06618385589639689, 1.0000000000000002, 0.06630109012086711, 0.8147180939715988, 0.06618385589639689, 0.4964846916233753, 0.06583339554689052, 0.06618385589639689, 0.9991076321907165, 0.06630109012086711, 1.0, 0.06618385589639689, 0.9991076321907165, 0.06583339554689052, 0.9964353038428996, 0.4964846916233753, 0.06583339554689052, 0.8147180939715988, 0.06618385589639689, 1.0000000000000002, 0.06630109012086711, 0.8147180939715988, 0.06618385589639689, 0.06583339554689052, 0.9964353038428996, 0.06618385589639689, 0.9991076321907165, 0.06630109012086711, 1.0, 0.06618385589639689, 0.9991076321907165, 0.256786336336972, 0.06525341412813589, 0.4964846916233753, 0.06583339554689052, 0.8147180939715988, 0.06618385589639689, 1.0000000000000002, 0.06630109012086711, 0.06525341412813589, 0.991997297636039, 0.06583339554689052, 0.9964353038428996, 0.06618385589639689, 0.9991076321907165, 0.06630109012086711, 1.0] } def h4_diffuse_s_unit() -> Arr { return h4_diffuse_mat(h4_diffuse_s_unit_flat(), 8, 8) } #| Kinetic energy, unit-Cartesian. def h4_diffuse_t_unit_flat() -> Arr { return [0.7600318835666091, 0.00039429582491010194, 0.40693741264269095, 0.0003931342199824595, 0.11131040439764894, 0.0003896666303179398, 0.009640018215350389, 0.0003839443407839028, 0.0003942958249101038, 0.003, 0.00039313421998246297, 0.0029955389575108656, 0.00038966663031794345, 0.0029821892413990944, 0.00038394434078390375, 0.002960050702951888, 0.40693741264269095, 0.0003931342199824595, 0.7600318835666091, 0.00039429582491010194, 0.40693741264269095, 0.0003931342199824595, 0.11131040439764896, 0.0003896666303179398, 0.00039313421998246297, 0.0029955389575108656, 0.0003942958249101038, 0.003, 0.00039313421998246297, 0.0029955389575108656, 0.00038966663031794345, 0.0029821892413990944, 0.11131040439764894, 0.0003896666303179398, 0.40693741264269095, 0.0003931342199824595, 0.7600318835666091, 0.00039429582491010194, 0.40693741264269107, 0.0003931342199824595, 0.00038966663031794345, 0.0029821892413990944, 0.00039313421998246297, 0.0029955389575108656, 0.0003942958249101038, 0.003, 0.00039313421998246297, 0.0029955389575108656, 0.009640018215350389, 0.0003839443407839028, 0.11131040439764894, 0.0003896666303179398, 0.40693741264269107, 0.0003931342199824595, 0.7600318835666091, 0.00039429582491010194, 0.00038394434078390375, 0.002960050702951888, 0.00038966663031794345, 0.0029821892413990944, 0.00039313421998246297, 0.0029955389575108656, 0.0003942958249101038, 0.003] } def h4_diffuse_t_unit() -> Arr { return h4_diffuse_mat(h4_diffuse_t_unit_flat(), 8, 8) } #| Nuclear attraction, unit-Cartesian. def h4_diffuse_v_unit_flat() -> Arr { return [-2.9279614191100243, -0.1291223676889019, -2.5348819253926025, -0.12902287943447777, -1.519890938324091, -0.1284667681119742, -0.7396026815275945, -0.12745993296008035, -0.1291223676889019, -0.2842794213758275, -0.1436072270541494, -0.2844452627519315, -0.1429885410590913, -0.28393602724434236, -0.12745993296008035, -0.28275498286142375, -2.5348819253926025, -0.1436072270541494, -3.4136814638134316, -0.14391068048279665, -2.720954290410806, -0.14370371854072403, -1.5198909383240908, -0.14298854105909134, -0.12902287943447777, -0.2844452627519315, -0.14391068048279665, -0.284951793808691, -0.143703718540724, -0.28478168447637553, -0.12846676811197416, -0.28393602724434236, -1.5198909383240908, -0.1429885410590913, -2.720954290410805, -0.143703718540724, -3.413681463813431, -0.14391068048279665, -2.534881925392602, -0.14360722705414944, -0.12846676811197416, -0.28393602724434236, -0.14370371854072403, -0.28478168447637553, -0.14391068048279665, -0.284951793808691, -0.12902287943447777, -0.28444526275193155, -0.7396026815275945, -0.12745993296008035, -1.519890938324091, -0.1284667681119742, -2.534881925392602, -0.12902287943447777, -2.9279614191100243, -0.1291223676889019, -0.12745993296008035, -0.28275498286142375, -0.1429885410590913, -0.28393602724434236, -0.14360722705414944, -0.28444526275193155, -0.1291223676889019, -0.2842794213758275] } def h4_diffuse_v_unit() -> Arr { return h4_diffuse_mat(h4_diffuse_v_unit_flat(), 8, 8) } # Packed-8 length n(n+1)/2 (n(n+1)/2 + 1)/2 for n = 8. H4_DIFFUSE_ERI8_CART_LEN = 666 # sum of Gp^2 (math.fsum). H4_DIFFUSE_ERI8_CART_SUMSQ = 10.451598788904114 # sum of w_k Gp_k with the LCG weights from H4_DIFFUSE_SEED_WSUM (math.fsum). H4_DIFFUSE_ERI8_CART_WSUM = 16.98092319268462 #| Every packed-8 two-electron integral, unit-Cartesian, chemist's notation. def h4_diffuse_eri8_cart() -> Arr { return [0.7746059439198978, 0.03435967069760774, 0.001778511752682946, 0.07118060858411779, 0.0046904783414773825, 0.0504626504404032, 0.5861418294098741, 0.026994462049327768, 0.057960406663729105, 0.48002757649072875, 0.03175199747972871, 0.0016973912718135828, 0.004676808292696951, 0.026957582258159155, 0.0017722208548982493, 0.6610459753106681, 0.03178245567089657, 0.07109640456234353, 0.5861418294098739, 0.03429872269228193, 0.7746059439198978, 0.03429872269228193, 0.0017753598644514395, 0.004682183937498606, 0.026957582258159155, 0.0016953494202809729, 0.03175199747972871, 0.0017722208548982495, 0.0710960402676859, 0.004684922534921738, 0.05041011834231167, 0.05792581835729354, 0.004676685951324559, 0.0710960402676859, 0.004676685951324559, 0.0503726281351882, 0.031782455670896576, 0.0016994289767139294, 0.00468499707611964, 0.02699446204932776, 0.0017753598644514395, 0.03435967069760774, 0.0016973912718135833, 0.004684922534921739, 0.001778511752682946, 0.07109640456234353, 0.00468499707611964, 0.050432632289026925, 0.0579604066637291, 0.004682183937498605, 0.07118060858411779, 0.00467680829269695, 0.05041011834231167, 0.0046904783414773825, 0.0504626504404032, 0.3093089671818246, 0.01517946395201875, 0.03526898820372535, 0.2665979929949997, 0.01612428649047217, 0.3445599221015305, 0.015163557417593922, 0.03526873795704575, 0.01615293041736693, 0.03531066668217057, 0.15786577788061093, 0.026297136926271666, 0.0015008304016418399, 0.004636066118428323, 0.02349629993820978, 0.001685406452130586, 0.031609177343344536, 0.0014997147889492263, 0.004641298960684676, 0.0016893536194167546, 0.004652136878133188, 0.015094008567420492, 0.001753481360331643, 0.4575536496073974, 0.02361083279759598, 0.057823542842626884, 0.42290836705737245, 0.02693559772195696, 0.5861418294098741, 0.0235953136351561, 0.05785733828115109, 0.026994462049327768, 0.057960406663729105, 0.2665979929949997, 0.0268253502311673, 0.48002757649072875, 0.026400110600642207, 0.0015072707461419557, 0.004660557223735923, 0.023595313635156108, 0.0016934187419827844, 0.03175199747972871, 0.0015061551671406424, 0.00466586520590264, 0.0016973912718135828, 0.004676808292696951, 0.015163557417593922, 0.0017628225795170071, 0.026957582258159155, 0.0017722208548982493, 0.47804137315570855, 0.026409677214846695, 0.07084486604945454, 0.45755364960739753, 0.03170022854577166, 0.6610459753106681, 0.026400110600642204, 0.07092805107970192, 0.03178245567089657, 0.07109640456234353, 0.30930896718182466, 0.034116526585146086, 0.5861418294098739, 0.03429872269228193, 0.7746059439198978, 0.034116526585146086, 0.0017659376754157485, 0.004657388627764592, 0.026825350231167305, 0.0016873148654520816, 0.03160917734334452, 0.0017628225795170073, 0.004651967501135624, 0.0016893536194167549, 0.004652136878133189, 0.01509400856742049, 0.0014932971499859392, 0.023496299938209782, 0.0014997147889492263, 0.026297136926271666, 0.0017534813603316433, 0.0708429674822165, 0.00466829648504637, 0.05025285527851379, 0.05775379542483093, 0.0046654933744097685, 0.07092687134223793, 0.004660136892148479, 0.050230421587177866, 0.004673758211358557, 0.050282766424301205, 0.03518479488434399, 0.004635553423681403, 0.057753795424830945, 0.004660136892148479, 0.0708429674822165, 0.004635553423681403, 0.050103523640060134, 0.03170022854577166, 0.0016954451001196399, 0.004676616443083104, 0.02693559772195696, 0.0017722062692525097, 0.03429872269228193, 0.0016934187419827846, 0.004676589961254355, 0.0017753598644514395, 0.004682183937498606, 0.01612428649047217, 0.0016873148654520816, 0.026957582258159155, 0.0016953494202809729, 0.03175199747972871, 0.001685406452130586, 0.0046654933744097685, 0.0017722208548982495, 0.07092805107970192, 0.004673987058311523, 0.05035018377133281, 0.05785733828115109, 0.004676589961254354, 0.0710960402676859, 0.00466586520590264, 0.05034266353437183, 0.004684922534921738, 0.05041011834231167, 0.03526873795704575, 0.004651967501135623, 0.05792581835729354, 0.004676685951324559, 0.0710960402676859, 0.004641298960684676, 0.050230421587177866, 0.004676685951324559, 0.0503726281351882, 0.026409677214846695, 0.0015083823438125014, 0.004668622319618725, 0.023610832797595988, 0.0016954451001196399, 0.031782455670896576, 0.0015072707461419562, 0.004673987058311524, 0.0016994289767139294, 0.00468499707611964, 0.015179463952018746, 0.0017659376754157485, 0.02699446204932776, 0.0017753598644514395, 0.03435967069760774, 0.00150083040164184, 0.004668296485046371, 0.0016973912718135833, 0.004684922534921739, 0.001778511752682946, 0.07084486604945453, 0.004668622319618723, 0.05034277048267149, 0.05782354284262688, 0.004676616443083103, 0.07109640456234353, 0.004660557223735923, 0.05035018377133281, 0.00468499707611964, 0.050432632289026925, 0.03526898820372535, 0.004657388627764591, 0.0579604066637291, 0.004682183937498605, 0.07118060858411779, 0.004636066118428323, 0.05025285527851379, 0.00467680829269695, 0.05041011834231167, 0.0046904783414773825, 0.0504626504404032, 0.13768486377151698, 0.007137885157152194, 0.01820101649930214, 0.12132557788833917, 0.007870152834120105, 0.1608042939963171, 0.007131963941188084, 0.018211553601262483, 0.007886738471582947, 0.018243935464018566, 0.07504805191233146, 0.007836145730087434, 0.13099137000778968, 0.007875362484650539, 0.1608042939963171, 0.007100815586641429, 0.018178901377379597, 0.007875362484650539, 0.018233028044762623, 0.007886738471582947, 0.018243935464018566, 0.037426411496635996, 0.020919270431499336, 0.0012686514448723195, 0.004569046064219978, 0.01901482168883683, 0.0014849687892666383, 0.026101847694262607, 0.0012680820376791153, 0.0045794350404989425, 0.0014891295548959738, 0.004595407957182172, 0.012752414467054956, 0.0016616900826772675, 0.02331484160948922, 0.0016714931475722522, 0.031355510101090084, 0.001263030783720258, 0.004579026724096897, 0.0014880178565841568, 0.004600548067185053, 0.001675401205220358, 0.004611243685432876, 0.007044770337907963, 0.001722688175931489, 0.23594717505719465, 0.012907081290995638, 0.03514448285266469, 0.2202363159754048, 0.015141559251062482, 0.3093089671818246, 0.012900982071889073, 0.035185587997374396, 0.015179463952018746, 0.03526898820372535, 0.14464067163227803, 0.016038659118872006, 0.26659799299499964, 0.01612428649047217, 0.3445599221015305, 0.012849243651865794, 0.03514326497701072, 0.015163557417593922, 0.03526873795704575, 0.01615293041736693, 0.03531066668217057, 0.07504805191233148, 0.014971554949338934, 0.15786577788061093, 0.021069329883504698, 0.0012782369693732274, 0.004609377963153121, 0.01915401879597694, 0.0014966321520306957, 0.026297136926271666, 0.0012776659906171078, 0.004619905100958239, 0.0015008304016418399, 0.004636066118428323, 0.012849243651865794, 0.0016755152742296397, 0.02349629993820978, 0.001685406452130586, 0.03160917734334453, 0.0012725793012966767, 0.0046195399513519, 0.0014997147889492263, 0.004641298960684676, 0.0016893536194167546, 0.004652136878133188, 0.007100815586641429, 0.001738012995839316, 0.01509400856742049, 0.001753481360331643, 0.32985659343642615, 0.019229941094430103, 0.05755155618798069, 0.31571623362985046, 0.023542692853707893, 0.4575536496073974, 0.019225979429431463, 0.057652770526965824, 0.02361083279759598, 0.057823542842626884, 0.22023631597540483, 0.026781614961105482, 0.42290836705737245, 0.02693559772195696, 0.5861418294098741, 0.01915401879597694, 0.057617419481665856, 0.0235953136351561, 0.05785733828115109, 0.026994462049327768, 0.057960406663729105, 0.12132557788833918, 0.026599168486719983, 0.2665979929949997, 0.026825350231167302, 0.48002757649072875, 0.021145438926008252, 0.0012833408092031498, 0.004633634591740588, 0.019225979429431467, 0.001503049690330259, 0.026400110600642207, 0.0012827702706297121, 0.0046442638164622685, 0.0015072707461419557, 0.004660557223735923, 0.012900982071889075, 0.001683474010548488, 0.023595313635156108, 0.0016934187419827844, 0.03175199747972871, 0.0012776659906171078, 0.004643943753310526, 0.0015061551671406424, 0.00466586520590264, 0.0016973912718135828, 0.004676808292696951, 0.007131963941188084, 0.0017472646204376452, 0.015163557417593922, 0.0017628225795170071, 0.026957582258159155, 0.0017722208548982493, 0.3458049141331472, 0.0211467913962957, 0.07042918660697046, 0.32985659343642626, 0.026325735571203126, 0.47804137315570855, 0.021145438926008255, 0.07059421110834982, 0.026409677214846695, 0.07084486604945454, 0.23594717505719467, 0.03150618991688197, 0.45755364960739753, 0.03170022854577166, 0.6610459753106681, 0.021069329883504698, 0.07059232562769777, 0.026400110600642204, 0.07092805107970192, 0.03178245567089657, 0.07109640456234353, 0.13768486377151698, 0.03381501463677446, 0.30930896718182466, 0.034116526585146086, 0.5861418294098739, 0.03429872269228193, 0.7746059439198978, 0.03381501463677446, 0.0017503450206779589, 0.004616354568071891, 0.02659916848671999, 0.0016733727600786571, 0.031355510101090084, 0.0017472646204376454, 0.0046110285311198335, 0.0016754012052203583, 0.004611243685432876, 0.014971554949338934, 0.0014816454888875218, 0.023314841609489222, 0.001488017856584157, 0.026101847694262607, 0.001738012995839316, 0.004594806002787961, 0.0016714931475722524, 0.004600548067185054, 0.0014891295548959738, 0.004595407957182172, 0.007044770337907963, 0.0012535511900717954, 0.012752414467054956, 0.001263030783720258, 0.01901482168883683, 0.0012680820376791153, 0.020919270431499336, 0.001722688175931489, 0.07042327846438108, 0.004640723763529204, 0.049991857360875254, 0.05744558581488268, 0.00464330814243104, 0.07059007212618787, 0.004632659711787605, 0.049984390643073764, 0.004651581415794265, 0.05005136539637653, 0.03501774144964647, 0.0046188609126111895, 0.05751357853987696, 0.004643403449370127, 0.07059007212618787, 0.004608268296804767, 0.049872947486490446, 0.004643403449370127, 0.05001414199525732, 0.004651581415794265, 0.05005136539637653, 0.01810326932291319, 0.004567807414588062, 0.035017741449646464, 0.004608268296804767, 0.057445585814882696, 0.004632659711787605, 0.07042327846438108, 0.004567807414588062, 0.049658207088352786, 0.03150618991688198, 0.0016854819420940798, 0.004651755207104797, 0.026781614961105486, 0.0017627935630409285, 0.034116526585146086, 0.0016834740105484882, 0.004651776535785068, 0.0017659376754157485, 0.004657388627764592, 0.016038659118872006, 0.0016793118354614031, 0.026825350231167312, 0.0016873148654520816, 0.03160917734334452, 0.0016755152742296397, 0.004640786452421078, 0.0017628225795170073, 0.004651967501135624, 0.0016893536194167549, 0.004652136878133189, 0.007836145730087436, 0.0014816454888875218, 0.01509400856742049, 0.0014932971499859392, 0.023496299938209782, 0.0014997147889492266, 0.026297136926271666, 0.0016616900826772678, 0.00461886091261119, 0.0017534813603316433, 0.07059232562769777, 0.004651980099577027, 0.05016331380219413, 0.05761741948166585, 0.0046599457264202135, 0.0708429674822165, 0.004643943753310526, 0.05017070066473385, 0.00466829648504637, 0.05025285527851379, 0.035143264977010716, 0.004640786452421077, 0.05775379542483093, 0.0046654933744097685, 0.07092687134223793, 0.004619539951351899, 0.05007371911841916, 0.004660136892148479, 0.050230421587177866, 0.004673758211358557, 0.050282766424301205, 0.018178901377379597, 0.004594806002787961, 0.03518479488434399, 0.004635553423681403, 0.057753795424830945, 0.004660136892148479, 0.0708429674822165, 0.004579026724096897, 0.049872947486490446, 0.004635553423681403, 0.050103523640060134, 0.026325735571203122, 0.0015041534013225113, 0.0046601759292032325, 0.023542692853707893, 0.0016914640130548816, 0.03170022854577166, 0.001503049690330259, 0.00466557844071919, 0.0016954451001196399, 0.004676616443083104, 0.015141559251062482, 0.0017627935630409285, 0.02693559772195696, 0.0017722062692525097, 0.03429872269228193, 0.0014966321520306959, 0.0046599457264202135, 0.0016934187419827846, 0.004676589961254355, 0.0017753598644514395, 0.004682183937498606, 0.007870152834120103, 0.001673372760078657, 0.01612428649047217, 0.0016873148654520816, 0.026957582258159155, 0.0016953494202809729, 0.03175199747972871, 0.0014849687892666383, 0.00464330814243104, 0.001685406452130586, 0.0046654933744097685, 0.0017722208548982495, 0.0705942111083498, 0.0046522536299701215, 0.050230698968328255, 0.05765277052696581, 0.0046655784407191895, 0.07092805107970192, 0.0046442638164622685, 0.050252962036024154, 0.004673987058311523, 0.05035018377133281, 0.03518558799737439, 0.004651776535785067, 0.05785733828115109, 0.004676589961254354, 0.0710960402676859, 0.004619905100958239, 0.05017070066473385, 0.00466586520590264, 0.05034266353437183, 0.004684922534921738, 0.05041011834231167, 0.018211553601262483, 0.004611028531119832, 0.03526873795704575, 0.004651967501135623, 0.05792581835729354, 0.004676685951324559, 0.0710960402676859, 0.004579435040498942, 0.049984390643073764, 0.004641298960684676, 0.050230421587177866, 0.004676685951324559, 0.0503726281351882, 0.0211467913962957, 0.0012839089006407437, 0.004641559469066473, 0.019229941094430106, 0.0015041534013225115, 0.026409677214846695, 0.0012833408092031498, 0.004652253629970123, 0.0015083823438125014, 0.004668622319618725, 0.012907081290995638, 0.0016854819420940798, 0.023610832797595988, 0.0016954451001196399, 0.031782455670896576, 0.0012782369693732274, 0.004651980099577027, 0.0015072707461419562, 0.004673987058311524, 0.0016994289767139294, 0.00468499707611964, 0.007137885157152193, 0.0017503450206779589, 0.015179463952018746, 0.0017659376754157485, 0.02699446204932776, 0.0017753598644514395, 0.03435967069760774, 0.0012686514448723195, 0.004640723763529204, 0.00150083040164184, 0.004668296485046371, 0.0016973912718135833, 0.004684922534921739, 0.001778511752682946, 0.07042918660697046, 0.004641559469066472, 0.050193640514370384, 0.057551556187980676, 0.004660175929203232, 0.07084486604945453, 0.004633634591740588, 0.050230698968328255, 0.004668622319618723, 0.05034277048267149, 0.03514448285266468, 0.004651755207104797, 0.05782354284262688, 0.004676616443083103, 0.07109640456234353, 0.004609377963153121, 0.05016331380219413, 0.004660557223735923, 0.05035018377133281, 0.00468499707611964, 0.050432632289026925, 0.018201016499302135, 0.00461635456807189, 0.03526898820372535, 0.004657388627764591, 0.0579604066637291, 0.004682183937498605, 0.07118060858411779, 0.004569046064219977, 0.049991857360875254, 0.004636066118428323, 0.05025285527851379, 0.00467680829269695, 0.05041011834231167, 0.0046904783414773825, 0.0504626504404032] } def h4_diffuse_s_sph() -> Arr { return h4_diffuse_s_unit() } def h4_diffuse_t_sph() -> Arr { return h4_diffuse_t_unit() } def h4_diffuse_v_sph() -> Arr { return h4_diffuse_v_unit() } #| Only s and p: the spherical and Cartesian sets are the same. def h4_diffuse_eri8_sph() -> Arr { return h4_diffuse_eri8_cart() } def h4_diffuse_m() -> Arr { return h4_diffuse_eye(8) } # ---- H4_DIFFUSE RHF: nalpha 2, nbeta 2; default state not analyzed ---- H4_DIFFUSE_E_RHF = -1.6291001503056712 H4_DIFFUSE_E_RHF_DEFAULT = -1.6291001503056712 H4_DIFFUSE_E_RHF_STABLE = -1.6291001503056712 # 1: no restart from the stability orbitals lowers the minao state; 0: one does; -1: not analyzed (not analyzed: canonical orthogonalization drops a vector). H4_DIFFUSE_RHF_IS_STABLE = -1 H4_DIFFUSE_RHF_NALPHA = 2 H4_DIFFUSE_RHF_NBETA = 2 # Max |D' - D| after one PySCF step (get_fock, eig, get_occ, make_rdm1) from the default density below. H4_DIFFUSE_RHF_SELF_STEP = 5.819678072782608e-12 #| Converged total density (alpha + beta), default state. def h4_diffuse_rhf_d_flat() -> Arr { return [0.8155210859839529, 0.5840386596523388, 0.6841708399667575, -0.53269449019856, -0.43004929974203854, -0.5589276325460679, -0.7192965925550897, 0.5054816383335906, 0.5840386596523388, 6.17016176083301, 1.4671846872835166, -6.179379165500959, 1.410155232512773, -6.180721863203361, 0.505481638234348, 6.166140953576964, 0.6841708399667575, 1.4671846872835166, 0.7399988336768004, -1.4319232000191628, -0.06888324860052711, -1.4509674785090438, -0.4300492997420435, 1.4101552325348292, -0.53269449019856, -6.179379165500959, -1.4319232000191628, 6.192196816003629, -1.450967478624894, 6.19174843758623, -0.5589276324991996, -6.180721863784839, -0.43004929974203854, 1.410155232512773, -0.06888324860052711, -1.450967478624894, 0.7399988336767482, -1.4319231997214124, 0.6841708399667408, 1.467184687123363, -0.5589276325460679, -6.180721863203361, -1.4509674785090438, 6.19174843758623, -1.4319231997214124, 6.192196814231214, -0.5326944899950794, -6.179379164313451, -0.7192965925550897, 0.505481638234348, -0.4300492997420435, -0.5589276324991996, 0.6841708399667408, -0.5326944899950794, 0.8155210859839557, 0.5840386595008056, 0.5054816383335906, 6.166140953576964, 1.4101552325348292, -6.180721863784839, 1.467184687123363, -6.179379164313451, 0.5840386595008056, 6.170161760228101] } def h4_diffuse_rhf_d() -> Arr { return h4_diffuse_mat(h4_diffuse_rhf_d_flat(), 8, 8) } # Smallest overlap eigenvalue: below the 1e-8 threshold. H4_DIFFUSE_S_MIN_EIG = 1.7058645923594027e-09 # Vectors canonical orthogonalization drops at threshold 1e-8. H4_DIFFUSE_NDROP = 1 test "h4_diffuse packs" { assert_near(h4_diffuse_pack_bad(h4_diffuse_shells(), H4_DIFFUSE_NSH, H4_DIFFUSE_NPRIMTOT, H4_DIFFUSE_NATOM), 0.0, 0.0) # nao_cart - nao_sph = sum over shells of ncart - nsph: 1 per d shell, 3 per f shell assert_near(H4_DIFFUSE_NAO_CART - H4_DIFFUSE_NAO_SPH, 0.0, 0.0) assert_near(len(h4_diffuse_fc()), H4_DIFFUSE_NAO_CART, 0.0) } test "h4_diffuse unit one-electron integrals are symmetric with a unit overlap diagonal" { assert_near(h4_diffuse_asym(h4_diffuse_s_unit(), 8), 0.0, 1.0e-14) assert_near(h4_diffuse_asym(h4_diffuse_t_unit(), 8), 0.0, 1.0e-14) assert_near(h4_diffuse_asym(h4_diffuse_v_unit(), 8), 0.0, 1.0e-14) assert_near(h4_diffuse_diag_dev(h4_diffuse_s_unit(), 8), 0.0, 1.0e-14) } test "h4_diffuse unit packed ERIs match their checksums and the Schwarz bound" { assert_near(len(h4_diffuse_eri8_cart()), H4_DIFFUSE_ERI8_CART_LEN, 0.0) assert_near(h4_diffuse_sumsq(h4_diffuse_eri8_cart()) / H4_DIFFUSE_ERI8_CART_SUMSQ, 1.0, 1.0e-12) assert_near(h4_diffuse_wsum(h4_diffuse_eri8_cart(), H4_DIFFUSE_SEED_WSUM), H4_DIFFUSE_ERI8_CART_WSUM, 1.0e-12 * H4_DIFFUSE_ERI8_CART_SUMSQ) assert_lt(h4_diffuse_schwarz(h4_diffuse_eri8_cart(), 8), 1.0e-12) } test "h4_diffuse rhf energies, labels and densities" { assert_lt(H4_DIFFUSE_E_RHF_STABLE, H4_DIFFUSE_E_RHF_DEFAULT + 1.0e-12) assert_lt(H4_DIFFUSE_RHF_SELF_STEP, 1.0e-10) assert_near(h4_diffuse_asym(h4_diffuse_rhf_d(), 8), 0.0, 1.0e-12) assert_near(h4_diffuse_trace2(h4_diffuse_rhf_d(), h4_diffuse_s_unit(), 8), 4.0, 1.0e-10) assert_near(h4_diffuse_e_elec(h4_diffuse_t_unit() + h4_diffuse_v_unit(), h4_diffuse_eri8_cart(), h4_diffuse_rhf_d() * 0.5, h4_diffuse_rhf_d() * 0.5, 8) + H4_DIFFUSE_E_NUC, H4_DIFFUSE_E_RHF_DEFAULT, 1.0e-10) }