pyscf_step.engine package#

Submodules#

pyscf_step.engine.aoc module#

Average-of-configuration SCF (aoc-SCF) for atoms, in PySCF’s GHF.

PySCF has no average-of-configuration SCF. It is needed for the spin-orbit correction: single determinants of open-shell atoms break the spherical symmetry and relax differently with and without spin-orbit, and the results are not even reproducible (phase 0, SEAMM 5876/5877). The spherical aoc treatment, as Bross, Bacskay, Peterson and Ruscic (J. Phys. Chem. A 127, 704 (2023)) use with DIRAC (Visser et al., J. Chem. Phys. 96, 2910 (1992)), is the only atomic treatment here.

Validated in SEAMM 5877 (ECP28MDF with SO, uncontracted cc-pVTZ-PP): the I atom 2P splitting is 7560.4 cm-1 (7603 measured; DIRAC aoc-SCF 7587).

pyscf_step.engine.aoc.determinant_average(mol, with_soc, mf)[source]#

The average of the configuration’s determinant energies at mf’s orbitals.

A check of the aoc energy expression: equal to mf.e_tot to rounding.

pyscf_step.engine.aoc.make_aoc_class()[source]#

The AOCGHF class, built on PySCF’s GHF (imported only when needed).

pyscf_step.engine.aoc.p_shell_atom(mol, n_p, check=True, log=None)[source]#

Scalar and two-component aoc energies of an atom with an open p shell.

For p1 and p5 the jj configurations are exact J states at SCF level: p1 gives J = 1/2 (p1/2^1) and J = 3/2 (p3/2^1); p5 gives J = 3/2 (p1/2^2 p3/2^3) and J = 1/2 (p1/2^1 p3/2^4). Each state is the aoc over its jj determinants with its own orbitals; the scalar 2P is the aoc over the six determinants of p^n. Other p shells (p2, p3, p4) need a small spinor CI and are refused.

The p shell is taken as the six highest occupied spin-orbitals of a spherical, fractionally occupied calculation, which must split 2 + 4 (p1/2, p3/2) with spin-orbit and be degenerate without it.

Returns a dictionary of energies (Eh), the splitting (cm-1) and the spin-orbit terms (kJ/mol): E_SO(ground) = E(ground J) - E(2P) and E_SO(J-avg) = E(J-avg) - E(2P), with E(J-avg) the (2J+1)-weighted average.

pyscf_step.engine.ecp_so module#

Spin-orbit parts of energy-consistent (Stuttgart-Cologne) pseudopotentials.

The basis-set libraries (the Basis Set Exchange, PySCF’s own) store these ECPs as scalar potentials only. For the MDF potentials, each l > 0 term is kept as two primitives, j = l - 1/2 then j = l + 1/2, weighted by l/(2l+1) and (l+1)/(2l+1) so that their sum is the averaged potential. The j-dependent potentials, and from them the spin-orbit operator, can therefore be rebuilt from the scalar data.

PySCF takes the spin-orbit part as a third coefficient per primitive, [exponent, c_scalar, c_so], for the operator U_SO(r) l.s with

U_SO = 2/(2l+1) [V(l, l+1/2) - V(l, l-1/2)],

which is -2c/l on the j = l - 1/2 primitive and +2c/(l+1) on the j = l + 1/2 one (c being the stored, weighted scalar coefficient). This is the Molpro convention for the published SO blocks, so the rebuilt values can be checked against them.

This module needs only the standard library.

exception pyscf_step.engine.ecp_so.ECPError[source]#

Bases: Exception

pyscf_step.engine.ecp_so.add_so_from_jweighted(ecp)[source]#

Add the spin-orbit column to an ECP in PySCF’s format.

Parameters:

ecp ([int, [[l, [[[exp, c], ...] for each power of r]], ...]]) – A scalar ECP as PySCF holds it (l = -1 is the local part).

Returns:

The ECP with [exp, c, c_so] primitives for l > 0, and the SO terms as {l: [(exponent, coefficient), …]} for checking.

Return type:

(ecp_with_so, so_table)

pyscf_step.engine.ecp_so.ecp_with_so(element, scalar_ecp, tolerance=2e-06)[source]#

