Skip to content
Permalink
Browse files

Fix Segfault in rpa_gw.F

The segfault occurred with the arch-file CRAY-XC40-cce.popt. The segfaults with the intel compiler might still be there...
  • Loading branch information...
fstein93 authored and alazzaro committed May 14, 2019
1 parent 1f51e7a commit 33bce52a62a741a6ca6bf70fd0b0c64098d0e2dc
Showing with 152 additions and 93 deletions.
  1. +99 −65 src/rpa_gw.F
  2. +53 −28 src/rpa_ri_gpw.F
@@ -94,12 +94,9 @@ MODULE rpa_gw
!> \brief ...
!> \param cut_RI ...
!> \param gw_corr_lev_occ ...
!> \param gw_corr_lev_occ_beta ...
!> \param gw_corr_lev_tot ...
!> \param gw_corr_lev_virt ...
!> \param gw_corr_lev_virt_beta ...
!> \param homo ...
!> \param homo_beta ...
!> \param nmo ...
!> \param num_integ_points ...
!> \param unit_nr ...
@@ -110,66 +107,82 @@ MODULE rpa_gw
!> \param RI_blk_sizes ...
!> \param do_ic_model ...
!> \param do_ic_opt_homo_lumo ...
!> \param my_open_shell ...
!> \param para_env ...
!> \param para_env_sub ...
!> \param fm_mat_W_tau ...
!> \param fm_mat_Q ...
!> \param mo_coeff ...
!> \param mo_coeff_beta ...
!> \param mat_dm_virt_local ...
!> \param mat_3c_overl_int_gw ...
!> \param mat_3c_overl_int_gw_beta ...
!> \param mat_3c_overl_nnP_ic ...
!> \param mat_3c_overl_nnP_ic_beta ...
!> \param mat_3c_overl_nnP_ic_reflected ...
!> \param mat_3c_overl_nnP_ic_reflected_beta ...
!> \param matrix_s ...
!> \param mat_W ...
!> \param mat_3c_overl_int ...
!> \param mat_contr_gf_occ ...
!> \param mat_contr_gf_virt ...
!> \param mat_contr_W ...
!> \param qs_env ...
!> \param gw_corr_lev_occ_beta ...
!> \param gw_corr_lev_virt_beta ...
!> \param homo_beta ...
!> \param mo_coeff_beta ...
!> \param mat_3c_overl_int_gw_beta ...
!> \param mat_3c_overl_nnP_ic_beta ...
!> \param mat_3c_overl_nnP_ic_reflected_beta ...
! **************************************************************************************************
SUBROUTINE allocate_matrices_gw_im_time(cut_RI, gw_corr_lev_occ, gw_corr_lev_occ_beta, gw_corr_lev_tot, &
gw_corr_lev_virt, gw_corr_lev_virt_beta, homo, homo_beta, nmo, &
SUBROUTINE allocate_matrices_gw_im_time(cut_RI, gw_corr_lev_occ, gw_corr_lev_tot, gw_corr_lev_virt, homo, nmo, &
num_integ_points, unit_nr, my_group_L_sizes_im_time, my_group_L_starts_im_time, &
row_from_LLL, prim_blk_sizes, RI_blk_sizes, do_ic_model, do_ic_opt_homo_lumo, &
my_open_shell, para_env, para_env_sub, fm_mat_W_tau, fm_mat_Q, &
mo_coeff, mo_coeff_beta, mat_dm_virt_local, mat_3c_overl_int_gw, &
mat_3c_overl_int_gw_beta, mat_3c_overl_nnP_ic, &
mat_3c_overl_nnP_ic_beta, mat_3c_overl_nnP_ic_reflected, &
mat_3c_overl_nnP_ic_reflected_beta, matrix_s, mat_W, &
mat_3c_overl_int, mat_contr_gf_occ, mat_contr_gf_virt, &
mat_contr_W, qs_env)

INTEGER, INTENT(IN) :: cut_RI, gw_corr_lev_occ, gw_corr_lev_occ_beta, gw_corr_lev_tot, &
gw_corr_lev_virt, gw_corr_lev_virt_beta, homo, homo_beta, nmo, num_integ_points, unit_nr
para_env, para_env_sub, fm_mat_W_tau, fm_mat_Q, &
mo_coeff, mat_dm_virt_local, mat_3c_overl_int_gw, &
mat_3c_overl_nnP_ic, mat_3c_overl_nnP_ic_reflected, &
matrix_s, mat_W, mat_3c_overl_int, mat_contr_gf_occ, mat_contr_gf_virt, &
mat_contr_W, qs_env, &
gw_corr_lev_occ_beta, gw_corr_lev_virt_beta, homo_beta, &
mo_coeff_beta, mat_3c_overl_int_gw_beta, mat_3c_overl_nnP_ic_beta, &
mat_3c_overl_nnP_ic_reflected_beta)

INTEGER, INTENT(IN) :: cut_RI, gw_corr_lev_occ, &
gw_corr_lev_tot, gw_corr_lev_virt, &
homo, nmo, num_integ_points, unit_nr
INTEGER, ALLOCATABLE, DIMENSION(:) :: my_group_L_sizes_im_time, &
my_group_L_starts_im_time, row_from_LLL
INTEGER, DIMENSION(:), POINTER :: prim_blk_sizes, RI_blk_sizes
LOGICAL :: do_ic_model, do_ic_opt_homo_lumo, &
my_open_shell
LOGICAL :: do_ic_model, do_ic_opt_homo_lumo
TYPE(cp_para_env_type), POINTER :: para_env, para_env_sub
TYPE(cp_fm_p_type), DIMENSION(:), POINTER :: fm_mat_W_tau
TYPE(cp_fm_type), POINTER :: fm_mat_Q, mo_coeff, mo_coeff_beta
TYPE(cp_fm_type), POINTER :: fm_mat_Q, mo_coeff
TYPE(dbcsr_p_type), INTENT(IN) :: mat_dm_virt_local
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: mat_3c_overl_int_gw, mat_3c_overl_int_gw_beta, &
mat_3c_overl_nnP_ic, mat_3c_overl_nnP_ic_beta, mat_3c_overl_nnP_ic_reflected, &
mat_3c_overl_nnP_ic_reflected_beta, matrix_s, mat_W
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: mat_3c_overl_int_gw, &
mat_3c_overl_nnP_ic, &
mat_3c_overl_nnP_ic_reflected, &
matrix_s, mat_W
TYPE(dbcsr_p_type), DIMENSION(:, :, :), POINTER :: mat_3c_overl_int
TYPE(dbcsr_type), POINTER :: mat_contr_gf_occ, mat_contr_gf_virt, &
mat_contr_W
TYPE(qs_environment_type), POINTER :: qs_env
INTEGER, INTENT(IN), OPTIONAL :: gw_corr_lev_occ_beta, &
gw_corr_lev_virt_beta, homo_beta
TYPE(cp_fm_type), OPTIONAL, POINTER :: mo_coeff_beta
TYPE(dbcsr_p_type), DIMENSION(:), OPTIONAL, POINTER :: mat_3c_overl_int_gw_beta, &
mat_3c_overl_nnP_ic_beta, mat_3c_overl_nnP_ic_reflected_beta

CHARACTER(LEN=*), PARAMETER :: routineN = 'allocate_matrices_gw_im_time', &
routineP = moduleN//':'//routineN

INTEGER :: handle, jquad, n_level_gw
LOGICAL :: my_open_shell

CALL timeset(routineN, handle)

my_open_shell = .FALSE.
IF (PRESENT(gw_corr_lev_occ_beta) .AND. PRESENT(gw_corr_lev_virt_beta) .AND. PRESENT(homo_beta) .AND. &
PRESENT(mo_coeff_beta) .AND. PRESENT(mat_3c_overl_int_gw_beta) .AND. PRESENT(mat_3c_overl_nnP_ic_beta) &
.AND. PRESENT(mat_3c_overl_nnP_ic_reflected_beta)) THEN
my_open_shell = .TRUE.
END IF

NULLIFY (mat_3c_overl_int_gw)
CALL dbcsr_allocate_matrix_set(mat_3c_overl_int_gw, gw_corr_lev_tot)

@@ -314,14 +327,11 @@ END SUBROUTINE allocate_matrices_gw_im_time
! **************************************************************************************************
!> \brief ...
!> \param vec_Sigma_c_gw ...
!> \param vec_Sigma_c_gw_beta ...
!> \param color_rpa_group ...
!> \param dimen_nm_gw ...
!> \param gw_corr_lev_occ ...
!> \param gw_corr_lev_occ_beta ...
!> \param gw_corr_lev_virt ...
!> \param homo ...
!> \param homo_beta ...
!> \param nmo ...
!> \param num_integ_points ...
!> \param num_integ_group ...
@@ -333,89 +343,103 @@ END SUBROUTINE allocate_matrices_gw_im_time
!> \param do_periodic ...
!> \param do_ri_Sigma_x ...
!> \param my_do_gw ...
!> \param my_open_shell ...
!> \param first_cycle_periodic_correction ...
!> \param do_GW_corr ...
!> \param a_scaling ...
!> \param Eigenval ...
!> \param Eigenval_beta ...
!> \param tj ...
!> \param vec_omega_fit_gw ...
!> \param vec_Sigma_x_gw ...
!> \param vec_Sigma_x_gw_beta ...
!> \param delta_corr ...
!> \param Eigenval_last ...
!> \param Eigenval_last_beta ...
!> \param Eigenval_scf ...
!> \param Eigenval_scf_beta ...
!> \param m_value ...
!> \param m_value_beta ...
!> \param vec_gw_energ ...
!> \param vec_gw_energ_beta ...
!> \param vec_gw_energ_error_fit ...
!> \param vec_gw_energ_error_fit_beta ...
!> \param vec_W_gw ...
!> \param vec_W_gw_beta ...
!> \param z_value ...
!> \param z_value_beta ...
!> \param fm_mat_S_gw ...
!> \param fm_mat_S_gw_work ...
!> \param fm_mat_S_gw_work_beta ...
!> \param fm_mat_S_gw_beta ...
!> \param para_env ...
!> \param mp2_env ...
!> \param kpoints ...
!> \param nkp ...
!> \param nkp_self_energy ...
!> \param do_kpoints_cubic_RPA ...
!> \param do_kpoints_from_Gamma ...
!> \param vec_Sigma_c_gw_beta ...
!> \param gw_corr_lev_occ_beta ...
!> \param homo_beta ...
!> \param Eigenval_beta ...
!> \param vec_Sigma_x_gw_beta ...
!> \param Eigenval_last_beta ...
!> \param Eigenval_scf_beta ...
!> \param m_value_beta ...
!> \param vec_gw_energ_beta ...
!> \param vec_gw_energ_error_fit_beta ...
!> \param vec_W_gw_beta ...
!> \param z_value_beta ...
!> \param fm_mat_S_gw_work_beta ...
!> \param fm_mat_S_gw_beta ...
! **************************************************************************************************
SUBROUTINE allocate_matrices_gw(vec_Sigma_c_gw, vec_Sigma_c_gw_beta, color_rpa_group, dimen_nm_gw, &
gw_corr_lev_occ, gw_corr_lev_occ_beta, gw_corr_lev_virt, homo, homo_beta, &
SUBROUTINE allocate_matrices_gw(vec_Sigma_c_gw, color_rpa_group, dimen_nm_gw, &
gw_corr_lev_occ, gw_corr_lev_virt, homo, &
nmo, num_integ_points, num_integ_group, unit_nr, &
gw_corr_lev_tot, num_fit_points, omega_max_fit, &
do_minimax_quad, do_periodic, do_ri_Sigma_x, my_do_gw, my_open_shell, &
do_minimax_quad, do_periodic, do_ri_Sigma_x, my_do_gw, &
first_cycle_periodic_correction, do_GW_corr, &
a_scaling, Eigenval, Eigenval_beta, &
tj, vec_omega_fit_gw, vec_Sigma_x_gw, &
vec_Sigma_x_gw_beta, delta_corr, Eigenval_last, Eigenval_last_beta, &
Eigenval_scf, Eigenval_scf_beta, m_value, m_value_beta, &
vec_gw_energ, vec_gw_energ_beta, vec_gw_energ_error_fit, vec_gw_energ_error_fit_beta, &
vec_W_gw, vec_W_gw_beta, z_value, z_value_beta, &
fm_mat_S_gw, fm_mat_S_gw_work, fm_mat_S_gw_work_beta, &
fm_mat_S_gw_beta, para_env, mp2_env, kpoints, nkp, nkp_self_energy, &
do_kpoints_cubic_RPA, do_kpoints_from_Gamma)
a_scaling, Eigenval, tj, vec_omega_fit_gw, vec_Sigma_x_gw, &
delta_corr, Eigenval_last, Eigenval_scf, m_value, &
vec_gw_energ, vec_gw_energ_error_fit, vec_W_gw, z_value, &
fm_mat_S_gw, fm_mat_S_gw_work, &
para_env, mp2_env, kpoints, nkp, nkp_self_energy, &
do_kpoints_cubic_RPA, do_kpoints_from_Gamma, &
vec_Sigma_c_gw_beta, gw_corr_lev_occ_beta, homo_beta, Eigenval_beta, &
vec_Sigma_x_gw_beta, Eigenval_last_beta, Eigenval_scf_beta, m_value_beta, &
vec_gw_energ_beta, vec_gw_energ_error_fit_beta, vec_W_gw_beta, z_value_beta, &
fm_mat_S_gw_work_beta, fm_mat_S_gw_beta)

COMPLEX(KIND=dp), ALLOCATABLE, &
DIMENSION(:, :, :), INTENT(OUT) :: vec_Sigma_c_gw, vec_Sigma_c_gw_beta
INTEGER, INTENT(IN) :: color_rpa_group, dimen_nm_gw, gw_corr_lev_occ, gw_corr_lev_occ_beta, &
gw_corr_lev_virt, homo, homo_beta, nmo, num_integ_points, num_integ_group, unit_nr
DIMENSION(:, :, :), INTENT(OUT) :: vec_Sigma_c_gw
INTEGER, INTENT(IN) :: color_rpa_group, dimen_nm_gw, gw_corr_lev_occ, gw_corr_lev_virt, &
homo, nmo, num_integ_points, num_integ_group, unit_nr
INTEGER, INTENT(INOUT) :: gw_corr_lev_tot, num_fit_points
REAL(KIND=dp) :: omega_max_fit
LOGICAL, INTENT(IN) :: do_minimax_quad, do_periodic, &
do_ri_Sigma_x, my_do_gw, my_open_shell
do_ri_Sigma_x, my_do_gw
LOGICAL, INTENT(OUT) :: first_cycle_periodic_correction
LOGICAL, ALLOCATABLE, DIMENSION(:), INTENT(OUT) :: do_GW_corr
REAL(KIND=dp), INTENT(IN) :: a_scaling
REAL(KIND=dp), DIMENSION(:), INTENT(INOUT) :: Eigenval, Eigenval_beta
REAL(KIND=dp), DIMENSION(:), INTENT(INOUT) :: Eigenval
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:), &
INTENT(IN) :: tj
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:), &
INTENT(OUT) :: vec_omega_fit_gw
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :), &
INTENT(OUT) :: vec_Sigma_x_gw, vec_Sigma_x_gw_beta
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:), INTENT(INOUT) :: delta_corr, Eigenval_last, &
Eigenval_last_beta, Eigenval_scf, Eigenval_scf_beta, m_value, m_value_beta, vec_gw_energ, &
vec_gw_energ_beta, vec_gw_energ_error_fit, vec_gw_energ_error_fit_beta, vec_W_gw, &
vec_W_gw_beta, z_value, z_value_beta
TYPE(cp_fm_type), POINTER :: fm_mat_S_gw, fm_mat_S_gw_work, &
fm_mat_S_gw_work_beta, fm_mat_S_gw_beta
INTENT(OUT) :: vec_Sigma_x_gw
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:), &
INTENT(INOUT) :: delta_corr, Eigenval_last, Eigenval_scf, &
m_value, vec_gw_energ, &
vec_gw_energ_error_fit, vec_W_gw, &
z_value
TYPE(cp_fm_type), POINTER :: fm_mat_S_gw, fm_mat_S_gw_work
TYPE(cp_para_env_type), POINTER :: para_env
TYPE(mp2_type), POINTER :: mp2_env
TYPE(kpoint_type), POINTER :: kpoints
INTEGER, INTENT(OUT) :: nkp, nkp_self_energy
LOGICAL, INTENT(IN) :: do_kpoints_cubic_RPA, &
do_kpoints_from_Gamma
COMPLEX(KIND=dp), ALLOCATABLE, &
DIMENSION(:, :, :), INTENT(OUT), OPTIONAL :: vec_Sigma_c_gw_beta
INTEGER, INTENT(IN), OPTIONAL :: gw_corr_lev_occ_beta, homo_beta
REAL(KIND=dp), DIMENSION(:), INTENT(INOUT), &
OPTIONAL :: Eigenval_beta
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :), &
INTENT(OUT), OPTIONAL :: vec_Sigma_x_gw_beta
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:), INTENT(INOUT), OPTIONAL :: Eigenval_last_beta, &
Eigenval_scf_beta, m_value_beta, vec_gw_energ_beta, vec_gw_energ_error_fit_beta, &
vec_W_gw_beta, z_value_beta
TYPE(cp_fm_type), OPTIONAL, POINTER :: fm_mat_S_gw_work_beta, fm_mat_S_gw_beta

