(git:27c966b)
Loading...
Searching...
No Matches
gw_ri_rs_small_cell_full_kp_lattice.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief RI lattice matrices, real-space cells and data distribution shared by χ, W, Σ and the
10!> Gamma correction of periodic RI-RS GW.
11!> \author Jan Wilhelm (with help of ChatGPT, GPT-6 Sol and GPT-6 Astra)
12! **************************************************************************************************
16 USE cp_cfm_types, ONLY: cp_cfm_get_info,&
18 USE cp_dbcsr_api, ONLY: dbcsr_create,&
23 dbcsr_type_no_symmetry
29 USE cp_fm_types, ONLY: cp_fm_create,&
36 USE kinds, ONLY: dp,&
37 dp_size,&
38 int_8
39 USE kpoint_types, ONLY: kpoint_type
40 USE mathconstants, ONLY: pi,&
41 twopi,&
42 z_zero
44 USE orbital_pointers, ONLY: indco,&
45 ncoset
51 USE qs_kind_types, ONLY: get_qs_kind,&
62#include "./base/base_uses.f90"
63
64 IMPLICIT NONE
65 PRIVATE
66
67 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'gw_ri_rs_small_cell_full_kp_lattice'
68
69 PUBLIC :: assemble_aa_contraction, &
76 real_bytes, &
79
80 ! Bytes per stored real and complex number.
81 REAL(kind=dp), PARAMETER :: real_bytes = real(dp_size, dp), complex_bytes = 2.0_dp*real_bytes
82
83CONTAINS
84
85! **************************************************************************************************
86!> \brief Assembles the q-independent, atom-diagonal AA contraction from stored coefficients.
87!> \param bs_env ...
88!> \param U_Pp Atom-diagonal reference-to-optimized AA contraction.
89! **************************************************************************************************
90 SUBROUTINE assemble_aa_contraction(bs_env, U_Pp)
91 TYPE(post_scf_bandstructure_type), POINTER :: bs_env
92 COMPLEX(KIND=dp), ALLOCATABLE, INTENT(OUT) :: u_pp(:, :)
93
94 CHARACTER(LEN=*), PARAMETER :: routinen = 'assemble_AA_contraction'
95
96 INTEGER :: first, first_opt, first_ref, handle, &
97 iatom, last, nopt, nref
98
99 CALL timeset(routinen, handle)
100
101 IF (.NOT. bs_env%auto_ri%ready .OR. &
102 .NOT. ALLOCATED(bs_env%auto_ri%sizes_ref_RI)) THEN
103 cpabort('Periodic AUTO_RI contraction is not initialized')
104 END IF
105 ALLOCATE (u_pp(sum(bs_env%auto_ri%sizes_ref_RI), &
106 sum(bs_env%auto_ri%sizes_opt_RI)), source=z_zero)
107 first_ref = 1
108 first_opt = 1
109 DO iatom = 1, bs_env%n_atom
110 nref = bs_env%auto_ri%sizes_ref_RI(iatom)
111 nopt = bs_env%auto_ri%sizes_opt_RI(iatom)
112 first = bs_env%auto_ri%U_Pp_atom_offset(iatom)
113 last = first + nref*nopt - 1
114 u_pp(first_ref:first_ref + nref - 1, first_opt:first_opt + nopt - 1) = &
115 reshape(bs_env%auto_ri%U_Pp_atom(first:last), [nref, nopt])
116 first_ref = first_ref + nref
117 first_opt = first_opt + nopt
118 END DO
119 IF (any(sum(abs(u_pp)**2, dim=1) <= tiny(1.0_dp))) THEN
120 cpabort('Periodic AUTO_RI contraction has an empty optimized direction')
121 END IF
122
123 CALL timestop(handle)
124
125 END SUBROUTINE assemble_aa_contraction
126
127! **************************************************************************************************
128!> \brief Dense MO coefficients of the cyclically owned SCF k points (owner of k: MODULO(k-1, ranks)).
129!> The locally stored parts of the distributed matrices are summed to the owner in batches of
130!> k points: few large reductions instead of one global gather per k, and no rank stores the
131!> coefficients of k points it does not own.
132!> \param bs_env ...
133!> \param mo_coeff distributed MO coefficients per k point and spin
134!> \param coeff coeff(:, :, k_local, spin) for the owned k points
135! **************************************************************************************************
136 SUBROUTINE owned_mo_coefficients(bs_env, mo_coeff, coeff)
137 TYPE(post_scf_bandstructure_type), POINTER :: bs_env
138 TYPE(cp_cfm_type), DIMENSION(:, :), INTENT(IN) :: mo_coeff
139 COMPLEX(KIND=dp), ALLOCATABLE, INTENT(OUT) :: coeff(:, :, :, :)
140
141 CHARACTER(LEN=*), PARAMETER :: routinen = 'owned_mo_coefficients'
142 REAL(kind=dp), PARAMETER :: batch_bytes = 128.0e6_dp
143
144 COMPLEX(KIND=dp), ALLOCATABLE :: batch(:, :, :)
145 INTEGER :: batch_size, first_owned, handle, &
146 i_batch, ikp, ispin, n_ao, n_batch, &
147 n_k, n_mo, n_owned, num_pe, root_rank
148
149 CALL timeset(routinen, handle)
150
151 n_k = SIZE(mo_coeff, 1)
152 num_pe = bs_env%para_env%num_pe
153 CALL cp_cfm_get_info(mo_coeff(1, 1), nrow_global=n_ao, ncol_global=n_mo)
154 ALLOCATE (coeff(n_ao, n_mo, (n_k + num_pe - 1 - bs_env%para_env%mepos)/num_pe, SIZE(mo_coeff, 2)))
155 batch_size = max(1, min((n_k + num_pe - 1)/num_pe, int(batch_bytes/(complex_bytes*real(n_ao*n_mo, dp)))))
156 ALLOCATE (batch(n_ao, n_mo, batch_size))
157 DO ispin = 1, SIZE(mo_coeff, 2)
158 DO root_rank = 0, min(num_pe, n_k) - 1
159 n_owned = (n_k - root_rank - 1)/num_pe + 1
160 DO first_owned = 1, n_owned, batch_size
161 n_batch = min(batch_size, n_owned - first_owned + 1)
162 DO i_batch = 1, n_batch
163 ikp = root_rank + 1 + (first_owned + i_batch - 2)*num_pe
164 CALL copy_local_cfm(mo_coeff(ikp, ispin), batch(:, :, i_batch))
165 END DO
166 CALL bs_env%para_env%sum(batch(:, :, 1:n_batch), root_rank)
167 IF (root_rank == bs_env%para_env%mepos) THEN
168 coeff(:, :, first_owned:first_owned + n_batch - 1, ispin) = batch(:, :, 1:n_batch)
169 END IF
170 END DO
171 END DO
172 END DO
173 DEALLOCATE (batch)
174
175 CALL timestop(handle)
176
177 END SUBROUTINE owned_mo_coefficients
178
179! **************************************************************************************************
180!> \brief Copy the locally owned elements of a distributed complex full matrix.
181!> \param cfm ...
182!> \param array ...
183! **************************************************************************************************
184 SUBROUTINE copy_local_cfm(cfm, array)
185 TYPE(cp_cfm_type) :: cfm
186 COMPLEX(KIND=dp), DIMENSION(:, :), INTENT(OUT) :: array
187
188 INTEGER :: col, i_col, i_row, ncol_local, &
189 nrow_local, row
190 INTEGER, DIMENSION(:), POINTER :: col_indices, row_indices
191
192 CALL cp_cfm_get_info(cfm, nrow_local=nrow_local, ncol_local=ncol_local, &
193 row_indices=row_indices, col_indices=col_indices)
194 array = z_zero
195 DO i_col = 1, ncol_local
196 col = col_indices(i_col)
197 DO i_row = 1, nrow_local
198 row = row_indices(i_row)
199 array(row, col) = cfm%local_data(i_row, i_col)
200 END DO
201 END DO
202 END SUBROUTINE copy_local_cfm
203
204! **************************************************************************************************
205!> \brief Construct a complete cell grid dual to the uniform SCF k-point mesh.
206!> \param bs_env ...
207!> \param index_to_cell ...
208! **************************************************************************************************
209 SUBROUTINE build_full_cell_grid(bs_env, index_to_cell)
210 TYPE(post_scf_bandstructure_type), POINTER :: bs_env
211 INTEGER, ALLOCATABLE, INTENT(OUT) :: index_to_cell(:, :)
212
213 INTEGER :: cell(3), i1, i2, i3, i_cell, &
214 i_direction, lower(3), upper(3)
215
216 DO i_direction = 1, 3
217 lower(i_direction) = -bs_env%kpoints_scf_desymm%nkp_grid(i_direction)/2
218 upper(i_direction) = lower(i_direction) + &
219 bs_env%kpoints_scf_desymm%nkp_grid(i_direction) - 1
220 END DO
221 ALLOCATE (index_to_cell(3, product(bs_env%kpoints_scf_desymm%nkp_grid)))
222 i_cell = 0
223 DO i1 = lower(1), upper(1)
224 DO i2 = lower(2), upper(2)
225 DO i3 = lower(3), upper(3)
226 i_cell = i_cell + 1
227 cell = [i1, i2, i3]
228 index_to_cell(:, i_cell) = cell
229 END DO
230 END DO
231 END DO
232
233 END SUBROUTINE build_full_cell_grid
234
235! **************************************************************************************************
236!> \brief Zero-wave-vector Fourier value of the selected RI metric kernel.
237!> \param bs_env ...
238!> \return ...
239! **************************************************************************************************
240 FUNCTION ri_metric_head_zero(bs_env) RESULT(head)
241 TYPE(post_scf_bandstructure_type), POINTER :: bs_env
242 REAL(kind=dp) :: head
243
244 IF (bs_env%ri_metric%potential_type == do_potential_short) THEN
245 IF (bs_env%ri_metric%omega <= 0.0_dp) THEN
246 cpabort('RI attenuation must be positive')
247 END IF
248 head = pi/bs_env%ri_metric%omega**2
249 ELSE
250 IF (bs_env%ri_metric%potential_type /= do_potential_truncated) THEN
251 cpabort('Unsupported RI metric')
252 END IF
253 head = twopi*bs_env%ri_metric%cutoff_radius**2
254 END IF
255 END FUNCTION ri_metric_head_zero
256
257! **************************************************************************************************
258!> \brief Form distributed I_PQ(R) = (φ_P,0 | v | φ_Q,R) over every screened neighbor cell.
259!>
260!> The finite-range potential v and the Gaussian screening radii determine the cell set.
261!> No cell is dropped because it lies outside the SCF Born-von Karman cell. Each real matrix
262!> remains distributed over the existing RI matrix communicator; callers release fm_R.
263!> The reciprocal interaction is I_PQ(q) = sum_R exp(i q.R) I_PQ(R).
264!> \param fm_R ...
265!> \param cells ...
266!> \param potential ...
267!> \param regularization ...
268!> \param bs_env ...
269!> \param qs_env ...
270!> \param reference_basis ...
271! **************************************************************************************************
272 SUBROUTINE build_ri_2c_lattice(fm_R, cells, potential, regularization, bs_env, qs_env, reference_basis)
273 TYPE(cp_fm_type), ALLOCATABLE, INTENT(OUT) :: fm_r(:)
274 INTEGER, ALLOCATABLE, INTENT(OUT) :: cells(:, :)
275 TYPE(coulomb_operator_type), INTENT(IN) :: potential
276 REAL(kind=dp), INTENT(IN) :: regularization
277 TYPE(post_scf_bandstructure_type), POINTER :: bs_env
278 TYPE(qs_environment_type), POINTER :: qs_env
279 LOGICAL, INTENT(IN), OPTIONAL :: reference_basis
280
281 CHARACTER(LEN=*), PARAMETER :: routinen = 'build_ri_2c_lattice'
282
283 INTEGER :: bounds(3), cell_index(3), handle, icell, &
284 ix, iy, iz, ncells
285 INTEGER, ALLOCATABLE :: occupied(:, :, :), occupied_flat(:), &
286 sizes(:)
287 INTEGER, POINTER :: col_sizes(:), row_sizes(:)
288 LOGICAL :: use_reference_basis
289 TYPE(cp_blacs_env_type), POINTER :: blacs
290 TYPE(cp_fm_struct_type), POINTER :: reference_matrix_struct
291 TYPE(dbcsr_distribution_type) :: distribution
292 TYPE(dbcsr_type), ALLOCATABLE :: matrices(:)
293 TYPE(distribution_2d_type), POINTER :: dist_2d
294 TYPE(kpoint_type), POINTER :: kpoints_ptr
295 TYPE(kpoint_type), TARGET :: kpoints
296 TYPE(mp_para_env_type), POINTER :: para
297 TYPE(neighbor_list_iterator_p_type), POINTER :: iterator(:)
298 TYPE(neighbor_list_set_p_type), POINTER :: neighbors(:)
299 TYPE(particle_type), POINTER :: particles(:)
300 TYPE(qs_kind_type), POINTER :: qs_kinds(:)
301
302 CALL timeset(routinen, handle)
303
304 use_reference_basis = .false.
305 IF (PRESENT(reference_basis)) use_reference_basis = reference_basis
306 NULLIFY (blacs, para, reference_matrix_struct)
307 CALL get_qs_env(qs_env, distribution_2d=dist_2d, particle_set=particles, qs_kind_set=qs_kinds, &
308 blacs_env=blacs, para_env=para)
309 ALLOCATE (sizes(bs_env%n_atom))
310 CALL get_particle_set(particles, qs_kinds, nsgf=sizes, basis=bs_env%basis_set_RI)
311 NULLIFY (neighbors, iterator)
312 CALL build_2c_neighbor_lists(neighbors, bs_env%basis_set_RI, bs_env%basis_set_RI, &
313 potential, "full_2c_RI", qs_env, sym_ij=.false., dist_2d=dist_2d)
314 bounds = 0
315 CALL neighbor_list_iterator_create(iterator, neighbors)
316 DO WHILE (neighbor_list_iterate(iterator) == 0)
317 CALL get_iterator_info(iterator, cell=cell_index)
318 bounds = max(bounds, abs(cell_index))
319 END DO
320 CALL neighbor_list_iterator_release(iterator)
321 CALL bs_env%para_env%max(bounds)
322 ALLOCATE (occupied(-bounds(1):bounds(1), -bounds(2):bounds(2), -bounds(3):bounds(3)))
323 occupied = 0
324 CALL neighbor_list_iterator_create(iterator, neighbors)
325 DO WHILE (neighbor_list_iterate(iterator) == 0)
326 CALL get_iterator_info(iterator, cell=cell_index)
327 occupied(cell_index(1), cell_index(2), cell_index(3)) = 1
328 END DO
329 CALL neighbor_list_iterator_release(iterator)
330 ALLOCATE (occupied_flat(SIZE(occupied)))
331 occupied_flat(:) = reshape(occupied, [SIZE(occupied)])
332 CALL bs_env%para_env%max(occupied_flat)
333 occupied(:, :, :) = reshape(occupied_flat, shape(occupied))
334 DEALLOCATE (occupied_flat)
335 ncells = sum(occupied)
336 cpassert(ncells > 0)
337 ALLOCATE (cells(3, ncells), fm_r(ncells))
338 ALLOCATE (kpoints%cell_to_index(-bounds(1):bounds(1), -bounds(2):bounds(2), -bounds(3):bounds(3)))
339 kpoints%cell_to_index = 0
340 icell = 0
341 DO ix = -bounds(1), bounds(1)
342 DO iy = -bounds(2), bounds(2)
343 DO iz = -bounds(3), bounds(3)
344 IF (occupied(ix, iy, iz) == 0) cycle
345 icell = icell + 1
346 cells(:, icell) = [ix, iy, iz]
347 kpoints%cell_to_index(ix, iy, iz) = icell
348 END DO
349 END DO
350 END DO
351 DEALLOCATE (occupied)
352 kpoints_ptr => kpoints
353 ALLOCATE (matrices(ncells))
354 CALL cp_dbcsr_dist2d_to_dist(dist_2d, distribution)
355 ALLOCATE (row_sizes(SIZE(sizes)), col_sizes(SIZE(sizes)))
356 row_sizes = sizes
357 col_sizes = sizes
358 CALL dbcsr_create(matrices(1), "full RI two-center", distribution, dbcsr_type_no_symmetry, row_sizes, col_sizes)
359 DEALLOCATE (row_sizes, col_sizes)
360 DO icell = 2, ncells
361 CALL dbcsr_create(matrices(icell), template=matrices(1))
362 END DO
363 CALL build_2c_integrals(matrices, 0.0_dp, qs_env, neighbors, bs_env%basis_set_RI, &
364 bs_env%basis_set_RI, potential, do_kpoints=.true., &
365 ext_kpoints=kpoints_ptr, regularization_ri=regularization)
366 DO icell = 1, ncells
367 IF (use_reference_basis) THEN
368 IF (.NOT. bs_env%auto_ri%enabled) THEN
369 cpabort('Reference RI lattice requires AUTO_RI')
370 END IF
371 IF (.NOT. ASSOCIATED(reference_matrix_struct)) THEN
372 CALL cp_fm_struct_create(reference_matrix_struct, context=blacs, nrow_global=sum(sizes), &
373 ncol_global=sum(sizes), para_env=para)
374 END IF
375 CALL cp_fm_create(fm_r(icell), reference_matrix_struct)
376 ELSE
377 CALL cp_fm_create(fm_r(icell), bs_env%fm_RI_RI%matrix_struct)
378 END IF
379 CALL copy_dbcsr_to_fm(matrices(icell), fm_r(icell))
380 CALL dbcsr_release(matrices(icell))
381 END DO
382 CALL dbcsr_distribution_release(distribution)
383 CALL release_neighbor_list_sets(neighbors)
384 IF (ASSOCIATED(reference_matrix_struct)) CALL cp_fm_struct_release(reference_matrix_struct)
385 DEALLOCATE (matrices, sizes, kpoints%cell_to_index)
386
387 CALL timestop(handle)
388
389 END SUBROUTINE build_ri_2c_lattice
390
391! **************************************************************************************************
392!> \brief Evaluate I_PQ(q) = sum_R exp(i q.R) I_PQ(R) collectively into an existing dense matrix.
393!>
394!> q is in reciprocal fractional coordinates, so q.R includes 2π. The real-space matrices
395!> stay distributed; no global RI-by-RI-by-cell array is replicated on the ranks.
396!> \param fm_R ...
397!> \param cells ...
398!> \param qpoint ...
399!> \param matrix_q ...
400! **************************************************************************************************
401 SUBROUTINE ri_2c_lattice_to_kp(fm_R, cells, qpoint, matrix_q)
402 TYPE(cp_fm_type), INTENT(IN) :: fm_r(:)
403 INTEGER, INTENT(IN) :: cells(:, :)
404 REAL(kind=dp), INTENT(IN) :: qpoint(3)
405 COMPLEX(KIND=dp), INTENT(OUT) :: matrix_q(:, :)
406
407 CHARACTER(LEN=*), PARAMETER :: routinen = 'ri_2c_lattice_to_kp'
408
409 COMPLEX(KIND=dp) :: phase
410 INTEGER :: handle, icell, icol, irow, ncols, nrows
411 INTEGER, POINTER :: cols(:), rows(:)
412
413 CALL timeset(routinen, handle)
414
415 cpassert(SIZE(fm_r) > 0)
416 cpassert(SIZE(cells, 1) == 3)
417 cpassert(SIZE(cells, 2) == SIZE(fm_r))
418 CALL cp_fm_get_info(fm_r(1), nrow_local=nrows, ncol_local=ncols, row_indices=rows, col_indices=cols)
419 matrix_q = z_zero
420 DO icell = 1, SIZE(fm_r)
421 phase = exp(cmplx(0.0_dp, twopi*dot_product(qpoint, real(cells(:, icell), dp)), dp))
422 DO icol = 1, ncols
423 DO irow = 1, nrows
424 matrix_q(rows(irow), cols(icol)) = matrix_q(rows(irow), cols(icol)) + &
425 phase*fm_r(icell)%local_data(irow, icol)
426 END DO
427 END DO
428 END DO
429 CALL fm_r(1)%matrix_struct%para_env%sum(matrix_q)
430
431 CALL timestop(handle)
432
433 END SUBROUTINE ri_2c_lattice_to_kp
434
435! **************************************************************************************************
436!> \brief Integrate each auxiliary function for the Gamma charge-mode projection.
437!> For a primitive x^(2m) exp(-α x²), I_0=sqrt(π/α), I_2m=(2m-1)I_(2m-2)/(2α).
438!> Odd Cartesian moments vanish; the existing spherical contraction supplies normalization.
439!> \param qs_env Atomic auxiliary bases.
440!> \param charge Integrals of the reference auxiliary functions.
441! **************************************************************************************************
442 SUBROUTINE gamma_auxiliary_charges(qs_env, charge)
443 TYPE(qs_environment_type), POINTER :: qs_env
444 COMPLEX(KIND=dp), INTENT(OUT) :: charge(:)
445
446 INTEGER :: first, iatom, ico, il, ipgf, iset, isgf, &
447 lmax, ncart, offset
448 REAL(kind=dp) :: alpha
449 REAL(kind=dp), ALLOCATABLE :: moments(:), primitive(:)
450 TYPE(gto_basis_set_type), POINTER :: basis
451 TYPE(particle_type), POINTER :: particles(:)
452 TYPE(qs_kind_type), POINTER :: qs_kinds(:)
453
454 CALL get_qs_env(qs_env, particle_set=particles, qs_kind_set=qs_kinds)
455 charge = z_zero
456 first = 0
457 DO iatom = 1, SIZE(particles)
458 CALL get_qs_kind(qs_kinds(particles(iatom)%atomic_kind%kind_number), &
459 basis_set=basis, basis_type='RI_AUX')
460 DO iset = 1, basis%nset
461 lmax = basis%lmax(iset)
462 ncart = ncoset(lmax)
463 ALLOCATE (moments(0:lmax), primitive(ncart*basis%npgf(iset)))
464 primitive = 0.0_dp
465 DO ipgf = 1, basis%npgf(iset)
466 alpha = basis%zet(ipgf, iset)
467 moments = 0.0_dp
468 moments(0) = sqrt(pi/alpha)
469 DO il = 2, lmax, 2
470 moments(il) = real(il - 1, dp)*moments(il - 2)/(2.0_dp*alpha)
471 END DO
472 DO ico = ncoset(basis%lmin(iset) - 1) + 1, ncart
473 primitive((ipgf - 1)*ncart + ico) = product(moments(indco(:, ico)))
474 END DO
475 END DO
476 offset = basis%first_sgf(1, iset)
477 DO isgf = offset, offset + basis%nsgf_set(iset) - 1
478 charge(first + isgf) = cmplx(sum(basis%sphi(1:SIZE(primitive), isgf)*primitive), 0.0_dp, dp)
479 END DO
480 DEALLOCATE (moments, primitive)
481 END DO
482 first = first + basis%nsgf
483 END DO
484 cpassert(first == SIZE(charge))
485
486 END SUBROUTINE gamma_auxiliary_charges
487
488! **************************************************************************************************
489!> \brief Return the contiguous part of 1..n owned by one rank of a block distribution.
490!> \param n Number of distributed items (grid rows or ordered grid pairs).
491!> \param rank ...
492!> \param n_rank ...
493!> \param first First owned item.
494!> \param n_local Number of owned items.
495! **************************************************************************************************
496 PURE SUBROUTINE block_range(n, rank, n_rank, first, n_local)
497 INTEGER, INTENT(IN) :: n, rank, n_rank
498 INTEGER, INTENT(OUT) :: first, n_local
499
500 first = int(int(n, int_8)*rank/n_rank) + 1
501 n_local = int(int(n, int_8)*(rank + 1)/n_rank) - first + 1
502
503 END SUBROUTINE block_range
504
methods related to the blacs parallel environment
Represents a complex full matrix distributed on many processors.
subroutine, public cp_cfm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, matrix_struct, para_env)
Returns information about a full matrix.
subroutine, public dbcsr_distribution_release(dist)
...
subroutine, public dbcsr_release(matrix)
...
DBCSR operations in CP2K.
subroutine, public copy_dbcsr_to_fm(matrix, fm, plan, check_plan)
Copy a DBCSR matrix to a BLACS matrix.
subroutine, public cp_dbcsr_dist2d_to_dist(dist2d, dist)
Creates a DBCSR distribution from a distribution_2d.
represent the structure of a full matrix
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
subroutine, public cp_fm_struct_release(fmstruct)
releases a full matrix structure
represent a full matrix distributed on many processors
Definition cp_fm_types.F:15
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
subroutine, public cp_fm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
creates a new full matrix with the given structure
stores a mapping of 2D info (e.g. matrix) on a 2D processor distribution (i.e. blacs grid) where cpus...
RI lattice matrices, real-space cells and data distribution shared by χ, W, Σ and the Gamma correctio...
real(kind=dp) function, public ri_metric_head_zero(bs_env)
Zero-wave-vector Fourier value of the selected RI metric kernel.
subroutine, public build_ri_2c_lattice(fm_r, cells, potential, regularization, bs_env, qs_env, reference_basis)
Form distributed I_PQ(R) = (φ_P,0 | v | φ_Q,R) over every screened neighbor cell.
subroutine, public gamma_auxiliary_charges(qs_env, charge)
Integrate each auxiliary function for the Gamma charge-mode projection. For a primitive x^(2m) exp(-α...
pure subroutine, public block_range(n, rank, n_rank, first, n_local)
Return the contiguous part of 1..n owned by one rank of a block distribution.
subroutine, public assemble_aa_contraction(bs_env, u_pp)
Assembles the q-independent, atom-diagonal AA contraction from stored coefficients.
subroutine, public owned_mo_coefficients(bs_env, mo_coeff, coeff)
Dense MO coefficients of the cyclically owned SCF k points (owner of k: MODULO(k-1,...
subroutine, public ri_2c_lattice_to_kp(fm_r, cells, qpoint, matrix_q)
Evaluate I_PQ(q) = sum_R exp(i q.R) I_PQ(R) collectively into an existing dense matrix.
subroutine, public build_full_cell_grid(bs_env, index_to_cell)
Construct a complete cell grid dual to the uniform SCF k-point mesh.
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_potential_truncated
integer, parameter, public do_potential_short
Library choices for electronic integral APIs.
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public int_8
Definition kinds.F:54
integer, parameter, public dp_size
Definition kinds.F:36
integer, parameter, public dp
Definition kinds.F:34
Types and basic routines needed for a kpoint calculation.
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
real(kind=dp), parameter, public twopi
complex(kind=dp), parameter, public z_zero
Interface to the message passing library MPI.
Provides Cartesian and spherical orbital pointers and indices.
integer, dimension(:), allocatable, public ncoset
integer, dimension(:, :), allocatable, public indco
Define methods related to particle_type.
subroutine, public get_particle_set(particle_set, qs_kind_set, first_sgf, last_sgf, nsgf, nmao, basis, ncgf)
Get the components of a particle set.
Define the data structure for the particle information.
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, mimic, 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_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, 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, matrix_vhxc, 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, xcint_weights, 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, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_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, harris_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, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, cneo_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, 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_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, hund_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, proj_shell_charge, lr_atom, do_mtlr, u_j_loop, ao_coef, init_u_ramping_each_scf, reltmat, ghost, monovalent, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
Define the neighbor list data types and the corresponding functionality.
subroutine, public release_neighbor_list_sets(nlists)
releases an array of neighbor_list_sets
subroutine, public neighbor_list_iterator_create(iterator_set, nl, search, nthread)
Neighbor list iterator functions.
subroutine, public neighbor_list_iterator_release(iterator_set)
...
integer function, public neighbor_list_iterate(iterator_set, mepos)
...
subroutine, public get_iterator_info(iterator_set, mepos, ikind, jkind, nkind, ilist, nlist, inode, nnode, iatom, jatom, r, cell)
...
Utility methods to build 3-center integral tensors of various types.
Definition qs_tensors.F:11
subroutine, public build_2c_integrals(t2c, filter_eps, qs_env, nl_2c, basis_i, basis_j, potential_parameter, do_kpoints, do_hfx_kpoints, ext_kpoints, regularization_ri)
...
subroutine, public build_2c_neighbor_lists(ij_list, basis_i, basis_j, potential_parameter, name, qs_env, sym_ij, molecular, dist_2d, pot_to_rad)
Build 2-center neighborlists adapted to different operators This mainly wraps build_neighbor_lists fo...
Definition qs_tensors.F:138
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
Represent a complex full matrix.
keeps the information about the structure of a full matrix
represent a full matrix
distributes pairs on a 2d grid of processors
Contains information about kpoints.
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.