The ECP with its spin-orbit part, checked against the published blocks.

Refuses an element with no published SO data, or whose scalar ECP is not the published one, rather than running without spin-orbit.

Returns (ecp_with_so, {“scalar”: worst, “so”: worst, “reference”: …}).

pyscf_step.engine.ecp_so.published(element)[source]#

The published SO and scalar blocks for an element, or None.

Returns {“ecp”, “core_electrons”, “reference”, “source”, “scalar”, “so”}, with the blocks as {l: [(exponent, coefficient), …]}.

pyscf_step.engine.ecp_so.scalar_table(ecp, power=2)[source]#

The scalar terms of one power of r, as {l: [(exponent, coefficient), …]}.

pyscf_step.engine.ecp_so.worst_difference(ours, reference)[source]#

The largest difference between two {l: [(exponent, coefficient)]} tables: absolute in the exponents, relative (to max(1, abs(c))) in the coefficients.

pyscf_step.engine.so_correction module#

The molecular spin-orbit correction: two-component minus scalar SCF.

For a closed-shell molecule at a fixed geometry, with the same basis and ECP:

E_SO(mol) = E(2c GHF, SO-ECP) - E(scalar RHF)

The core electrons left explicit by a small-core ECP (I: 4s4p4d) contribute a large second-order term (~100 kJ/mol for I) that cancels against the same term in the atoms. The molecular (second-order) correction to the atomization energy, with the atomic J-averages taken from experiment as the composite schemes do, is therefore

delta_SO = -E_SO(mol) + sum_atoms E_SO(J-avg, atom)

with the atoms by aoc-SCF (see aoc). Bross et al. (J. Phys. Chem. A 127, 704 (2023)) keep this SCF level; it fits ATcT best.

Known offset (SEAMM 5877, report it with each result; do not tune it away): with uncontracted cc-pVTZ-PP and experimental r_e these values sit 7-10 % below Bross’s DIRAC numbers (HI 2.19 vs 2.4, CH3I 2.33 vs 2.6, I2 7.57 vs 8.0 kJ/mol), likely from the geometries (theirs CCSD(T)-F12b) and DIRAC’s aoc and 2c-ECP implementation. The basis is not the cause: HI is 2.190 / 2.189 / 2.199 with unc-cc-pVTZ-PP / unc-aug-cc-pVTZ-PP / unc-cc-pVQZ-PP.

pyscf_step.engine.so_correction.delta_so(e_so_molecule_kj, atom_terms_kj)[source]#

delta_SO = -E_SO(mol) + sum of the atoms’ E_SO(J-avg), in kJ/mol.

Parameters:
  • e_so_molecule_kj (float) – E(2c) - E(scalar) of the molecule.

  • atom_terms_kj (iterable of float) – E_SO(J-avg) of each atom with a spin-orbit ECP (once per atom).

pyscf_step.engine.so_correction.molecule_pair(mol, check_scalar_limit=True)[source]#

Scalar RHF and two-component GHF (SO-ECP) energies of a closed-shell molecule.

Returns {“E_scalar”, “E_2c”, “E_SO_kJ”} and, if asked, the scalar-limit check GHF(no SOC) - RHF, which must be ~0.

pyscf_step.engine.so_driver module#

Driver for one spin-orbit task, run with the PySCF environment’s Python.

python so_driver.py input.json -o results.json

The task’s directory holds this script, aoc.py and so_correction.py (flat). The input names the task:

  • "atom": an atom with an open p shell (p1 or p5), by aoc-SCF, scalar and two component (see aoc.p_shell_atom);

  • "molecule": a closed-shell molecule, scalar RHF and two-component GHF with the SO-ECP (see so_correction.molecule_pair).

and gives the structure, the basis and the ECP (with its spin-orbit column) in PySCF’s internal format, so nothing here reads a basis-set library. Errors are written to the results as {"error": ...} and the exit code is 1.

pyscf_step.engine.so_driver.main(argv=None)[source]#
pyscf_step.engine.so_driver.run(data)[source]#

Module contents#

Code that runs inside the PySCF environment.

The modules here import numpy and (where needed) PySCF, never SEAMM, so the step’s driver script can run them in a separate Python environment (seamm-pyscf).