Subject: Issue with Open-shell Systems in Resource Estimation for Quantum Chemistry
Hi everyone,
I was working on this demo from Soran that caught my attention: Resource Estimation for Quantum Chemistry.
However, I encountered a constraint: the function does not support open-shell systems, displaying the following error message:
ValueError: Open-shell systems are not supported. Change the charge or spin multiplicity of the molecule.
This limitation means that we cannot fully use it for the larger molecules I’m working on. Has anyone faced this issue before? Do we have an alternative solution?
Here’s the code to replicate the error message:
# Molecule definition
<Molecule = C3H7, Charge: 0, Basis: STO-3G, Orbitals: 22, Electrons: 25>
# Error traceback
line 31 ValueError: Open-shell systems are not supported. Change the charge or spin multiplicity of the molecule.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[174], line 31
29 print("Molecule CH_molecule:")
30 print(mol)
---> 31 core, one, two = qml.qchem.electron_integrals(mol)()
32 algo = qml.resource.DoubleFactorization(one, two)
33 print(f'Estimated gates : {algo.gates:.2e} \nEstimated qubits: {algo.qubits}')
File /opt/anaconda3/envs/pen/lib/python3.10/site-packages/pennylane/qchem/hamiltonian.py:120, in electron_integrals.<locals>._electron_integrals(*args)
111 def _electron_integrals(*args):
112 r"""Compute the one- and two-electron integrals in the molecular orbital basis.
113
114 Args:
(...)
118 tuple[array[float]]: 1D tuple containing core constant, one- and two-electron integrals
119 """
--> 120 _, coeffs, _, h_core, repulsion_tensor = scf(mol)(*args)
121 one = qml.math.einsum("qr,rs,st->qt", coeffs.T, h_core, coeffs)
122 two = qml.math.swapaxes(
123 qml.math.einsum(
124 "ab,cd,bdeg,ef,gh->acfh", coeffs.T, coeffs.T, repulsion_tensor, coeffs, coeffs
(...)
127 3,
128 )
File /opt/anaconda3/envs/pen/lib/python3.10/site-packages/pennylane/qchem/hartree_fock.py:120, in scf.<locals>._scf(*args)
110 r"""Perform the self-consistent-field iterations.
111
112 Args:
(...)
117 Fock matrix, core matrix
118 """
119 if mol.n_electrons % 2 == 1 or mol.mult != 1:
--> 120 raise ValueError(
121 "Open-shell systems are not supported. Change the charge or spin multiplicity of the molecule."
122 )
124 basis_functions = mol.basis_set
125 charges = mol.nuclear_charges
Any insights or suggestions would be greatly appreciated.
Many thanks,
Parfait