[Wien] lapw2c run-time error (with suggested code correction)
Michal Wierzbicki
wierzba at if.pw.edu.pl
Sun Feb 10 12:26:48 CET 2008
lapw2c crashed during an SCF calculation of BaC crystal in the wurtzite
structure with an 'illegal instruction' message. I am using the followig
software:
Wien2k 08.1
Intel Fortran 9.1.052
Intel MKL 9.0
I recompiled SRC_lapw2/* with the following compiler options
FOPT = -FR -mp1 -w -prec_div -pc80 -O0 -traceback -check -debug
Then I got the following error message:
forrtl: severe (408): fort: (2): Subscript #1 of the array EB has value 63
which is greater than the upper bound of 62
Image PC Routine Line Source
lapw2c 08127BAE eweigh_ 648 fermi_tmp_.F
It seems that error is at line 648 in fermi.F file. There is a logical .and.
in the do-while loop condition there.
If the first condition "(nn+ndeg).le.nnn" is false optimizing compiler
may decide to not evaluate the rest.
However if it does then the second condition requires the element
eb(nn+ndeg,kk,jspin1) of an array which is out of bound.
I think the solution is to split the logical .and. and evaluate the rest
inside the do-loop, with the conditional exit out of the loop.
******************* patch begins *****************************************
--- fermi.F.orig 2008-02-09 23:07:58.000000000 +0100
+++ fermi.F 2008-02-09 23:34:17.000000000 +0100
@@ -644,8 +645,8 @@
wecp=weight(nn+(jspin1-1)*nnn,kk)
!
! check degeneracy
- do while((nn+ndeg).le.nnn.and. &
- abs(eb(nn+ndeg,kk,jspin1)-eb(nn,kk,jspin1)).lt.abs(cordeg))
+ do while((nn+ndeg).le.nnn)
+ if(abs(eb(nn+ndeg,kk,jspin1)-eb(nn,kk,jspin1)).lt.abs(cordeg)) exit
if(abs(weight(nn+ndeg+(jspin1-1)*nnn,kk) &
-weight(nn+(jspin1-1)*nnn,kk)).ge.1e-6) ifcp=1
wecp=wecp+weight((nn+ndeg)+(jspin1-1)*nnn,kk)
******************** patch ends ******************************************
With regards,
Michal Wierzbicki
Faculty of Physics
Warsaw University of Technology
Koszykowa 75 00-662 Warszawa
Poland
More information about the Wien
mailing list