diff --git a/LR_Modules/Coul_cut_2D_ph.f90 b/LR_Modules/Coul_cut_2D_ph.f90 index a9e331c1e..4b1a8944d 100644 --- a/LR_Modules/Coul_cut_2D_ph.f90 +++ b/LR_Modules/Coul_cut_2D_ph.f90 @@ -32,6 +32,7 @@ MODULE Coul_cut_2D_ph ! ! PUBLIC :: cutoff_fact_qg, cutoff_lr_Vlocq, cutoff_localq + PUBLIC :: deallocate_2d_arrays CONTAINS ! @@ -228,4 +229,10 @@ subroutine cutoff_dynmat0 (dynwrk, rhog) ENDDO return end subroutine cutoff_dynmat0 + +subroutine deallocate_2d_arrays () + IF ( allocated(cutoff_2D_qg) ) DEALLOCATE(cutoff_2D_qg) + IF ( allocated(lr_Vlocq) ) DEALLOCATE(lr_Vlocq) +end subroutine deallocate_2d_arrays + END MODULE Coul_cut_2D_ph diff --git a/PHonon/PH/deallocate_phq.f90 b/PHonon/PH/deallocate_phq.f90 index df36b2d44..61b28f6f5 100644 --- a/PHonon/PH/deallocate_phq.f90 +++ b/PHonon/PH/deallocate_phq.f90 @@ -45,6 +45,7 @@ subroutine deallocate_phq USE qpoint_aux, ONLY : ikmks, ikmkmqs, becpt, alphapt USE becmod, ONLY : deallocate_bec_type USE nc_mag_aux, ONLY : int1_nc_save, deeq_nc_save + USE Coul_cut_2D_ph, ONLY : deallocate_2d_arrays IMPLICIT NONE INTEGER :: ik, ipol @@ -194,6 +195,6 @@ subroutine deallocate_phq ! ENDIF - RETURN - + call deallocate_2d_arrays () + end subroutine deallocate_phq diff --git a/PHonon/PH/phq_init.f90 b/PHonon/PH/phq_init.f90 index e707f11da..7b39459f3 100644 --- a/PHonon/PH/phq_init.f90 +++ b/PHonon/PH/phq_init.f90 @@ -130,7 +130,7 @@ SUBROUTINE phq_init() ! component of the cutoff of the COulomb interaction IF (do_cutoff_2D) call cutoff_fact_qg() ! in 2D calculations the long range part of vlocq(g) (erf/r part) - ! was not re-added in g-space because everything is caclulated in + ! was not re-added in g-space because everything is calculated in ! radial coordinates, which is not compatible with 2D cutoff. ! It will be re-added each time vlocq(g) is used in the code. ! Here, this cutoff long-range part of vlocq(g) is computed only once