Skip to content

Commit

Permalink
RTBSE : Fixing dashboard issues from cp2k#3691 (cp2k#3698)
Browse files Browse the repository at this point in the history
Co-authored-by: Štěpán Marek <[email protected]>
  • Loading branch information
StepanMarek and Štěpán Marek authored Sep 26, 2024
1 parent a4477e4 commit d205b35
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 60 deletions.
30 changes: 4 additions & 26 deletions src/emd/rt_bse.F
Original file line number Diff line number Diff line change
Expand Up @@ -74,32 +74,10 @@ MODULE rt_bse
omp_get_num_threads, &
omp_set_num_threads, &
omp_get_max_threads
USE dbt_api, ONLY: dbt_create, &
dbt_clear, &
USE dbt_api, ONLY: dbt_clear, &
dbt_contract, &
dbt_copy_matrix_to_tensor, &
dbt_copy_tensor_to_matrix, &
dbt_copy, &
dbt_destroy, &
dbt_type, &
dbt_pgrid_type, &
dbt_pgrid_create, &
dbt_pgrid_destroy, &
dbt_mp_environ_pgrid, &
dbt_default_distvec, &
dbt_distribution_type, &
dbt_distribution_new, &
dbt_distribution_destroy, &
dbt_iterator_type, &
dbt_iterator_start, &
dbt_iterator_stop, &
dbt_iterator_blocks_left, &
dbt_iterator_next_block, &
dbt_put_block, &
dbt_get_block, &
dbt_reserve_blocks, &
dbt_get_num_blocks, &
dbt_get_info
dbt_copy_tensor_to_matrix
USE libint_2c_3c, ONLY: libint_potential_type
USE mp2_ri_2c, ONLY: RI_2c_integral_mat
USE qs_tensors, ONLY: neighbor_list_3c_destroy, &
Expand Down Expand Up @@ -943,7 +921,7 @@ SUBROUTINE get_idempotence_deviation(rtbse_env, rho, deviation_metric)
CALL cp_fm_to_cfm(msourcer=rtbse_env%S_fm, mtarget=rtbse_env%rho_workspace(1))
DO j = 1, rtbse_env%n_spin
CALL cp_cfm_trace(rtbse_env%rho_workspace(1), rho(j), buffer_1)
buffer_dev = buffer_dev + REAL(ABS(buffer_1)*ABS(buffer_1))
buffer_dev = buffer_dev + REAL(ABS(buffer_1)*ABS(buffer_1), kind=dp)
END DO
! Now, determine Tr(S * rho_re * S * rho_re) - Tr(S * rho_im * S * rho_im) + 2i Tr(S * rho_re * S * rho_im)
DO j = 1, rtbse_env%n_spin
Expand All @@ -957,7 +935,7 @@ SUBROUTINE get_idempotence_deviation(rtbse_env, rho, deviation_metric)
CMPLX(0.0, 0.0, kind=dp), rtbse_env%rho_workspace(3))
! Tr (S * rho * S * rho)
CALL cp_cfm_trace(rtbse_env%rho_workspace(1), rtbse_env%rho_workspace(3), buffer_2)
deviation_metric = deviation_metric + REAL(ABS(buffer_2)*ABS(buffer_2))
deviation_metric = deviation_metric + REAL(ABS(buffer_2)*ABS(buffer_2), kind=dp)
END DO
deviation_metric = SQRT(deviation_metric) - SQRT(buffer_dev)
END SUBROUTINE get_idempotence_deviation
Expand Down
10 changes: 10 additions & 0 deletions src/emd/rt_bse_types.F
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,23 @@ MODULE rt_bse_types
! Workspace required for hartree_pw
TYPE(dbcsr_type) :: v_dbcsr = dbcsr_type(), &
w_dbcsr = dbcsr_type()
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && CPVERSION(9, 5) > CPVERSION(__GNUC__, __GNUC_MINOR__)
TYPE(dbt_type) :: screened_dbt, &
sigma_dbt, &
greens_dbt, &
t_3c_w, &
t_3c_work_RI__AO_AO, &
t_3c_work_RI_AO__AO, &
t_3c_work2_RI_AO__AO
#else
TYPE(dbt_type) :: screened_dbt = dbt_type(), &
sigma_dbt = dbt_type(), &
greens_dbt = dbt_type(), &
t_3c_w = dbt_type(), &
t_3c_work_RI__AO_AO = dbt_type(), &
t_3c_work_RI_AO__AO = dbt_type(), &
t_3c_work2_RI_AO__AO = dbt_type()
#endif
! These matrices are always real
INTEGER :: etrs_max_iter = 10
INTEGER :: ham_reference_type = 2
Expand Down
73 changes: 41 additions & 32 deletions src/post_scf_bandstructure_types.F
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ MODULE post_scf_bandstructure_types
cp_fm_type
USE dbt_api, ONLY: dbt_destroy,&
dbt_type
USE input_constants, ONLY: small_cell_full_kp
USE input_constants, ONLY: rtp_method_bse,&
small_cell_full_kp
USE kinds, ONLY: default_string_length,&
dp
USE kpoint_types, ONLY: kpoint_release,&
Expand Down Expand Up @@ -70,10 +71,10 @@ MODULE post_scf_bandstructure_types
eigenval_scGW0
REAL(KIND=dp), DIMENSION(:, :), ALLOCATABLE :: eigenval_scf_soc, &
eigenval_G0W0_soc
TYPE(band_edges_type), DIMENSION(2) :: band_edges_scf_Gamma
TYPE(band_edges_type) :: band_edges_scf, &
band_edges_G0W0, &
band_edges_HF
TYPE(band_edges_type), DIMENSION(2) :: band_edges_scf_Gamma = band_edges_type()
TYPE(band_edges_type) :: band_edges_scf = band_edges_type(), &
band_edges_G0W0 = band_edges_type(), &
band_edges_HF = band_edges_type()

