Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete symmetry information from fcidump to avoid PySCF error #97

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

kevinsung
Copy link
Collaborator

Without this change, PySCF throws an error if you try to run a calculation. Example:

from pyscf import mcscf, tools

# Specify molecule properties
num_orbitals = 16
num_elec_a = num_elec_b = 5
open_shell = False
spin_sq = 0

# Read in molecule from disk
mf_as = tools.fcidump.to_scf("../molecules/n2_fci.txt")

# Run FCI
cas = mcscf.CASCI(mf_as.run(), ncas=num_orbitals, nelecas=(num_elec_a, num_elec_b))
_, _, fci_vec, _, _ = cas.kernel()
Traceback (most recent call last):
  File "/home/kevinsung/projects/qiskit-addon-sqd/docs/tutorials/repro.py", line 15, in <module>
    _, _, fci_vec, _, _ = cas.kernel()
                          ^^^^^^^^^^^^
  File "/home/kevinsung/.pyenv/versions/tutorials/lib/python3.11/site-packages/pyscf/mcscf/casci_symm.py", line 59, in
 kernel
    mo_coeff = self.mo_coeff = label_symmetry_(self, mo_coeff, ci0)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kevinsung/.pyenv/versions/tutorials/lib/python3.11/site-packages/pyscf/mcscf/casci_symm.py", line 128, i
n label_symmetry_
    ' '.join([symm.irrep_id2name(mc.mol.groupname, irrep)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kevinsung/.pyenv/versions/tutorials/lib/python3.11/site-packages/pyscf/mcscf/casci_symm.py", line 128, i
n <listcomp>
    ' '.join([symm.irrep_id2name(mc.mol.groupname, irrep)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kevinsung/.pyenv/versions/tutorials/lib/python3.11/site-packages/pyscf/symm/addons.py", line 502, in irr
ep_id2name
    return param.CHARACTER_TABLE[gpname][irrep_id_in_d2h][0]
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'N/a'

@caleb-johnson caleb-johnson merged commit 04373ee into Qiskit:main Nov 5, 2024
10 checks passed
@kevinsung kevinsung deleted the orbsym branch November 5, 2024 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants