QMCPACK / qmcpack

Main repository for QMCPACK, an open-source production level many-body ab initio Quantum Monte Carlo code for computing the electronic structure of atoms, molecules, and solids with full performance portable GPU support
http://www.qmcpack.org
Other
296 stars 138 forks source link

Better Guards Needed for Bad SPOSet Construction. #4576

Open rcclay opened 1 year ago

rcclay commented 1 year ago

Describe the bug

To Reproduce We'll use QMCPACK/tests/solids/diamondC_1x1x1-Gaussian_pp_Tw_cplx/ system as test.
1.) Replace C_diamond-twist-third.wfj.xml with the attached XML

<?xml version="1.0"?>
<!-- This file was modified from tests/solids/diamondC_1x1x1-Gaussian_pp_Tw_cplx/C_diamond-twist-third.structure.xml
     to allow both occupied and virtual orbitals to be read into QMCPACk which are used by the unit test test_pyscf_complex_MO.cpp -->
<qmcsystem>
  <wavefunction name="psi0" target="e">
    <determinantset type="MolecularOrbital" name="LCAOBSet" source="ion0" transform="yes" twist="0.3101394529  0.3101394529  0.3101394529" href="dft-inputs/C_diamond-twist-third.h5" PBCimages="12 12 12">
      <sposet basisset="LCAOBSet" name="spo-up" size="26">
        <occupation mode="ground"/>
        <coefficient size="26" spindataset="0"/>
      </sposet>
      <sposet basisset="LCAOBSet" name="spo-dn" size="26">
        <occupation mode="ground"/>
        <coefficient size="26" spindataset="0"/>
      </sposet>
      <slaterdeterminant>
        <determinant id="updet" group="u" sposet="spo_ud" size="4" />
        <determinant id="downdet" group="d" sposet="spo_ud" size="4" />
      </slaterdeterminant>
    </determinantset>
  </wavefunction>
</qmcsystem>

2.) Run. Should see that QMCPACK makes it all the way to VMC before segfaulting.

Expected behavior Referencing a non-registered SPOSet should be detected at parse time and the code should abort. Instead, it gives no errors and actually makes it through a few SPOSet evaluate calls before segfaulting. The numbers coming out are also wrong.

System:

prckent commented 1 year ago

Do we /can we require the slaterdeterminants to be after the sposet definition?

ye-luo commented 1 year ago

We still support that. I need help updating all the tests before disallowing sposet inside determinantset