! parameters that influence the GW flavor
LOGICAL :: do_hedin_shift = .FALSE.
Expand Down Expand Up @@ -151,38 +152,46 @@ MODULE post_scf_bandstructure_types
regularization_RI = -1.0_dp

! global full cfm_1d used in GW
TYPE(cp_fm_type) :: fm_s_Gamma, &
fm_Gocc, &
fm_Gvir
TYPE(cp_fm_type), DIMENSION(2) :: fm_ks_Gamma, &
fm_V_xc_Gamma, &
fm_mo_coeff_Gamma
TYPE(cp_fm_type), DIMENSION(4) :: fm_work_mo
TYPE(cp_fm_type) :: fm_RI_RI, &
fm_chi_Gamma_freq, &
fm_W_MIC_freq, &
fm_W_MIC_freq_1_extra, &
fm_W_MIC_freq_1_no_extra, &
fm_W_MIC_freq_zero, &
fm_h_G0W0_Gamma
TYPE(cp_cfm_type) :: cfm_work_mo, &
cfm_work_mo_2
TYPE(cp_fm_type) :: fm_s_Gamma = cp_fm_type(), &
fm_Gocc = cp_fm_type(), &
fm_Gvir = cp_fm_type()
TYPE(cp_fm_type), DIMENSION(2) :: fm_ks_Gamma = cp_fm_type(), &
fm_V_xc_Gamma = cp_fm_type(), &
fm_mo_coeff_Gamma = cp_fm_type()
TYPE(cp_fm_type), DIMENSION(4) :: fm_work_mo = cp_fm_type()
TYPE(cp_fm_type) :: fm_RI_RI = cp_fm_type(), &
fm_chi_Gamma_freq = cp_fm_type(), &
fm_W_MIC_freq = cp_fm_type(), &
fm_W_MIC_freq_1_extra = cp_fm_type(), &
fm_W_MIC_freq_1_no_extra = cp_fm_type(), &
fm_W_MIC_freq_zero = cp_fm_type(), &
fm_h_G0W0_Gamma = cp_fm_type()
TYPE(cp_cfm_type) :: cfm_work_mo = cp_cfm_type(), &
cfm_work_mo_2 = cp_cfm_type()

! global dbcsr cfm_1d used in GW
TYPE(dbcsr_p_type) :: mat_ao_ao, &
mat_RI_RI
TYPE(dbcsr_p_type) :: mat_ao_ao = dbcsr_p_type(), &
mat_RI_RI = dbcsr_p_type()
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: mat_chi_Gamma_tau => NULL()

