(git:15c7cac)
Loading...
Searching...
No Matches
qs_linres_issc_utils.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 Chemical shift calculation by dfpt
10!> Initialization of the issc_env, creation of the special neighbor lists
11!> Perturbation Hamiltonians by application of the p and rxp oprtators to psi0
12!> Write output
13!> Deallocate everything
14!> \note
15!> The psi0 should be localized
16!> the Sebastiani method works within the assumption that the orbitals are
17!> completely contained in the simulation box
18! **************************************************************************************************
22 USE cell_types, ONLY: cell_type,&
23 pbc
25 USE cp_dbcsr_api, ONLY: dbcsr_convert_offsets_to_sizes,&
30 dbcsr_set,&
31 dbcsr_type_antisymmetric,&
32 dbcsr_type_symmetric
42 USE cp_fm_types, ONLY: cp_fm_create,&
51 USE cp_output_handling, ONLY: cp_p_file,&
58 USE kinds, ONLY: default_string_length,&
59 dp
60 USE mathlib, ONLY: diamat_all
65 USE physcon, ONLY: a_fine,&
66 e_mass,&
67 hertz,&
68 p_mass
75 USE qs_linres_types, ONLY: get_issc_env,&
79 USE qs_mo_types, ONLY: get_mo_set,&
84#include "./base/base_uses.f90"
85
86 IMPLICIT NONE
87
88 PRIVATE
90
91 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_linres_issc_utils'
92
93CONTAINS
94
95! **************************************************************************************************
96!> \brief Initialize the issc environment
97!> \param issc_env ...
98!> \param p_env ...
99!> \param qs_env ...
100! **************************************************************************************************
101 SUBROUTINE issc_response(issc_env, p_env, qs_env)
102 !
103 TYPE(issc_env_type) :: issc_env
104 TYPE(qs_p_env_type) :: p_env
105 TYPE(qs_environment_type), POINTER :: qs_env
106
107 CHARACTER(LEN=*), PARAMETER :: routinen = 'issc_response'
108
109 INTEGER :: handle, idir, ijdir, ispin, jdir, nao, &
110 nmo, nspins, output_unit
111 LOGICAL :: do_dso, do_fc, do_pso, do_sd, should_stop
112 REAL(dp) :: chk, fro
113 TYPE(cp_fm_struct_type), POINTER :: tmp_fm_struct
114 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:) :: h1_psi0, psi0_order, psi1
115 TYPE(cp_fm_type), DIMENSION(:), POINTER :: fc_psi0, psi1_fc
116 TYPE(cp_fm_type), DIMENSION(:, :), POINTER :: dso_psi0, efg_psi0, psi1_dso, psi1_efg, &
117 psi1_pso, pso_psi0
118 TYPE(cp_fm_type), POINTER :: mo_coeff
119 TYPE(cp_logger_type), POINTER :: logger
120 TYPE(dft_control_type), POINTER :: dft_control
121 TYPE(linres_control_type), POINTER :: linres_control
122 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos
123 TYPE(mp_para_env_type), POINTER :: para_env
124 TYPE(qs_matrix_pools_type), POINTER :: mpools
125 TYPE(section_vals_type), POINTER :: issc_section, lr_section
126
127 CALL timeset(routinen, handle)
128 !
129 NULLIFY (dft_control, linres_control, lr_section, issc_section)
130 NULLIFY (logger, mpools, mo_coeff, para_env)
131 NULLIFY (tmp_fm_struct, psi1_fc, psi1_efg, psi1_pso, pso_psi0, fc_psi0, efg_psi0)
132
133 logger => cp_get_default_logger()
134 lr_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%LINRES")
135 issc_section => section_vals_get_subs_vals(qs_env%input, &
136 "PROPERTIES%LINRES%SPINSPIN")
137
138 output_unit = cp_print_key_unit_nr(logger, lr_section, "PRINT%PROGRAM_RUN_INFO", &
139 extension=".linresLog")
140 IF (output_unit > 0) THEN
141 WRITE (unit=output_unit, fmt="(T10,A,/)") &
142 "*** Self consistent optimization of the response wavefunctions ***"
143 END IF
144
145 CALL get_qs_env(qs_env=qs_env, &
146 dft_control=dft_control, &
147 mpools=mpools, &
148 linres_control=linres_control, &
149 mos=mos, &
150 para_env=para_env)
151
152 nspins = dft_control%nspins
153
154 CALL get_issc_env(issc_env=issc_env, &
155 !list_cubes=list_cubes, &
156 psi1_efg=psi1_efg, &
157 psi1_pso=psi1_pso, &
158 psi1_dso=psi1_dso, &
159 psi1_fc=psi1_fc, &
160 efg_psi0=efg_psi0, &
161 pso_psi0=pso_psi0, &
162 dso_psi0=dso_psi0, &
163 fc_psi0=fc_psi0, &
164 do_fc=do_fc, &
165 do_sd=do_sd, &
166 do_pso=do_pso, &
167 do_dso=do_dso)
168 !
169 ! allocate the vectors
170 ALLOCATE (psi0_order(nspins))
171 ALLOCATE (psi1(nspins), h1_psi0(nspins))
172 DO ispin = 1, nspins
173 CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff)
174 psi0_order(ispin) = mo_coeff
175 CALL cp_fm_get_info(mo_coeff, ncol_global=nmo, nrow_global=nao)
176 NULLIFY (tmp_fm_struct)
177 CALL cp_fm_struct_create(tmp_fm_struct, nrow_global=nao, &
178 ncol_global=nmo, &
179 context=mo_coeff%matrix_struct%context)
180 CALL cp_fm_create(psi1(ispin), tmp_fm_struct)
181 CALL cp_fm_create(h1_psi0(ispin), tmp_fm_struct)
182 CALL cp_fm_struct_release(tmp_fm_struct)
183 END DO
184 chk = 0.0_dp
185 should_stop = .false.
186 !
187 ! operator efg
188 IF (do_sd) THEN
189 ijdir = 0
190 DO idir = 1, 3
191 DO jdir = idir, 3
192 ijdir = ijdir + 1
193 DO ispin = 1, nspins
194 CALL cp_fm_set_all(psi1_efg(ispin, ijdir), 0.0_dp)
195 END DO
196 IF (output_unit > 0) THEN
197 WRITE (output_unit, "(T10,A)") "Response to the perturbation operator efg_"//achar(idir + 119)//achar(jdir + 119)
198 END IF
199 !
200 !Initial guess for psi1
201 DO ispin = 1, nspins
202 CALL cp_fm_set_all(psi1(ispin), 0.0_dp)
203 END DO
204 !
205 DO ispin = 1, nspins
206 CALL cp_fm_to_fm(efg_psi0(ispin, ijdir), h1_psi0(ispin))
207 END DO
208 !
209 !
210 linres_control%lr_triplet = .false.
211 linres_control%do_kernel = .false.
212 linres_control%converged = .false.
213 CALL linres_solver(p_env, qs_env, psi1, h1_psi0, psi0_order, output_unit, should_stop)
214 !
215 !
216 ! copy the response
217 DO ispin = 1, nspins
218 CALL cp_fm_to_fm(psi1(ispin), psi1_efg(ispin, ijdir))
219 fro = cp_fm_frobenius_norm(psi1(ispin))
220 chk = chk + fro
221 END DO
222 !
223 !
224 IF (output_unit > 0) THEN
225 WRITE (output_unit, "(T10,A)") "Write the resulting psi1 in restart file... not implemented yet"
226 END IF
227 !
228 ! Write the result in the restart file
229 END DO ! jdir
230 END DO ! idir
231 END IF
232 !
233 ! operator pso
234 IF (do_pso) THEN
235 DO idir = 1, 3
236 DO ispin = 1, nspins
237 CALL cp_fm_set_all(psi1_pso(ispin, idir), 0.0_dp)
238 END DO
239 IF (output_unit > 0) THEN
240 WRITE (output_unit, "(T10,A)") "Response to the perturbation operator pso_"//achar(idir + 119)
241 END IF
242 !
243 !Initial guess for psi1
244 DO ispin = 1, nspins
245 CALL cp_fm_set_all(psi1(ispin), 0.0_dp)
246 !CALL cp_fm_to_fm(rxp_psi0(ispin,idir)%matrix, psi1(ispin))
247 !CALL cp_fm_scale(-1.0_dp,psi1(ispin))
248 END DO
249 !
250 !DO scf cycle to optimize psi1
251 DO ispin = 1, nspins
252 CALL cp_fm_to_fm(pso_psi0(ispin, idir), h1_psi0(ispin))
253 END DO
254 !
255 !
256 linres_control%lr_triplet = .false. ! we do singlet response
257 linres_control%do_kernel = .false. ! we do uncoupled response
258 linres_control%converged = .false.
259 CALL linres_solver(p_env, qs_env, psi1, h1_psi0, psi0_order, output_unit, should_stop)
260 !
261 !
262 ! copy the response
263 DO ispin = 1, nspins
264 CALL cp_fm_to_fm(psi1(ispin), psi1_pso(ispin, idir))
265 fro = cp_fm_frobenius_norm(psi1(ispin))
266 chk = chk + fro
267 END DO
268 !
269 !
270 IF (output_unit > 0) THEN
271 WRITE (output_unit, "(T10,A)") "Write the resulting psi1 in restart file... not implemented yet"
272 END IF
273 !
274 ! Write the result in the restart file
275 END DO ! idir
276 END IF
277 !
278 ! operator fc
279 IF (do_fc) THEN
280 DO ispin = 1, nspins
281 CALL cp_fm_set_all(psi1_fc(ispin), 0.0_dp)
282 END DO
283 IF (output_unit > 0) THEN
284 WRITE (output_unit, "(T10,A)") "Response to the perturbation operator fc"
285 END IF
286 !
287 !Initial guess for psi1
288 DO ispin = 1, nspins
289 CALL cp_fm_set_all(psi1(ispin), 0.0_dp)
290 END DO
291 !
292 DO ispin = 1, nspins
293 CALL cp_fm_to_fm(fc_psi0(ispin), h1_psi0(ispin))
294 END DO
295 !
296 !
297 linres_control%lr_triplet = .true. ! we do triplet response
298 linres_control%do_kernel = .true. ! we do coupled response
299 linres_control%converged = .false.
300 CALL linres_solver(p_env, qs_env, psi1, h1_psi0, psi0_order, output_unit, should_stop)
301 !
302 !
303 ! copy the response
304 DO ispin = 1, nspins
305 CALL cp_fm_to_fm(psi1(ispin), psi1_fc(ispin))
306 fro = cp_fm_frobenius_norm(psi1(ispin))
307 chk = chk + fro
308 END DO
309 !
310 !
311 IF (output_unit > 0) THEN
312 WRITE (output_unit, "(T10,A)") "Write the resulting psi1 in restart file... not implemented yet"
313 END IF
314 !
315 ! Write the result in the restart file
316 END IF
317
318 !>>>> debugging only
319 !
320 ! here we have the operator r and compute the polarizability for debugging the kernel only
321 IF (do_dso) THEN
322 DO idir = 1, 3
323 DO ispin = 1, nspins
324 CALL cp_fm_set_all(psi1_dso(ispin, idir), 0.0_dp)
325 END DO
326 IF (output_unit > 0) THEN
327 WRITE (output_unit, "(T10,A)") "Response to the perturbation operator r_"//achar(idir + 119)
328 END IF
329 !
330 !Initial guess for psi1
331 DO ispin = 1, nspins
332 CALL cp_fm_set_all(psi1(ispin), 0.0_dp)
333 !CALL cp_fm_to_fm(rxp_psi0(ispin,idir)%matrix, psi1(ispin))
334 !CALL cp_fm_scale(-1.0_dp,psi1(ispin))
335 END DO
336 !
337 !DO scf cycle to optimize psi1
338 DO ispin = 1, nspins
339 CALL cp_fm_to_fm(dso_psi0(ispin, idir), h1_psi0(ispin))
340 END DO
341 !
342 !
343 linres_control%lr_triplet = .false. ! we do singlet response
344 linres_control%do_kernel = .true. ! we do uncoupled response
345 linres_control%converged = .false.
346 CALL linres_solver(p_env, qs_env, psi1, h1_psi0, psi0_order, output_unit, should_stop)
347 !
348 !
349 ! copy the response
350 DO ispin = 1, nspins
351 CALL cp_fm_to_fm(psi1(ispin), psi1_dso(ispin, idir))
352 fro = cp_fm_frobenius_norm(psi1(ispin))
353 chk = chk + fro
354 END DO
355 IF (output_unit > 0) THEN
356 WRITE (output_unit, "(T10,A)") "Write the resulting psi1 in restart file... not implemented yet"
357 END IF
358 !
359 ! Write the result in the restart file
360 END DO ! idir
361 END IF
362 !<<<< debugging only
363
364 !
365 !
366 ! print the checksum
367 IF (output_unit > 0) THEN
368 WRITE (output_unit, '(T2,A,E23.16)') 'ISSC| response: CheckSum =', chk
369 END IF
370 !
371 !
372 ! clean up
373 CALL cp_fm_release(psi1)
374 CALL cp_fm_release(h1_psi0)
375 DEALLOCATE (psi0_order)
376 !
377 CALL cp_print_key_finished_output(output_unit, logger, lr_section,&
378 & "PRINT%PROGRAM_RUN_INFO")
379 !
380 CALL timestop(handle)
381 !
382 END SUBROUTINE issc_response
383
384! **************************************************************************************************
385!> \brief ...
386!> \param issc_env ...
387!> \param qs_env ...
388!> \param iatom ...
389! **************************************************************************************************
390 SUBROUTINE issc_issc(issc_env, qs_env, iatom)
391
392 TYPE(issc_env_type) :: issc_env
393 TYPE(qs_environment_type), POINTER :: qs_env
394 INTEGER, INTENT(IN) :: iatom
395
396 CHARACTER(LEN=*), PARAMETER :: routinen = 'issc_issc'
397
398 INTEGER :: handle, ispin, ixyz, jatom, jxyz, natom, &
399 nmo, nspins
400 LOGICAL :: do_dso, do_fc, do_pso, do_sd, gapw
401 REAL(dp) :: buf, facdso, facfc, facpso, facsd, g, &
402 issc_dso, issc_fc, issc_pso, issc_sd, &
403 maxocc
404 REAL(dp), DIMENSION(3) :: r_i, r_j
405 REAL(dp), DIMENSION(:, :, :, :, :), POINTER :: issc
406 TYPE(cell_type), POINTER :: cell
407 TYPE(cp_fm_type), DIMENSION(:), POINTER :: fc_psi0, psi1_fc
408 TYPE(cp_fm_type), DIMENSION(:, :), POINTER :: psi1_dso, psi1_efg, psi1_pso
409 TYPE(cp_fm_type), POINTER :: mo_coeff
410 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_dso, matrix_efg, matrix_fc, &
411 matrix_pso
412 TYPE(dft_control_type), POINTER :: dft_control
413 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos
414 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
415 TYPE(section_vals_type), POINTER :: issc_section
416
417 CALL timeset(routinen, handle)
418
419 NULLIFY (cell, dft_control, particle_set, issc, psi1_fc, psi1_efg, psi1_pso)
420 NULLIFY (matrix_efg, matrix_fc, matrix_pso, mos, mo_coeff, fc_psi0)
421
422 CALL get_qs_env(qs_env=qs_env, &
423 cell=cell, &
424 dft_control=dft_control, &
425 particle_set=particle_set, &
426 mos=mos)
427
428 gapw = dft_control%qs_control%gapw
429 natom = SIZE(particle_set, 1)
430 nspins = dft_control%nspins
431
432 CALL get_issc_env(issc_env=issc_env, &
433 matrix_efg=matrix_efg, &
434 matrix_pso=matrix_pso, &
435 matrix_fc=matrix_fc, &
436 matrix_dso=matrix_dso, &
437 psi1_fc=psi1_fc, &
438 psi1_efg=psi1_efg, &
439 psi1_pso=psi1_pso, &
440 psi1_dso=psi1_dso, &
441 fc_psi0=fc_psi0, &
442 issc=issc, &
443 do_fc=do_fc, &
444 do_sd=do_sd, &
445 do_pso=do_pso, &
446 do_dso=do_dso)
447
448 g = e_mass/(2.0_dp*p_mass)
449 facfc = hertz*g**2*a_fine**4
450 facpso = hertz*g**2*a_fine**4
451 facsd = hertz*g**2*a_fine**4
452 facdso = hertz*g**2*a_fine**4
453
454 !
455 !
456 issc_section => section_vals_get_subs_vals(qs_env%input, &
457 & "PROPERTIES%LINRES%SPINSPIN")
458 !
459 ! Initialize
460 DO ispin = 1, nspins
461 CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff, maxocc=maxocc)
462 CALL cp_fm_get_info(mo_coeff, ncol_global=nmo)
463
464 DO jatom = 1, natom
465 r_i = particle_set(iatom)%r
466 r_j = particle_set(jatom)%r
467 r_j = pbc(r_i, r_j, cell) + r_i
468 !
469 !
470 !
471 !write(*,*) 'iatom =',iatom,' r_i=',r_i
472 !write(*,*) 'jatom =',jatom,' r_j=',r_j
473 !
474 ! FC term
475 !
476 IF (do_fc .AND. iatom /= jatom) THEN
477 !
478 ! build the integral for the jatom
479 CALL dbcsr_set(matrix_fc(1)%matrix, 0.0_dp)
480 CALL build_fermi_contact_matrix(qs_env, matrix_fc, r_j)
481 CALL cp_dbcsr_sm_fm_multiply(matrix_fc(1)%matrix, mo_coeff, &
482 fc_psi0(ispin), ncol=nmo,& ! fc_psi0 a buffer
483 & alpha=1.0_dp)
484
485 CALL cp_fm_trace(fc_psi0(ispin), mo_coeff, buf)
486 WRITE (*, *) ' jatom', jatom, 'tr(P*fc)=', buf
487
488 CALL cp_fm_trace(fc_psi0(ispin), psi1_fc(ispin), buf)
489 issc_fc = 2.0_dp*2.0_dp*maxocc*facfc*buf
490 issc(1, 1, iatom, jatom, 1) = issc(1, 1, iatom, jatom, 1) + issc_fc
491 issc(2, 2, iatom, jatom, 1) = issc(2, 2, iatom, jatom, 1) + issc_fc
492 issc(3, 3, iatom, jatom, 1) = issc(3, 3, iatom, jatom, 1) + issc_fc
493 END IF
494 !
495 ! SD term
496 !
497 IF (do_sd .AND. iatom /= jatom) THEN
498 !
499 ! build the integral for the jatom
500 CALL dbcsr_set(matrix_efg(1)%matrix, 0.0_dp)
501 CALL dbcsr_set(matrix_efg(2)%matrix, 0.0_dp)
502 CALL dbcsr_set(matrix_efg(3)%matrix, 0.0_dp)
503 CALL dbcsr_set(matrix_efg(4)%matrix, 0.0_dp)
504 CALL dbcsr_set(matrix_efg(5)%matrix, 0.0_dp)
505 CALL dbcsr_set(matrix_efg(6)%matrix, 0.0_dp)
506 CALL build_efg_matrix(qs_env, matrix_efg, r_j)
507 DO ixyz = 1, 6
508 CALL cp_dbcsr_sm_fm_multiply(matrix_efg(ixyz)%matrix, mo_coeff, &
509 fc_psi0(ispin), ncol=nmo,& ! fc_psi0 a buffer
510 & alpha=1.0_dp, beta=0.0_dp)
511 CALL cp_fm_trace(fc_psi0(ispin), mo_coeff, buf)
512 WRITE (*, *) ' jatom', jatom, ixyz, 'tr(P*efg)=', buf
513 DO jxyz = 1, 6
514 CALL cp_fm_trace(fc_psi0(ispin), psi1_efg(ispin, jxyz), buf)
515 issc_sd = 2.0_dp*maxocc*facsd*buf
516 !issc(ixyz,jxyz,iatom,jatom) = issc_sd
517 !write(*,*) 'pso_',ixyz,jxyz,' iatom',iatom,'jatom',jatom,issc_pso
518 END DO
519 END DO
520 END IF
521 !
522 ! PSO term
523 !
524 IF (do_pso .AND. iatom /= jatom) THEN
525 !
526 ! build the integral for the jatom
527 CALL dbcsr_set(matrix_pso(1)%matrix, 0.0_dp)
528 CALL dbcsr_set(matrix_pso(2)%matrix, 0.0_dp)
529 CALL dbcsr_set(matrix_pso(3)%matrix, 0.0_dp)
530 CALL build_pso_matrix(qs_env, matrix_pso, r_j)
531 DO ixyz = 1, 3
532 CALL cp_dbcsr_sm_fm_multiply(matrix_pso(ixyz)%matrix, mo_coeff, &
533 fc_psi0(ispin), ncol=nmo,& ! fc_psi0 a buffer
534 & alpha=1.0_dp, beta=0.0_dp)
535 DO jxyz = 1, 3
536 CALL cp_fm_trace(fc_psi0(ispin), psi1_pso(ispin, jxyz), buf)
537 issc_pso = -2.0_dp*maxocc*facpso*buf
538 issc(ixyz, jxyz, iatom, jatom, 3) = issc(ixyz, jxyz, iatom, jatom, 3) + issc_pso
539 END DO
540 END DO
541 END IF
542 !
543 ! DSO term
544 !
545 !>>>>> for debugging we compute here the polarizability and NOT the DSO term!
546 IF (do_dso .AND. iatom == natom .AND. jatom == natom) THEN
547 DO ixyz = 1, 3
548 CALL cp_dbcsr_sm_fm_multiply(matrix_dso(ixyz)%matrix, mo_coeff, &
549 fc_psi0(ispin), ncol=nmo,& ! fc_psi0 a buffer
550 & alpha=1.0_dp, beta=0.0_dp)
551 DO jxyz = 1, 3
552 CALL cp_fm_trace(psi1_dso(ispin, jxyz), fc_psi0(ispin), buf)
553 ! we save the polarizability for a checksum later on !
554 issc_dso = 2.0_dp*maxocc*buf
555 issc(ixyz, jxyz, iatom, jatom, 4) = issc(ixyz, jxyz, iatom, jatom, 4) + issc_dso
556 END DO
557 END DO
558
559 END IF
560 !
561 END DO ! jatom
562 END DO ! ispin
563 !
564 !
565 ! Finalize
566 CALL timestop(handle)
567 !
568 END SUBROUTINE issc_issc
569
570! **************************************************************************************************
571!> \brief ...
572!> \param issc_env ...
573!> \param qs_env ...
574! **************************************************************************************************
575 SUBROUTINE issc_print(issc_env, qs_env)
576 TYPE(issc_env_type) :: issc_env
577 TYPE(qs_environment_type), POINTER :: qs_env
578
579 CHARACTER(LEN=2) :: element_symbol_i, element_symbol_j
580 CHARACTER(LEN=default_string_length) :: name_i, name_j, title
581 INTEGER :: iatom, jatom, natom, output_unit, &
582 unit_atoms
583 LOGICAL :: do_dso, do_fc, do_pso, do_sd, gapw
584 REAL(dp) :: eig(3), issc_iso_dso, issc_iso_fc, &
585 issc_iso_pso, issc_iso_sd, &
586 issc_iso_tot, issc_tmp(3, 3)
587 REAL(dp), DIMENSION(:, :, :, :, :), POINTER :: issc
588 REAL(dp), EXTERNAL :: ddot
589 TYPE(atomic_kind_type), POINTER :: atom_kind_i, atom_kind_j
590 TYPE(cp_logger_type), POINTER :: logger
591 TYPE(dft_control_type), POINTER :: dft_control
592 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
593 TYPE(section_vals_type), POINTER :: issc_section
594
595 NULLIFY (logger, particle_set, atom_kind_i, atom_kind_j, dft_control)
596
597 logger => cp_get_default_logger()
598 output_unit = cp_logger_get_default_io_unit(logger)
599
600 issc_section => section_vals_get_subs_vals(qs_env%input, &
601 "PROPERTIES%LINRES%SPINSPIN")
602
603 CALL get_issc_env(issc_env=issc_env, &
604 issc=issc, &
605 do_fc=do_fc, &
606 do_sd=do_sd, &
607 do_pso=do_pso, &
608 do_dso=do_dso)
609 !
610 CALL get_qs_env(qs_env=qs_env, &
611 dft_control=dft_control, &
612 particle_set=particle_set)
613
614 natom = SIZE(particle_set, 1)
615 gapw = dft_control%qs_control%gapw
616
617 !
618 IF (output_unit > 0) THEN
619 WRITE (output_unit, '(T2,A,E14.6)') 'ISSC| CheckSum K =', &
620 sqrt(ddot(SIZE(issc), issc, 1, issc, 1))
621 END IF
622 !
623 IF (btest(cp_print_key_should_output(logger%iter_info, issc_section, &
624 "PRINT%K_MATRIX"), cp_p_file)) THEN
625
626 unit_atoms = cp_print_key_unit_nr(logger, issc_section, "PRINT%K_MATRIX", &
627 extension=".data", middle_name="K", log_filename=.false.)
628
629 IF (unit_atoms > 0) THEN
630 WRITE (unit_atoms, *)
631 WRITE (unit_atoms, *)
632 WRITE (title, '(A)') "Indirect spin-spin coupling matrix"
633 WRITE (unit_atoms, '(T2,A)') title
634 DO iatom = 1, natom
635 atom_kind_i => particle_set(iatom)%atomic_kind
636 CALL get_atomic_kind(atom_kind_i, name=name_i, element_symbol=element_symbol_i)
637 DO jatom = 1, natom
638 atom_kind_j => particle_set(jatom)%atomic_kind
639 CALL get_atomic_kind(atom_kind_j, name=name_j, element_symbol=element_symbol_j)
640 !
641 IF (iatom == jatom .AND. .NOT. do_dso) cycle
642 !
643 !
644 ! FC
645 issc_tmp(:, :) = issc(:, :, iatom, jatom, 1)
646 issc_tmp(:, :) = 0.5_dp*(issc_tmp(:, :) + transpose(issc_tmp(:, :)))
647 CALL diamat_all(issc_tmp, eig)
648 issc_iso_fc = (eig(1) + eig(2) + eig(3))/3.0_dp
649 !
650 ! SD
651 issc_tmp(:, :) = issc(:, :, iatom, jatom, 2)
652 issc_tmp(:, :) = 0.5_dp*(issc_tmp(:, :) + transpose(issc_tmp(:, :)))
653 CALL diamat_all(issc_tmp, eig)
654 issc_iso_sd = (eig(1) + eig(2) + eig(3))/3.0_dp
655 !
656 ! PSO
657 issc_tmp(:, :) = issc(:, :, iatom, jatom, 3)
658 issc_tmp(:, :) = 0.5_dp*(issc_tmp(:, :) + transpose(issc_tmp(:, :)))
659 CALL diamat_all(issc_tmp, eig)
660 issc_iso_pso = (eig(1) + eig(2) + eig(3))/3.0_dp
661 !
662 ! DSO
663 issc_tmp(:, :) = issc(:, :, iatom, jatom, 4)
664 issc_tmp(:, :) = 0.5_dp*(issc_tmp(:, :) + transpose(issc_tmp(:, :)))
665 CALL diamat_all(issc_tmp, eig)
666 issc_iso_dso = (eig(1) + eig(2) + eig(3))/3.0_dp
667 !
668 ! TOT
669 issc_iso_tot = issc_iso_fc + issc_iso_sd + issc_iso_dso + issc_iso_pso
670 !
671 !
672 WRITE (unit_atoms, *)
673 WRITE (unit_atoms, '(T2,2(A,I5,A,2X,A2))') 'Indirect spin-spin coupling between ', &
674 iatom, trim(name_i), element_symbol_i, ' and ', &
675 jatom, trim(name_j), element_symbol_j
676 !
677 IF (do_fc) WRITE (unit_atoms, '(T1,A,f12.4,A)') ' Isotropic FC contribution = ', issc_iso_fc, ' Hz'
678 IF (do_sd) WRITE (unit_atoms, '(T1,A,f12.4,A)') ' Isotropic SD contribution = ', issc_iso_sd, ' Hz'
679 IF (do_pso) WRITE (unit_atoms, '(T1,A,f12.4,A)') ' Isotropic PSO contribution = ', issc_iso_pso, ' Hz'
680 !IF(do_dso) WRITE(unit_atoms,'(T1,A,f12.4,A)') ' Isotropic DSO contribution = ',issc_iso_dso,' Hz'
681 IF (do_dso) WRITE (unit_atoms, '(T1,A,f12.4,A)') ' !!! POLARIZABILITY (for the moment) = ', issc_iso_dso, ' Hz'
682 IF (.NOT. do_dso) WRITE (unit_atoms, '(T1,A,f12.4,A)') ' Isotropic coupling = ', issc_iso_tot, ' Hz'
683 END DO
684 END DO
685 END IF
686 CALL cp_print_key_finished_output(unit_atoms, logger, issc_section,&
687 & "PRINT%K_MATRIX")
688 END IF
689 !
690 !
691 END SUBROUTINE issc_print
692
693! **************************************************************************************************
694!> \brief Initialize the issc environment
695!> \param issc_env ...
696!> \param qs_env ...
697! **************************************************************************************************
698 SUBROUTINE issc_env_init(issc_env, qs_env)
699 !
700 TYPE(issc_env_type) :: issc_env
701 TYPE(qs_environment_type), POINTER :: qs_env
702
703 CHARACTER(LEN=*), PARAMETER :: routinen = 'issc_env_init'
704
705 INTEGER :: handle, iatom, idir, ini, ir, ispin, m, &
706 n, n_rep, nao, natom, nspins, &
707 output_unit
708 INTEGER, ALLOCATABLE, DIMENSION(:) :: first_sgf, last_sgf
709 INTEGER, DIMENSION(:), POINTER :: list, row_blk_sizes
710 LOGICAL :: gapw
711 TYPE(cp_fm_struct_type), POINTER :: tmp_fm_struct
712 TYPE(cp_fm_type), POINTER :: mo_coeff
713 TYPE(cp_logger_type), POINTER :: logger
714 TYPE(dbcsr_distribution_type), POINTER :: dbcsr_dist
715 TYPE(dft_control_type), POINTER :: dft_control
716 TYPE(linres_control_type), POINTER :: linres_control
717 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos
718 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
719 POINTER :: sab_orb
720 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
721 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
722 TYPE(section_vals_type), POINTER :: issc_section, lr_section
723
724!
725
726 CALL timeset(routinen, handle)
727
728 NULLIFY (linres_control)
729 NULLIFY (logger, issc_section)
730 NULLIFY (tmp_fm_struct)
731 NULLIFY (particle_set, qs_kind_set)
732 NULLIFY (sab_orb)
733
734 logger => cp_get_default_logger()
735 lr_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%LINRES")
736
737 output_unit = cp_print_key_unit_nr(logger, lr_section, "PRINT%PROGRAM_RUN_INFO", &
738 extension=".linresLog")
739
740 CALL issc_env_cleanup(issc_env)
741
742 IF (output_unit > 0) THEN
743 WRITE (output_unit, "(/,T20,A,/)") "*** Start indirect spin-spin coupling Calculation ***"
744 WRITE (output_unit, "(T10,A,/)") "Inizialization of the ISSC environment"
745 END IF
746
747 issc_section => section_vals_get_subs_vals(qs_env%input, &
748 & "PROPERTIES%LINRES%SPINSPIN")
749 !CALL section_vals_val_get(nmr_section,"INTERPOLATE_SHIFT",l_val=nmr_env%interpolate_shift)
750 !CALL section_vals_val_get(nmr_section,"SHIFT_GAPW_RADIUS",r_val=nmr_env%shift_gapw_radius)
751
752 CALL get_qs_env(qs_env=qs_env, &
753 dft_control=dft_control, &
754 linres_control=linres_control, &
755 mos=mos, &
756 sab_orb=sab_orb, &
757 particle_set=particle_set, &
758 qs_kind_set=qs_kind_set, &
759 dbcsr_dist=dbcsr_dist)
760 !
761 !
762 gapw = dft_control%qs_control%gapw
763 nspins = dft_control%nspins
764 natom = SIZE(particle_set, 1)
765 !
766 ! check that the psi0 are localized and you have all the centers
767 IF (.NOT. linres_control%localized_psi0) THEN
768 CALL cp_warn(__location__, 'To get indirect spin-spin coupling parameters within '// &
769 'PBC you need to localize zero order orbitals')
770 END IF
771 !
772 !
773 ! read terms need to be calculated
774 ! FC
775 CALL section_vals_val_get(issc_section, "DO_FC", l_val=issc_env%do_fc)
776 ! SD
777 CALL section_vals_val_get(issc_section, "DO_SD", l_val=issc_env%do_sd)
778 ! PSO
779 CALL section_vals_val_get(issc_section, "DO_PSO", l_val=issc_env%do_pso)
780 ! DSO
781 CALL section_vals_val_get(issc_section, "DO_DSO", l_val=issc_env%do_dso)
782 !
783 !
784 ! read the list of atoms on which the issc need to be calculated
785 CALL section_vals_val_get(issc_section, "ISSC_ON_ATOM_LIST", n_rep_val=n_rep)
786 !
787 !
788 NULLIFY (issc_env%issc_on_atom_list)
789 n = 0
790 DO ir = 1, n_rep
791 NULLIFY (list)
792 CALL section_vals_val_get(issc_section, "ISSC_ON_ATOM_LIST", i_rep_val=ir, i_vals=list)
793 IF (ASSOCIATED(list)) THEN
794 CALL reallocate(issc_env%issc_on_atom_list, 1, n + SIZE(list))
795 DO ini = 1, SIZE(list)
796 issc_env%issc_on_atom_list(ini + n) = list(ini)
797 END DO
798 n = n + SIZE(list)
799 END IF
800 END DO
801 !
802 IF (.NOT. ASSOCIATED(issc_env%issc_on_atom_list)) THEN
803 ALLOCATE (issc_env%issc_on_atom_list(natom))
804 DO iatom = 1, natom
805 issc_env%issc_on_atom_list(iatom) = iatom
806 END DO
807 END IF
808 issc_env%issc_natms = SIZE(issc_env%issc_on_atom_list)
809 !
810 !
811 ! Initialize the issc tensor
812 ALLOCATE (issc_env%issc(3, 3, issc_env%issc_natms, issc_env%issc_natms, 4), &
813 issc_env%issc_loc(3, 3, issc_env%issc_natms, issc_env%issc_natms, 4))
814 issc_env%issc(:, :, :, :, :) = 0.0_dp
815 issc_env%issc_loc(:, :, :, :, :) = 0.0_dp
816 !
817 ! allocation
818 ALLOCATE (issc_env%efg_psi0(nspins, 6), issc_env%pso_psi0(nspins, 3), issc_env%fc_psi0(nspins), &
819 issc_env%psi1_efg(nspins, 6), issc_env%psi1_pso(nspins, 3), issc_env%psi1_fc(nspins), &
820 issc_env%dso_psi0(nspins, 3), issc_env%psi1_dso(nspins, 3))
821 DO ispin = 1, nspins
822 CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff)
823 CALL cp_fm_get_info(mo_coeff, ncol_global=m, nrow_global=nao)
824
825 NULLIFY (tmp_fm_struct)
826 CALL cp_fm_struct_create(tmp_fm_struct, nrow_global=nao, &
827 ncol_global=m, &
828 context=mo_coeff%matrix_struct%context)
829 DO idir = 1, 6
830 CALL cp_fm_create(issc_env%psi1_efg(ispin, idir), tmp_fm_struct)
831 CALL cp_fm_create(issc_env%efg_psi0(ispin, idir), tmp_fm_struct)
832 END DO
833 DO idir = 1, 3
834 CALL cp_fm_create(issc_env%psi1_pso(ispin, idir), tmp_fm_struct)
835 CALL cp_fm_create(issc_env%pso_psi0(ispin, idir), tmp_fm_struct)
836 CALL cp_fm_create(issc_env%psi1_dso(ispin, idir), tmp_fm_struct)
837 CALL cp_fm_create(issc_env%dso_psi0(ispin, idir), tmp_fm_struct)
838 END DO
839 CALL cp_fm_create(issc_env%psi1_fc(ispin), tmp_fm_struct)
840 CALL cp_fm_create(issc_env%fc_psi0(ispin), tmp_fm_struct)
841 CALL cp_fm_struct_release(tmp_fm_struct)
842 END DO
843 !
844 ! prepare for allocation
845 ALLOCATE (first_sgf(natom))
846 ALLOCATE (last_sgf(natom))
847 CALL get_particle_set(particle_set, qs_kind_set, &
848 first_sgf=first_sgf, &
849 last_sgf=last_sgf)
850 ALLOCATE (row_blk_sizes(natom))
851 CALL dbcsr_convert_offsets_to_sizes(first_sgf, row_blk_sizes, last_sgf)
852 DEALLOCATE (first_sgf)
853 DEALLOCATE (last_sgf)
854
855 !
856 ! efg, pso and fc operators
857 CALL dbcsr_allocate_matrix_set(issc_env%matrix_efg, 6)
858 ALLOCATE (issc_env%matrix_efg(1)%matrix)
859 CALL dbcsr_create(matrix=issc_env%matrix_efg(1)%matrix, &
860 name="efg (3xx-rr)/3", &
861 dist=dbcsr_dist, matrix_type=dbcsr_type_symmetric, &
862 row_blk_size=row_blk_sizes, col_blk_size=row_blk_sizes, &
863 mutable_work=.true.)
864 CALL cp_dbcsr_alloc_block_from_nbl(issc_env%matrix_efg(1)%matrix, sab_orb)
865
866 ALLOCATE (issc_env%matrix_efg(2)%matrix, &
867 issc_env%matrix_efg(3)%matrix, issc_env%matrix_efg(4)%matrix, &
868 issc_env%matrix_efg(5)%matrix, issc_env%matrix_efg(6)%matrix)
869 CALL dbcsr_copy(issc_env%matrix_efg(2)%matrix, issc_env%matrix_efg(1)%matrix, &
870 'efg xy')
871 CALL dbcsr_copy(issc_env%matrix_efg(3)%matrix, issc_env%matrix_efg(1)%matrix, &
872 'efg xz')
873 CALL dbcsr_copy(issc_env%matrix_efg(4)%matrix, issc_env%matrix_efg(1)%matrix, &
874 'efg (3yy-rr)/3')
875 CALL dbcsr_copy(issc_env%matrix_efg(5)%matrix, issc_env%matrix_efg(1)%matrix, &
876 'efg yz')
877 CALL dbcsr_copy(issc_env%matrix_efg(6)%matrix, issc_env%matrix_efg(1)%matrix, &
878 'efg (3zz-rr)/3')
879
880 CALL dbcsr_set(issc_env%matrix_efg(1)%matrix, 0.0_dp)
881 CALL dbcsr_set(issc_env%matrix_efg(2)%matrix, 0.0_dp)
882 CALL dbcsr_set(issc_env%matrix_efg(3)%matrix, 0.0_dp)
883 CALL dbcsr_set(issc_env%matrix_efg(4)%matrix, 0.0_dp)
884 CALL dbcsr_set(issc_env%matrix_efg(5)%matrix, 0.0_dp)
885 CALL dbcsr_set(issc_env%matrix_efg(6)%matrix, 0.0_dp)
886 !
887 ! PSO
888 CALL dbcsr_allocate_matrix_set(issc_env%matrix_pso, 3)
889 ALLOCATE (issc_env%matrix_pso(1)%matrix)
890 CALL dbcsr_create(matrix=issc_env%matrix_pso(1)%matrix, &
891 name="pso x", &
892 dist=dbcsr_dist, matrix_type=dbcsr_type_antisymmetric, &
893 row_blk_size=row_blk_sizes, col_blk_size=row_blk_sizes, &
894 mutable_work=.true.)
895 CALL cp_dbcsr_alloc_block_from_nbl(issc_env%matrix_pso(1)%matrix, sab_orb)
896
897 ALLOCATE (issc_env%matrix_pso(2)%matrix, issc_env%matrix_pso(3)%matrix)
898 CALL dbcsr_copy(issc_env%matrix_pso(2)%matrix, issc_env%matrix_pso(1)%matrix, &
899 'pso y')
900 CALL dbcsr_copy(issc_env%matrix_pso(3)%matrix, issc_env%matrix_pso(1)%matrix, &
901 'pso z')
902 CALL dbcsr_set(issc_env%matrix_pso(1)%matrix, 0.0_dp)
903 CALL dbcsr_set(issc_env%matrix_pso(2)%matrix, 0.0_dp)
904 CALL dbcsr_set(issc_env%matrix_pso(3)%matrix, 0.0_dp)
905 !
906 ! DSO
907 CALL dbcsr_allocate_matrix_set(issc_env%matrix_dso, 3)
908 ALLOCATE (issc_env%matrix_dso(1)%matrix, issc_env%matrix_dso(2)%matrix, issc_env%matrix_dso(3)%matrix)
909 CALL dbcsr_copy(issc_env%matrix_dso(1)%matrix, issc_env%matrix_efg(1)%matrix, &
910 'dso x')
911 CALL dbcsr_copy(issc_env%matrix_dso(2)%matrix, issc_env%matrix_efg(1)%matrix, &
912 'dso y')
913 CALL dbcsr_copy(issc_env%matrix_dso(3)%matrix, issc_env%matrix_efg(1)%matrix, &
914 'dso z')
915 CALL dbcsr_set(issc_env%matrix_dso(1)%matrix, 0.0_dp)
916 CALL dbcsr_set(issc_env%matrix_dso(2)%matrix, 0.0_dp)
917 CALL dbcsr_set(issc_env%matrix_dso(3)%matrix, 0.0_dp)
918 !
919 ! FC
920 CALL dbcsr_allocate_matrix_set(issc_env%matrix_fc, 1)
921 ALLOCATE (issc_env%matrix_fc(1)%matrix)
922 CALL dbcsr_copy(issc_env%matrix_fc(1)%matrix, issc_env%matrix_efg(1)%matrix, &
923 'fc')
924 CALL dbcsr_set(issc_env%matrix_fc(1)%matrix, 0.0_dp)
925
926 DEALLOCATE (row_blk_sizes)
927 !
928 ! Conversion factors
929 IF (output_unit > 0) THEN
930 WRITE (output_unit, "(T2,A,T60,I4,A)")&
931 & "ISSC| spin-spin coupling computed for ", issc_env%issc_natms, ' atoms'
932 END IF
933
934 CALL cp_print_key_finished_output(output_unit, logger, lr_section,&
935 & "PRINT%PROGRAM_RUN_INFO")
936
937 CALL timestop(handle)
938
939 END SUBROUTINE issc_env_init
940
941! **************************************************************************************************
942!> \brief Deallocate the issc environment
943!> \param issc_env ...
944!> \par History
945! **************************************************************************************************
946 SUBROUTINE issc_env_cleanup(issc_env)
947
948 TYPE(issc_env_type), INTENT(INOUT) :: issc_env
949
950 IF (ASSOCIATED(issc_env%issc_on_atom_list)) THEN
951 DEALLOCATE (issc_env%issc_on_atom_list)
952 END IF
953 IF (ASSOCIATED(issc_env%issc)) THEN
954 DEALLOCATE (issc_env%issc)
955 END IF
956 IF (ASSOCIATED(issc_env%issc_loc)) THEN
957 DEALLOCATE (issc_env%issc_loc)
958 END IF
959 !
960 !efg_psi0
961 CALL cp_fm_release(issc_env%efg_psi0)
962 !
963 !pso_psi0
964 CALL cp_fm_release(issc_env%pso_psi0)
965 !
966 !dso_psi0
967 CALL cp_fm_release(issc_env%dso_psi0)
968 !
969 !fc_psi0
970 CALL cp_fm_release(issc_env%fc_psi0)
971 !
972 !psi1_efg
973 CALL cp_fm_release(issc_env%psi1_efg)
974 !
975 !psi1_pso
976 CALL cp_fm_release(issc_env%psi1_pso)
977 !
978 !psi1_dso
979 CALL cp_fm_release(issc_env%psi1_dso)
980 !
981 !psi1_fc
982 CALL cp_fm_release(issc_env%psi1_fc)
983 !
984 !matrix_efg
985 IF (ASSOCIATED(issc_env%matrix_efg)) THEN
986 CALL dbcsr_deallocate_matrix_set(issc_env%matrix_efg)
987 END IF
988 !
989 !matrix_pso
990 IF (ASSOCIATED(issc_env%matrix_pso)) THEN
991 CALL dbcsr_deallocate_matrix_set(issc_env%matrix_pso)
992 END IF
993 !
994 !matrix_dso
995 IF (ASSOCIATED(issc_env%matrix_dso)) THEN
996 CALL dbcsr_deallocate_matrix_set(issc_env%matrix_dso)
997 END IF
998 !
999 !matrix_fc
1000 IF (ASSOCIATED(issc_env%matrix_fc)) THEN
1001 CALL dbcsr_deallocate_matrix_set(issc_env%matrix_fc)
1002 END IF
1003
1004 END SUBROUTINE issc_env_cleanup
1005
1006END MODULE qs_linres_issc_utils
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
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_set(matrix, alpha)
...
DBCSR operations in CP2K.
subroutine, public cp_dbcsr_sm_fm_multiply(matrix, fm_in, fm_out, ncol, alpha, beta)
multiply a dbcsr with a fm matrix
Basic linear algebra operations for full matrices.
real(kind=dp) function, public cp_fm_frobenius_norm(matrix_a)
computes the Frobenius norm of matrix_a
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_set_all(matrix, alpha, beta)
set all elements of a matrix to the same value, and optionally the diagonal to a different one
subroutine, public cp_fm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
creates a new full matrix with the given structure
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
integer, parameter, public cp_p_file
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
objects that represent the structure of input sections and the data contained in an input section
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
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
An array-based list which grows on demand. When the internal array is full, a new array of twice the ...
Definition list.F:24
Collection of simple mathematical functions and subroutines.
Definition mathlib.F:15
subroutine, public diamat_all(a, eigval, dac)
Diagonalize the symmetric n by n matrix a using the LAPACK library. Only the upper triangle of matrix...
Definition mathlib.F:381
Utility routines for the memory handling.
Interface to the message passing library MPI.
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.
Definition of physical constants:
Definition physcon.F:68
real(kind=dp), parameter, public a_fine
Definition physcon.F:119
real(kind=dp), parameter, public hertz
Definition physcon.F:186
real(kind=dp), parameter, public p_mass
Definition physcon.F:112
real(kind=dp), parameter, public e_mass
Definition physcon.F:109
Distribution of the electric field gradient integral matrix.
subroutine, public build_efg_matrix(qs_env, matrix_efg, rc)
Calculation of the electric field gradient matrix over Cartesian Gaussian functions.
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.
Distribution of the Fermi contact integral matrix.
subroutine, public build_fermi_contact_matrix(qs_env, matrix_fc, rc)
Calculation of the Fermi contact matrix over Cartesian Gaussian functions.
Define the quickstep kind type and their sub types.
Chemical shift calculation by dfpt Initialization of the issc_env, creation of the special neighbor l...
subroutine, public issc_issc(issc_env, qs_env, iatom)
...
subroutine, public issc_response(issc_env, p_env, qs_env)
Initialize the issc environment.
subroutine, public issc_env_cleanup(issc_env)
Deallocate the issc environment.
subroutine, public issc_env_init(issc_env, qs_env)
Initialize the issc environment.
subroutine, public issc_print(issc_env, qs_env)
...
localize wavefunctions linear response scf
subroutine, public linres_solver(p_env, qs_env, psi1, h1_psi0, psi0_order, iounit, should_stop, silent)
scf loop to optimize the first order wavefunctions (psi1) given a perturbation as an operator applied...
Type definitiona for linear response calculations.
subroutine, public get_issc_env(issc_env, issc_on_atom_list, issc_gapw_radius, issc_loc, do_fc, do_sd, do_pso, do_dso, issc, interpolate_issc, psi1_efg, psi1_pso, psi1_dso, psi1_fc, efg_psi0, pso_psi0, dso_psi0, fc_psi0, matrix_efg, matrix_pso, matrix_dso, matrix_fc)
...
wrapper for the pools of matrixes
Definition and initialisation of the mo data type.
Definition qs_mo_types.F:22
subroutine, public get_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, mo_coeff, mo_coeff_b, uniform_occupation, kts, mu, flexible_electron_count)
Get the components of a MO set data structure.
Define the neighbor list data types and the corresponding functionality.
basis types for the calculation of the perturbation of density theory.
Distribution of the spin orbit integral matrix.
subroutine, public build_pso_matrix(qs_env, matrix_so, rc)
Calculation of the paramagnetic spin orbit matrix over Cartesian Gaussian functions.
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
keeps the information about the structure of a full matrix
represent a full matrix
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.
General settings for linear response calculations.
container for the pools of matrixes used by qs
Represent a qs system that is perturbed. Can calculate the linear operator and the rhs of the system ...