When running task 125 (nonlinear optics calculations), I receive an error:
Info(nonlinopt): 1 of 64 k-points
At line 23 of file getpmat.f90 (unit = 85, file = 'È+')
Fortran runtime error: File already opened in another unit
Note, the file name is actually a number of non-reproducible/non-encoded characters, but it is otherwise apparent this should be PMAT.OUT. I receive this error both when running the example NLO code as well as my own script calling task 125. I have not attempted linear optics calculations, so may get the same error there (or any task needing the momentum matrix elements) as well.
I'd appreciate any input! Thank you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for considering this issue. Inserting 'close' into nonlinopt.f90 as you suggested did allow the calculation to run. I am rather surprised that this was necessary, though, considering I know others run nonlinopt without editing the source file. If you think of any errors on my end in compiling, running, or similar, that could have caused this bug, please let me know.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Possibly, it is compiler dependent problem. I use gfortran compiler. Maybe some other compilers allow it. Anyway, the open statement in nonlinopt routine seems to be for older version of the code, and forgotten to be deleted.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is a bug in the code. Most compilers close the files automatically. But some compilers do not. Hence this problem might not show up for everyone.
The bug will be fixed in the latest release of the Elk code.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
When running task 125 (nonlinear optics calculations), I receive an error:
Info(nonlinopt): 1 of 64 k-points
At line 23 of file getpmat.f90 (unit = 85, file = 'È+')
Fortran runtime error: File already opened in another unit
Note, the file name is actually a number of non-reproducible/non-encoded characters, but it is otherwise apparent this should be PMAT.OUT. I receive this error both when running the example NLO code as well as my own script calling task 125. I have not attempted linear optics calculations, so may get the same error there (or any task needing the momentum matrix elements) as well.
I'd appreciate any input! Thank you.
Hi,
It seems a bug of program.
PMAT.OUT is opened in getpmat routine. But it has already been opened (or forgetten to be closed) in nonlinopt routine.
Temporarily, inserting
'close(50)'
at line 61 of nonlinopt.f90 (just below open statement) and recompiling the code should fix this problem.
Last edit: Koichi Kitahara 2014-03-11
Hi Koichi,
Thanks for considering this issue. Inserting 'close' into nonlinopt.f90 as you suggested did allow the calculation to run. I am rather surprised that this was necessary, though, considering I know others run nonlinopt without editing the source file. If you think of any errors on my end in compiling, running, or similar, that could have caused this bug, please let me know.
Hi,
Possibly, it is compiler dependent problem. I use gfortran compiler. Maybe some other compilers allow it. Anyway, the open statement in nonlinopt routine seems to be for older version of the code, and forgotten to be deleted.
There is a bug in the code. Most compilers close the files automatically. But some compilers do not. Hence this problem might not show up for everyone.
The bug will be fixed in the latest release of the Elk code.
OK, thank you both for the help!