! local dbcsr cfm_1d used in GW (local in tensor group)
TYPE(dbcsr_p_type) :: mat_ao_ao_tensor, &
mat_RI_RI_tensor
TYPE(dbcsr_p_type) :: mat_ao_ao_tensor = dbcsr_p_type(), &
mat_RI_RI_tensor = dbcsr_p_type()

! tensors for sparse matrix-tensor operations
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && CPVERSION(9, 5) > CPVERSION(__GNUC__, __GNUC_MINOR__)
TYPE(dbt_type) :: t_G, &
t_chi, &
t_W, &
t_RI_AO__AO, &
t_RI__AO_AO
#else
TYPE(dbt_type) :: t_G = dbt_type(), &
t_chi = dbt_type(), &
t_W = dbt_type(), &
t_RI_AO__AO = dbt_type(), &
t_RI__AO_AO = dbt_type()
#endif

! parameters and data for parallelization
INTEGER :: group_size_tensor = -1, &
Expand Down Expand Up @@ -213,7 +222,7 @@ MODULE post_scf_bandstructure_types
LOGICAL, DIMENSION(:, :), ALLOCATABLE :: skip_Sigma_occ, &
skip_Sigma_vir
! Marek : rtp_method
INTEGER :: rtp_method
INTEGER :: rtp_method = rtp_method_bse

! check-arrays and names for restarting
LOGICAL, DIMENSION(:), ALLOCATABLE :: read_chi, &
Expand All @@ -235,19 +244,19 @@ MODULE post_scf_bandstructure_types
basis_set_RI
INTEGER, DIMENSION(:), ALLOCATABLE :: sizes_AO, &
sizes_RI
TYPE(neighbor_list_3c_type) :: nl_3c
TYPE(libint_potential_type) :: ri_metric, &
trunc_coulomb
TYPE(neighbor_list_3c_type) :: nl_3c = neighbor_list_3c_type()
TYPE(libint_potential_type) :: ri_metric = libint_potential_type(), &
trunc_coulomb = libint_potential_type()

! parameters for SOC calculation
REAL(KIND=dp) :: energy_window_soc = -1.0_dp
! sizes: mat_V_SOC_xyz: xyz, img
TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: mat_V_SOC_xyz => NULL()
TYPE(cp_fm_type), DIMENSION(3) :: fm_V_SOC_xyz_mo
TYPE(cp_fm_type), DIMENSION(3) :: fm_V_SOC_xyz_mo = cp_fm_type()
! small-cell GW: dimension = number of kpoints; large-cell GW: Gamma-point, dimension = 1
TYPE(cp_cfm_type), DIMENSION(:), ALLOCATABLE :: cfm_SOC_spinor_ao
TYPE(band_edges_type) :: band_edges_scf_SOC, &
band_edges_G0W0_SOC
TYPE(band_edges_type) :: band_edges_scf_SOC = band_edges_type(), &
band_edges_G0W0_SOC = band_edges_type()

! parameters for DOS and PDOS calculation
REAL(KIND=dp) :: energy_window_DOS = -1.0_dp, &
Expand Down
4 changes: 2 additions & 2 deletions src/rpa_sigma_functional.F
Original file line number Diff line number Diff line change
Expand Up @@ -731,15 +731,15 @@ INTEGER FUNCTION intervalnum(x_coord, n, sigma) RESULT(inum)

INTEGER :: i

IF (sigma <= 0.0_dp) STOP 'intervalnum: sigma should be positive'
IF (sigma <= 0.0_dp) CPABORT('intervalnum: sigma should be positive')

inum = -1
IF (sigma > x_coord(n)) inum = n
DO i = 1, n - 1
IF ((sigma > x_coord(i)) .AND. (sigma <= x_coord(i + 1))) inum = i
END DO

IF (inum == -1) STOP 'interval: something was wrong'
IF (inum == -1) CPABORT('interval: something was wrong')

END FUNCTION intervalnum

Expand Down

0 comments on commit d205b35

Please sign in to comment.