Page 1 of 1

err : allocatable array is already allocated

Posted: Thu Feb 23, 2017 11:22 am
by Fawei
Dear all,
I encountered the following err. Could anyone please help me to figure out some solutions?

The err exists at the last step of example B-doped Diamond ( epw3.in ). The EPW output file contains the following lines.
############
The .epb files have been correctly read

forrtl: severe (151): allocatable array is already allocated
Image PC Routine Line Source
epw.x 0000000000473FDF ephwann_shuffle_ 221 ephwann_shuffle.f90
epw.x 000000000046FD55 elphon_shuffle_wr 755 elphon_shuffle_wrap.f90
epw.x 00000000004374D2 MAIN__ 153 epw.f90
epw.x 0000000000436516 Unknown Unknown Unknown
libc.so.6 00002B69D0E65CDD Unknown Unknown Unknown
epw.x 0000000000436409 Unknown Unknown Unknown
#################

Thanks
Fawei

Re: err : allocatable array is already allocated

Posted: Thu Feb 23, 2017 11:29 am
by carla.verdi
Dear Fawei,

Try and put IF (.NOT. ALLOCATED (tau)) before ALLOCATE( tau( 3, nat ) ) in line 221 of ephwann_shuffle.f90;
do the same on line 224: write IF (.NOT. ALLOCATED (ityp)) before ALLOCATE( ityp( nat ) )
After recompiling the error should be gone.

Best
Carla

Re: err : allocatable array is already allocated

Posted: Thu Feb 23, 2017 12:14 pm
by Fawei
Dear Carla,
Thanks for your prompt reply.
Lines 231 and 244 have the same problems too.
line-231 IF (mpime /= ionode_id) ALLOCATE( ityp( nat ) )
line-244 IF (mpime /= ionode_id) ALLOCATE( tau( 3, nat ) )
So I just comment these two lines, and compile EPW again. It works.
Is it okay for the code without these two lines?
Best
Fawei

Re: err : allocatable array is already allocated

Posted: Thu Feb 23, 2017 12:29 pm
by carla.verdi
If will crash with some restart options. The best thing to do is to comment those line, comment also line 221 and 224, and put
IF (.NOT. ALLOCATED (tau)) ALLOCATE( tau( 3, nat ) )
IF (.NOT. ALLOCATED (ityp)) ALLOCATE( ityp( nat ) )
just after line 209 or 210.

Best
Carla

Re: err : allocatable array is already allocated

Posted: Fri Feb 24, 2017 1:34 am
by Fawei
okay, thanks for your kind help!
Best
Fawei