filippi-claudia / champ

The Cornell-Holland Ab-initio Materials Package (CHAMP) is a quantum Monte Carlo suite of programs for electronic structure calculations of atomic and molecular systems.
GNU General Public License v3.0
18 stars 7 forks source link

Davidson solver out-of-bounds read #206

Open v1kko opened 2 years ago

v1kko commented 2 years ago

The davidson solver has an out-of-bounds access problem. Even when increasing the array size we get Floating point errors so something is wrong

branch

main

compile flags

cmake ../ -DCMAKE_Fortran_COMPILER=mpifort -DCMAKE_BUILD_TYPE=DEBUG

command

> champ/tests/CI_test/VMC-H2$ mpirun.openmpi -n 1 ~/local_projects/champ/bin/vmc.mov1 -i revised_vmc_lin.inp

output

DAV: Setup subspace problem
DAV: Diagonal-Preconditioned-Residue (DPR)
DAV: tolerance         :  0.100E+00
DAV: Number eigenvalues :          2
DAV: Update size        :          4
DAV: Max basis size     :         10
DAV: Modified Gram-Schmidt orthogonalization with projection update
DAV: -----------------------------
DAV: Iteration:          1
DAV: Basis size:          4
At line 519 of file /home/vikko/local_projects/champ/src/vmc/davidson.f90
Fortran runtime error: Index '3' of dimension 1 of array 'has_converged' above upper bound of 2

Error termination. Backtrace:
DAV: eigv-0.10371D+01-0.36620D+00
DAV: resd 0.16624D+02 0.18019D+03
DAV: Root not yet converged     :          2
#0  0x7fdddd4c7ae0 in ???
#1  0x7fdddd4c8659 in ???
#2  0x7fdddd4c8c56 in ???
#3  0x55e4301dca7b in __davidson_MOD_compute_dpr
    at /home/vikko/local_projects/champ/src/vmc/davidson.f90:523
#4  0x55e4301e167e in __davidson_MOD_generalized_eigensolver
    at /home/vikko/local_projects/champ/src/vmc/davidson.f90:319
#5  0x55e4301e35f4 in __davidson_wrap_mod_MOD_davidson_wrap
    at /home/vikko/local_projects/champ/src/vmc/davidson_wrap.f90:66
#6  0x55e4301ce01d in __optwf_lin_dav_more_MOD_lin_d
    at /home/vikko/local_projects/champ/src/vmc/optwf_lin_dav_more.f:82
#7  0x55e4301ba629 in __optwf_lin_dav_MOD_optwf_lin_d
    at /home/vikko/local_projects/champ/src/vmc/optwf_lin_dav.f:117
#8  0x55e4301e620e in __optwf_mod_MOD_optwf
    at /home/vikko/local_projects/champ/src/vmc/optwf.f90:31
#9  0x55e4301e3b6a in MAIN__
    at /home/vikko/local_projects/champ/src/vmc/main.f90:62
#10  0x55e43017b749 in main
    at /home/vikko/local_projects/champ/src/vmc/main.f90:16
v1kko commented 1 year ago

@NicoRenaud , @neelravi , for your reference, an old issue I created last year