CHARACTER(LEN=*), PARAMETER :: routineN = 'allocate_matrices_gw', &
routineP = moduleN//':'//routineN
@@ -424,11 +448,21 @@ SUBROUTINE allocate_matrices_gw(vec_Sigma_c_gw, vec_Sigma_c_gw_beta, color_rpa_g
INTEGER :: handle, iiB, iquad, jjB, jquad, m_global, m_global_beta, n_global, n_global_beta, &
n_level_gw, n_level_gw_ref, ncol_local, nm_global, nrow_local
INTEGER, DIMENSION(:), POINTER :: row_indices
LOGICAL :: my_open_shell
REAL(KIND=dp) :: omega
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:) :: vec_omega_gw

CALL timeset(routineN, handle)

my_open_shell = .FALSE.
IF (PRESENT(vec_Sigma_c_gw_beta) .AND. PRESENT(gw_corr_lev_occ_beta) .AND. PRESENT(homo_beta) .AND. &
PRESENT(Eigenval_beta) .AND. PRESENT(vec_Sigma_x_gw_beta) .AND. PRESENT(Eigenval_last_beta) .AND. &
PRESENT(Eigenval_scf_beta) .AND. PRESENT(m_value_beta) .AND. PRESENT(vec_gw_energ_beta) .AND. &
PRESENT(vec_gw_energ_error_fit_beta) .AND. PRESENT(vec_W_gw_beta) .AND. PRESENT(z_value_beta) .AND. &
PRESENT(fm_mat_S_gw_work_beta) .AND. PRESENT(fm_mat_S_gw_beta)) THEN
my_open_shell = .TRUE.
END IF

gw_corr_lev_tot = gw_corr_lev_occ+gw_corr_lev_virt

! fill the omega_frequency vector
Oops, something went wrong.

0 comments on commit 33bce52

Please sign in to comment.
You can’t perform that action at this time.