Skip to content

Handle embedded PySCF basis sets in cclib2pyscf metadata - #1927

Open
barlowa124 wants to merge 1 commit into
cclib:masterfrom
barlowa124:fix-pyscf-custom-basis-1851
Open

barlowa124 wants to merge 1 commit into
cclib:masterfrom
barlowa124:fix-pyscf-custom-basis-1851

Conversation

@barlowa124

Copy link
Copy Markdown

Fixes #1851.

cclib2pyscf.makecclib crashed with TypeError: unhashable type: 'list' for any PySCF molecule built with an embedded basis set, i.e. gto.M(basis={...: gto.parse(...)}). In that case mol.basis is a dict whose values are parsed basis data (nested lists) rather than basis names, and the metadata builder called set() on them.

Non-string dict values are now labelled custom, so embedded basis sets produce basis_set: "custom" while named per-element bases are still deduplicated and joined as before ({"H": "sto-3g", "C": "sto-3g"} -> "sto-3g").

On the issue's reproduction with a minimal H2 molecule and a parsed basis, makecclib now completes and yields the expected metadata for embedded and named basis inputs. Added test_makecclib_custom_basis to test/bridge/testpyscf.py, and pytest test/bridge/testpyscf.py passes all three tests.

makecclib crashed with 'unhashable type: list' when a PySCF molecule
was built with a basis dict whose values are parsed basis data rather
than basis names, because the metadata builder ran set() over the
dict values. Non-string values are now labelled 'custom', so embedded
basis sets parse fine while named per-element bases are still joined
and deduplicated as before.

This branch has not been deployed

No deployments
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.

Can't handle PySCF custom basis sets in cclib.bridge.cclib2pyscf.makecclib

1 participant