Add symmetry support for PySCF multiconfiguration methods to savetoqmcpack#5564
Add symmetry support for PySCF multiconfiguration methods to savetoqmcpack#5564ye-luo merged 10 commits intoQMCPACK:developfrom
Conversation
ye-luo
left a comment
There was a problem hiding this comment.
Welcome and thank you for the fix.
prckent
left a comment
There was a problem hiding this comment.
Many thanks for investigating this and making the fix. As also noted by Ye, please can you update this to just have the functional change and not the formatting change? It makes it is more difficult to see the changes.
If you have opinions on helpful python formatting we can tackle that separately.
|
Test this please |
|
Thanks @NastaMauger . Unless you prefer otherwise, I think we can merge this. OK? As you noted in #5563 , clearly additional work is needed to get the overall support for PySCF multideterminant wavefunctions working correctly. |
|
@prckent I agree. |
|
Test this please |
Proposed changes
The current version of
savetoqmcpack(PyscfToQmcpack.py) does not properly handle symmetry when using multiconfigurational SCF methods. As a result, it fails if the user enables symmetry in their PySCF calculation.Related to this issue: #5563
What type(s) of changes does this code introduce?
The current version of
PyscfToQmcpack.pyuses an explicit type comparison againstmcscf.mc1step.CASSCF:This fails when the user enables symmetry in PySCF, because the returned object is a subclass like
mcscf.mc1step_symm.SymAdaptedCASSCF. Even though it is still anmcscfobject, thetype(mf)check does not account for subclasses.This PR updates the type check to use
isinstance():isinstance(mf, (mcscf.casci.CASCI, mcscf.mc1step.CASSCF))This ensures that both base types and any subclasses (including symmetry-adapted variants) are correctly recognized.
Added a clear and reliable condition to detect whether the wavefunction is multideterminant, ensuring proper handling of both symmetry and non-symmetry cases. Additionally, user-friendly print statements were included to notify the user when a multideterminant wavefunction has been successfully saved with the explicit name of the file.
Does this introduce a breaking change?
What systems has this change been tested on?
Tested with symmetry on and off; multideterminant detection works correctly.
test.txt
Checklist
Update the following with an [x] where the items apply. If you're unsure about any of them, don't hesitate to ask. This is
simply a reminder of what we are going to look for before merging your code.