diff --git a/python/examples/count_dict_h2o.json b/python/examples/count_dict_h2o.json new file mode 100644 index 0000000..4239b65 --- /dev/null +++ b/python/examples/count_dict_h2o.json @@ -0,0 +1,277 @@ +{ + "000000000000000000011111000000000000000000011111": 1, + "000000000000000000101111000000000000000000101111": 1, + "000000000000000000110111000000000000000000110111": 1, + "000000000000000000111011000000000000000000111011": 1, + "000000000000000000111101000000000000000000111101": 1, + "000000000000000001001111000000000000000001001111": 1, + "000000000000000001010111000000000000000001010111": 1, + "000000000000000001011011000000000000000001011011": 1, + "000000000000000001011101000000000000000001011101": 1, + "000000000000000001110011000000000000000001110011": 1, + "000000000000000001111001000000000000000001111001": 1, + "000000000000000010001111000000000000000010001111": 1, + "000000000000000010010111000000000000000010010111": 1, + "000000000000000010011011000000000000000010011011": 1, + "000000000000000010011101000000000000000010011101": 1, + "000000000000000010110011000000000000000010110011": 1, + "000000000000000011010101000000000000000011010101": 1, + "000000000000000100001111000000000000000100001111": 1, + "000000000000000100010111000000000000000100010111": 1, + "000000000000000100011011000000000000000100011011": 1, + "000000000000000100011101000000000000000100011101": 1, + "000000000000000100110101000000000000000100110101": 1, + "000000000000000101010011000000000000000101010011": 1, + "000000000000000101011001000000000000000101011001": 1, + "000000000000000110010011000000000000000110010011": 1, + "000000000000000110011001000000000000000110011001": 1, + "000000000000001000001111000000000000001000001111": 1, + "000000000000001000010111000000000000001000010111": 1, + "000000000000001000011011000000000000001000011011": 1, + "000000000000001000011101000000000000001000011101": 1, + "000000000000001000110101000000000000001000110101": 1, + "000000000000001001010011000000000000001001010011": 1, + "000000000000001001011001000000000000001001011001": 1, + "000000000000001010010011000000000000001010010011": 1, + "000000000000001100010011000000000000001100010011": 1, + "000000000000001100010101000000000000001100010101": 1, + "000000000000010000001111000000000000010000001111": 1, + "000000000000010000010111000000000000010000010111": 1, + "000000000000010000011011000000000000010000011011": 1, + "000000000000010000011101000000000000010000011101": 1, + "000000000000010000011110000000000000010000011110": 1, + "000000000000010000100111000000000000010000100111": 1, + "000000000000010000101101000000000000010000101101": 1, + "000000000000010001001011000000000000010001001011": 1, + "000000000000010010000111000000000000010010000111": 1, + "000000000000010010001011000000000000010010001011": 1, + "000000000000010100000111000000000000010100000111": 1, + "000000000000010100001011000000000000010100001011": 1, + "000000000000010100001101000000000000010100001101": 1, + "000000000000011000000111000000000000011000000111": 1, + "000000000000011000100101000000000000011000100101": 1, + "000000000000011001000011000000000000011001000011": 1, + "000000000000011010000011000000000000011010000011": 1, + "000000000000100000001111000000000000100000001111": 1, + "000000000000100000010111000000000000100000010111": 1, + "000000000000100000011011000000000000100000011011": 1, + "000000000000100000011101000000000000100000011101": 1, + "000000000000100000110011000000000000100000110011": 1, + "000000000000100000111001000000000000100000111001": 1, + "000000000000100010010011000000000000100010010011": 1, + "000000000000100010010101000000000000100010010101": 1, + "000000000000100100010011000000000000100100010011": 1, + "000000000000100100011001000000000000100100011001": 1, + "000000000000101000010011000000000000101000010011": 1, + "000000000000110000001011000000000000110000001011": 1, + "000000000000111000000011000000000000111000000011": 1, + "000000000001000000001111000000000001000000001111": 1, + "000000000001000000010111000000000001000000010111": 1, + "000000000001000000011011000000000001000000011011": 1, + "000000000001000000011101000000000001000000011101": 1, + "000000000001000000110101000000000001000000110101": 1, + "000000000001000001010011000000000001000001010011": 1, + "000000000001000001011001000000000001000001011001": 1, + "000000000001000010010011000000000001000010010011": 1, + "000000000001000010011001000000000001000010011001": 1, + "000000000001000100010101000000000001000100010101": 1, + "000000000001001000010101000000000001001000010101": 1, + "000000000001010000000111000000000001010000000111": 1, + "000000000001010000001101000000000001010000001101": 1, + "000000000001100000010011000000000001100000010011": 1, + "000000000001100000011001000000000001100000011001": 1, + "000000000010000000001111000000000010000000001111": 1, + "000000000010000000010111000000000010000000010111": 1, + "000000000010000000011011000000000010000000011011": 1, + "000000000010000000011101000000000010000000011101": 1, + "000000000010000000101011000000000010000000101011": 1, + "000000000010000001000111000000000010000001000111": 1, + "000000000010000001001101000000000010000001001101": 1, + "000000000010000010000111000000000010000010000111": 1, + "000000000010000010001011000000000010000010001011": 1, + "000000000010000010001101000000000010000010001101": 1, + "000000000010000100001011000000000010000100001011": 1, + "000000000010001000001011000000000010001000001011": 1, + "000000000010100000000111000000000010100000000111": 1, + "000000000010100000001101000000000010100000001101": 1, + "000000000011000000001011000000000011000000001011": 1, + "000000000100000000001111000000000100000000001111": 1, + "000000000100000000010111000000000100000000010111": 1, + "000000000100000000011011000000000100000000011011": 1, + "000000000100000000011101000000000100000000011101": 1, + "000000000100000000100111000000000100000000100111": 1, + "000000000100000001001011000000000100000001001011": 1, + "000000000100000010001011000000000100000010001011": 1, + "000000000100000100000111000000000100000100000111": 1, + "000000000100000100001101000000000100000100001101": 1, + "000000000100001000001101000000000100001000001101": 1, + "000000000100010000010101000000000100010000010101": 1, + "000000000100100000001011000000000100100000001011": 1, + "000000000101000000000111000000000101000000000111": 1, + "000000000101000000001101000000000101000000001101": 1, + "000000000110000000010011000000000110000000010011": 1, + "000000001000000000001111000000001000000000001111": 1, + "000000001000000000010111000000001000000000010111": 1, + "000000001000000000011011000000001000000000011011": 1, + "000000001000000000011101000000001000000000011101": 1, + "000000001000000000110101000000001000000000110101": 1, + "000000001000000001010011000000001000000001010011": 1, + "000000001000000001011001000000001000000001011001": 1, + "000000001000000010010011000000001000000010010011": 1, + "000000001000000010011001000000001000000010011001": 1, + "000000001000000100010101000000001000000100010101": 1, + "000000001000001000010101000000001000001000010101": 1, + "000000001000010000000111000000001000010000000111": 1, + "000000001000010000001101000000001000010000001101": 1, + "000000001000100000010011000000001000100000010011": 1, + "000000001000100000011001000000001000100000011001": 1, + "000000001001000000010101000000001001000000010101": 1, + "000000001010000000001011000000001010000000001011": 1, + "000000001100000000000111000000001100000000000111": 1, + "000000001100000000001101000000001100000000001101": 1, + "000000010000000000001111000000010000000000001111": 1, + "000000010000000000010111000000010000000000010111": 1, + "000000010000000000011011000000010000000000011011": 1, + "000000010000000000011101000000010000000000011101": 1, + "000000010000000001010101000000010000000001010101": 1, + "000000010000000010010101000000010000000010010101": 1, + "000000010000000100010011000000010000000100010011": 1, + "000000010000000100011001000000010000000100011001": 1, + "000000010000001000011001000000010000001000011001": 1, + "000000010001000000011001000000010001000000011001": 1, + "000000011000000000010011000000011000000000010011": 1, + "000000100000000000001111000000100000000000001111": 1, + "000000100000000000010111000000100000000000010111": 1, + "000000100000000000011011000000100000000000011011": 1, + "000000100000000000011101000000100000000000011101": 1, + "000000100000000000110011000000100000000000110011": 1, + "000000100000000001010101000000100000000001010101": 1, + "000000100000000010010101000000100000000010010101": 1, + "000000100000000100011001000000100000000100011001": 1, + "000000100000001000010011000000100000001000010011": 1, + "000000100000010000001011000000100000010000001011": 1, + "000000100000100000010101000000100000100000010101": 1, + "000000100001000000010011000000100001000000010011": 1, + "000000100001000000011001000000100001000000011001": 1, + "000000100010000000000111000000100010000000000111": 1, + "000000100010000000001101000000100010000000001101": 1, + "000000100100000000001011000000100100000000001011": 1, + "000000101000000000010011000000101000000000010011": 1, + "000000101000000000011001000000101000000000011001": 1, + "000001000000000000001111000001000000000000001111": 1, + "000001000000000000010111000001000000000000010111": 1, + "000001000000000000011011000001000000000000011011": 1, + "000001000000000000011101000001000000000000011101": 1, + "000001000000000001011001000001000000000001011001": 1, + "000001000000000010010011000001000000000010010011": 1, + "000001000000000010011001000001000000000010011001": 1, + "000001000000000100010101000001000000000100010101": 1, + "000001000000001000010101000001000000001000010101": 1, + "000001000000010000000111000001000000010000000111": 1, + "000001000000010000001101000001000000010000001101": 1, + "000001000000100000010011000001000000100000010011": 1, + "000001000000100000011001000001000000100000011001": 1, + "000001000010000000001011000001000010000000001011": 1, + "000001000100000000000111000001000100000000000111": 1, + "000001000100000000001101000001000100000000001101": 1, + "000001001000000000010101000001001000000000010101": 1, + "000001100000000000011001000001100000000000011001": 1, + "000010000000000000001111000010000000000000001111": 1, + "000010000000000000010111000010000000000000010111": 1, + "000010000000000000011011000010000000000000011011": 1, + "000010000000000000011101000010000000000000011101": 1, + "000010000000000000100111000010000000000000100111": 1, + "000010000000000000101101000010000000000000101101": 1, + "000010000000000010001011000010000000000010001011": 1, + "000010000000000100000111000010000000000100000111": 1, + "000010000000000100001101000010000000000100001101": 1, + "000010000000001000001101000010000000001000001101": 1, + "000010000000010000010101000010000000010000010101": 1, + "000010000000100000001011000010000000100000001011": 1, + "000010000001000000000111000010000001000000000111": 1, + "000010000001000000001101000010000001000000001101": 1, + "000010000010000000010011000010000010000000010011": 1, + "000010000010000000011001000010000010000000011001": 1, + "000010001000000000000111000010001000000000000111": 1, + "000010100000000000001011000010100000000000001011": 1, + "000011000000000000000111000011000000000000000111": 1, + "000100000000000000001111000100000000000000001111": 1, + "000100000000000000010111000100000000000000010111": 1, + "000100000000000000011011000100000000000000011011": 1, + "000100000000000000011101000100000000000000011101": 1, + "000100000000000001000111000100000000000001000111": 1, + "000100000000000001001101000100000000000001001101": 1, + "000100000000000010000111000100000000000010000111": 1, + "000100000000000010001101000100000000000010001101": 1, + "000100000000000100001011000100000000000100001011": 1, + "000100000000001000001011000100000000001000001011": 1, + "000100000000010000010011000100000000010000010011": 1, + "000100000000010000011001000100000000010000011001": 1, + "000100000000100000001101000100000000100000001101": 1, + "000100000001000000001011000100000001000000001011": 1, + "000100000010000000010101000100000010000000010101": 1, + "000100000100000000010011000100000100000000010011": 1, + "000100001000000000001011000100001000000000001011": 1, + "000100100000000000000111000100100000000000000111": 1, + "000101000000000000001011000101000000000000001011": 1, + "000110000000000000010011000110000000000000010011": 1, + "001000000000000000001111001000000000000000001111": 1, + "001000000000000000010111001000000000000000010111": 1, + "001000000000000000011011001000000000000000011011": 1, + "001000000000000000011101001000000000000000011101": 1, + "001000000000000000110101001000000000000000110101": 1, + "001000000000000001010011001000000000000001010011": 1, + "001000000000000001011001001000000000000001011001": 1, + "001000000000000010010011001000000000000010010011": 1, + "001000000000000100010101001000000000000100010101": 1, + "001000000000001000010101001000000000001000010101": 1, + "001000000000100000010011001000000000100000010011": 1, + "001000000000100000011001001000000000100000011001": 1, + "001000000100000000000111001000000100000000000111": 1, + "001000010000000000011001001000010000000000011001": 1, + "001000100000000000010011001000100000000000010011": 1, + "001010000000000000000111001010000000000000000111": 1, + "001100000000000000001011001100000000000000001011": 1, + "010000000000000000001111010000000000000000001111": 1, + "010000000000000000010111010000000000000000010111": 1, + "010000000000000000011011010000000000000000011011": 1, + "010000000000000000011101010000000000000000011101": 1, + "010000000000000001010011010000000000000001010011": 1, + "010000000000000001011001010000000000000001011001": 1, + "010000000000000010010011010000000000000010010011": 1, + "010000000000000010011001010000000000000010011001": 1, + "010000000000000100010101010000000000000100010101": 1, + "010000000000001000010101010000000000001000010101": 1, + "010000000000010000000111010000000000010000000111": 1, + "010000000000010000001101010000000000010000001101": 1, + "010000000000100000010011010000000000100000010011": 1, + "010000000010000000001011010000000010000000001011": 1, + "010000000100000000000111010000000100000000000111": 1, + "010000001000000000010101010000001000000000010101": 1, + "010000010000000000010011010000010000000000010011": 1, + "010000100000000000010011010000100000000000010011": 1, + "010001000000000000010101010001000000000000010101": 1, + "010010000000000000000111010010000000000000000111": 1, + "010100000000000000001011010100000000000000001011": 1, + "100000000000000000001111100000000000000000001111": 1, + "100000000000000000010111100000000000000000010111": 1, + "100000000000000000011011100000000000000000011011": 1, + "100000000000000000011101100000000000000000011101": 1, + "100000000000000000111001100000000000000000111001": 1, + "100000000000000001010101100000000000000001010101": 1, + "100000000000000010010101100000000000000010010101": 1, + "100000000000000100010011100000000000000100010011": 1, + "100000000000000100011001100000000000000100011001": 1, + "100000000000001000011001100000000000001000011001": 1, + "100000000000010000001011100000000000010000001011": 1, + "100000000000100000010101100000000000100000010101": 1, + "100000000001000000010011100000000001000000010011": 1, + "100000000010000000000111100000000010000000000111": 1, + "100000000100000000001011100000000100000000001011": 1, + "100001000000000000010011100001000000000000010011": 1, + "100001000000000000011001100001000000000000011001": 1, + "100010000000000000001011100010000000000000001011": 1, + "100100000000000000000111100100000000000000000111": 1, + "101000000000000000010011101000000000000000010011": 1, + "110000000000000000010011110000000000000000010011": 1 +} diff --git a/python/examples/run_sqd_sbd.ipynb b/python/examples/run_sqd_sbd.ipynb index 1917b96..d9e14a0 100644 --- a/python/examples/run_sqd_sbd.ipynb +++ b/python/examples/run_sqd_sbd.ipynb @@ -10,8 +10,8 @@ "Same self-consistent SQD workflow as `run_sqd_sbd.py`, but interactive and serial.\n", "Runs on a single MPI rank (mpi4py auto-initializes `MPI.COMM_WORLD` with size=1 inside a Jupyter kernel; SBD's MPI collectives become no-ops).\n", "\n", - "Workload: H2O FCIDUMP (NORB=24, NELEC=10, MS2=0), 300 uniform-random bitstrings refined toward HF, 1 batch, 2 SQD iterations.\n", - "Should converge to ~-76.2 Ha in a few seconds on CPU (FCI reference ≈ -76.24 Ha). Scale samples_per_batch up on a GPU box for a tighter result.\n", + "Workload: H2O FCIDUMP (NORB=24, NELEC=10, MS2=0), the 275 bitstrings in `count_dict_h2o.json`, 1 batch, 2 SQD iterations.\n", + "Converges to ≈ -76.236 Ha in seconds on CPU — upstream's value for this 75,625-determinant subspace (FCI ≈ -76.2438 Ha). For tighter results use a larger determinant list (`h2o-1em5-alpha.txt` → 5514 bitstrings → 3.0e7 determinants) on a GPU.\n", "\n", "**Multi-rank version:** [`run_sqd_sbd.py`](./run_sqd_sbd.py) — same recipe, run with `mpirun -np N python run_sqd_sbd.py …`." ] @@ -63,7 +63,7 @@ "from mpi4py import MPI\n", "from pyscf import ao2mo, tools\n", "from qiskit_addon_sqd.fermion import diagonalize_fermionic_hamiltonian\n", - "from qiskit_addon_sqd.counts import generate_bit_array_uniform\n", + "from qiskit.primitives import BitArray\n", "\n", "import sbd\n", "from sbd.sbd_solver import solve_sci_batch\n", @@ -128,7 +128,20 @@ "cell_type": "markdown", "id": "29e41ca3", "metadata": {}, - "source": "## 3. Bitstrings — uniform random, refined by configuration recovery\n\nWe generate uniform-random 48-bit strings as a stand-in for noisy quantum-measurement counts, then pass HF initial occupancies to `diagonalize_fermionic_hamiltonian` (next cell). qiskit-addon-sqd's configuration-recovery step uses those occupancies to pull random samples toward physically meaningful configurations.\n\n*(In production you'd pass actual hardware counts via `qiskit_addon_sqd.counts.bit_array_to_arrays(...)` — see `run_sqd_sbd.py --counts ...` for the loader.)*" + "source": [ + "## 3. Bitstrings — a curated H2O determinant set\n", + "\n", + "`count_dict_h2o.json` holds 275 bitstrings in qiskit-addon-sqd's `[beta | alpha]` layout\n", + "(24 bits per half, 5 electrons each), built from the vendored `h2o-1em3-alpha.txt` by reusing\n", + "every alpha half-determinant for both spin sectors. SBD then forms the 275 × 275 =\n", + "75,625-determinant tensor product — the subspace `run_sbd_diag.py` builds from `--adetfile`.\n", + "\n", + "All of them already carry the target Hamming weight, so none are postselected away; of\n", + "uniform-random 48-bit strings only `C(24,5)² / 4²⁴ ≈ 6e-6` would qualify. Counts are all 1 —\n", + "a determinant list, not a shot histogram.\n", + "\n", + "*(For hardware output, pass your own file: `run_sqd_sbd.py --counts …`.)*" + ] }, { "cell_type": "code", @@ -155,14 +168,14 @@ ], "source": [ "rng = np.random.default_rng(42)\n", - "bit_array = generate_bit_array_uniform(300, norb*2, rand_seed=rng)\n", - "print(f'Generated {bit_array.num_shots} uniform-random bitstrings ({norb*2} bits / shot)')\n", "\n", - "# HF initial occupancies: lowest 5 orbitals filled in each spin sector\n", - "hf_occ_a = np.array([1.0]*num_elec_a + [0.0]*(norb - num_elec_a))\n", - "hf_occ_b = np.array([1.0]*num_elec_b + [0.0]*(norb - num_elec_b))\n", - "print(f'HF α occupancy : {hf_occ_a}')\n", - "print(f'HF β occupancy : {hf_occ_b}')" + "counts = json.loads(Path('count_dict_h2o.json').read_text())\n", + "bit_array = BitArray.from_counts(counts, num_bits=norb*2)\n", + "\n", + "weights = {(k[norb:].count('1'), k[:norb].count('1')) for k in counts}\n", + "print(f'Loaded {len(counts)} bitstrings ({norb*2} bits / shot) from count_dict_h2o.json')\n", + "print(f'(alpha, beta) Hamming weights present: {weights} -> target ({num_elec_a}, {num_elec_b})')\n", + "print(f'Tensor-product subspace: {len(counts)} x {len(counts)} = {len(counts)**2:_} determinants')" ] }, { @@ -483,7 +496,8 @@ " for i, r in enumerate(results):\n", " total_e = r.energy + nuc\n", " dim = np.prod(r.sci_state.amplitudes.shape)\n", - " print(f' iter {iteration}, batch {i}: E = {total_e:.10f} Ha subspace dim = {dim:_}')\n", + " # carryover dets selected for the next iteration, not the 75,625 diagonalized\n", + " print(f' iter {iteration}, batch {i}: E = {total_e:.10f} Ha carryover dim = {dim:_}')\n", "\n", "result = diagonalize_fermionic_hamiltonian(\n", " hcore, eri, bit_array,\n", @@ -492,7 +506,6 @@ " samples_per_batch=300,\n", " num_batches=1,\n", " max_iterations=2,\n", - " initial_occupancies=(hf_occ_a, hf_occ_b), # bootstraps recovery from HF\n", " sci_solver=sbd_solver,\n", " symmetrize_spin=True,\n", " callback=callback,\n", @@ -591,7 +604,7 @@ "## Notes\n", "\n", "- **Why this works in a notebook**: SBD is MPI-native at the C++ level, but a Jupyter kernel is a single Python process. `mpi4py` auto-initializes MPI with `MPI.COMM_WORLD` of size 1; SBD's collectives all become no-ops; the full SQD loop runs on rank 0.\n", - "- **Why `initial_occupancies=` is needed for random samples**: 48-bit uniform-random strings overwhelmingly fail the Hamming-weight check (5α+5β). qiskit-addon-sqd's configuration_recovery uses occupancies to pull noisy samples toward physical configurations; HF occupancies are the natural seed before the first SBD diagonalization gives real ones.\n", + "- **Why a curated counts file**: qiskit-addon-sqd postselects on (5α, 5β), which uniform-random strings almost never satisfy. `count_dict_h2o.json` supplies determinants that do. From iteration 2 on, configuration recovery refines them from the previous diagonalization's occupancies — no `initial_occupancies` needed.\n", "- **Multi-rank**: launch [`run_sqd_sbd.py`](./run_sqd_sbd.py) with `mpirun -np N python …` for production scale.\n", "- **GPU**: pass `DeviceConfig.gpu()` (Thrust) or `DeviceConfig.gpu_omp()` (LLVM offload) on a CUDA-capable machine. Not available on macOS — keep `DeviceConfig.cpu()` here." ] diff --git a/python/examples/run_sqd_sbd.py b/python/examples/run_sqd_sbd.py index e2b8f0b..782bb93 100644 --- a/python/examples/run_sqd_sbd.py +++ b/python/examples/run_sqd_sbd.py @@ -22,7 +22,7 @@ Bitstring input (choose one): --counts FILE count_dict.json {bitstring: count} - --samples N generate N uniform random bitstrings (default) + --samples N generate N random bitstrings at the target Hamming weights Usage (MPI required): # H2O with bundled data, random samples @@ -66,7 +66,8 @@ def parse_args(): p.add_argument("--counts", default=None, help="Path to count_dict.json (bitstring counts from hardware)") p.add_argument("--samples", type=int, default=3000, - help="Number of uniform random samples (used when --counts is not given)") + help="Number of random samples when --counts is absent, drawn at " + "the target alpha/beta Hamming weights.") p.add_argument("--device", choices=["auto", "cpu", "gpu", "gpu-omp", "gpu-nvidia-omp"], default="cpu", @@ -205,12 +206,21 @@ def main(): if rank == 0: print(f"Loaded {bit_array.num_shots} bitstrings from {args.counts}") else: - from qiskit_addon_sqd.counts import generate_bit_array_uniform - bit_array = generate_bit_array_uniform( - args.samples, norb * 2, rand_seed=rand_seed + # Stand-in for hardware counts, at the target Hamming weights. Uniform + # strings get postselected away: survival is C(norb,ne)^2 / 4^norb, + # ~6e-6 for H2O (5 of 24). + from qiskit_addon_sqd.counts import generate_counts_bipartite_hamming + counts = generate_counts_bipartite_hamming( + args.samples, + norb * 2, + hamming_right=num_elec_a, + hamming_left=num_elec_b, + rand_seed=rand_seed, ) + bit_array = BitArray.from_counts(counts, num_bits=norb * 2) if rank == 0: - print(f"Generated {bit_array.num_shots} uniform random bitstrings") + print(f"Generated {bit_array.num_shots} random bitstrings with " + f"({num_elec_a}, {num_elec_b}) alpha/beta Hamming weights") if rank == 0: print() @@ -262,18 +272,6 @@ def callback(results: list[SCIResult]): print("Starting SQD loop...") t0 = time.perf_counter() - # HF (Hartree-Fock) occupancies as a recovery seed: first num_elec_a - # alpha orbitals filled, first num_elec_b beta orbitals filled. This - # is what configuration_recovery falls back to when the bit_array - # contains no valid Hamming-weight strings — which is always the - # case for the uniform-random fallback path (probability of a random - # 2*norb bitstring having exactly (num_elec_a, num_elec_b) Hamming - # weights is vanishing for any realistic norb). Cheap insurance even - # when --counts is provided; harmless if the bit_array is already - # valid. - hf_alpha = np.zeros(norb); hf_alpha[:num_elec_a] = 1.0 - hf_beta = np.zeros(norb); hf_beta[:num_elec_b] = 1.0 - try: result = diagonalize_fermionic_hamiltonian( hcore, @@ -288,7 +286,6 @@ def callback(results: list[SCIResult]): symmetrize_spin=True, callback=callback, seed=rand_seed, - initial_occupancies=(hf_alpha, hf_beta), ) except RuntimeError as e: if "Failed to open FCIDUMP" in str(e):