[Wien] x xspec runtime error
Gavin Abo
gsabo at crimson.ua.edu
Tue Sep 13 00:41:04 CEST 2011
Dr. Fecher,
Yes, I did check how much data there was in the case.dos1ev. NENRG was
770, and there were 770 lines of data starting at line 4 and going until
the end of the file. This is the same as you described.
It also seems to me that there is no need to check the eof and to use
your DO loop until IEMAX is reached. Though, as you stated, no error
with NENRG or dos data sets is assumed.
Best Regards,
Gavin
On 9/12/2011 1:45 AM, Gerhard Fecher wrote:
> Did you check how much data you have in case.dos1ev ?
> in the second line of that file you should find the number of dos data sets
> NENRG= 770 (number where youre case stopped with the error, indeed it may be different for other cases)
> this should be the same as the number of data in line 4 and following, as IEMAX is read from that line
>
> As I told, I had no time to have a look into the code, after I have seen it it seems
> to me that it is not needed to check whether the eof is reached.
> Supposed there is no error in NENERG possible when the case.dos1ev file is written, the loop may just be
> DO i=1, IEMAX
> IF (LC.EQ.0) then
> READ(32,4713,ERR=913) ENE(i),DOS(i,2),DOS(i,3)
> ELSE
> READ(32,4713,ERR=913) ENE(i),DOS(i,1),DOS(i,2),DOS(i,3)
> ENDIF
> END DO
> and there is no need for any GOTO CONTINUEs, or other constructs to test the eof.
>
> Ciao
> Gerhard
>
> ====================================
> Dr. Gerhard H. Fecher
> Institut of Inorganic and Analytical Chemistry
> Johannes Gutenberg - University
> 55099 Mainz
> ________________________________________
> Von: wien-bounces at zeus.theochem.tuwien.ac.at [wien-bounces at zeus.theochem.tuwien.ac.at]" im Auftrag von"Gavin Abo [gsabo at crimson.ua.edu]
> Gesendet: Freitag, 9. September 2011 14:47
> Bis: wien at zeus.theochem.tuwien.ac.at
> Betreff: Re: [Wien] x xspec runtime error
>
> Dr. Fecher,
>
> Oops, you are right. My logical expression was not correct. It should
> have been a less than or equal (i .LE. IEMAX .or. .NOT. EOF(32)).
> However, I would use your logical expression of (.not. (eof(32) .or.
> i.gt.iemax)), since it matches the thought process.
>
> Regarding 1) and 2), I believe this is already done in the code. Dr.
> Blaha previously posted:
>
> The dimension is read from unit 32, and then it tries to read as many
> lines ....
>
> READ (32,4712) IEMAX
> allocate ( A1(NRAD,IEMAX), B1(NRAD,IEMAX))
> allocate ( ENE(IEMAX))
> allocate ( DOS(IEMAX,3),XI(IEMAX,2),X(IEMAX))
> allocate ( XINTER(IEMAX),XOUT(IEMAX))
>
> Eventually one could try for security to allocate the arrays ENE and DOS
> with IEMAX+1.
>
> Best Regards,
>
> Gavin
>
> On 9/9/2011 2:30 AM, Gerhard Fecher wrote:
>> you like to have the do while loop executed
>> if i does not exceed iemax and the end of file is not reached
>> what means (.not. (eof(32) .or. i.gt.iemax)) or similar by making use of the logical rules.
>>
>> if the dimensioning is a problem then I would preffer to
>> 1) read in first the number nmax of datasets in the file (can be done with a similar loop reading a dummy instead of the arrays)
>> 2) do the correct dimensioning of the arrays by allocation
>> 3) rewind the file
>> 4) read in the data in a do i=1, nmax loop
>>
>> Unfortunately, I have actually not enough time to do it in detail (as it might need to check the complete subroutine
>> to avoid to introduce other bugs).
>>
>> Ciao
>> Gerhard
>>
>> ====================================
>> Dr. Gerhard H. Fecher
>> Institut of Inorganic and Analytical Chemistry
>> Johannes Gutenberg - University
>> 55099 Mainz
>> ________________________________________
>> Von: wien-bounces at zeus.theochem.tuwien.ac.at [wien-bounces at zeus.theochem.tuwien.ac.at]" im Auftrag von"Gavin Abo [gsabo at crimson.ua.edu]
>> Gesendet: Donnerstag, 8. September 2011 18:14
>> Bis: wien at zeus.theochem.tuwien.ac.at
>> Betreff: Re: [Wien] x xspec runtime error
>>
>> First, Dr. Marks, thanks for your explanation on the "-check bounds" option. It was in my compiler options temporarily "only for debugging", because I got a SIGSEGV error with the recently released intel fortran compiler (composer_xe_2011_sp1.6.233). I found good debugging tips on the SIGSEGV error (i.e., how to find more information about the cause of the error) at http://software.intel.com/en-us/articles/determining-root-cause-of-sigsegv-or-sigbus-errors/. One was to use the "-check bounds" option. However, we found that composer_xe_2011_sp1.6.233 just does not work for the Wien2k code. Therefore, I'm using the composerxe-2011.3.174 version of the ifort 12 compiler.
>>
>> Lastly, Dr. Fecher, I agree that the DO WHILE loop is likely better readable for the compiler. However, I don't think that it addresses the out of bound array indexing. Therefore, I believe "(i .GE. IEMAX .or. .NOT. EOF(32))" rather than "(.NOT. EOF(32))" would be a better stop condition for the loop. If the syntax of "(i .GE. IEMAX .or. .NOT. EOF(32))" is not quite right, it is due to my lack of Fortran experience. I believe that because the READ statement is called at the EOF and it reads into an array (probably not a concern if where reading into a single variable, then being copied into an array) that an access attempt is made outside the ENE(i) array. This could occur due to extra line read to determine the EOF. Though, the original code (CONTINUE-goto) works perfectly fine as is. However, the adjustment could be better coding practice.
>>
>> Kind Regards,
>>
>> Gavin
>>
>> On 9/8/2011 3:00 AM, Gerhard Fecher wrote:
>>
>> I guess a construct like
>>
>> i = 0
>> DO WHILE (.NOT. EOF(32))
>> i = i + 1
>> IF (LC.EQ.0) then
>> READ(32,4713,ERR=913) ENE(i),DOS(i,1),DOS(i,3)
>> ELSE
>> READ(32,4713,ERR=913) ENE(i),DOS(i,1),DOS(i,2),DOS(i,3)
>> ENDIF
>> END DO
>>
>> would be better readable than the CONTINUE GOTO CONTINUE spaghetti
>> (maybe also for the compiler)
>>
>> Ciao
>> Gerhard
>>
>> ====================================
>> Dr. Gerhard H. Fecher
>> Institut of Inorganic and Analytical Chemistry
>> Johannes Gutenberg - University
>> 55099 Mainz
>> ________________________________________
>> Von: wien-bounces at zeus.theochem.tuwien.ac.at<mailto:wien-bounces at zeus.theochem.tuwien.ac.at> [wien-bounces at zeus.theochem.tuwien.ac.at<mailto:wien-bounces at zeus.theochem.tuwien.ac.at>]" im Auftrag von"Gavin Abo [gsabo at crimson.ua.edu<mailto:gsabo at crimson.ua.edu>]
>> Gesendet: Mittwoch, 7. September 2011 02:04
>> Bis: wien at zeus.theochem.tuwien.ac.at<mailto:wien at zeus.theochem.tuwien.ac.at>
>> Betreff: [Wien] x xspec runtime error
>>
>> Dear Dr. Blaha and Wien2k users,
>>
>> When running x xspec, I get the error shown below. It looks like there is an infinite loop from lines 170 to 180 in txspec.f that causes an array index to go out of the upper bound, but I don't have much Fortran experience. Should there be a condition (IEMAX?) and break or jump statement to get out of the "1 CONTINUE" and "goto 1" loop from line 170 and 180?
>>
>> forrt1: severe (408): fort: (2): Subscript #1 of the array ENE has value 771 which is greater than the upper bound 770
>>
>> Image PC Routine Line Source
>> ...
>> txspec 0000000000423085 MAIN__ 176 txspec.f
>> ...
>>
>>
>>
>> stop error txspec xspec.def
>>
>>
>> ...
>>
>> Lines from file txspec.f in SRC_txspec.f
>>
>> Line 170:
>> I=0
>> 1 CONTINUE
>> i=i+1
>> IF (LC.EQ.0) then
>> READ(32,4713,END=2,ERR=913) ENE(i),DOS(i,1),DOS(i,3)
>> ELSE
>> READ(32,4713,END=2,ERR=913) ENE(i),DOS(i,1),DOS(i,2),DOS(i,3)
>> ENDIF
>> goto 1
>> 2 CONTINUE
>> :Line 180
>>
>> Thanks,
>>
>> Gavin
>> _______________________________________________
>> Wien mailing list
>> Wien at zeus.theochem.tuwien.ac.at<mailto:Wien at zeus.theochem.tuwien.ac.at>
>> http://zeus.theochem.tuwien.ac.at/mailman/listinfo/wien
>>
>>
>>
>> _______________________________________________
>> Wien mailing list
>> Wien at zeus.theochem.tuwien.ac.at
>> http://zeus.theochem.tuwien.ac.at/mailman/listinfo/wien
>>
> _______________________________________________
> Wien mailing list
> Wien at zeus.theochem.tuwien.ac.at
> http://zeus.theochem.tuwien.ac.at/mailman/listinfo/wien
> _______________________________________________
> Wien mailing list
> Wien at zeus.theochem.tuwien.ac.at
> http://zeus.theochem.tuwien.ac.at/mailman/listinfo/wien
>
More information about the Wien
mailing list