From 75e331fa9992144df5217a8a214d51c9880f9100 Mon Sep 17 00:00:00 2001 From: annahehn <36073704+annahehn@users.noreply.github.com> Date: Fri, 29 May 2026 18:44:04 +0200 Subject: [PATCH] Printout for interface with ROSE (Lukas Guhl) (#5302) --- src/iao_analysis.F | 24 ++- src/iao_types.F | 214 +++++++++++++++++++++++++- src/input_cp2k_print_dft.F | 15 ++ src/input_cp2k_subsys.F | 40 +++++ src/qs_scf_post_gpw.F | 2 + src/subsys/particle_types.F | 3 +- src/topology.F | 46 +++++- src/topology_types.F | 14 +- tests/QS/regtest-iao/TEST_FILES.toml | 1 + tests/QS/regtest-iao/waterammonia.inp | 97 ++++++++++++ 10 files changed, 444 insertions(+), 12 deletions(-) create mode 100644 tests/QS/regtest-iao/waterammonia.inp diff --git a/src/iao_analysis.F b/src/iao_analysis.F index f0ef7b2fbb..0e658efcd6 100644 --- a/src/iao_analysis.F +++ b/src/iao_analysis.F @@ -63,7 +63,9 @@ MODULE iao_analysis USE cp_output_handling, ONLY: cp_print_key_finished_output,& cp_print_key_unit_nr USE cp_realspace_grid_cube, ONLY: cp_pw_to_cube - USE iao_types, ONLY: iao_env_type + USE iao_types, ONLY: iao_env_type,& + organise_printout_for_rose,& + print_fragment_association USE input_constants, ONLY: do_iaoloc_enone,& do_iaoloc_pm2 USE input_section_types, ONLY: section_get_ivals,& @@ -200,7 +202,8 @@ CONTAINS CPASSERT(iao_env%do_iao) ! k-points? - CALL get_qs_env(qs_env, dft_control=dft_control) + NULLIFY (particle_set) + CALL get_qs_env(qs_env, dft_control=dft_control, particle_set=particle_set) nspin = dft_control%nspins nimages = dft_control%nimages IF (nimages > 1) THEN @@ -252,7 +255,7 @@ CONTAINS ! overlap matrices CALL get_qs_env(qs_env, matrix_s_kp=matrix_s) smat => matrix_s(1, 1)%matrix - ! + CALL get_qs_env(qs_env=qs_env, qs_kind_set=qs_kind_set) nkind = SIZE(qs_kind_set) ALLOCATE (ref_basis_set_list(nkind), orb_basis_set_list(nkind)) @@ -279,7 +282,16 @@ CONTAINS ref_basis_set_list, ref_basis_set_list, srr_list) CALL build_overlap_matrix_simple(ks_env, sro, & ref_basis_set_list, orb_basis_set_list, sro_list) - ! + + IF (PRESENT(mos)) THEN + my_mos => mos + ELSE + CALL get_qs_env(qs_env, mos=my_mos) + END IF + CALL get_mo_set(my_mos(1), mo_coeff=mo_coeff) + + IF (iao_env%do_fragments) CALL organise_printout_for_rose(qs_env, orb_basis_set_list) + IF (PRESENT(mos)) THEN my_mos => mos ELSE @@ -631,7 +643,9 @@ CONTAINS IF (ASSOCIATED(ibo_cc_section)) THEN CALL print_center_spread(moments, nocc, ibo_cc_section) END IF - ! + + IF (iao_env%do_fragments) CALL print_fragment_association(qs_env, moments, unit_nr) + IF (PRESENT(bond_centers)) THEN nx = SIZE(bond_centers, 1) no = SIZE(bond_centers, 2) diff --git a/src/iao_types.F b/src/iao_types.F index 8d69d0621a..ce837e271c 100644 --- a/src/iao_types.F +++ b/src/iao_types.F @@ -12,7 +12,31 @@ !> \author JGH ! ************************************************************************************************** MODULE iao_types - USE cell_types, ONLY: cell_type + USE atomic_kind_types, ONLY: atomic_kind_type,& + get_atomic_kind_set + USE basis_set_types, ONLY: gto_basis_set_p_type + USE cell_types, ONLY: cell_type,& + pbc + USE cp_blacs_env, ONLY: cp_blacs_env_type + USE cp_dbcsr_api, ONLY: dbcsr_get_info,& + dbcsr_p_type,& + dbcsr_type + USE cp_dbcsr_operations, ONLY: copy_dbcsr_to_fm + USE cp_fm_struct, ONLY: cp_fm_struct_create,& + cp_fm_struct_release,& + cp_fm_struct_type + USE cp_fm_types, ONLY: cp_fm_create,& + cp_fm_release,& + cp_fm_to_fm_submat,& + cp_fm_type,& + cp_fm_write_formatted + USE cp_log_handling, ONLY: cp_get_default_logger,& + cp_logger_type + USE cp_output_handling, ONLY: cp_p_file,& + cp_print_key_finished_output,& + cp_print_key_should_output,& + cp_print_key_unit_nr + USE cp_units, ONLY: cp_unit_from_cp2k USE input_constants, ONLY: do_iaoloc_enone,& do_iaoloc_pm2 USE input_section_types, ONLY: section_vals_get,& @@ -20,12 +44,17 @@ MODULE iao_types section_vals_type,& section_vals_val_get USE kinds, ONLY: dp + USE message_passing, ONLY: mp_para_env_type + USE particle_types, ONLY: particle_type + USE qs_environment_types, ONLY: get_qs_env,& + qs_environment_type #include "./base/base_uses.f90" IMPLICIT NONE PRIVATE - PUBLIC :: iao_env_type, iao_read_input, iao_set_default + PUBLIC :: iao_env_type, iao_read_input, iao_set_default, & + organise_printout_for_rose, print_fragment_association ! ************************************************************************************************** TYPE iao_env_type @@ -60,6 +89,9 @@ MODULE iao_types ibo_cubes_section => NULL(), & ibo_molden_section => NULL(), & ibo_cc_section => NULL() + ! Fragments + LOGICAL :: do_fragments = .FALSE. + INTEGER :: nfrags = 0 END TYPE iao_env_type ! ************************************************************************************************** @@ -169,7 +201,183 @@ CONTAINS END IF END SUBROUTINE iao_read_input - ! ************************************************************************************************** +!> \brief Prints fragmented overlap matrices for interface with ROSE +!> \param qs_env ... +!> \param orb_basis_set_list ... +! ************************************************************************************************** + SUBROUTINE organise_printout_for_rose(qs_env, orb_basis_set_list) + TYPE(qs_environment_type), POINTER :: qs_env + TYPE(gto_basis_set_p_type), DIMENSION(:), & + INTENT(IN), POINTER :: orb_basis_set_list + + CHARACTER(len=*), PARAMETER :: routineN = 'organise_printout_for_rose' + + INTEGER :: after, colskip, handle, iatom, ii, & + ikind, iounit, jj, ncol, nfrags, nrow, & + rowfrag, rowskip, totalcol, totalrow + INTEGER, ALLOCATABLE, DIMENSION(:) :: atom_of_kind, kind_of + LOGICAL :: lfirstcol, lfirstcoljj + TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set + TYPE(cp_blacs_env_type), POINTER :: blacs_env + TYPE(cp_fm_struct_type), POINTER :: fmstruct + TYPE(cp_fm_type) :: fm_sorb, fm_sorb_frags12, fm_sorb_frags22 + TYPE(cp_logger_type), POINTER :: logger + TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: matrix_s + TYPE(dbcsr_type), POINTER :: smat + TYPE(mp_para_env_type), POINTER :: para_env + TYPE(particle_type), DIMENSION(:), POINTER :: particle_set + + CALL timeset(routineN, handle) + + !get number of fragments + NULLIFY (particle_set, atomic_kind_set) + CALL get_qs_env(qs_env, particle_set=particle_set, atomic_kind_set=atomic_kind_set, & + matrix_s_kp=matrix_s) + CALL get_atomic_kind_set(atomic_kind_set=atomic_kind_set, atom_of_kind=atom_of_kind, kind_of=kind_of) + smat => matrix_s(1, 1)%matrix + + nfrags = 0 + DO ii = 1, SIZE(particle_set) + IF (nfrags < particle_set(ii)%fragment_index) & + nfrags = particle_set(ii)%fragment_index + END DO + + logger => cp_get_default_logger() + IF (BTEST(cp_print_key_should_output(logger%iter_info, & + qs_env%input, "DFT%PRINT%IAO_ANALYSIS%IAO_OVERLAP"), cp_p_file)) THEN + iounit = cp_print_key_unit_nr(logger, qs_env%input, "DFT%PRINT%IAO_ANALYSIS%IAO_OVERLAP", & + extension=".Log", file_form="FORMATTED", file_action="WRITE", & + file_status="REPLACE") + CALL section_vals_val_get(qs_env%input, "DFT%PRINT%IAO_ANALYSIS%IAO_OVERLAP%NDIGITS", i_val=after) + after = MIN(MAX(after, 1), 16) + + DO ii = 1, nfrags + DO jj = 1, nfrags + NULLIFY (para_env, blacs_env) + CALL get_qs_env(qs_env=qs_env, blacs_env=blacs_env, para_env=para_env) + totalcol = 0 + totalrow = 0 + rowfrag = 0 + colskip = 0 + rowskip = 0 + lfirstcol = .TRUE. + lfirstcoljj = .TRUE. + + DO iatom = 1, SIZE(particle_set) + ikind = kind_of(iatom) + IF (particle_set(iatom)%fragment_index == jj) THEN + totalcol = totalcol + orb_basis_set_list(ikind)%gto_basis_set%nsgf + lfirstcoljj = .FALSE. + ELSEIF (lfirstcoljj) THEN + colskip = colskip + orb_basis_set_list(ikind)%gto_basis_set%nsgf + END IF + IF (particle_set(iatom)%fragment_index == ii) THEN + totalrow = totalrow + orb_basis_set_list(ikind)%gto_basis_set%nsgf + lfirstcol = .FALSE. + ELSEIF (lfirstcol) THEN + rowskip = rowskip + orb_basis_set_list(ikind)%gto_basis_set%nsgf + END IF + rowfrag = rowfrag + orb_basis_set_list(ikind)%gto_basis_set%nsgf + END DO + + CALL dbcsr_get_info(matrix_s(1, 1)%matrix, nfullrows_total=nrow, nfullcols_total=ncol) + CALL cp_fm_struct_create(fmstruct=fmstruct, para_env=para_env, context=blacs_env, & + nrow_global=nrow, ncol_global=ncol) + CALL cp_fm_create(matrix=fm_sorb, matrix_struct=fmstruct, name="Overlap matrix S_B1") + CALL cp_fm_struct_release(fmstruct=fmstruct) + CALL copy_dbcsr_to_fm(matrix_s(1, 1)%matrix, fm_sorb) + + CALL cp_fm_struct_create(fmstruct=fmstruct, para_env=para_env, context=blacs_env, & + nrow_global=totalrow, ncol_global=totalcol) + CALL cp_fm_create(matrix=fm_sorb_frags22, matrix_struct=fmstruct, name="Overlap matrix S_B1^kk' (S22)") + CALL cp_fm_struct_release(fmstruct=fmstruct) + CALL cp_fm_to_fm_submat(fm_sorb, fm_sorb_frags22, & + totalrow, totalcol, 1 + rowskip, 1 + colskip, 1, 1) + + CALL cp_fm_struct_create(fmstruct=fmstruct, para_env=para_env, context=blacs_env, & + nrow_global=rowfrag, ncol_global=totalcol) + CALL cp_fm_create(matrix=fm_sorb_frags12, matrix_struct=fmstruct, name="Overlap matrix S_B1^k' (S12)") + CALL cp_fm_struct_release(fmstruct=fmstruct) + CALL cp_fm_to_fm_submat(fm_sorb, fm_sorb_frags12, rowfrag, totalcol, 1, 1 + colskip, 1, 1) + + IF (iounit > 0) WRITE (iounit, *) "FRAGMENTS kk' NR. ", ii, jj + CALL cp_fm_write_formatted(fm_sorb_frags22, iounit, "Overlap matrix S_B1^kk' (S22)") + IF (ii /= jj) THEN + IF (iounit > 0) WRITE (iounit, *) "FRAGMENTS kk' NR. ", ii, jj + CALL cp_fm_write_formatted(fm_sorb_frags12, iounit, "Overlap matrix S_B1^k' (S12)") + END IF + + CALL cp_fm_release(fm_sorb) + CALL cp_fm_release(fm_sorb_frags22) + CALL cp_fm_release(fm_sorb_frags12) + + END DO + END DO + + CALL cp_print_key_finished_output(iounit, logger, qs_env%input, "DFT%PRINT%IAO_ANALYSIS%IAO_OVERLAP") + END IF + + CALL timestop(handle) + + END SUBROUTINE organise_printout_for_rose +! ************************************************************************************************** +!> \brief Associates IBO centers to fragments +!> \param qs_env ... +!> \param moments ... +!> \param unit_nr ... +! ************************************************************************************************** + SUBROUTINE print_fragment_association(qs_env, moments, unit_nr) + TYPE(qs_environment_type), POINTER :: qs_env + REAL(KIND=dp), DIMENSION(:, :, :), INTENT(IN) :: moments + INTEGER, INTENT(IN), OPTIONAL :: unit_nr + + CHARACTER(len=*), PARAMETER :: routineN = 'print_fragment_association' + + INTEGER :: handle, iatom, is, ispin, jcenter, & + natom, ncenters, nspin + INTEGER, ALLOCATABLE, DIMENSION(:, :) :: atomcenter + REAL(KIND=dp) :: conv, dab, mindab + REAL(KIND=dp), DIMENSION(3) :: rab + TYPE(cell_type), POINTER :: cell + TYPE(particle_type), DIMENSION(:), POINTER :: particle_set + + CALL timeset(routineN, handle) + + NULLIFY (cell, particle_set) + CALL get_qs_env(qs_env=qs_env, cell=cell, particle_set=particle_set, natom=natom) + conv = cp_unit_from_cp2k(1.0_dp, TRIM("angstrom")) + nspin = SIZE(moments, 3) + ncenters = SIZE(moments, 2) + ALLOCATE (atomcenter(ncenters, nspin)) + atomcenter = 0 + DO ispin = 1, nspin + DO jcenter = 1, SIZE(moments, 2) + mindab = 10.0_dp + DO iatom = 1, natom + rab(:) = pbc(particle_set(iatom)%r(:), moments(:, jcenter, ispin), cell) + dab = SQRT(rab(1)*rab(1) + rab(2)*rab(2) + rab(3)*rab(3)) + IF (dab <= mindab) THEN + mindab = dab + atomcenter(jcenter, ispin) = iatom + END IF + END DO + END DO + + IF (unit_nr > 0) THEN + WRITE (unit_nr, "(/,T2,A,i1)") "Intrinsic Bond Orbitals: Centers associated to fragments for Spin ", & + ispin + WRITE (unit_nr, "(T2,A6,T30,A6,T60,A4,T70,A8)") "Center", "Moment", "Atom", "Fragment" + DO is = 1, ncenters + WRITE (unit_nr, "(i7,3F15.8,4X,I7,4X,I7)") is, moments(1:3, is, ispin), atomcenter(is, ispin), & + particle_set(atomcenter(is, ispin))%fragment_index + END DO + WRITE (unit_nr, "(/)") + END IF + END DO + + CALL timestop(handle) + + END SUBROUTINE print_fragment_association END MODULE iao_types diff --git a/src/input_cp2k_print_dft.F b/src/input_cp2k_print_dft.F index 2f74108138..ba9941b111 100644 --- a/src/input_cp2k_print_dft.F +++ b/src/input_cp2k_print_dft.F @@ -435,6 +435,7 @@ CONTAINS default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) CALL section_add_keyword(print_key, keyword) CALL keyword_release(keyword) + CALL keyword_create(keyword, __LOCATION__, name="NDIGITS", & description="Specify the number of digits used to print the AO matrices", & default_i_val=6) @@ -478,6 +479,7 @@ CONTAINS default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) CALL section_add_keyword(print_key, keyword) CALL keyword_release(keyword) + CALL keyword_create(keyword, __LOCATION__, name="COMMUTATOR_HR", & description="Controls the printing of the [H,r] commutator matrix", & default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) @@ -1877,11 +1879,24 @@ CONTAINS n_var=-1, type_of_var=integer_t, repeats=.TRUE.) CALL section_add_keyword(subsection, keyword) CALL keyword_release(keyword) + CALL section_add_subsection(sub_print_key, subsection) CALL section_release(subsection) CALL section_add_subsection(print_key, sub_print_key) CALL section_release(sub_print_key) + NULLIFY (sub_print_key) + CALL cp_print_key_section_create(sub_print_key, __LOCATION__, name="IAO_OVERLAP", & + description="Controls the printout required for ROSE.", & + print_level=debug_print_level, filename="CP2K_ROSE") + CALL keyword_create(keyword, __LOCATION__, name="NDIGITS", & + description="Specify the number of digits used to print the MO information.", & + default_i_val=6) + CALL section_add_keyword(sub_print_key, keyword) + CALL keyword_release(keyword) + CALL section_add_subsection(print_key, sub_print_key) + CALL section_release(sub_print_key) + CALL section_add_subsection(section, print_key) CALL section_release(print_key) ! END OF IAO_ANALYSIS SECTION diff --git a/src/input_cp2k_subsys.F b/src/input_cp2k_subsys.F index 66dedfe200..e8f1eeb2a5 100644 --- a/src/input_cp2k_subsys.F +++ b/src/input_cp2k_subsys.F @@ -1861,6 +1861,10 @@ CONTAINS CALL section_add_subsection(section, subsection) CALL section_release(subsection) + CALL create_fragments_section(subsection) + CALL section_add_subsection(section, subsection) + CALL section_release(subsection) + END SUBROUTINE create_topology_section ! ************************************************************************************************** @@ -1926,6 +1930,42 @@ CONTAINS CALL keyword_release(keyword) END SUBROUTINE create_center_section +! ************************************************************************************************** +!> \brief Specify keywords used to setup several fragments +!> \param section the section to create +! ************************************************************************************************** + SUBROUTINE create_fragments_section(section) + TYPE(section_type), POINTER :: section + + TYPE(keyword_type), POINTER :: keyword + TYPE(section_type), POINTER :: subsection, subsubsection + + CPASSERT(.NOT. ASSOCIATED(section)) + NULLIFY (keyword, subsection, subsubsection) + CALL section_create(section, __LOCATION__, name="FRAGMENTS", & + description="Specify the fragments of a full system.", & + n_keywords=1, n_subsections=0, repeats=.FALSE.) + + CALL section_create(subsection, __LOCATION__, name="FRAGMENT", & + description="Specify information about the fragments.", & + n_keywords=1, n_subsections=0, repeats=.TRUE.) + + CALL keyword_create(keyword, __LOCATION__, & + name="FRAG_RANGE", & + variants=s2a("RANGE"), & + description="Defines fragments. This keyword can be repeated.", & + repeats=.FALSE., & + n_var=-1, & + type_of_var=integer_t, & + usage="FRAG_RANGE 1 5") + CALL section_add_keyword(subsection, keyword) + CALL keyword_release(keyword) + + CALL section_add_subsection(section, subsection) + CALL section_release(subsection) + + END SUBROUTINE create_fragments_section + ! ************************************************************************************************** !> \brief Specify keywords used to setup several molecules with few connectivity files !> \param section the section to create diff --git a/src/qs_scf_post_gpw.F b/src/qs_scf_post_gpw.F index 5aeabd2f31..45a1171c3c 100644 --- a/src/qs_scf_post_gpw.F +++ b/src/qs_scf_post_gpw.F @@ -1314,6 +1314,7 @@ CONTAINS IF (dft_control%do_admm) THEN CALL admm_uncorrect_for_eigenvalues(ispin, admm_env, ks_rmpv(ispin)%matrix) END IF + END DO CALL timestop(handle) @@ -3446,6 +3447,7 @@ CONTAINS IF (BTEST(cp_print_key_should_output(logger%iter_info, print_key), cp_p_file)) THEN unit_nr = cp_print_key_unit_nr(logger, input, "DFT%PRINT%IAO_ANALYSIS", extension=".iao", log_filename=.FALSE.) CALL iao_read_input(iao_env, print_key, cell) + IF (particle_set(1)%fragment_index /= 0) iao_env%do_fragments = .TRUE. IF (iao_env%do_iao) THEN CALL iao_wfn_analysis(qs_env, iao_env, unit_nr) END IF diff --git a/src/subsys/particle_types.F b/src/subsys/particle_types.F index cd7c6683bc..18dd5c7d12 100644 --- a/src/subsys/particle_types.F +++ b/src/subsys/particle_types.F @@ -40,7 +40,8 @@ MODULE particle_types ! Particle dependent terms for shell-model INTEGER :: atom_index = 0, & t_region_index = 0, & - shell_index = 0 + shell_index = 0, & + fragment_index = 0 END TYPE particle_type ! Public data types diff --git a/src/topology.F b/src/topology.F index de925982d5..25f5b75af9 100644 --- a/src/topology.F +++ b/src/topology.F @@ -157,13 +157,14 @@ CONTAINS TYPE(cell_type), POINTER :: my_cell, my_cell_ref TYPE(cp_logger_type), POINTER :: logger TYPE(section_vals_type), POINTER :: cell_ref_section, cell_section, & - constraint_section, topology_section + constraint_section, fragment_section, & + topology_section TYPE(topology_parameters_type) :: topology NULLIFY (logger) logger => cp_get_default_logger() CALL timeset(routineN, handle) - NULLIFY (cell_section, cell_ref_section, constraint_section, topology_section) + NULLIFY (cell_section, cell_ref_section, constraint_section, topology_section, fragment_section) cell_section => section_vals_get_subs_vals(subsys_section, "CELL") IF (use_motion_section) THEN @@ -285,12 +286,19 @@ CONTAINS END IF CALL cp_print_key_finished_output(iw2, logger, subsys_section, & "TOPOLOGY%DUMP_PSF") + !13. Read fragmentation + fragment_section => section_vals_get_subs_vals(subsys_section, "TOPOLOGY%FRAGMENTS") + CALL section_vals_get(fragment_section, explicit=explicit) + IF (explicit) THEN + CALL read_fragments(topology, subsys_section, particle_set=particle_set) + END IF !13. Cleanup the topology structure type CALL deallocate_topology(topology) CALL timestop(handle) CALL cp_print_key_finished_output(iw, logger, subsys_section, & "PRINT%TOPOLOGY_INFO") + END SUBROUTINE topology_control ! ************************************************************************************************** @@ -460,6 +468,40 @@ CONTAINS "PRINT%TOPOLOGY_INFO") END SUBROUTINE connectivity_control +! ************************************************************************************************** +!> \brief Reads fragments from input file +!> \param topology ... +!> \param subsys_section ... +!> \param particle_set ... +! ************************************************************************************************** + SUBROUTINE read_fragments(topology, subsys_section, particle_set) + + TYPE(topology_parameters_type), INTENT(INOUT) :: topology + TYPE(section_vals_type), POINTER :: subsys_section + TYPE(particle_type), DIMENSION(:), POINTER :: particle_set + + INTEGER :: i_rep, ifrag, n_rep + INTEGER, DIMENSION(:), POINTER :: frag_range + TYPE(section_vals_type), POINTER :: section + + NULLIFY (section) + NULLIFY (frag_range) + + section => section_vals_get_subs_vals(subsys_section, "TOPOLOGY%FRAGMENTS") + section => section_vals_get_subs_vals(section, "FRAGMENT") + CALL section_vals_get(section, n_repetition=n_rep) + ALLOCATE (topology%fragments(n_rep)) + + DO i_rep = 1, n_rep + CALL section_vals_val_get(section, "FRAG_RANGE", i_vals=frag_range, i_rep_section=i_rep) + topology%fragments(i_rep)%frag_start = frag_range(1) + topology%fragments(i_rep)%frag_end = frag_range(2) + DO ifrag = topology%fragments(i_rep)%frag_start, topology%fragments(i_rep)%frag_end + particle_set(ifrag)%fragment_index = i_rep + END DO + END DO + + END SUBROUTINE read_fragments ! ************************************************************************************************** !> \brief Reads connectivity from file diff --git a/src/topology_types.F b/src/topology_types.F index 5eb15df4f0..440becf6d0 100644 --- a/src/topology_types.F +++ b/src/topology_types.F @@ -145,6 +145,7 @@ MODULE topology_types TYPE(connectivity_info_type), POINTER :: conn_info => NULL() TYPE(constraint_info_type), POINTER :: cons_info => NULL() TYPE(cell_type), POINTER :: cell => NULL(), cell_ref => NULL(), cell_muc => NULL() + TYPE(frag_list_p_type), DIMENSION(:), POINTER:: fragments => NULL() INTEGER :: conn_type = -1 INTEGER :: coord_type = -1 INTEGER :: exclude_vdw = -1 @@ -180,12 +181,17 @@ MODULE topology_types TYPE constr_list_type INTEGER, DIMENSION(:), POINTER :: constr => NULL() END TYPE constr_list_type +! ************************************************************************************************** + TYPE frag_list_p_type + INTEGER :: frag_start = -1 + INTEGER :: frag_end = -1 + END TYPE frag_list_p_type PUBLIC :: atom_info_type, & connectivity_info_type, & constraint_info_type, & topology_parameters_type, & - constr_list_type + constr_list_type, frag_list_p_type PUBLIC :: init_topology, & deallocate_topology, & @@ -535,6 +541,12 @@ CONTAINS IF (ASSOCIATED(topology%cons_info)) THEN DEALLOCATE (topology%cons_info) END IF + !------------------------------------------------ + ! 5. DEALLOCATE fragments + !----------------------------------------------- + IF (ASSOCIATED(topology%fragments)) THEN + DEALLOCATE (topology%fragments) + END IF END SUBROUTINE deallocate_topology diff --git a/tests/QS/regtest-iao/TEST_FILES.toml b/tests/QS/regtest-iao/TEST_FILES.toml index 097589cf0d..54a1b78d32 100644 --- a/tests/QS/regtest-iao/TEST_FILES.toml +++ b/tests/QS/regtest-iao/TEST_FILES.toml @@ -1,4 +1,5 @@ # "ch2o.inp" = [] "gapw.inp" = [] +"waterammonia.inp" = [] #EOF diff --git a/tests/QS/regtest-iao/waterammonia.inp b/tests/QS/regtest-iao/waterammonia.inp new file mode 100644 index 0000000000..0a67563a61 --- /dev/null +++ b/tests/QS/regtest-iao/waterammonia.inp @@ -0,0 +1,97 @@ +&GLOBAL + PRINT_LEVEL MEDIUM + PROJECT h2 + RUN_TYPE ENERGY +&END GLOBAL + +&FORCE_EVAL + METHOD Quickstep + &DFT + BASIS_SET_FILE_NAME BASIS_MOLOPT + BASIS_SET_FILE_NAME EMSL_BASIS_SETS + BASIS_SET_FILE_NAME BASIS_MOLOPT_UCL + &MGRID + CUTOFF 500 + REL_CUTOFF 40 + &END MGRID + &POISSON + PERIODIC NONE + PSOLVER WAVELET + &END POISSON + &PRINT + &IAO_ANALYSIS + &BOND_ORBITALS + &CHARGE_CENTER + &END CHARGE_CENTER + &IBO_MOLDEN + &END IBO_MOLDEN + &END BOND_ORBITALS + &IAO_OVERLAP + &END IAO_OVERLAP + &END IAO_ANALYSIS + &END PRINT + &QS + EPS_DEFAULT 1.0E-14 + LMAXN0 4 + METHOD GAPW + &END QS + &SCF + EPS_SCF 1.0E-6 + MAX_SCF 300 + SCF_GUESS RESTART + &END SCF + &XC + &XC_FUNCTIONAL PBE + &END XC_FUNCTIONAL + &END XC + &END DFT + &SUBSYS + &CELL + ABC 9. 9. 9. + PERIODIC NONE + &END CELL + &COORD + N 3.065535 4.387890 4.446870 + H 2.831315 5.370550 4.340610 + H 2.598355 3.896910 3.690860 + H 2.627575 4.078680 5.309140 + O 6.029625 4.515340 4.446840 + H 5.067865 4.375490 4.446200 + H 6.401645 3.629450 4.447050 + &END COORD + &KIND H + BASIS_SET Ahlrichs-pVDZ + ELEMENT H + HARD_EXP_RADIUS 1.00 + LEBEDEV_GRID 50 + POTENTIAL ALL + RADIAL_GRID 50 + &END KIND + &KIND O + BASIS_SET Ahlrichs-pVDZ + HARD_EXP_RADIUS 1.00 + LEBEDEV_GRID 50 + POTENTIAL ALL + RADIAL_GRID 50 + &END KIND + &KIND N + BASIS_SET Ahlrichs-pVDZ + HARD_EXP_RADIUS 1.00 + LEBEDEV_GRID 50 + POTENTIAL ALL + RADIAL_GRID 50 + &END KIND + &TOPOLOGY + &CENTER_COORDINATES T + &END CENTER_COORDINATES + &FRAGMENTS + &FRAGMENT + FRAG_RANGE 1 4 + &END FRAGMENT + &FRAGMENT + FRAG_RANGE 5 7 + &END FRAGMENT + &END FRAGMENTS + &END TOPOLOGY + &END SUBSYS +&END FORCE_EVAL