From 537841399b72b693b48850a5eb1aabb47aee574b Mon Sep 17 00:00:00 2001 From: Frederick Stein Date: Tue, 2 Jul 2024 10:12:17 +0200 Subject: [PATCH] Initialize DBCSR_related variables --- src/dbx/cp_dbcsr_api.F | 6 +++--- src/dm_ls_scf_types.F | 26 ++++++++++++++++-------- src/pexsi_types.F | 13 ++++++------ src/transport_env_types.F | 14 ++++++------- tools/precommit/check_file_properties.py | 1 + 5 files changed, 35 insertions(+), 25 deletions(-) diff --git a/src/dbx/cp_dbcsr_api.F b/src/dbx/cp_dbcsr_api.F index f4882941ac..d570c3379c 100644 --- a/src/dbx/cp_dbcsr_api.F +++ b/src/dbx/cp_dbcsr_api.F @@ -259,15 +259,15 @@ MODULE cp_dbcsr_api END TYPE TYPE dbcsr_type - TYPE(dbcsr_type_prv), PRIVATE :: prv + TYPE(dbcsr_type_prv), PRIVATE :: prv = dbcsr_type_prv() END TYPE dbcsr_type TYPE dbcsr_distribution_type - TYPE(dbcsr_distribution_type_prv), PRIVATE :: prv + TYPE(dbcsr_distribution_type_prv), PRIVATE :: prv = dbcsr_distribution_type_prv() END TYPE dbcsr_distribution_type TYPE dbcsr_iterator_type - TYPE(dbcsr_iterator_type_prv), PRIVATE :: prv + TYPE(dbcsr_iterator_type_prv), PRIVATE :: prv = dbcsr_iterator_type_prv() END TYPE dbcsr_iterator_type INTERFACE dbcsr_add diff --git a/src/dm_ls_scf_types.F b/src/dm_ls_scf_types.F index 6e4c5886cf..80d8367e11 100644 --- a/src/dm_ls_scf_types.F +++ b/src/dm_ls_scf_types.F @@ -43,8 +43,8 @@ MODULE dm_ls_scf_types INTEGER :: cluster_type = -1 LOGICAL :: do_pao = .FALSE. INTEGER, DIMENSION(:), ALLOCATABLE :: atom_to_molecule - TYPE(dbcsr_type) :: matrix_A - TYPE(dbcsr_type) :: matrix_B + TYPE(dbcsr_type) :: matrix_A = dbcsr_type() + TYPE(dbcsr_type) :: matrix_B = dbcsr_type() END TYPE TYPE ls_mat_history_type @@ -93,8 +93,11 @@ MODULE dm_ls_scf_types REAL(KIND=dp), DIMENSION(2) :: homo_spin = 0.0_dp REAL(KIND=dp), DIMENSION(2) :: lumo_spin = 0.0_dp - ! This prevents a bug in GCC up to version 9.x (9.5 seems to work though) +#if defined(__GNUC__) && defined(__GNUC_MINOR__) && (CPVERSION(9, 5) > CPVERSION(__GNUC__, __GNUC_MINOR__)) TYPE(ls_mat_history_type) :: scf_history = ls_mat_history_type(matrix=null()) +#else + TYPE(ls_mat_history_type) :: scf_history = ls_mat_history_type() +#endif INTEGER :: extrapolation_order = -1 LOGICAL :: has_unit_metric = .FALSE. @@ -126,18 +129,23 @@ MODULE dm_ls_scf_types REAL(KIND=dp) :: eps_diis = 0.0_dp REAL(KIND=dp) :: energy_init = 0.0_dp - TYPE(dbcsr_type) :: matrix_s_inv - TYPE(dbcsr_type) :: matrix_s - TYPE(dbcsr_type) :: matrix_bs_sqrt, matrix_bs_sqrt_inv - TYPE(dbcsr_type) :: matrix_s_sqrt, matrix_s_sqrt_inv + TYPE(dbcsr_type) :: matrix_s_inv = dbcsr_type() + TYPE(dbcsr_type) :: matrix_s = dbcsr_type() + TYPE(dbcsr_type) :: matrix_bs_sqrt = dbcsr_type(), matrix_bs_sqrt_inv = dbcsr_type() + TYPE(dbcsr_type) :: matrix_s_sqrt = dbcsr_type(), matrix_s_sqrt_inv = dbcsr_type() TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_ks TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_p LOGICAL :: report_all_sparsities = .FALSE., perform_mu_scan = .FALSE., use_s_sqrt = .FALSE. - TYPE(ls_mstruct_type) :: ls_mstruct +#if defined(__GNUC__) && defined(__GNUC_MINOR__) && (CPVERSION(9, 5) > CPVERSION(__GNUC__, __GNUC_MINOR__)) + TYPE(ls_mstruct_type) :: ls_mstruct = ls_mstruct_type(atom_to_molecule=NULL()) TYPE(ls_scf_curvy_type) :: curvy_data = ls_scf_curvy_type(matrix_dp=null(), matrix_p=null(), & matrix_psave=null(), matrix_bch=null()) +#else + TYPE(ls_mstruct_type) :: ls_mstruct = ls_mstruct_type() + TYPE(ls_scf_curvy_type) :: curvy_data = ls_scf_curvy_type() +#endif TYPE(chebyshev_type) :: chebyshev = chebyshev_type() @@ -150,7 +158,7 @@ MODULE dm_ls_scf_types LOGICAL :: calculate_forces = .FALSE. - TYPE(lib_pexsi_env) :: pexsi + TYPE(lib_pexsi_env) :: pexsi = lib_pexsi_env() TYPE(mp_para_env_type), POINTER :: para_env => NULL() LOGICAL :: do_pao = .FALSE. diff --git a/src/pexsi_types.F b/src/pexsi_types.F index af711000ab..59cb759fb3 100644 --- a/src/pexsi_types.F +++ b/src/pexsi_types.F @@ -85,20 +85,21 @@ MODULE pexsi_types !> \author Patrick Seewald ! ************************************************************************************************** TYPE lib_pexsi_env - TYPE(dbcsr_type) :: dbcsr_template_matrix_sym, & - dbcsr_template_matrix_nonsym - TYPE(dbcsr_csr_type) :: csr_mat_p, csr_mat_ks, csr_mat_s, & - csr_mat_E, csr_mat_F + TYPE(dbcsr_type) :: dbcsr_template_matrix_sym = dbcsr_type(), & + dbcsr_template_matrix_nonsym = dbcsr_type() + TYPE(dbcsr_csr_type) :: csr_mat_p = dbcsr_csr_type(), csr_mat_ks = dbcsr_csr_type(), & + csr_mat_s = dbcsr_csr_type(), csr_mat_E = dbcsr_csr_type(), & + csr_mat_F = dbcsr_csr_type() TYPE(cp_pexsi_options) :: options REAL(KIND=dp), DIMENSION(:), POINTER :: kTS => NULL() TYPE(dbcsr_p_type), DIMENSION(:), & POINTER :: matrix_w => NULL() INTEGER(KIND=C_INTPTR_T) :: plan = 0_C_INTPTR_T INTEGER :: nspin = -1, num_ranks_per_pole = -1 - TYPE(mp_comm_type) :: mp_group = mp_comm_type() + TYPE(mp_comm_type) :: mp_group = mp_comm_type() TYPE(dbcsr_type), DIMENSION(:), & POINTER :: max_ev_vector => NULL() - TYPE(dbcsr_type) :: csr_sparsity + TYPE(dbcsr_type) :: csr_sparsity = dbcsr_type() INTEGER, DIMENSION(2) :: mp_dims = -1 LOGICAL :: csr_screening = .FALSE., do_adaptive_tol_nel = .FALSE. diff --git a/src/transport_env_types.F b/src/transport_env_types.F index 38070a8153..e1e221ed02 100644 --- a/src/transport_env_types.F +++ b/src/transport_env_types.F @@ -95,14 +95,14 @@ MODULE transport_env_types TYPE transport_env_type TYPE(C_FUNPTR) :: ext_c_method_ptr = C_NULL_FUNPTR TYPE(cp2k_transport_parameters) :: params = cp2k_transport_parameters() - TYPE(dbcsr_type) :: template_matrix_sym - TYPE(dbcsr_type) :: template_matrix_nosym - TYPE(dbcsr_type) :: csr_sparsity + TYPE(dbcsr_type) :: template_matrix_sym = dbcsr_type() + TYPE(dbcsr_type) :: template_matrix_nosym = dbcsr_type() + TYPE(dbcsr_type) :: csr_sparsity = dbcsr_type() TYPE(dbcsr_type), POINTER :: dm_imag => NULL() - TYPE(dbcsr_csr_type) :: s_matrix - TYPE(dbcsr_csr_type) :: ks_matrix - TYPE(dbcsr_csr_type) :: p_matrix - TYPE(dbcsr_csr_type) :: imagp_matrix + TYPE(dbcsr_csr_type) :: s_matrix = dbcsr_csr_type() + TYPE(dbcsr_csr_type) :: ks_matrix = dbcsr_csr_type() + TYPE(dbcsr_csr_type) :: p_matrix = dbcsr_csr_type() + TYPE(dbcsr_csr_type) :: imagp_matrix = dbcsr_csr_type() LOGICAL :: csr_screening = .FALSE. INTEGER, DIMENSION(:), POINTER :: contacts_data => NULL() INTEGER, DIMENSION(:), POINTER :: nsgf => NULL() diff --git a/tools/precommit/check_file_properties.py b/tools/precommit/check_file_properties.py index cc31f9cf38..478666708e 100755 --- a/tools/precommit/check_file_properties.py +++ b/tools/precommit/check_file_properties.py @@ -60,6 +60,7 @@ r"LIBXSMM_VERSION2", r"LIBXSMM_VERSION3", r"LIBXSMM_VERSION4", + r"CPVERSION", ) FLAG_EXCEPTIONS_RE = re.compile(r"|".join(FLAG_EXCEPTIONS))