@@ -2490,16 +2490,18 @@ subroutine dis_extract(dis_control, kmesh_info, sitesym, print_output, dis_manif
24902490 call set_error_alloc(error, ' Error allocating wkomegai1 in dis_extract' , comm)
24912491 return
24922492 endif
2493- allocate (czmat_in(num_bands, num_bands, num_kpts), stat= ierr)
2494- if (ierr /= 0 ) then
2495- call set_error_alloc(error, ' Error allocating czmat_in in dis_extract' , comm)
2496- return
2497- endif
2498- allocate (czmat_out(num_bands, num_bands, num_kpts), stat= ierr)
2499- if (ierr /= 0 ) then
2500- call set_error_alloc(error, ' Error allocating czmat_out in dis_extract' , comm)
2501- return
2502- endif
2493+ if (lsitesymmetry) then ! we only need these large arrays for the symmetry code
2494+ allocate (czmat_in(num_bands, num_bands, num_kpts), stat= ierr)
2495+ if (ierr /= 0 ) then
2496+ call set_error_alloc(error, ' Error allocating czmat_in in dis_extract' , comm)
2497+ return
2498+ endif
2499+ allocate (czmat_out(num_bands, num_bands, num_kpts), stat= ierr)
2500+ if (ierr /= 0 ) then
2501+ call set_error_alloc(error, ' Error allocating czmat_out in dis_extract' , comm)
2502+ return
2503+ endif
2504+ end if
25032505 allocate (history(dis_control% conv_window), stat= ierr)
25042506 if (ierr /= 0 ) then
25052507 call set_error_alloc(error, ' Error allocating history in dis_extract' , comm)
@@ -2934,15 +2936,17 @@ subroutine dis_extract(dis_control, kmesh_info, sitesym, print_output, dis_manif
29342936 enddo
29352937 ! [BIG ITERATION LOOP (iter)]
29362938
2937- deallocate (czmat_out, stat= ierr)
2938- if (ierr /= 0 ) then
2939- call set_error_dealloc(error, ' Error deallocating czmat_out in dis_extract' , comm)
2940- return
2941- endif
2942- deallocate (czmat_in, stat= ierr)
2943- if (ierr /= 0 ) then
2944- call set_error_dealloc(error, ' Error deallocating czmat_in in dis_extract' , comm)
2945- return
2939+ if (lsitesymmetry) then
2940+ deallocate (czmat_out, stat= ierr)
2941+ if (ierr /= 0 ) then
2942+ call set_error_dealloc(error, ' Error deallocating czmat_out in dis_extract' , comm)
2943+ return
2944+ endif
2945+ deallocate (czmat_in, stat= ierr)
2946+ if (ierr /= 0 ) then
2947+ call set_error_dealloc(error, ' Error deallocating czmat_in in dis_extract' , comm)
2948+ return
2949+ endif
29462950 endif
29472951 deallocate (czmat_out_loc, stat= ierr)
29482952 if (ierr /= 0 ) then
0 commit comments