(git:b279b6b)
qs_tddfpt2_subgroups.F
Go to the documentation of this file.
1 !--------------------------------------------------------------------------------------------------!
2 ! CP2K: A general program to perform molecular dynamics simulations !
3 ! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
4 ! !
5 ! SPDX-License-Identifier: GPL-2.0-or-later !
6 !--------------------------------------------------------------------------------------------------!
7 
9  USE admm_types, ONLY: admm_type,&
11  USE atomic_kind_types, ONLY: atomic_kind_type
13  gto_basis_set_type
14  USE cell_types, ONLY: cell_type
17  cp_blacs_env_type
18  USE cp_control_types, ONLY: dft_control_type,&
19  qs_control_type,&
20  tddfpt2_control_type
25  cp_fm_struct_type
26  USE cp_fm_types, ONLY: cp_fm_copy_general,&
27  cp_fm_create,&
29  cp_fm_release,&
30  cp_fm_type
31  USE dbcsr_api, ONLY: dbcsr_create,&
32  dbcsr_distribution_release,&
33  dbcsr_distribution_type,&
34  dbcsr_get_info,&
35  dbcsr_release,&
36  dbcsr_type
37  USE distribution_1d_types, ONLY: distribution_1d_type
39  distribution_2d_type
44  hartree_local_type
48  USE input_section_types, ONLY: section_vals_type,&
50  USE kinds, ONLY: default_string_length,&
51  dp
53  mp_para_env_type
54  USE molecule_kind_types, ONLY: molecule_kind_type
55  USE molecule_types, ONLY: molecule_type
56  USE particle_types, ONLY: particle_type
57  USE pw_env_methods, ONLY: pw_env_create,&
59  USE pw_env_types, ONLY: pw_env_release,&
61  pw_env_type
62  USE qs_environment_types, ONLY: get_qs_env,&
63  qs_environment_type
64  USE qs_kind_types, ONLY: get_qs_kind,&
65  qs_kind_type
66  USE qs_ks_types, ONLY: qs_ks_env_type
69  local_rho_type
70  USE qs_neighbor_list_types, ONLY: neighbor_list_set_p_type,&
72  USE qs_neighbor_lists, ONLY: atom2d_build,&
75  local_atoms_type,&
78  USE qs_rho0_methods, ONLY: init_rho0
83  task_list_type
84 #include "./base/base_uses.f90"
85 
86  IMPLICIT NONE
87 
88  PRIVATE
89 
90  CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_tddfpt2_subgroups'
91  LOGICAL, PARAMETER, PRIVATE :: debug_this_module = .true.
92 
93  PUBLIC :: tddfpt_subgroup_env_type
96 
97 ! **************************************************************************************************
98 !> \brief Parallel (sub)group environment.
99 !> \par History
100 !> * 01.2017 created [Sergey Chulkov]
101 ! **************************************************************************************************
102  TYPE tddfpt_subgroup_env_type
103  !> indicates that the global MPI communicator has been split into subgroups; if it is .FALSE.
104  !> certain components of the structure (blacs_env, para_env, admm_A, and mos_occ)
105  !> can still be accessed; in this case they simply point to the corresponding global variables
106  LOGICAL :: is_split = .false.
107  !> number of parallel groups
108  INTEGER :: ngroups = -1
109  !> group_distribution(0:ngroups-1) : a process with rank 'i' belongs to the parallel group
110  !> with index 'group_distribution(i)'
111  INTEGER, DIMENSION(:), ALLOCATABLE :: group_distribution
112  !> group-specific BLACS parallel environment
113  TYPE(cp_blacs_env_type), POINTER :: blacs_env => null()
114  !> group-specific MPI parallel environment
115  TYPE(mp_para_env_type), POINTER :: para_env => null()
116  !> occupied MOs stored in a matrix form [nao x nmo_occ(spin)] distributed across processes
117  !> in the parallel group
118  TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:) :: mos_occ
119  !> group-specific copy of the ADMM A matrix 'admm_type%A'
120  TYPE(cp_fm_type), POINTER :: admm_A => null()
121  !
122  !> indicates that a set of multi-grids has been allocated; if it is .FALSE. all the components
123  !> below point to the corresponding global variables and can be accessed
124  LOGICAL :: is_mgrid = .false.
125  !> group-specific DBCSR distribution
126  TYPE(dbcsr_distribution_type), POINTER :: dbcsr_dist => null()
127  !> group-specific two-dimensional distribution of pairs of particles
128  TYPE(distribution_2d_type), POINTER :: dist_2d => null()
129  !> group-specific plane wave environment
130  TYPE(pw_env_type), POINTER :: pw_env => null()
131  !> lists of neighbours in auxiliary and primary basis sets
132  TYPE(neighbor_list_set_p_type), &
133  DIMENSION(:), POINTER :: sab_aux_fit => null(), sab_orb => null()
134  !> task lists in auxiliary and primary basis sets
135  TYPE(task_list_type), POINTER :: task_list_aux_fit => null(), task_list_orb => null()
136  !> soft task lists in auxiliary and primary basis sets
137  TYPE(task_list_type), POINTER :: task_list_aux_fit_soft => null(), task_list_orb_soft => null()
138  !> GAPW local atomic grids
139  TYPE(hartree_local_type), POINTER :: hartree_local => null()
140  TYPE(local_rho_type), POINTER :: local_rho_set => null()
141  TYPE(local_rho_type), POINTER :: local_rho_set_admm => null()
142  END TYPE tddfpt_subgroup_env_type
143 
144 ! **************************************************************************************************
145 !> \brief Structure to save global multi-grid related parameters.
146 !> \par History
147 !> * 09.2016 created [Sergey Chulkov]
148 !> * 01.2017 moved from qs_tddfpt2_methods [Sergey Chulkov]
149 ! **************************************************************************************************
150  TYPE mgrid_saved_parameters
151  !> create commensurate grids
152  LOGICAL :: commensurate_mgrids = .false.
153  !> create real-space grids
154  LOGICAL :: realspace_mgrids = .false.
155  !> do not perform load balancing
156  LOGICAL :: skip_load_balance = .false.
157  !> cutoff value at the finest grid level
158  REAL(KIND=dp) :: cutoff = 0.0_dp
159  !> inverse scale factor
160  REAL(KIND=dp) :: progression_factor = 0.0_dp
161  !> relative cutoff
162  REAL(KIND=dp) :: relative_cutoff = 0.0_dp
163  !> list of explicitly given cutoff values
164  REAL(KIND=dp), DIMENSION(:), POINTER :: e_cutoff => null()
165  END TYPE mgrid_saved_parameters
166 
167 CONTAINS
168 
169 ! **************************************************************************************************
170 !> \brief Split MPI communicator to create a set of parallel (sub)groups.
171 !> \param sub_env parallel group environment (initialised on exit)
172 !> \param qs_env Quickstep environment
173 !> \param mos_occ ground state molecular orbitals in primary atomic basis set
174 !> \param kernel Type of kernel (full/sTDA) that will be used
175 !> \par History
176 !> * 01.2017 (sub)group-related code has been moved here from the main subroutine tddfpt()
177 !> [Sergey Chulkov]
178 ! **************************************************************************************************
179  SUBROUTINE tddfpt_sub_env_init(sub_env, qs_env, mos_occ, kernel)
180  TYPE(tddfpt_subgroup_env_type), INTENT(out) :: sub_env
181  TYPE(qs_environment_type), POINTER :: qs_env
182  TYPE(cp_fm_type), DIMENSION(:), INTENT(in) :: mos_occ
183  INTEGER, INTENT(in) :: kernel
184 
185  CHARACTER(LEN=*), PARAMETER :: routinen = 'tddfpt_sub_env_init'
186 
187  INTEGER :: handle, ispin, nao, nao_aux, natom, &
188  nmo_occ, nspins
189  TYPE(admm_type), POINTER :: admm_env
190  TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
191  TYPE(cp_blacs_env_type), POINTER :: blacs_env_global
192  TYPE(cp_fm_struct_type), POINTER :: fm_struct
193  TYPE(dft_control_type), POINTER :: dft_control
194  TYPE(mgrid_saved_parameters) :: mgrid_saved
195  TYPE(mp_para_env_type), POINTER :: para_env_global
196  TYPE(pw_env_type), POINTER :: pw_env_global
197  TYPE(qs_control_type), POINTER :: qs_control
198  TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
199  TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
200 
201  CALL timeset(routinen, handle)
202 
203  nspins = SIZE(mos_occ)
204 
205  CALL get_qs_env(qs_env, blacs_env=blacs_env_global, dft_control=dft_control, &
206  para_env=para_env_global, pw_env=pw_env_global)
207 
208  tddfpt_control => dft_control%tddfpt2_control
209  qs_control => dft_control%qs_control
210 
211  ! ++ split mpi communicator if
212  ! a) the requested number of processors per group > 0
213  ! (means that the split has been requested explicitly), and
214  ! b) the number of subgroups is >= 2
215  sub_env%is_split = tddfpt_control%nprocs > 0 .AND. tddfpt_control%nprocs*2 <= para_env_global%num_pe
216 
217  ALLOCATE (sub_env%mos_occ(nspins))
218  NULLIFY (sub_env%admm_A)
219 
220  IF (sub_env%is_split) THEN
221  ALLOCATE (sub_env%group_distribution(0:para_env_global%num_pe - 1))
222 
223  ALLOCATE (sub_env%para_env)
224  CALL sub_env%para_env%from_split(comm=para_env_global, ngroups=sub_env%ngroups, &
225  group_distribution=sub_env%group_distribution, subgroup_min_size=tddfpt_control%nprocs)
226 
227  ! ++ create a new parallel environment based on the given sub-communicator)
228  NULLIFY (sub_env%blacs_env)
229 
230  ! use the default (SQUARE) BLACS grid layout and non-repeatable BLACS collective operations
231  ! by omitting optional parameters 'blacs_grid_layout' and 'blacs_repeatable'.
232  ! Ideally we should take these parameters from the variables globenv%blacs_grid_layout and
233  ! globenv%blacs_repeatable, however the global environment is not available
234  ! from the subroutine 'qs_energies_properties'.
235  CALL cp_blacs_env_create(sub_env%blacs_env, sub_env%para_env)
236 
237  NULLIFY (fm_struct)
238 
239  DO ispin = 1, nspins
240  CALL cp_fm_get_info(mos_occ(ispin), nrow_global=nao, ncol_global=nmo_occ)
241  CALL cp_fm_struct_create(fm_struct, nrow_global=nao, ncol_global=nmo_occ, context=sub_env%blacs_env)
242  CALL cp_fm_create(sub_env%mos_occ(ispin), fm_struct)
243  CALL cp_fm_struct_release(fm_struct)
244  CALL tddfpt_fm_replicate_across_subgroups(fm_src=mos_occ(ispin), &
245  fm_dest_sub=sub_env%mos_occ(ispin), sub_env=sub_env)
246  END DO
247 
248  IF (dft_control%do_admm) THEN
249  CALL get_qs_env(qs_env, admm_env=admm_env)
250  CALL cp_fm_get_info(admm_env%A, nrow_global=nao_aux, ncol_global=nao)
251  CALL cp_fm_struct_create(fm_struct, nrow_global=nao_aux, ncol_global=nao, context=sub_env%blacs_env)
252  ALLOCATE (sub_env%admm_A)
253  CALL cp_fm_create(sub_env%admm_A, fm_struct)
254  CALL cp_fm_struct_release(fm_struct)
255  CALL tddfpt_fm_replicate_across_subgroups(fm_src=admm_env%A, fm_dest_sub=sub_env%admm_A, sub_env=sub_env)
256  END IF
257  ELSE
258  CALL para_env_global%retain()
259  sub_env%para_env => para_env_global
260 
261  CALL blacs_env_global%retain()
262  sub_env%blacs_env => blacs_env_global
263 
264  sub_env%mos_occ(:) = mos_occ(:)
265 
266  IF (dft_control%do_admm) THEN
267  CALL get_qs_env(qs_env, admm_env=admm_env)
268  sub_env%admm_A => admm_env%A
269  END IF
270  END IF
271 
272  IF (kernel == tddfpt_kernel_full) THEN
273  ! ++ allocate a new plane wave environment
274  sub_env%is_mgrid = sub_env%is_split .OR. tddfpt_control%mgrid_is_explicit
275 
276  NULLIFY (sub_env%dbcsr_dist, sub_env%dist_2d)
277  NULLIFY (sub_env%sab_orb, sub_env%sab_aux_fit)
278  NULLIFY (sub_env%task_list_orb, sub_env%task_list_aux_fit)
279  NULLIFY (sub_env%task_list_orb_soft, sub_env%task_list_aux_fit_soft)
280 
281  IF (sub_env%is_mgrid) THEN
282  IF (tddfpt_control%mgrid_is_explicit) &
283  CALL init_tddfpt_mgrid(qs_control, tddfpt_control, mgrid_saved)
284 
285  NULLIFY (sub_env%pw_env)
286 
287  CALL pw_env_create(sub_env%pw_env)
288  CALL pw_env_rebuild(sub_env%pw_env, qs_env, sub_env%para_env)
289 
290  CALL tddfpt_build_distribution_2d(distribution_2d=sub_env%dist_2d, dbcsr_dist=sub_env%dbcsr_dist, &
291  blacs_env=sub_env%blacs_env, qs_env=qs_env)
292  CALL tddfpt_build_tasklist(task_list=sub_env%task_list_orb, sab=sub_env%sab_orb, basis_type="ORB", &
293  distribution_2d=sub_env%dist_2d, pw_env=sub_env%pw_env, qs_env=qs_env, &
294  soft_valid=.false., skip_load_balance=qs_control%skip_load_balance_distributed, &
295  reorder_grid_ranks=.true.)
296  IF (qs_control%gapw .OR. qs_control%gapw_xc) THEN
297  CALL tddfpt_build_tasklist(task_list=sub_env%task_list_orb_soft, sab=sub_env%sab_orb, basis_type="ORB", &
298  distribution_2d=sub_env%dist_2d, pw_env=sub_env%pw_env, qs_env=qs_env, &
299  soft_valid=.true., skip_load_balance=qs_control%skip_load_balance_distributed, &
300  reorder_grid_ranks=.true.)
301  END IF
302 
303  IF (dft_control%do_admm) THEN
304  CALL tddfpt_build_tasklist(task_list=sub_env%task_list_aux_fit, sab=sub_env%sab_aux_fit, &
305  basis_type="AUX_FIT", distribution_2d=sub_env%dist_2d, &
306  pw_env=sub_env%pw_env, qs_env=qs_env, soft_valid=.false., &
307  skip_load_balance=qs_control%skip_load_balance_distributed, &
308  reorder_grid_ranks=.false.)
309  IF (qs_control%gapw .OR. qs_control%gapw_xc) THEN
310  CALL tddfpt_build_tasklist(task_list=sub_env%task_list_aux_fit_soft, sab=sub_env%sab_aux_fit, &
311  basis_type="AUX_FIT", distribution_2d=sub_env%dist_2d, &
312  pw_env=sub_env%pw_env, qs_env=qs_env, soft_valid=.true., &
313  skip_load_balance=qs_control%skip_load_balance_distributed, &
314  reorder_grid_ranks=.false.)
315  END IF
316  END IF
317 
318  IF (tddfpt_control%mgrid_is_explicit) &
319  CALL restore_qs_mgrid(qs_control, mgrid_saved)
320  ELSE
321  CALL pw_env_retain(pw_env_global)
322  sub_env%pw_env => pw_env_global
323 
324  CALL get_qs_env(qs_env, dbcsr_dist=sub_env%dbcsr_dist, &
325  sab_orb=sub_env%sab_orb, task_list=sub_env%task_list_orb)
326  IF (dft_control%do_admm) THEN
327  CALL get_admm_env(admm_env, sab_aux_fit=sub_env%sab_aux_fit, &
328  task_list_aux_fit=sub_env%task_list_aux_fit)
329  IF (qs_control%gapw .OR. qs_control%gapw_xc) THEN
330  sub_env%task_list_aux_fit_soft => admm_env%admm_gapw_env%task_list
331  END IF
332  END IF
333  IF (qs_control%gapw .OR. qs_control%gapw_xc) THEN
334  CALL get_qs_env(qs_env, task_list_soft=sub_env%task_list_orb_soft)
335  END IF
336  END IF
337 
338  ! GAPW initializations
339  IF (dft_control%qs_control%gapw) THEN
340  CALL get_qs_env(qs_env, &
341  atomic_kind_set=atomic_kind_set, &
342  natom=natom, &
343  qs_kind_set=qs_kind_set)
344 
345  CALL local_rho_set_create(sub_env%local_rho_set)
346  CALL allocate_rho_atom_internals(sub_env%local_rho_set%rho_atom_set, atomic_kind_set, &
347  qs_kind_set, dft_control, sub_env%para_env)
348 
349  CALL init_rho0(sub_env%local_rho_set, qs_env, dft_control%qs_control%gapw_control, &
350  zcore=0.0_dp)
351  CALL rho0_s_grid_create(sub_env%pw_env, sub_env%local_rho_set%rho0_mpole)
352  CALL hartree_local_create(sub_env%hartree_local)
353  CALL init_coulomb_local(sub_env%hartree_local, natom)
354  ELSEIF (dft_control%qs_control%gapw_xc) THEN
355  CALL get_qs_env(qs_env, &
356  atomic_kind_set=atomic_kind_set, &
357  qs_kind_set=qs_kind_set)
358  CALL local_rho_set_create(sub_env%local_rho_set)
359  CALL allocate_rho_atom_internals(sub_env%local_rho_set%rho_atom_set, atomic_kind_set, &
360  qs_kind_set, dft_control, sub_env%para_env)
361  END IF
362 
363  ! ADMM/GAPW
364  IF (dft_control%do_admm) THEN
365  IF (dft_control%qs_control%gapw .OR. dft_control%qs_control%gapw_xc) THEN
366  CALL get_qs_env(qs_env, atomic_kind_set=atomic_kind_set)
367  CALL local_rho_set_create(sub_env%local_rho_set_admm)
368  CALL allocate_rho_atom_internals(sub_env%local_rho_set_admm%rho_atom_set, atomic_kind_set, &
369  admm_env%admm_gapw_env%admm_kind_set, &
370  dft_control, sub_env%para_env)
371  END IF
372  END IF
373 
374  ELSE IF (kernel == tddfpt_kernel_stda) THEN
375  sub_env%is_mgrid = .false.
376  NULLIFY (sub_env%dbcsr_dist, sub_env%dist_2d)
377  NULLIFY (sub_env%sab_orb, sub_env%sab_aux_fit)
378  NULLIFY (sub_env%task_list_orb, sub_env%task_list_orb_soft, sub_env%task_list_aux_fit)
379  NULLIFY (sub_env%pw_env)
380  IF (sub_env%is_split) THEN
381  cpabort('Subsys option not available')
382  ELSE
383  CALL get_qs_env(qs_env, dbcsr_dist=sub_env%dbcsr_dist, sab_orb=sub_env%sab_orb)
384  END IF
385  ELSE IF (kernel == tddfpt_kernel_none) THEN
386  sub_env%is_mgrid = .false.
387  NULLIFY (sub_env%dbcsr_dist, sub_env%dist_2d)
388  NULLIFY (sub_env%sab_orb, sub_env%sab_aux_fit)
389  NULLIFY (sub_env%task_list_orb, sub_env%task_list_orb_soft, sub_env%task_list_aux_fit)
390  NULLIFY (sub_env%pw_env)
391  IF (sub_env%is_split) THEN
392  cpabort('Subsys option not available')
393  ELSE
394  CALL get_qs_env(qs_env, dbcsr_dist=sub_env%dbcsr_dist, sab_orb=sub_env%sab_orb)
395  END IF
396  ELSE
397  cpabort("Unknown kernel type")
398  END IF
399 
400  CALL timestop(handle)
401 
402  END SUBROUTINE tddfpt_sub_env_init
403 
404 ! **************************************************************************************************
405 !> \brief Release parallel group environment
406 !> \param sub_env parallel group environment (modified on exit)
407 !> \par History
408 !> * 01.2017 created [Sergey Chulkov]
409 ! **************************************************************************************************
410  SUBROUTINE tddfpt_sub_env_release(sub_env)
411  TYPE(tddfpt_subgroup_env_type), INTENT(inout) :: sub_env
412 
413  CHARACTER(LEN=*), PARAMETER :: routinen = 'tddfpt_sub_env_release'
414 
415  INTEGER :: handle, i
416 
417  CALL timeset(routinen, handle)
418 
419  IF (sub_env%is_mgrid) THEN
420  IF (ASSOCIATED(sub_env%task_list_aux_fit)) &
421  CALL deallocate_task_list(sub_env%task_list_aux_fit)
422 
423  IF (ASSOCIATED(sub_env%task_list_orb)) &
424  CALL deallocate_task_list(sub_env%task_list_orb)
425 
426  IF (ASSOCIATED(sub_env%task_list_orb_soft)) &
427  CALL deallocate_task_list(sub_env%task_list_orb_soft)
428 
429  CALL release_neighbor_list_sets(sub_env%sab_aux_fit)
430  CALL release_neighbor_list_sets(sub_env%sab_orb)
431 
432  IF (ASSOCIATED(sub_env%dbcsr_dist)) THEN
433  CALL dbcsr_distribution_release(sub_env%dbcsr_dist)
434  DEALLOCATE (sub_env%dbcsr_dist)
435  END IF
436 
437  IF (ASSOCIATED(sub_env%dist_2d)) &
438  CALL distribution_2d_release(sub_env%dist_2d)
439  END IF
440 
441  ! GAPW
442  IF (ASSOCIATED(sub_env%local_rho_set)) THEN
443  CALL local_rho_set_release(sub_env%local_rho_set)
444  END IF
445  IF (ASSOCIATED(sub_env%hartree_local)) THEN
446  CALL hartree_local_release(sub_env%hartree_local)
447  END IF
448  IF (ASSOCIATED(sub_env%local_rho_set_admm)) THEN
449  CALL local_rho_set_release(sub_env%local_rho_set_admm)
450  END IF
451 
452  ! if TDDFPT-specific plane-wave environment has not been requested,
453  ! the pointers sub_env%dbcsr_dist, sub_env%sab_*, and sub_env%task_list_*
454  ! point to the corresponding ground-state variables from qs_env
455  ! and should not be deallocated
456 
457  CALL pw_env_release(sub_env%pw_env)
458 
459  sub_env%is_mgrid = .false.
460 
461  IF (sub_env%is_split .AND. ASSOCIATED(sub_env%admm_A)) THEN
462  CALL cp_fm_release(sub_env%admm_A)
463  DEALLOCATE (sub_env%admm_A)
464  NULLIFY (sub_env%admm_A)
465  END IF
466 
467  IF (sub_env%is_split) THEN
468  DO i = SIZE(sub_env%mos_occ), 1, -1
469  CALL cp_fm_release(sub_env%mos_occ(i))
470  END DO
471  END IF
472  DEALLOCATE (sub_env%mos_occ)
473 
474  CALL cp_blacs_env_release(sub_env%blacs_env)
475  CALL mp_para_env_release(sub_env%para_env)
476 
477  IF (ALLOCATED(sub_env%group_distribution)) &
478  DEALLOCATE (sub_env%group_distribution)
479 
480  sub_env%is_split = .false.
481 
482  CALL timestop(handle)
483 
484  END SUBROUTINE tddfpt_sub_env_release
485 
486 ! **************************************************************************************************
487 !> \brief Replace the global multi-grid related parameters in qs_control by the ones given in the
488 !> TDDFPT/MGRID subsection. The original parameters are stored into the 'mgrid_saved'
489 !> variable.
490 !> \param qs_control Quickstep control parameters (modified on exit)
491 !> \param tddfpt_control TDDFPT control parameters
492 !> \param mgrid_saved structure to hold global MGRID-related parameters (initialised on exit)
493 !> \par History
494 !> * 09.2016 created [Sergey Chulkov]
495 !> * 01.2017 moved from qs_tddfpt2_methods [Sergey Chulkov]
496 !> \note the code to build the 'e_cutoff' list was taken from the subroutine read_mgrid_section()
497 ! **************************************************************************************************
498  SUBROUTINE init_tddfpt_mgrid(qs_control, tddfpt_control, mgrid_saved)
499  TYPE(qs_control_type), POINTER :: qs_control
500  TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
501  TYPE(mgrid_saved_parameters), INTENT(out) :: mgrid_saved
502 
503  CHARACTER(LEN=*), PARAMETER :: routinen = 'init_tddfpt_mgrid'
504 
505  INTEGER :: handle, igrid, ngrids
506 
507  CALL timeset(routinen, handle)
508 
509  ! ++ save global plane-wave grid parameters to the variable 'mgrid_saved'
510  mgrid_saved%commensurate_mgrids = qs_control%commensurate_mgrids
511  mgrid_saved%realspace_mgrids = qs_control%realspace_mgrids
512  mgrid_saved%skip_load_balance = qs_control%skip_load_balance_distributed
513  mgrid_saved%cutoff = qs_control%cutoff
514  mgrid_saved%progression_factor = qs_control%progression_factor
515  mgrid_saved%relative_cutoff = qs_control%relative_cutoff
516  mgrid_saved%e_cutoff => qs_control%e_cutoff
517 
518  ! ++ set parameters from 'tddfpt_control' as default ones for all newly allocated plane-wave grids
519  qs_control%commensurate_mgrids = tddfpt_control%mgrid_commensurate_mgrids
520  qs_control%realspace_mgrids = tddfpt_control%mgrid_realspace_mgrids
521  qs_control%skip_load_balance_distributed = tddfpt_control%mgrid_skip_load_balance
522  qs_control%cutoff = tddfpt_control%mgrid_cutoff
523  qs_control%progression_factor = tddfpt_control%mgrid_progression_factor
524  qs_control%relative_cutoff = tddfpt_control%mgrid_relative_cutoff
525 
526  ALLOCATE (qs_control%e_cutoff(tddfpt_control%mgrid_ngrids))
527  ngrids = tddfpt_control%mgrid_ngrids
528  IF (ASSOCIATED(tddfpt_control%mgrid_e_cutoff)) THEN
529  ! following read_mgrid_section() there is a magic scale factor there (0.5_dp)
530  DO igrid = 1, ngrids
531  qs_control%e_cutoff(igrid) = tddfpt_control%mgrid_e_cutoff(igrid)*0.5_dp
532  END DO
533  ! ++ round 'qs_control%cutoff' upward to the nearest sub-grid's cutoff value;
534  ! here we take advantage of the fact that the array 'e_cutoff' has been sorted in descending order
535  DO igrid = ngrids, 1, -1
536  IF (qs_control%cutoff <= qs_control%e_cutoff(igrid)) THEN
537  qs_control%cutoff = qs_control%e_cutoff(igrid)
538  EXIT
539  END IF
540  END DO
541  ! igrid == 0 if qs_control%cutoff is larger than the largest manually provided cutoff value;
542  ! use the largest actual value
543  IF (igrid <= 0) &
544  qs_control%cutoff = qs_control%e_cutoff(1)
545  ELSE
546  qs_control%e_cutoff(1) = qs_control%cutoff
547  DO igrid = 2, ngrids
548  qs_control%e_cutoff(igrid) = qs_control%e_cutoff(igrid - 1)/qs_control%progression_factor
549  END DO
550  END IF
551 
552  CALL timestop(handle)
553  END SUBROUTINE init_tddfpt_mgrid
554 
555 ! **************************************************************************************************
556 !> \brief Restore the global multi-grid related parameters stored in the 'mgrid_saved' variable.
557 !> \param qs_control Quickstep control parameters (modified on exit)
558 !> \param mgrid_saved structure that holds global MGRID-related parameters
559 !> \par History
560 !> * 09.2016 created [Sergey Chulkov]
561 ! **************************************************************************************************
562  SUBROUTINE restore_qs_mgrid(qs_control, mgrid_saved)
563  TYPE(qs_control_type), POINTER :: qs_control
564  TYPE(mgrid_saved_parameters), INTENT(in) :: mgrid_saved
565 
566  CHARACTER(LEN=*), PARAMETER :: routinen = 'restore_qs_mgrid'
567 
568  INTEGER :: handle
569 
570  CALL timeset(routinen, handle)
571 
572  IF (ASSOCIATED(qs_control%e_cutoff)) &
573  DEALLOCATE (qs_control%e_cutoff)
574 
575  qs_control%commensurate_mgrids = mgrid_saved%commensurate_mgrids
576  qs_control%realspace_mgrids = mgrid_saved%realspace_mgrids
577  qs_control%skip_load_balance_distributed = mgrid_saved%skip_load_balance
578  qs_control%cutoff = mgrid_saved%cutoff
579  qs_control%progression_factor = mgrid_saved%progression_factor
580  qs_control%relative_cutoff = mgrid_saved%relative_cutoff
581  qs_control%e_cutoff => mgrid_saved%e_cutoff
582 
583  CALL timestop(handle)
584  END SUBROUTINE restore_qs_mgrid
585 
586 ! **************************************************************************************************
587 !> \brief Distribute atoms across the two-dimensional grid of processors.
588 !> \param distribution_2d new two-dimensional distribution of pairs of particles
589 !> (allocated and initialised on exit)
590 !> \param dbcsr_dist new DBCSR distribution (allocated and initialised on exit)
591 !> \param blacs_env BLACS parallel environment
592 !> \param qs_env Quickstep environment
593 !> \par History
594 !> * 09.2016 created [Sergey Chulkov]
595 !> * 01.2017 moved from qs_tddfpt2_methods [Sergey Chulkov]
596 ! **************************************************************************************************
597  SUBROUTINE tddfpt_build_distribution_2d(distribution_2d, dbcsr_dist, blacs_env, qs_env)
598  TYPE(distribution_2d_type), POINTER :: distribution_2d
599  TYPE(dbcsr_distribution_type), POINTER :: dbcsr_dist
600  TYPE(cp_blacs_env_type), POINTER :: blacs_env
601  TYPE(qs_environment_type), POINTER :: qs_env
602 
603  CHARACTER(LEN=*), PARAMETER :: routinen = 'tddfpt_build_distribution_2d'
604 
605  INTEGER :: handle
606  TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
607  TYPE(cell_type), POINTER :: cell
608  TYPE(molecule_kind_type), DIMENSION(:), POINTER :: molecule_kind_set
609  TYPE(molecule_type), DIMENSION(:), POINTER :: molecule_set
610  TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
611  TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
612  TYPE(section_vals_type), POINTER :: input
613 
614  CALL timeset(routinen, handle)
615 
616  CALL get_qs_env(qs_env, atomic_kind_set=atomic_kind_set, cell=cell, input=input, &
617  molecule_kind_set=molecule_kind_set, molecule_set=molecule_set, &
618  particle_set=particle_set, qs_kind_set=qs_kind_set)
619 
620  NULLIFY (distribution_2d)
621  CALL distribute_molecules_2d(cell=cell, &
622  atomic_kind_set=atomic_kind_set, &
623  particle_set=particle_set, &
624  qs_kind_set=qs_kind_set, &
625  molecule_kind_set=molecule_kind_set, &
626  molecule_set=molecule_set, &
627  distribution_2d=distribution_2d, &
628  blacs_env=blacs_env, &
629  force_env_section=input)
630 
631  ALLOCATE (dbcsr_dist)
632  CALL cp_dbcsr_dist2d_to_dist(distribution_2d, dbcsr_dist)
633 
634  CALL timestop(handle)
635  END SUBROUTINE tddfpt_build_distribution_2d
636 
637 ! **************************************************************************************************
638 !> \brief Build task and neighbour lists for the given plane wave environment and basis set.
639 !> \param task_list new task list (allocated and initialised on exit)
640 !> \param sab new list of neighbours (allocated and initialised on exit)
641 !> \param basis_type type of the basis set
642 !> \param distribution_2d two-dimensional distribution of pairs of particles
643 !> \param pw_env plane wave environment
644 !> \param qs_env Quickstep environment
645 !> \param soft_valid generate a task list for soft basis functions (GAPW, GAPW_XC)
646 !> \param skip_load_balance do not perform load balancing
647 !> \param reorder_grid_ranks re-optimise grid ranks and re-create the real-space grid descriptor
648 !> as well as grids
649 !> \par History
650 !> * 09.2016 created [Sergey Chulkov]
651 !> * 01.2017 moved from qs_tddfpt2_methods [Sergey Chulkov]
652 ! **************************************************************************************************
653  SUBROUTINE tddfpt_build_tasklist(task_list, sab, basis_type, distribution_2d, pw_env, qs_env, &
654  soft_valid, skip_load_balance, reorder_grid_ranks)
655  TYPE(task_list_type), POINTER :: task_list
656  TYPE(neighbor_list_set_p_type), DIMENSION(:), &
657  POINTER :: sab
658  CHARACTER(len=*), INTENT(in) :: basis_type
659  TYPE(distribution_2d_type), POINTER :: distribution_2d
660  TYPE(pw_env_type), POINTER :: pw_env
661  TYPE(qs_environment_type), POINTER :: qs_env
662  LOGICAL, INTENT(in) :: soft_valid, skip_load_balance, &
663  reorder_grid_ranks
664 
665  CHARACTER(LEN=*), PARAMETER :: routinen = 'tddfpt_build_tasklist'
666 
667  INTEGER :: handle, ikind, nkinds
668  LOGICAL, ALLOCATABLE, DIMENSION(:) :: orb_present
669  REAL(kind=dp) :: subcells
670  REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: orb_radius
671  REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: pair_radius
672  TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
673  TYPE(cell_type), POINTER :: cell
674  TYPE(distribution_1d_type), POINTER :: local_particles
675  TYPE(gto_basis_set_type), POINTER :: orb_basis_set
676  TYPE(local_atoms_type), ALLOCATABLE, DIMENSION(:) :: atom2d
677  TYPE(molecule_type), DIMENSION(:), POINTER :: molecule_set
678  TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
679  TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
680  TYPE(qs_ks_env_type), POINTER :: ks_env
681  TYPE(section_vals_type), POINTER :: input
682 
683  CALL timeset(routinen, handle)
684 
685  CALL get_qs_env(qs_env, atomic_kind_set=atomic_kind_set, cell=cell, input=input, &
686  ks_env=ks_env, local_particles=local_particles, molecule_set=molecule_set, &
687  particle_set=particle_set, qs_kind_set=qs_kind_set)
688 
689  nkinds = SIZE(atomic_kind_set)
690 
691  ALLOCATE (atom2d(nkinds))
692  CALL atom2d_build(atom2d, local_particles, distribution_2d, atomic_kind_set, &
693  molecule_set, molecule_only=.false., particle_set=particle_set)
694 
695  ALLOCATE (orb_present(nkinds))
696  ALLOCATE (orb_radius(nkinds))
697  ALLOCATE (pair_radius(nkinds, nkinds))
698 
699  DO ikind = 1, nkinds
700  CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set, basis_type=basis_type)
701  IF (ASSOCIATED(orb_basis_set)) THEN
702  orb_present(ikind) = .true.
703  CALL get_gto_basis_set(gto_basis_set=orb_basis_set, kind_radius=orb_radius(ikind))
704  ELSE
705  orb_present(ikind) = .false.
706  orb_radius(ikind) = 0.0_dp
707  END IF
708  END DO
709 
710  CALL pair_radius_setup(orb_present, orb_present, orb_radius, orb_radius, pair_radius)
711 
712  NULLIFY (sab)
713  CALL section_vals_val_get(input, "DFT%SUBCELLS", r_val=subcells)
714  CALL build_neighbor_lists(sab, particle_set, atom2d, cell, pair_radius, &
715  mic=.false., subcells=subcells, molecular=.false., nlname="sab_orb")
716 
717  CALL atom2d_cleanup(atom2d)
718  DEALLOCATE (atom2d, orb_present, orb_radius, pair_radius)
719 
720  CALL allocate_task_list(task_list)
721  CALL generate_qs_task_list(ks_env, task_list, &
722  reorder_rs_grid_ranks=reorder_grid_ranks, soft_valid=soft_valid, &
723  basis_type=basis_type, skip_load_balance_distributed=skip_load_balance, &
724  pw_env_external=pw_env, sab_orb_external=sab)
725 
726  CALL timestop(handle)
727  END SUBROUTINE tddfpt_build_tasklist
728 
729 ! **************************************************************************************************
730 !> \brief Create a DBCSR matrix based on a template matrix, distribution object, and the list of
731 !> neighbours.
732 !> \param matrix matrix to create
733 !> \param template template matrix
734 !> \param dbcsr_dist DBCSR distribution
735 !> \param sab list of neighbours
736 !> \par History
737 !> * 09.2016 created [Sergey Chulkov]
738 !> * 01.2017 moved from qs_tddfpt2_methods [Sergey Chulkov]
739 ! **************************************************************************************************
740  SUBROUTINE tddfpt_dbcsr_create_by_dist(matrix, template, dbcsr_dist, sab)
741  TYPE(dbcsr_type), POINTER :: matrix, template
742  TYPE(dbcsr_distribution_type), POINTER :: dbcsr_dist
743  TYPE(neighbor_list_set_p_type), DIMENSION(:), &
744  POINTER :: sab
745 
746  CHARACTER(LEN=*), PARAMETER :: routinen = 'tddfpt_dbcsr_create_by_dist'
747 
748  CHARACTER :: matrix_type
749  CHARACTER(len=default_string_length) :: matrix_name
750  INTEGER :: handle
751  INTEGER, DIMENSION(:), POINTER :: col_blk_sizes, row_blk_sizes
752 
753  CALL timeset(routinen, handle)
754 
755  cpassert(ASSOCIATED(template))
756  CALL dbcsr_get_info(template, row_blk_size=row_blk_sizes, col_blk_size=col_blk_sizes, &
757  name=matrix_name, matrix_type=matrix_type)
758 
759  IF (ASSOCIATED(matrix)) THEN
760  CALL dbcsr_release(matrix)
761  ELSE
762  ALLOCATE (matrix)
763  END IF
764 
765  CALL dbcsr_create(matrix, matrix_name, dbcsr_dist, matrix_type, row_blk_sizes, col_blk_sizes, nze=0)
766  CALL cp_dbcsr_alloc_block_from_nbl(matrix, sab)
767 
768  CALL timestop(handle)
769 
770  END SUBROUTINE tddfpt_dbcsr_create_by_dist
771 
772 ! **************************************************************************************************
773 !> \brief Replicate a globally distributed matrix across all sub-groups. At the end
774 !> every sub-group will hold a local copy of the original globally distributed matrix.
775 !>
776 !> |--------------------|
777 !> fm_src | 0 1 2 3 |
778 !> |--------------------|
779 !> / MPI ranks \
780 !> |/_ _\|
781 !> |--------------------| |--------------------|
782 !> fm_dest_subgroup0 | 0 1 | | 2 3 | fm_dest_subgroup1
783 !> |--------------------| |--------------------|
784 !> subgroup 0 subgroup 1
785 !>
786 !> \param fm_src globally distributed matrix to replicate
787 !> \param fm_dest_sub subgroup-specific copy of the replicated matrix
788 !> \param sub_env subgroup environment
789 !> \par History
790 !> * 09.2016 created [Sergey Chulkov]
791 !> * 01.2017 moved from qs_tddfpt2_methods [Sergey Chulkov]
792 ! **************************************************************************************************
793  SUBROUTINE tddfpt_fm_replicate_across_subgroups(fm_src, fm_dest_sub, sub_env)
794  TYPE(cp_fm_type), INTENT(IN) :: fm_src, fm_dest_sub
795  TYPE(tddfpt_subgroup_env_type), INTENT(in) :: sub_env
796 
797  CHARACTER(LEN=*), PARAMETER :: routinen = 'tddfpt_fm_replicate_across_subgroups'
798 
799  INTEGER :: handle, igroup, igroup_local, ncols_global_dest, ncols_global_src, ngroups, &
800  nrows_global_dest, nrows_global_src
801  TYPE(cp_blacs_env_type), POINTER :: blacs_env_global
802  TYPE(cp_fm_type) :: fm_null
803  TYPE(mp_para_env_type), POINTER :: para_env_global
804 
805  IF (sub_env%is_split) THEN
806  CALL timeset(routinen, handle)
807 
808  CALL cp_fm_get_info(fm_src, nrow_global=nrows_global_src, ncol_global=ncols_global_src, &
809  context=blacs_env_global, para_env=para_env_global)
810  CALL cp_fm_get_info(fm_dest_sub, nrow_global=nrows_global_dest, ncol_global=ncols_global_dest)
811 
812  IF (debug_this_module) THEN
813  cpassert(nrows_global_src == nrows_global_dest)
814  cpassert(ncols_global_src == ncols_global_dest)
815  END IF
816 
817  igroup_local = sub_env%group_distribution(para_env_global%mepos)
818  ngroups = sub_env%ngroups
819 
820  DO igroup = 0, ngroups - 1
821  IF (igroup == igroup_local) THEN
822  CALL cp_fm_copy_general(fm_src, fm_dest_sub, para_env_global)
823  ELSE
824  CALL cp_fm_copy_general(fm_src, fm_null, para_env_global)
825  END IF
826  END DO
827 
828  CALL timestop(handle)
829  END IF
831 END MODULE qs_tddfpt2_subgroups
832 
Types and set/get functions for auxiliary density matrix methods.
Definition: admm_types.F:15
subroutine, public get_admm_env(admm_env, mo_derivs_aux_fit, mos_aux_fit, sab_aux_fit, sab_aux_fit_asymm, sab_aux_fit_vs_orb, matrix_s_aux_fit, matrix_s_aux_fit_kp, matrix_s_aux_fit_vs_orb, matrix_s_aux_fit_vs_orb_kp, task_list_aux_fit, matrix_ks_aux_fit, matrix_ks_aux_fit_kp, matrix_ks_aux_fit_im, matrix_ks_aux_fit_dft, matrix_ks_aux_fit_hfx, matrix_ks_aux_fit_dft_kp, matrix_ks_aux_fit_hfx_kp, rho_aux_fit, rho_aux_fit_buffer, admm_dm)
Get routine for the ADMM env.
Definition: admm_types.F:593
Define the atomic kind types and their sub types.
subroutine, public get_gto_basis_set(gto_basis_set, name, aliases, norm_type, kind_radius, ncgf, nset, nsgf, cgf_symbol, sgf_symbol, norm_cgf, set_radius, lmax, lmin, lx, ly, lz, m, ncgf_set, npgf, nsgf_set, nshell, cphi, pgf_radius, sphi, scon, zet, first_cgf, first_sgf, l, last_cgf, last_sgf, n, gcc, maxco, maxl, maxpgf, maxsgf_set, maxshell, maxso, nco_sum, npgf_sum, nshell_sum, maxder, short_kind_radius)
...
Handles all functions related to the CELL.
Definition: cell_types.F:15
methods related to the blacs parallel environment
Definition: cp_blacs_env.F:15
subroutine, public cp_blacs_env_release(blacs_env)
releases the given blacs_env
Definition: cp_blacs_env.F:282
subroutine, public cp_blacs_env_create(blacs_env, para_env, blacs_grid_layout, blacs_repeatable, row_major, grid_2d)
allocates and initializes a type that represent a blacs context
Definition: cp_blacs_env.F:123
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
DBCSR operations in CP2K.
subroutine, public cp_dbcsr_dist2d_to_dist(dist2d, dist)
Creates a DBCSR distribution from a distribution_2d.
represent the structure of a full matrix
Definition: cp_fm_struct.F:14
subroutine, public cp_fm_struct_create(fmstruct, para_env, context, nrow_global, ncol_global, nrow_block, ncol_block, descriptor, first_p_pos, local_leading_dimension, template_fmstruct, square_blocks, force_block)
allocates and initializes a full matrix structure
Definition: cp_fm_struct.F:125
subroutine, public cp_fm_struct_release(fmstruct)
releases a full matrix structure
Definition: cp_fm_struct.F:320
represent a full matrix distributed on many processors
Definition: cp_fm_types.F:15
subroutine, public cp_fm_copy_general(source, destination, para_env)
General copy of a fm matrix to another fm matrix. Uses non-blocking MPI rather than ScaLAPACK.
Definition: cp_fm_types.F:1538
subroutine, public cp_fm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, nrow_locals, ncol_locals, matrix_struct, para_env)
returns all kind of information about the full matrix
Definition: cp_fm_types.F:1016
subroutine, public cp_fm_create(matrix, matrix_struct, name, use_sp)
creates a new full matrix with the given structure
Definition: cp_fm_types.F:167
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
stores a mapping of 2D info (e.g. matrix) on a 2D processor distribution (i.e. blacs grid) where cpus...
subroutine, public distribution_2d_release(distribution_2d)
...
Distribution methods for atoms, particles, or molecules.
subroutine, public distribute_molecules_2d(cell, atomic_kind_set, particle_set, qs_kind_set, molecule_kind_set, molecule_set, distribution_2d, blacs_env, force_env_section)
Distributes the particle pairs creating a 2d distribution optimally suited for quickstep.
subroutine, public init_coulomb_local(hartree_local, natom)
...
subroutine, public hartree_local_release(hartree_local)
...
subroutine, public hartree_local_create(hartree_local)
...
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public tddfpt_kernel_none
integer, parameter, public tddfpt_kernel_full
integer, parameter, public tddfpt_kernel_stda
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
Defines the basic variable types.
Definition: kinds.F:23
integer, parameter, public dp
Definition: kinds.F:34
integer, parameter, public default_string_length
Definition: kinds.F:57
Interface to the message passing library MPI.
subroutine, public mp_para_env_release(para_env)
releases the para object (to be called when you don't want anymore the shared copy of this object)
Define the molecule kind structure types and the corresponding functionality.
Define the data structure for the molecule information.
Define the data structure for the particle information.
methods of pw_env that have dependence on qs_env
subroutine, public pw_env_rebuild(pw_env, qs_env, external_para_env)
rebuilds the pw_env data (necessary if cell or cutoffs change)
subroutine, public pw_env_create(pw_env)
creates a pw_env, if qs_env is given calls pw_env_rebuild
container for various plainwaves related things
Definition: pw_env_types.F:14
subroutine, public pw_env_retain(pw_env)
retains the pw_env (see doc/ReferenceCounting.html)
Definition: pw_env_types.F:161
subroutine, public pw_env_release(pw_env, para_env)
releases the given pw_env (see doc/ReferenceCounting.html)
Definition: pw_env_types.F:176
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_RI_aux_kp, matrix_s, matrix_s_RI_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, WannierCentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, rhs)
Get the QUICKSTEP environment.
Define the quickstep kind type and their sub types.
Definition: qs_kind_types.F:23
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_r3d_rs_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, U_of_dft_plus_u, J_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, J0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, floating, name, element_symbol, pao_basis_size, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public local_rho_set_create(local_rho_set)
...
subroutine, public local_rho_set_release(local_rho_set)
...
Define the neighbor list data types and the corresponding functionality.
subroutine, public release_neighbor_list_sets(nlists)
releases an array of neighbor_list_sets
Generate the atomic neighbor lists.
subroutine, public atom2d_cleanup(atom2d)
free the internals of atom2d
subroutine, public pair_radius_setup(present_a, present_b, radius_a, radius_b, pair_radius, prmin)
...
subroutine, public build_neighbor_lists(ab_list, particle_set, atom, cell, pair_radius, subcells, mic, symmetric, molecular, subset_of_mol, current_subset, operator_type, nlname, atomb_to_keep)
Build simple pair neighbor lists.
subroutine, public atom2d_build(atom2d, distribution_1d, distribution_2d, atomic_kind_set, molecule_set, molecule_only, particle_set)
Build some distribution structure of atoms, refactored from build_qs_neighbor_lists.
subroutine, public rho0_s_grid_create(pw_env, rho0_mpole)
...
subroutine, public init_rho0(local_rho_set, qs_env, gapw_control, zcore)
...
subroutine, public allocate_rho_atom_internals(rho_atom_set, atomic_kind_set, qs_kind_set, dft_control, para_env)
...
subroutine, public tddfpt_sub_env_init(sub_env, qs_env, mos_occ, kernel)
Split MPI communicator to create a set of parallel (sub)groups.
subroutine, public tddfpt_sub_env_release(sub_env)
Release parallel group environment.
subroutine, public tddfpt_fm_replicate_across_subgroups(fm_src, fm_dest_sub, sub_env)
Replicate a globally distributed matrix across all sub-groups. At the end every sub-group will hold a...
subroutine, public tddfpt_dbcsr_create_by_dist(matrix, template, dbcsr_dist, sab)
Create a DBCSR matrix based on a template matrix, distribution object, and the list of neighbours.
generate the tasks lists used by collocate and integrate routines
subroutine, public generate_qs_task_list(ks_env, task_list, reorder_rs_grid_ranks, skip_load_balance_distributed, soft_valid, basis_type, pw_env_external, sab_orb_external)
...
types for task lists
subroutine, public deallocate_task_list(task_list)
deallocates the components and the object itself
subroutine, public allocate_task_list(task_list)
allocates and initialised the components of the task_list_type