(git:9111030)
Loading...
Searching...
No Matches
pao_param_gth.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 Parametrization based on GTH pseudo potentials
10!> \author Ole Schuett
11! **************************************************************************************************
16 USE cell_types, ONLY: cell_type,&
17 pbc
18 USE cp_dbcsr_api, ONLY: &
26 USE kinds, ONLY: dp
27 USE machine, ONLY: m_flush
34 USE pao_types, ONLY: pao_env_type
38 USE qs_kind_types, ONLY: get_qs_kind,&
41#include "./base/base_uses.f90"
42
43 IMPLICIT NONE
44
45 PRIVATE
46
49
50CONTAINS
51
52! **************************************************************************************************
53!> \brief Initialize the linear potential parametrization
54!> \param pao ...
55!> \param qs_env ...
56! **************************************************************************************************
57 SUBROUTINE pao_param_init_gth(pao, qs_env)
58 TYPE(pao_env_type), POINTER :: pao
59 TYPE(qs_environment_type), POINTER :: qs_env
60
61 CHARACTER(len=*), PARAMETER :: routinen = 'pao_param_init_gth'
62
63 INTEGER :: acol, arow, handle, iatom, idx, ikind, &
64 iterm, jatom, maxl, n, natoms
65 INTEGER, DIMENSION(:), POINTER :: blk_sizes_pri, col_blk_size, nterms, &
66 row_blk_size
67 REAL(dp), DIMENSION(:, :), POINTER :: block_v_term, vec_v_terms
68 TYPE(dbcsr_iterator_type) :: iter
69 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s
70 TYPE(pao_potential_type), DIMENSION(:), POINTER :: pao_potentials
71 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
72 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
73
74 CALL timeset(routinen, handle)
75
76 CALL get_qs_env(qs_env, &
77 natom=natoms, &
78 matrix_s=matrix_s, &
79 qs_kind_set=qs_kind_set, &
80 particle_set=particle_set)
81
82 maxl = 0
83 ALLOCATE (row_blk_size(natoms), col_blk_size(natoms), nterms(natoms))
84 DO iatom = 1, natoms
85 CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
86 CALL pao_param_count_gth(qs_env, ikind, nterms(iatom))
87 CALL get_qs_kind(qs_kind_set(ikind), pao_potentials=pao_potentials)
88 cpassert(SIZE(pao_potentials) == 1)
89 maxl = max(maxl, pao_potentials(1)%maxl)
90 END DO
91 CALL init_orbital_pointers(maxl) ! needs to be called before gth_calc_term()
92
93 ! allocate matrix_V_terms
94 CALL dbcsr_get_info(matrix_s(1)%matrix, row_blk_size=blk_sizes_pri)
95 col_blk_size = sum(nterms)
96 row_blk_size = blk_sizes_pri**2
97 CALL dbcsr_create(pao%matrix_V_terms, &
98 name="PAO matrix_V_terms", &
99 dist=pao%diag_distribution, &
100 matrix_type="N", &
101 row_blk_size=row_blk_size, &
102 col_blk_size=col_blk_size)
103 CALL dbcsr_reserve_diag_blocks(pao%matrix_V_terms)
104 CALL dbcsr_set(pao%matrix_V_terms, 0.0_dp)
105
106 ! calculate and store poential terms
107!$OMP PARALLEL DEFAULT(NONE) SHARED(pao,qs_env,blk_sizes_pri,natoms,nterms) &
108!$OMP PRIVATE(iter,arow,acol,iatom,jatom,N,idx,vec_V_terms,block_V_term)
109 CALL dbcsr_iterator_start(iter, pao%matrix_V_terms)
110 DO WHILE (dbcsr_iterator_blocks_left(iter))
111 CALL dbcsr_iterator_next_block(iter, arow, acol, vec_v_terms)
112 iatom = arow; cpassert(arow == acol)
113 n = blk_sizes_pri(iatom)
114 DO jatom = 1, natoms
115 IF (jatom == iatom) cycle ! waste some storage to simplify things later
116 DO iterm = 1, nterms(jatom)
117 idx = sum(nterms(1:jatom - 1)) + iterm
118 block_v_term(1:n, 1:n) => vec_v_terms(:, idx) ! map column into matrix
119 CALL gth_calc_term(qs_env, block_v_term, iatom, jatom, iterm)
120 END DO
121 END DO
122 END DO
123 CALL dbcsr_iterator_stop(iter)
124!$OMP END PARALLEL
125
126 IF (pao%precondition) THEN
127 CALL pao_param_gth_preconditioner(pao, qs_env, nterms)
128 END IF
129
130 DEALLOCATE (row_blk_size, col_blk_size, nterms)
131 CALL timestop(handle)
132 END SUBROUTINE pao_param_init_gth
133
134! **************************************************************************************************
135!> \brief Finalize the GTH potential parametrization
136!> \param pao ...
137! **************************************************************************************************
139 TYPE(pao_env_type), POINTER :: pao
140
141 CALL dbcsr_release(pao%matrix_V_terms)
142 IF (pao%precondition) THEN
143 CALL dbcsr_release(pao%matrix_precon)
144 CALL dbcsr_release(pao%matrix_precon_inv)
145 END IF
146
147 END SUBROUTINE pao_param_finalize_gth
148
149! **************************************************************************************************
150!> \brief Builds the preconditioner matrix_precon and matrix_precon_inv
151!> \param pao ...
152!> \param qs_env ...
153!> \param nterms ...
154! **************************************************************************************************
155 SUBROUTINE pao_param_gth_preconditioner(pao, qs_env, nterms)
156 TYPE(pao_env_type), POINTER :: pao
157 TYPE(qs_environment_type), POINTER :: qs_env
158 INTEGER, DIMENSION(:), POINTER :: nterms
159
160 CHARACTER(len=*), PARAMETER :: routinen = 'pao_param_gth_preconditioner'
161
162 INTEGER :: acol, arow, handle, i, iatom, ioffset, &
163 j, jatom, joffset, m, n, natoms
164 LOGICAL :: arnoldi_converged, converged, found
165 REAL(dp) :: eval_max, eval_min
166 REAL(dp), DIMENSION(:, :), POINTER :: block, block_overlap, block_v_term
167 TYPE(dbcsr_iterator_type) :: iter
168 TYPE(dbcsr_type) :: matrix_gth_overlap
169 TYPE(ls_scf_env_type), POINTER :: ls_scf_env
170 TYPE(mp_comm_type) :: group
171
172 CALL timeset(routinen, handle)
173
174 CALL get_qs_env(qs_env, ls_scf_env=ls_scf_env)
175 CALL dbcsr_get_info(pao%matrix_V_terms, group=group)
176 natoms = SIZE(nterms)
177
178 CALL dbcsr_create(matrix_gth_overlap, &
179 template=pao%matrix_V_terms, &
180 matrix_type="N", &
181 row_blk_size=nterms, &
182 col_blk_size=nterms)
183 CALL dbcsr_reserve_all_blocks(matrix_gth_overlap)
184 CALL dbcsr_set(matrix_gth_overlap, 0.0_dp)
185
186 DO iatom = 1, natoms
187 DO jatom = 1, natoms
188 ioffset = sum(nterms(1:iatom - 1))
189 joffset = sum(nterms(1:jatom - 1))
190 n = nterms(iatom)
191 m = nterms(jatom)
192
193 ALLOCATE (block(n, m))
194 block = 0.0_dp
195
196 ! can't use OpenMP here block is a pointer and hence REDUCTION(+:block) does work
197 CALL dbcsr_iterator_start(iter, pao%matrix_V_terms)
198 DO WHILE (dbcsr_iterator_blocks_left(iter))
199 CALL dbcsr_iterator_next_block(iter, arow, acol, block_v_term)
200 cpassert(arow == acol)
201 DO i = 1, n
202 DO j = 1, m
203 block(i, j) = block(i, j) + sum(block_v_term(:, ioffset + i)*block_v_term(:, joffset + j))
204 END DO
205 END DO
206 END DO
207 CALL dbcsr_iterator_stop(iter)
208
209 CALL group%sum(block)
210
211 CALL dbcsr_get_block_p(matrix=matrix_gth_overlap, row=iatom, col=jatom, block=block_overlap, found=found)
212 IF (ASSOCIATED(block_overlap)) THEN
213 block_overlap = block
214 END IF
215
216 DEALLOCATE (block)
217 END DO
218 END DO
219
220 !TODO: good setting for arnoldi?
221 CALL arnoldi_extremal(matrix_gth_overlap, eval_max, eval_min, max_iter=100, &
222 threshold=1e-2_dp, converged=arnoldi_converged)
223 IF (pao%iw > 0) WRITE (pao%iw, *) "PAO| GTH-preconditioner converged, min, max, max/min:", &
224 arnoldi_converged, eval_min, eval_max, eval_max/eval_min
225
226 CALL dbcsr_create(pao%matrix_precon, template=matrix_gth_overlap)
227 CALL dbcsr_create(pao%matrix_precon_inv, template=matrix_gth_overlap)
228
229 CALL matrix_sqrt_newton_schulz(pao%matrix_precon_inv, pao%matrix_precon, matrix_gth_overlap, &
230 threshold=ls_scf_env%eps_filter, &
231 order=ls_scf_env%s_sqrt_order, &
232 max_iter_lanczos=ls_scf_env%max_iter_lanczos, &
233 eps_lanczos=ls_scf_env%eps_lanczos, &
234 converged=converged)
235 CALL dbcsr_release(matrix_gth_overlap)
236
237 IF (.NOT. converged) THEN
238 cpabort("PAO: Sqrt of GTH-preconditioner did not converge.")
239 END IF
240
241 CALL timestop(handle)
242 END SUBROUTINE pao_param_gth_preconditioner
243
244! **************************************************************************************************
245!> \brief Takes current matrix_X and calculates the matrices A and B.
246!> \param pao ...
247!> \param qs_env ...
248!> \param ls_scf_env ...
249!> \param gradient ...
250!> \param penalty ...
251! **************************************************************************************************
252 SUBROUTINE pao_calc_ab_gth(pao, qs_env, ls_scf_env, gradient, penalty)
253 TYPE(pao_env_type), POINTER :: pao
254 TYPE(qs_environment_type), POINTER :: qs_env
255 TYPE(ls_scf_env_type), TARGET :: ls_scf_env
256 LOGICAL, INTENT(IN) :: gradient
257 REAL(dp), INTENT(INOUT), OPTIONAL :: penalty
258
259 CHARACTER(len=*), PARAMETER :: routinen = 'pao_calc_AB_gth'
260
261 INTEGER :: handle
262 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s
263 TYPE(dbcsr_type) :: matrix_m, matrix_u
264
265 CALL timeset(routinen, handle)
266 CALL get_qs_env(qs_env, matrix_s=matrix_s)
267 CALL dbcsr_create(matrix_u, matrix_type="N", dist=pao%diag_distribution, template=matrix_s(1)%matrix)
268 CALL dbcsr_reserve_diag_blocks(matrix_u)
269
270 !TODO: move this condition into pao_calc_U, use matrix_N as template
271 IF (gradient) THEN
272 CALL pao_calc_grad_lnv_wrt_u(qs_env, ls_scf_env, matrix_m)
273 CALL pao_calc_u_gth(pao, matrix_u, matrix_m, pao%matrix_G, penalty)
274 CALL dbcsr_release(matrix_m)
275 ELSE
276 CALL pao_calc_u_gth(pao, matrix_u, penalty=penalty)
277 END IF
278
279 CALL pao_calc_ab_from_u(pao, qs_env, ls_scf_env, matrix_u)
280 CALL dbcsr_release(matrix_u)
281 CALL timestop(handle)
282 END SUBROUTINE pao_calc_ab_gth
283
284! **************************************************************************************************
285!> \brief Calculate new matrix U and optinally its gradient G
286!> \param pao ...
287!> \param matrix_U ...
288!> \param matrix_M1 ...
289!> \param matrix_G ...
290!> \param penalty ...
291! **************************************************************************************************
292 SUBROUTINE pao_calc_u_gth(pao, matrix_U, matrix_M1, matrix_G, penalty)
293 TYPE(pao_env_type), POINTER :: pao
294 TYPE(dbcsr_type) :: matrix_u
295 TYPE(dbcsr_type), OPTIONAL :: matrix_m1, matrix_g
296 REAL(dp), INTENT(INOUT), OPTIONAL :: penalty
297
298 CHARACTER(len=*), PARAMETER :: routinen = 'pao_calc_U_gth'
299
300 INTEGER :: acol, arow, handle, iatom, idx, iterm, &
301 n, natoms
302 INTEGER, DIMENSION(:), POINTER :: nterms
303 LOGICAL :: found
304 REAL(dp), ALLOCATABLE, DIMENSION(:) :: gaps
305 REAL(dp), DIMENSION(:), POINTER :: world_g, world_x
306 REAL(dp), DIMENSION(:, :), POINTER :: block_g, block_m1, block_m2, block_u, &
307 block_v, block_v_term, block_x, &
308 vec_v_terms
309 TYPE(dbcsr_iterator_type) :: iter
310 TYPE(mp_comm_type) :: group
311
312 CALL timeset(routinen, handle)
313
314 CALL dbcsr_get_info(pao%matrix_X, row_blk_size=nterms, group=group)
315 natoms = SIZE(nterms)
316 ALLOCATE (gaps(natoms))
317 gaps(:) = huge(dp)
318
319 ! allocate arrays for world-view
320 ALLOCATE (world_x(sum(nterms)), world_g(sum(nterms)))
321 world_x = 0.0_dp; world_g = 0.0_dp
322
323 ! collect world_X from atomic blocks
324 CALL dbcsr_iterator_start(iter, pao%matrix_X)
325 DO WHILE (dbcsr_iterator_blocks_left(iter))
326 CALL dbcsr_iterator_next_block(iter, arow, acol, block_x)
327 iatom = arow; cpassert(arow == acol)
328 idx = sum(nterms(1:iatom - 1))
329 world_x(idx + 1:idx + nterms(iatom)) = block_x(:, 1)
330 END DO
331 CALL dbcsr_iterator_stop(iter)
332 CALL group%sum(world_x) ! sync world view across MPI ranks
333
334 ! loop over atoms
335 CALL dbcsr_iterator_start(iter, matrix_u)
336 DO WHILE (dbcsr_iterator_blocks_left(iter))
337 CALL dbcsr_iterator_next_block(iter, arow, acol, block_u)
338 iatom = arow; cpassert(arow == acol)
339 n = SIZE(block_u, 1)
340 CALL dbcsr_get_block_p(matrix=pao%matrix_V_terms, row=iatom, col=iatom, block=vec_v_terms, found=found)
341 cpassert(ASSOCIATED(vec_v_terms))
342
343 ! calculate potential V of i'th atom
344 ALLOCATE (block_v(n, n))
345 block_v = 0.0_dp
346 DO iterm = 1, SIZE(world_x)
347 block_v_term(1:n, 1:n) => vec_v_terms(:, iterm) ! map column into matrix
348 block_v = block_v + world_x(iterm)*block_v_term
349 END DO
350
351 ! calculate gradient block of i'th atom
352 IF (.NOT. PRESENT(matrix_g)) THEN
353 CALL pao_calc_u_block_fock(pao, iatom=iatom, penalty=penalty, v=block_v, u=block_u, gap=gaps(iatom))
354
355 ELSE ! TURNING POINT (if calc grad) ------------------------------------
356 cpassert(PRESENT(matrix_m1))
357 CALL dbcsr_get_block_p(matrix=matrix_m1, row=iatom, col=iatom, block=block_m1, found=found)
358 ALLOCATE (block_m2(n, n))
359 CALL pao_calc_u_block_fock(pao, iatom=iatom, penalty=penalty, v=block_v, u=block_u, &
360 m1=block_m1, g=block_m2, gap=gaps(iatom))
361 DO iterm = 1, SIZE(world_g)
362 block_v_term(1:n, 1:n) => vec_v_terms(:, iterm) ! map column into matrix
363 world_g(iterm) = world_g(iterm) + sum(block_v_term*block_m2)
364 END DO
365 DEALLOCATE (block_m2)
366 END IF
367 DEALLOCATE (block_v)
368 END DO
369 CALL dbcsr_iterator_stop(iter)
370
371 ! distribute world_G across atomic blocks
372 IF (PRESENT(matrix_g)) THEN
373 CALL group%sum(world_g) ! sync world view across MPI ranks
374 CALL dbcsr_iterator_start(iter, matrix_g)
375 DO WHILE (dbcsr_iterator_blocks_left(iter))
376 CALL dbcsr_iterator_next_block(iter, arow, acol, block_g)
377 iatom = arow; cpassert(arow == acol)
378 idx = sum(nterms(1:iatom - 1))
379 block_g(:, 1) = world_g(idx + 1:idx + nterms(iatom))
380 END DO
381 CALL dbcsr_iterator_stop(iter)
382 END IF
383
384 DEALLOCATE (world_x, world_g)
385
386 ! sum penalty energies across ranks
387 IF (PRESENT(penalty)) THEN
388 CALL group%sum(penalty)
389 END IF
390
391 ! print homo-lumo gap encountered by fock-layer
392 CALL group%min(gaps)
393 IF (pao%iw_gap > 0) THEN
394 DO iatom = 1, natoms
395 WRITE (pao%iw_gap, *) "PAO| atom:", iatom, " fock gap:", gaps(iatom)
396 END DO
397 CALL m_flush(pao%iw_gap)
398 END IF
399
400 ! one-line summary
401 IF (pao%iw > 0) THEN
402 WRITE (pao%iw, "(A,E20.10,A,T71,I10)") " PAO| min_gap:", minval(gaps), " for atom:", minloc(gaps)
403 END IF
404
405 DEALLOCATE (gaps)
406 CALL timestop(handle)
407
408 END SUBROUTINE pao_calc_u_gth
409
410! **************************************************************************************************
411!> \brief Returns the number of parameters for given atomic kind
412!> \param qs_env ...
413!> \param ikind ...
414!> \param nparams ...
415! **************************************************************************************************
416 SUBROUTINE pao_param_count_gth(qs_env, ikind, nparams)
417 TYPE(qs_environment_type), POINTER :: qs_env
418 INTEGER, INTENT(IN) :: ikind
419 INTEGER, INTENT(OUT) :: nparams
420
421 INTEGER :: max_projector, maxl, ncombis
422 TYPE(pao_potential_type), DIMENSION(:), POINTER :: pao_potentials
423 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
424
425 CALL get_qs_env(qs_env, qs_kind_set=qs_kind_set)
426 CALL get_qs_kind(qs_kind_set(ikind), pao_potentials=pao_potentials)
427
428 IF (SIZE(pao_potentials) /= 1) THEN
429 cpabort("GTH parametrization requires exactly one PAO_POTENTIAL section per KIND")
430 END IF
431
432 max_projector = pao_potentials(1)%max_projector
433 maxl = pao_potentials(1)%maxl
434
435 IF (maxl < 0) THEN
436 cpabort("GTH parametrization requires non-negative PAO_POTENTIAL%MAXL")
437 END IF
438
439 IF (max_projector < 0) THEN
440 cpabort("GTH parametrization requires non-negative PAO_POTENTIAL%MAX_PROJECTOR")
441 END IF
442
443 IF (mod(maxl, 2) /= 0) THEN
444 cpabort("GTH parametrization requires even-numbered PAO_POTENTIAL%MAXL")
445 END IF
446
447 ncombis = (max_projector + 1)*(max_projector + 2)/2
448 nparams = ncombis*(maxl/2 + 1)
449
450 END SUBROUTINE pao_param_count_gth
451
452! **************************************************************************************************
453!> \brief Fills the given block_V with the requested potential term
454!> \param qs_env ...
455!> \param block_V ...
456!> \param iatom ...
457!> \param jatom ...
458!> \param kterm ...
459! **************************************************************************************************
460 SUBROUTINE gth_calc_term(qs_env, block_V, iatom, jatom, kterm)
461 TYPE(qs_environment_type), POINTER :: qs_env
462 REAL(dp), DIMENSION(:, :), INTENT(OUT) :: block_v
463 INTEGER, INTENT(IN) :: iatom, jatom, kterm
464
465 INTEGER :: c, ikind, jkind, lpot, max_l, min_l, &
466 pot_max_projector, pot_maxl
467 REAL(dp), DIMENSION(3) :: ra, rab, rb
468 REAL(kind=dp) :: pot_beta
469 TYPE(cell_type), POINTER :: cell
470 TYPE(gto_basis_set_type), POINTER :: basis_set
471 TYPE(pao_potential_type), DIMENSION(:), POINTER :: pao_potentials
472 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
473 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
474
475 CALL get_qs_env(qs_env, &
476 cell=cell, &
477 particle_set=particle_set, &
478 qs_kind_set=qs_kind_set)
479
480 ! get GTH-settings from remote atom
481 CALL get_atomic_kind(particle_set(jatom)%atomic_kind, kind_number=jkind)
482 CALL get_qs_kind(qs_kind_set(jkind), pao_potentials=pao_potentials)
483 cpassert(SIZE(pao_potentials) == 1)
484 pot_max_projector = pao_potentials(1)%max_projector
485 pot_maxl = pao_potentials(1)%maxl
486 pot_beta = pao_potentials(1)%beta
487
488 c = 0
489 outer: DO lpot = 0, pot_maxl, 2
490 DO max_l = 0, pot_max_projector
491 DO min_l = 0, max_l
492 c = c + 1
493 IF (c == kterm) EXIT outer
494 END DO
495 END DO
496 END DO outer
497
498 ! get basis-set of central atom
499 CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
500 CALL get_qs_kind(qs_kind_set(ikind), basis_set=basis_set)
501
502 ra = particle_set(iatom)%r
503 rb = particle_set(jatom)%r
504 rab = pbc(ra, rb, cell)
505
506 block_v = 0.0_dp
507 CALL pao_calc_gaussian(basis_set, block_v, rab=rab, lpot=lpot, &
508 min_l=min_l, max_l=max_l, beta=pot_beta, weight=1.0_dp)
509
510 END SUBROUTINE gth_calc_term
511
512! **************************************************************************************************
513!> \brief Calculate initial guess for matrix_X
514!> \param pao ...
515! **************************************************************************************************
517 TYPE(pao_env_type), POINTER :: pao
518
519 INTEGER :: acol, arow
520 REAL(dp), DIMENSION(:, :), POINTER :: block_x
521 TYPE(dbcsr_iterator_type) :: iter
522
523!$OMP PARALLEL DEFAULT(NONE) SHARED(pao) &
524!$OMP PRIVATE(iter,arow,acol,block_X)
525 CALL dbcsr_iterator_start(iter, pao%matrix_X)
526 DO WHILE (dbcsr_iterator_blocks_left(iter))
527 CALL dbcsr_iterator_next_block(iter, arow, acol, block_x)
528 cpassert(arow == acol)
529 cpassert(SIZE(block_x, 2) == 1)
530
531 ! a simplistic guess, which at least makes the atom visible to others
532 block_x = 0.0_dp
533 block_x(1, 1) = 0.01_dp
534 END DO
535 CALL dbcsr_iterator_stop(iter)
536!$OMP END PARALLEL
537
538 END SUBROUTINE pao_param_initguess_gth
539
540END MODULE pao_param_gth
static GRID_HOST_DEVICE int idx(const orbital a)
Return coset index of given orbital angular momentum.
arnoldi iteration using dbcsr
Definition arnoldi_api.F:16
subroutine, public arnoldi_extremal(matrix_a, max_ev, min_ev, converged, threshold, max_iter)
simple wrapper to estimate extremal eigenvalues with arnoldi, using the old lanczos interface this hi...
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
Handles all functions related to the CELL.
Definition cell_types.F:15
logical function, public dbcsr_iterator_blocks_left(iterator)
...
subroutine, public dbcsr_iterator_stop(iterator)
...
subroutine, public dbcsr_get_block_p(matrix, row, col, block, found, row_size, col_size)
...
subroutine, public dbcsr_get_info(matrix, nblkrows_total, nblkcols_total, nfullrows_total, nfullcols_total, nblkrows_local, nblkcols_local, nfullrows_local, nfullcols_local, my_prow, my_pcol, local_rows, local_cols, proc_row_dist, proc_col_dist, row_blk_size, col_blk_size, row_blk_offset, col_blk_offset, distribution, name, matrix_type, group)
...
subroutine, public dbcsr_iterator_next_block(iterator, row, column, block, block_number_argument_has_been_removed, row_size, col_size, row_offset, col_offset, transposed)
...
subroutine, public dbcsr_iterator_start(iterator, matrix, shared, dynamic, dynamic_byrows)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_release(matrix)
...
subroutine, public dbcsr_reserve_all_blocks(matrix)
Reserves all blocks.
subroutine, public dbcsr_reserve_diag_blocks(matrix)
Reserves all diagonal blocks.
Types needed for a linear scaling quickstep SCF run based on the density matrix.
Routines useful for iterative matrix calculations.
subroutine, public matrix_sqrt_newton_schulz(matrix_sqrt, matrix_sqrt_inv, matrix, threshold, order, eps_lanczos, max_iter_lanczos, symmetrize, converged, iounit)
compute the sqrt of a matrix via the sign function and the corresponding Newton-Schulz iterations the...
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Machine interface based on Fortran 2003 and POSIX.
Definition machine.F:17
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
Definition machine.F:124
Interface to the message passing library MPI.
Provides Cartesian and spherical orbital pointers and indices.
subroutine, public init_orbital_pointers(maxl)
Initialize or update the orbital pointers.
Common framework for using eigenvectors of a Fock matrix as PAO basis.
subroutine, public pao_calc_u_block_fock(pao, iatom, v, u, penalty, gap, evals, m1, g)
Calculate new matrix U and optinally its gradient G.
Parametrization based on GTH pseudo potentials.
subroutine, public pao_calc_ab_gth(pao, qs_env, ls_scf_env, gradient, penalty)
Takes current matrix_X and calculates the matrices A and B.
subroutine, public pao_param_initguess_gth(pao)
Calculate initial guess for matrix_X.
subroutine, public pao_param_count_gth(qs_env, ikind, nparams)
Returns the number of parameters for given atomic kind.
subroutine, public pao_param_init_gth(pao, qs_env)
Initialize the linear potential parametrization.
subroutine, public pao_param_finalize_gth(pao)
Finalize the GTH potential parametrization.
Common routines for PAO parametrizations.
subroutine, public pao_calc_grad_lnv_wrt_u(qs_env, ls_scf_env, matrix_m_diag)
Helper routine, calculates partial derivative dE/dU.
subroutine, public pao_calc_ab_from_u(pao, qs_env, ls_scf_env, matrix_u_diag)
Takes current matrix_X and calculates the matrices A and B.
Factory routines for potentials used e.g. by pao_param_exp and pao_ml.
subroutine, public pao_calc_gaussian(basis_set, block_v, block_d, rab, lpot, beta, weight, min_shell, max_shell, min_l, max_l)
Calculates potential term of the form r**lpot * Exp(-beta*r**2) One needs to call init_orbital_pointe...
Types used by the PAO machinery.
Definition pao_types.F:12
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, 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, 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, monovalent, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
Holds information about a PAO potential.
Provides all information about a quickstep kind.