Hi, I found the Culprit and I was able to solve the LWORK parameter problem.
What I found out is that abi_xheev.f90 was initiating the wrong LWORK, though the old code did work for some cases, but the way at which it is being set will not always be valid due to some unknown variation. The proper way of setting LWORK was, according to documentation (MAMGA source code)
1. let MAGMA survey the amount of WORK to be done by setting LWORK = -1, LWORK = -1 will not proceed with calculations in the routine.
2. this will spit out the correct value of LWORK from the first element of WORK.
3. then get the value of WORK(1) as the correct LWORK
That was the proper way of setting LWORK, but in abi_xheevd, it was different
This is how LWORK was being set from the original Abinit code
Code: Select all
!Initiate dummy array here (should not be similar to the arrays and variables used by the original
!magmaf_zheevd so as magma will not overwrite the original variables)
!plan for lwork
!set lwork, this time it should be ircwork since magma overwrites LWORK
rcwork = REAL(cwork_(1)) !complex? to real
IRCWORK = rcwork_ !real to integer
!here goes the original abinit magmaf_zheevd code
magmaf_zheevd(***(1:2*IRCWORK),IRCWORK,***) ! LWORK is now IRCWORK, WORK is also being overwritten by the magma survey so its name should be different here.
Fix should also be done on other ABI code implementing the wrong LWORK, after this, things will be running fine and expected for double precision calculations.