(git:374b731)
Loading...
Searching...
No Matches
qs_tddfpt2_methods.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
10 USE admm_types, ONLY: admm_type,&
13 USE bibliography, ONLY: grimme2013,&
16 cite_reference
17 USE cell_types, ONLY: cell_type
24 USE cp_fm_types, ONLY: cp_fm_create,&
37 USE dbcsr_api, ONLY: dbcsr_p_type
39 USE header, ONLY: tddfpt_header,&
44 USE input_constants, ONLY: &
53 USE kinds, ONLY: dp
57 USE machine, ONLY: m_flush
61 USE physcon, ONLY: evolt
70 USE qs_mo_types, ONLY: mo_set_type
89 USE qs_tddfpt2_soc, ONLY: tddfpt_soc
110 USE xc_write_output, ONLY: xc_write
111#include "./base/base_uses.f90"
112
113 IMPLICIT NONE
114
115 PRIVATE
116
117 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_tddfpt2_methods'
118
119 LOGICAL, PARAMETER, PRIVATE :: debug_this_module = .false.
120 ! number of first derivative components (3: d/dx, d/dy, d/dz)
121 INTEGER, PARAMETER, PRIVATE :: nderivs = 3
122 INTEGER, PARAMETER, PRIVATE :: maxspins = 2
123
125
126! **************************************************************************************************
127
128CONTAINS
129
130! **************************************************************************************************
131!> \brief Perform TDDFPT calculation.
132!> \param qs_env Quickstep environment
133!> \param calc_forces ...
134!> \par History
135!> * 05.2016 created [Sergey Chulkov]
136!> * 06.2016 refactored to be used with Davidson eigensolver [Sergey Chulkov]
137!> * 03.2017 cleaned and refactored [Sergey Chulkov]
138!> \note Based on the subroutines tddfpt_env_init(), and tddfpt_env_deallocate().
139! **************************************************************************************************
140 SUBROUTINE tddfpt(qs_env, calc_forces)
141 TYPE(qs_environment_type), POINTER :: qs_env
142 LOGICAL, INTENT(IN) :: calc_forces
143
144 CHARACTER(LEN=*), PARAMETER :: routinen = 'tddfpt'
145
146 INTEGER :: handle, ispin, istate, log_unit, mult, &
147 my_state, nao, nocc, nspins, &
148 nstate_max, nstates, nvirt, old_state
149 INTEGER, DIMENSION(maxspins) :: nactive
150 LOGICAL :: do_admm, do_exck, do_hfx, do_hfxlr, &
151 do_hfxsr, do_soc, lmult_tmp, &
152 state_change
153 REAL(kind=dp) :: gsmin, gsval, xsval
154 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: evals, ostrength
155 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
156 TYPE(cell_type), POINTER :: cell
157 TYPE(cp_blacs_env_type), POINTER :: blacs_env
158 TYPE(cp_fm_struct_type), POINTER :: matrix_struct
159 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:) :: my_mos
160 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: dipole_op_mos_occ, evects, s_evects
161 TYPE(cp_logger_type), POINTER :: logger
162 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks, matrix_ks_oep, matrix_s, &
163 matrix_s_aux_fit, &
164 matrix_s_aux_fit_vs_orb
165 TYPE(dft_control_type), POINTER :: dft_control
166 TYPE(excited_energy_type), POINTER :: ex_env
167 TYPE(full_kernel_env_type), TARGET :: full_kernel_env, kernel_env_admm_aux
168 TYPE(kernel_env_type) :: kernel_env
169 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos, mos_aux_fit
170 TYPE(mp_para_env_type), POINTER :: para_env
171 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
172 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
173 TYPE(qs_scf_env_type), POINTER :: scf_env
174 TYPE(section_vals_type), POINTER :: hfxsr_section, kernel_section, &
175 lri_section, soc_section, &
176 tddfpt_print_section, tddfpt_section, &
177 xc_section
178 TYPE(stda_env_type), TARGET :: stda_kernel
179 TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
180 TYPE(tddfpt_ground_state_mos), DIMENSION(:), &
181 POINTER :: gs_mos
182 TYPE(tddfpt_subgroup_env_type) :: sub_env
183 TYPE(tddfpt_work_matrices) :: work_matrices
184
185 CALL timeset(routinen, handle)
186
187 NULLIFY (logger)
188 logger => cp_get_default_logger()
189
190 ! input section print/xc
191 NULLIFY (tddfpt_section)
192 tddfpt_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%TDDFPT")
193
194 CALL tddfpt_input(qs_env, do_hfx, do_admm, do_exck, &
195 do_hfxsr, do_hfxlr, xc_section, tddfpt_print_section, &
196 lri_section, hfxsr_section)
197
198 log_unit = cp_print_key_unit_nr(logger, tddfpt_print_section, "PROGRAM_BANNER", &
199 extension=".tddfptLog")
200
201 CALL get_qs_env(qs_env, &
202 blacs_env=blacs_env, &
203 cell=cell, &
204 dft_control=dft_control, &
205 matrix_ks=matrix_ks, &
206 matrix_s=matrix_s, &
207 mos=mos, &
208 scf_env=scf_env)
209 tddfpt_control => dft_control%tddfpt2_control
210 tddfpt_control%do_hfx = do_hfx
211 tddfpt_control%do_admm = do_admm
212 tddfpt_control%do_hfxsr = do_hfxsr
213 tddfpt_control%hfxsr_primbas = 0
214 tddfpt_control%hfxsr_re_int = .true.
215 tddfpt_control%do_hfxlr = do_hfxlr
216 tddfpt_control%do_exck = do_exck
217 IF (tddfpt_control%do_hfxlr) THEN
218 kernel_section => section_vals_get_subs_vals(tddfpt_section, "XC%HFX_KERNEL%HFXLR")
219 CALL section_vals_val_get(kernel_section, "RCUT", r_val=tddfpt_control%hfxlr_rcut)
220 CALL section_vals_val_get(kernel_section, "SCALE", r_val=tddfpt_control%hfxlr_scale)
221 END IF
222
223 soc_section => section_vals_get_subs_vals(tddfpt_section, "SOC")
224 CALL section_vals_get(soc_section, explicit=do_soc)
225
226 IF (do_soc) THEN
227 ! start with multiplicity that is not specified in input
228 ! so that excited-state gradient is for multiplicity given in input
229 lmult_tmp = tddfpt_control%rks_triplets
230 tddfpt_control%rks_triplets = .NOT. (tddfpt_control%rks_triplets)
231 END IF
232
233 CALL cite_reference(iannuzzi2005)
234 IF (tddfpt_control%kernel == tddfpt_kernel_stda) THEN
235 CALL cite_reference(grimme2013)
236 CALL cite_reference(grimme2016)
237 END IF
238
239 CALL tddfpt_header(log_unit)
240 CALL kernel_info(log_unit, dft_control, tddfpt_control, xc_section)
241 ! obtain occupied and virtual (unoccupied) ground-state Kohn-Sham orbitals
242 NULLIFY (gs_mos)
243
244 CALL tddfpt_init_mos(qs_env, gs_mos, log_unit)
245
246 ! obtain corrected KS-matrix
247 CALL tddfpt_oecorr(qs_env, gs_mos, matrix_ks_oep)
248
249 IF ((tddfpt_control%do_lrigpw) .AND. &
250 (tddfpt_control%kernel /= tddfpt_kernel_full)) THEN
251 CALL cp_abort(__location__, "LRI only implemented for full kernel")
252 END IF
253
254 IF (ASSOCIATED(matrix_ks_oep)) matrix_ks => matrix_ks_oep
255
256 ! components of the dipole operator
257 CALL tddfpt_dipole_operator(dipole_op_mos_occ, &
258 tddfpt_control, &
259 gs_mos, &
260 qs_env)
261
262 nspins = SIZE(gs_mos)
263 ! multiplicity of molecular system
264 IF (nspins > 1) THEN
265 mult = abs(SIZE(gs_mos(1)%evals_occ) - SIZE(gs_mos(2)%evals_occ)) + 1
266 IF (mult > 2) &
267 CALL cp_warn(__location__, "There is a convergence issue for multiplicity >= 3")
268 ELSE
269 IF (tddfpt_control%rks_triplets) THEN
270 mult = 3
271 ELSE
272 mult = 1
273 END IF
274 END IF
275
276 ! split mpi communicator
277 ALLOCATE (my_mos(nspins))
278 DO ispin = 1, nspins
279 my_mos(ispin) = gs_mos(ispin)%mos_occ
280 END DO
281 CALL tddfpt_sub_env_init(sub_env, qs_env, mos_occ=my_mos(:), &
282 kernel=tddfpt_control%kernel)
283 DEALLOCATE (my_mos)
284
285 IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN
286 ! create environment for Full Kernel
287 IF (dft_control%qs_control%xtb) THEN
288 cpabort("TDDFPT: xTB only works with sTDA Kernel")
289 END IF
290
291 IF (tddfpt_control%do_hfxsr) THEN
292 kernel_section => section_vals_get_subs_vals(tddfpt_section, "XC%HFX_KERNEL")
293 CALL section_vals_val_get(kernel_section, "HFXSR_PRIMBAS", &
294 i_val=tddfpt_control%hfxsr_primbas)
295 ! basis set
296 CALL create_minbas_set(qs_env, log_unit, basis_type="TDA_HFX", &
297 primitive=tddfpt_control%hfxsr_primbas)
298 ! admm control
299 ALLOCATE (full_kernel_env%admm_control)
300 full_kernel_env%admm_control%purification_method = do_admm_purify_none
301 full_kernel_env%admm_control%method = do_admm_basis_projection
302 full_kernel_env%admm_control%scaling_model = do_admm_exch_scaling_none
303 full_kernel_env%admm_control%aux_exch_func = do_admm_aux_exch_func_none
304 ! hfx section
305 full_kernel_env%hfxsr_section => hfxsr_section
306 !
307 CALL aux_admm_init(qs_env, mos, full_kernel_env%admm_env, &
308 full_kernel_env%admm_control, "TDA_HFX")
309 CALL get_admm_env(full_kernel_env%admm_env, mos_aux_fit=mos_aux_fit, &
310 matrix_s_aux_fit=matrix_s_aux_fit, &
311 matrix_s_aux_fit_vs_orb=matrix_s_aux_fit_vs_orb)
312 CALL admm_fit_mo_coeffs(full_kernel_env%admm_env, matrix_s_aux_fit, &
313 matrix_s_aux_fit_vs_orb, mos, mos_aux_fit, .true.)
314 ! x_data
315 CALL get_qs_env(qs_env, cell=cell, atomic_kind_set=atomic_kind_set, &
316 qs_kind_set=qs_kind_set, particle_set=particle_set, &
317 para_env=para_env)
318 CALL hfx_create(full_kernel_env%x_data, para_env, hfxsr_section, atomic_kind_set, &
319 qs_kind_set, particle_set, dft_control, cell, orb_basis="TDA_HFX")
320 END IF
321
322 ! allocate pools and work matrices
323 nstates = tddfpt_control%nstates
324 !! Too many states can lead to Problems
325 !! You should be warned if there are more states
326 !! then occ-virt Combinations!!
327 CALL cp_fm_get_info(gs_mos(1)%mos_occ, ncol_global=nocc)
328 CALL cp_fm_get_info(gs_mos(1)%mos_virt, ncol_global=nvirt)
329 nstate_max = nocc*nvirt
330 IF (nstates > nstate_max) THEN
331 cpwarn("NUMBER OF EXCITED STATES COULD LEAD TO PROBLEMS!")
332 cpwarn("Experimental: CHANGED NSTATES TO ITS MAXIMUM VALUE!")
333 nstates = nstate_max
334 tddfpt_control%nstates = nstate_max
335 END IF
336 CALL tddfpt_create_work_matrices(work_matrices, gs_mos, nstates, do_hfx, do_admm, &
337 do_hfxlr, do_exck, qs_env, sub_env)
338
339 ! create full_kernel and admm_kernel within tddfpt_energies
340 kernel_env%full_kernel => full_kernel_env
341 kernel_env%admm_kernel => kernel_env_admm_aux
342 NULLIFY (kernel_env%stda_kernel)
343 IF (do_hfxsr) THEN
344 ! work matrices for SR HFX
345 CALL hfxsr_create_work_matrices(work_matrices, qs_env, full_kernel_env%admm_env)
346 END IF
347 IF (do_hfxlr) THEN
348 ! calculate S_half and Lowdin MO coefficients
349 CALL get_lowdin_mo_coefficients(qs_env, sub_env, work_matrices)
350 END IF
351 ELSE IF (tddfpt_control%kernel == tddfpt_kernel_stda) THEN
352 ! setup for kernel_stda outside tddfpt_energies
353 nactive = 0
354 CALL cp_fm_get_info(gs_mos(1)%mos_occ, nrow_global=nao)
355 DO ispin = 1, SIZE(gs_mos)
356 CALL cp_fm_get_info(gs_mos(ispin)%mos_occ, &
357 ncol_global=nactive(ispin))
358 END DO
359 CALL allocate_stda_env(qs_env, stda_kernel, nao, nactive)
360 ! sTDA parameters
361 CALL stda_init_param(qs_env, stda_kernel, tddfpt_control%stda_control)
362 ! allocate pools and work matrices
363 nstates = tddfpt_control%nstates
364 CALL stda_create_work_matrices(work_matrices, gs_mos, nstates, &
365 qs_env, sub_env)
366 !
367 CALL stda_init_matrices(qs_env, stda_kernel, sub_env, &
368 work_matrices, tddfpt_control)
369 !
370 kernel_env%stda_kernel => stda_kernel
371 NULLIFY (kernel_env%full_kernel)
372 NULLIFY (kernel_env%admm_kernel)
373 ELSE IF (tddfpt_control%kernel == tddfpt_kernel_none) THEN
374 ! allocate pools and work matrices
375 nstates = tddfpt_control%nstates
376 CALL stda_create_work_matrices(work_matrices, gs_mos, nstates, &
377 qs_env, sub_env)
378 NULLIFY (kernel_env%full_kernel)
379 NULLIFY (kernel_env%admm_kernel)
380 NULLIFY (kernel_env%stda_kernel)
381 END IF
382
383 ALLOCATE (evects(nspins, nstates))
384 ALLOCATE (evals(nstates))
385
386 ALLOCATE (s_evects(nspins, nstates))
387 DO istate = 1, nstates
388 DO ispin = 1, nspins
389 CALL fm_pool_create_fm( &
390 work_matrices%fm_pool_ao_mo_occ(ispin)%pool, &
391 s_evects(ispin, istate))
392 END DO
393 END DO
394
395 IF (.NOT. do_soc) THEN
396 ! compute tddfpt excitation energies of multiplicity mult
397 CALL tddfpt_energies(qs_env, nstates, work_matrices, &
398 tddfpt_control, logger, tddfpt_print_section, evects, evals, &
399 gs_mos, tddfpt_section, s_evects, matrix_s, kernel_env, matrix_ks, &
400 sub_env, ostrength, dipole_op_mos_occ, mult, xc_section, full_kernel_env, &
401 kernel_env_admm_aux)
402 ELSE
403 CALL tddfpt_soc_energies(qs_env, nstates, work_matrices, &
404 tddfpt_control, logger, tddfpt_print_section, &
405 evects, evals, ostrength, &
406 gs_mos, tddfpt_section, s_evects, matrix_s, kernel_env, matrix_ks, &
407 sub_env, dipole_op_mos_occ, lmult_tmp, xc_section, full_kernel_env, &
408 kernel_env_admm_aux)
409 END IF
410
411 !print forces for selected states
412 IF (calc_forces) THEN
413 CALL tddfpt_print_forces(qs_env, evects, evals, ostrength, &
414 tddfpt_print_section, gs_mos, &
415 kernel_env, sub_env, work_matrices)
416 END IF
417
418 ! excited state potential energy surface
419 IF (qs_env%excited_state) THEN
420 IF (sub_env%is_split) THEN
421 CALL cp_abort(__location__, &
422 "Excited state forces not possible when states"// &
423 " are distributed to different CPU pools.")
424 END IF
425 ! for gradients unshifted KS matrix
426 IF (ASSOCIATED(matrix_ks_oep)) CALL get_qs_env(qs_env, matrix_ks=matrix_ks)
427 CALL get_qs_env(qs_env, exstate_env=ex_env)
428 state_change = .false.
429 IF (ex_env%state > 0) THEN
430 my_state = ex_env%state
431 ELSEIF (ex_env%state < 0) THEN
432 ! state following
433 ALLOCATE (my_mos(nspins))
434 DO ispin = 1, nspins
435 my_mos(ispin) = gs_mos(ispin)%mos_occ
436 END DO
437 my_state = abs(ex_env%state)
438 CALL assign_state(qs_env, matrix_s, evects, my_mos, ex_env%wfn_history, my_state)
439 DEALLOCATE (my_mos)
440 IF (my_state /= abs(ex_env%state)) THEN
441 state_change = .true.
442 old_state = abs(ex_env%state)
443 END IF
444 ex_env%state = -my_state
445 ELSE
446 CALL cp_warn(__location__, &
447 "Active excited state not assigned. Use the first state.")
448 my_state = 1
449 END IF
450 cpassert(my_state > 0)
451 IF (my_state > nstates) THEN
452 CALL cp_warn(__location__, &
453 "There were not enough excited states calculated.")
454 cpabort("excited state potential energy surface")
455 END IF
456 !
457 ! energy
458 ex_env%evalue = evals(my_state)
459 ! excitation vector
460 CALL cp_fm_release(ex_env%evect)
461 ALLOCATE (ex_env%evect(nspins))
462 DO ispin = 1, nspins
463 CALL cp_fm_get_info(matrix=evects(ispin, 1), &
464 matrix_struct=matrix_struct)
465 CALL cp_fm_create(ex_env%evect(ispin), matrix_struct)
466 CALL cp_fm_to_fm(evects(ispin, my_state), ex_env%evect(ispin))
467 END DO
468
469 IF (log_unit > 0) THEN
470 gsval = ex_env%wfn_history%gsval
471 gsmin = ex_env%wfn_history%gsmin
472 xsval = ex_env%wfn_history%xsval
473 WRITE (log_unit, "(1X,A,T40,F10.6,A,T62,F10.6,A)") "Ground state orbital alignment:", &
474 gsmin, "[MinVal]", gsval, "[Average]"
475 WRITE (log_unit, "(1X,A,T71,F10.6)") "Excitation vector alignment:", xsval
476 IF (state_change) THEN
477 WRITE (log_unit, "(1X,A,I5,T60,A14,T76,I5)") &
478 "Target state has been changed from state ", &
479 old_state, " to new state ", my_state
480 END IF
481 WRITE (log_unit, "(1X,A,I4,A,F12.5,A)") "Calculate properties for state:", &
482 my_state, " with excitation energy ", ex_env%evalue*evolt, " eV"
483 END IF
484
485 IF (calc_forces) THEN
486 CALL tddfpt_forces_main(qs_env, gs_mos, ex_env, kernel_env, &
487 sub_env, work_matrices)
488 END IF
489 END IF
490
491 ! clean up
492 CALL cp_fm_release(evects)
493 CALL cp_fm_release(s_evects)
494
495 CALL cp_print_key_finished_output(log_unit, &
496 logger, &
497 tddfpt_print_section, &
498 "PROGRAM_BANNER")
499
500 DEALLOCATE (evals, ostrength)
501
502 IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN
503 IF (do_admm) CALL release_kernel_env(kernel_env%admm_kernel)
504 IF (tddfpt_control%do_lrigpw) THEN
505 CALL lri_env_release(kernel_env%full_kernel%lri_env)
506 DEALLOCATE (kernel_env%full_kernel%lri_env)
507 CALL lri_density_release(kernel_env%full_kernel%lri_density)
508 DEALLOCATE (kernel_env%full_kernel%lri_density)
509 END IF
510 CALL release_kernel_env(kernel_env%full_kernel)
511 ELSE IF (tddfpt_control%kernel == tddfpt_kernel_stda) THEN
512 CALL deallocate_stda_env(stda_kernel)
513 ELSE IF (tddfpt_control%kernel == tddfpt_kernel_none) THEN
514 !
515 ELSE
516 cpabort('Unknown kernel type')
517 END IF
518 CALL tddfpt_release_work_matrices(work_matrices, sub_env)
519 CALL tddfpt_sub_env_release(sub_env)
520
521 CALL cp_fm_release(dipole_op_mos_occ)
522
523 DO ispin = nspins, 1, -1
524 CALL tddfpt_release_ground_state_mos(gs_mos(ispin))
525 END DO
526 DEALLOCATE (gs_mos)
527
528 IF (ASSOCIATED(matrix_ks_oep)) &
529 CALL dbcsr_deallocate_matrix_set(matrix_ks_oep)
530
531 CALL timestop(handle)
532
533 END SUBROUTINE tddfpt
534
535! **************************************************************************************************
536!> \brief TDDFPT input
537!> \param qs_env Quickstep environment
538!> \param do_hfx ...
539!> \param do_admm ...
540!> \param do_exck ...
541!> \param do_hfxsr ...
542!> \param do_hfxlr ...
543!> \param xc_section ...
544!> \param tddfpt_print_section ...
545!> \param lri_section ...
546!> \param hfxsr_section ...
547! **************************************************************************************************
548 SUBROUTINE tddfpt_input(qs_env, do_hfx, do_admm, do_exck, do_hfxsr, do_hfxlr, &
549 xc_section, tddfpt_print_section, lri_section, hfxsr_section)
550 TYPE(qs_environment_type), POINTER :: qs_env
551 LOGICAL, INTENT(INOUT) :: do_hfx, do_admm, do_exck, do_hfxsr, &
552 do_hfxlr
553 TYPE(section_vals_type), POINTER :: xc_section, tddfpt_print_section, &
554 lri_section, hfxsr_section
555
556 CHARACTER(len=20) :: nstates_str
557 LOGICAL :: exar, exf, exgcp, exhf, exhfxk, exk, &
558 explicit_root, expot, exvdw, exwfn, &
559 found, same_hfx
560 REAL(kind=dp) :: c_hf
561 TYPE(dft_control_type), POINTER :: dft_control
562 TYPE(section_vals_type), POINTER :: hfx_section, hfx_section_gs, input, &
563 tddfpt_section, xc_root, xc_sub
564 TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
565
566 NULLIFY (dft_control, input)
567 CALL get_qs_env(qs_env, dft_control=dft_control, input=input)
568 tddfpt_control => dft_control%tddfpt2_control
569
570 ! no k-points
571 cpassert(dft_control%nimages <= 1)
572
573 IF (tddfpt_control%nstates <= 0) THEN
574 CALL integer_to_string(tddfpt_control%nstates, nstates_str)
575 CALL cp_warn(__location__, "TDDFPT calculation was requested for "// &
576 trim(nstates_str)//" excited states: nothing to do.")
577 RETURN
578 END IF
579
580 NULLIFY (tddfpt_section, tddfpt_print_section)
581 tddfpt_section => section_vals_get_subs_vals(input, "PROPERTIES%TDDFPT")
582 tddfpt_print_section => section_vals_get_subs_vals(tddfpt_section, "PRINT")
583
584 IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN
585 NULLIFY (xc_root)
586 xc_root => section_vals_get_subs_vals(tddfpt_section, "XC")
587 CALL section_vals_get(xc_root, explicit=explicit_root)
588 NULLIFY (xc_section)
589 IF (explicit_root) THEN
590 ! No ADIABATIC_RESCALING option possible
591 NULLIFY (xc_sub)
592 xc_sub => section_vals_get_subs_vals(xc_root, "ADIABATIC_RESCALING")
593 CALL section_vals_get(xc_sub, explicit=exar)
594 IF (exar) THEN
595 CALL cp_warn(__location__, "TDDFPT Kernel with ADIABATIC_RESCALING not possible.")
596 cpabort("TDDFPT Input")
597 END IF
598 ! No GCP_POTENTIAL option possible
599 NULLIFY (xc_sub)
600 xc_sub => section_vals_get_subs_vals(xc_root, "GCP_POTENTIAL")
601 CALL section_vals_get(xc_sub, explicit=exgcp)
602 IF (exgcp) THEN
603 CALL cp_warn(__location__, "TDDFPT Kernel with GCP_POTENTIAL not possible.")
604 cpabort("TDDFPT Input")
605 END IF
606 ! No VDW_POTENTIAL option possible
607 NULLIFY (xc_sub)
608 xc_sub => section_vals_get_subs_vals(xc_root, "VDW_POTENTIAL")
609 CALL section_vals_get(xc_sub, explicit=exvdw)
610 IF (exvdw) THEN
611 CALL cp_warn(__location__, "TDDFPT Kernel with VDW_POTENTIAL not possible.")
612 cpabort("TDDFPT Input")
613 END IF
614 ! No WF_CORRELATION option possible
615 NULLIFY (xc_sub)
616 xc_sub => section_vals_get_subs_vals(xc_root, "WF_CORRELATION")
617 CALL section_vals_get(xc_sub, explicit=exwfn)
618 IF (exwfn) THEN
619 CALL cp_warn(__location__, "TDDFPT Kernel with WF_CORRELATION not possible.")
620 cpabort("TDDFPT Input")
621 END IF
622 ! No XC_POTENTIAL option possible
623 NULLIFY (xc_sub)
624 xc_sub => section_vals_get_subs_vals(xc_root, "XC_POTENTIAL")
625 CALL section_vals_get(xc_sub, explicit=expot)
626 IF (expot) THEN
627 CALL cp_warn(__location__, "TDDFPT Kernel with XC_POTENTIAL not possible.")
628 cpabort("TDDFPT Input")
629 END IF
630 !
631 NULLIFY (xc_sub)
632 xc_sub => section_vals_get_subs_vals(xc_root, "XC_FUNCTIONAL")
633 CALL section_vals_get(xc_sub, explicit=exf)
634 NULLIFY (xc_sub)
635 xc_sub => section_vals_get_subs_vals(xc_root, "XC_KERNEL")
636 CALL section_vals_get(xc_sub, explicit=exk)
637 IF ((exf .AND. exk) .OR. .NOT. (exf .OR. exk)) THEN
638 CALL cp_warn(__location__, "TDDFPT Kernel needs XC_FUNCTIONAL or XC_KERNEL section.")
639 cpabort("TDDFPT Input")
640 END IF
641 NULLIFY (xc_sub)
642 xc_sub => section_vals_get_subs_vals(xc_root, "HF")
643 CALL section_vals_get(xc_sub, explicit=exhf)
644 NULLIFY (xc_sub)
645 xc_sub => section_vals_get_subs_vals(xc_root, "HFX_KERNEL")
646 CALL section_vals_get(xc_sub, explicit=exhfxk)
647 !
648 xc_section => xc_root
649 hfx_section => section_vals_get_subs_vals(xc_section, "HF")
650 CALL section_vals_get(hfx_section, explicit=do_hfx)
651 IF (do_hfx) THEN
652 CALL section_vals_val_get(hfx_section, "FRACTION", r_val=c_hf)
653 do_hfx = (c_hf /= 0.0_dp)
654 END IF
655 !TDDFPT only works if the kernel has the same HF section as the DFT%XC one
656 IF (do_hfx) THEN
657 hfx_section_gs => section_vals_get_subs_vals(input, "DFT%XC%HF")
658 CALL compare_hfx_sections(hfx_section, hfx_section_gs, same_hfx)
659 IF (.NOT. same_hfx) THEN
660 cpabort("TDDFPT Kernel must use the same HF section as DFT%XC or no HF at all.")
661 END IF
662 END IF
663
664 do_admm = do_hfx .AND. dft_control%do_admm
665 IF (do_admm) THEN
666 ! 'admm_env%xc_section_primary' and 'admm_env%xc_section_aux' need to be redefined
667 CALL cp_abort(__location__, &
668 "ADMM is not implemented for a TDDFT kernel XC-functional which is different from "// &
669 "the one used for the ground-state calculation. A ground-state 'admm_env' cannot be reused.")
670 END IF
671 ! SET HFX_KERNEL and/or XC_KERNEL
672 IF (exk) THEN
673 do_exck = .true.
674 ELSE
675 do_exck = .false.
676 END IF
677 IF (exhfxk) THEN
678 xc_sub => section_vals_get_subs_vals(xc_root, "HFX_KERNEL")
679 CALL section_vals_val_get(xc_sub, "DO_HFXSR", l_val=do_hfxsr)
680 xc_sub => section_vals_get_subs_vals(xc_root, "HFX_KERNEL%HFXLR")
681 CALL section_vals_get(xc_sub, explicit=do_hfxlr)
682 ELSE
683 do_hfxsr = .false.
684 do_hfxlr = .false.
685 END IF
686 ELSE
687 xc_section => section_vals_get_subs_vals(input, "DFT%XC")
688 hfx_section => section_vals_get_subs_vals(xc_section, "HF")
689 CALL section_vals_get(hfx_section, explicit=do_hfx)
690 IF (do_hfx) THEN
691 CALL section_vals_val_get(hfx_section, "FRACTION", r_val=c_hf)
692 do_hfx = (c_hf /= 0.0_dp)
693 END IF
694 do_admm = do_hfx .AND. dft_control%do_admm
695 do_exck = .false.
696 do_hfxsr = .false.
697 do_hfxlr = .false.
698 END IF
699 ELSE
700 do_hfx = .false.
701 do_admm = .false.
702 do_exck = .false.
703 do_hfxsr = .false.
704 do_hfxlr = .false.
705 END IF
706
707 ! reset rks_triplets if UKS is in use
708 IF (tddfpt_control%rks_triplets .AND. dft_control%nspins > 1) THEN
709 tddfpt_control%rks_triplets = .false.
710 CALL cp_warn(__location__, "Keyword RKS_TRIPLETS has been ignored for spin-polarised calculations")
711 END IF
712
713 ! lri input
714 IF (tddfpt_control%do_lrigpw) THEN
715 lri_section => section_vals_get_subs_vals(tddfpt_section, "LRIGPW")
716 END IF
717
718 ! set defaults for short range HFX
719 NULLIFY (hfxsr_section)
720 IF (do_hfxsr) THEN
721 hfxsr_section => section_vals_get_subs_vals(tddfpt_section, "XC%HFX_KERNEL%HF")
722 CALL section_vals_get(hfxsr_section, explicit=found)
723 IF (.NOT. found) THEN
724 cpabort("HFXSR option needs &HF section defined")
725 END IF
726 CALL section_vals_val_get(hfxsr_section, "INTERACTION_POTENTIAL%POTENTIAL_TYPE", explicit=found)
727 IF (.NOT. found) THEN
728 CALL section_vals_val_set(hfxsr_section, "INTERACTION_POTENTIAL%POTENTIAL_TYPE", &
730 END IF
731 CALL section_vals_val_get(hfxsr_section, "INTERACTION_POTENTIAL%CUTOFF_RADIUS", explicit=found)
732 IF (.NOT. found) THEN
733 CALL section_vals_val_set(hfxsr_section, "INTERACTION_POTENTIAL%CUTOFF_RADIUS", r_val=7.5589_dp)
734 END IF
735 CALL section_vals_val_get(hfxsr_section, "RI%_SECTION_PARAMETERS_", l_val=found)
736 IF (found) THEN
737 CALL cp_abort(__location__, "Short range TDA kernel with RI not possible")
738 END IF
739 END IF
740
741 END SUBROUTINE tddfpt_input
742
743! **************************************************************************************************
744!> \brief ...
745!> \param log_unit ...
746!> \param dft_control ...
747!> \param tddfpt_control ...
748!> \param xc_section ...
749! **************************************************************************************************
750 SUBROUTINE kernel_info(log_unit, dft_control, tddfpt_control, xc_section)
751 INTEGER, INTENT(IN) :: log_unit
752 TYPE(dft_control_type), POINTER :: dft_control
753 TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
754 TYPE(section_vals_type), POINTER :: xc_section
755
756 CHARACTER(LEN=4) :: ktype
757 LOGICAL :: lsd
758
759 lsd = (dft_control%nspins > 1)
760 IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN
761 ktype = "FULL"
762 IF (log_unit > 0) THEN
763 WRITE (log_unit, "(T2,A,T77,A4)") "KERNEL|", trim(ktype)
764 CALL xc_write(log_unit, xc_section, lsd)
765 IF (tddfpt_control%do_hfx) THEN
766 IF (tddfpt_control%do_admm) THEN
767 WRITE (log_unit, "(T2,A,T62,A19)") "KERNEL|", "ADMM Exact Exchange"
768 IF (tddfpt_control%admm_xc_correction) THEN
769 WRITE (log_unit, "(T2,A,T60,A21)") "KERNEL|", "Apply ADMM Kernel XC Correction"
770 END IF
771 IF (tddfpt_control%admm_symm) THEN
772 WRITE (log_unit, "(T2,A,T60,A21)") "KERNEL|", "Symmetric ADMM Kernel"
773 END IF
774 ELSE
775 WRITE (log_unit, "(T2,A,T67,A14)") "KERNEL|", "Exact Exchange"
776 END IF
777 END IF
778 IF (tddfpt_control%do_hfxsr) THEN
779 WRITE (log_unit, "(T2,A,T43,A38)") "KERNEL|", "Short range HFX approximation"
780 END IF
781 IF (tddfpt_control%do_hfxlr) THEN
782 WRITE (log_unit, "(T2,A,T43,A38)") "KERNEL|", "Long range HFX approximation"
783 END IF
784 IF (tddfpt_control%do_lrigpw) THEN
785 WRITE (log_unit, "(T2,A,T42,A39)") "KERNEL|", "LRI approximation of transition density"
786 END IF
787 END IF
788 ELSE IF (tddfpt_control%kernel == tddfpt_kernel_stda) THEN
789 ktype = "sTDA"
790 IF (log_unit > 0) THEN
791 WRITE (log_unit, "(T2,A,T77,A4)") "KERNEL|", trim(ktype)
792 IF (tddfpt_control%stda_control%do_ewald) THEN
793 WRITE (log_unit, "(T2,A,T78,A3)") "KERNEL| Coulomb term uses Ewald summation"
794 ELSE
795 WRITE (log_unit, "(T2,A,T78,A3)") "KERNEL| Coulomb term uses direct summation (MIC)"
796 END IF
797 IF (tddfpt_control%stda_control%do_exchange) THEN
798 WRITE (log_unit, "(T2,A,T78,A3)") "KERNEL| Exact exchange term", "YES"
799 WRITE (log_unit, "(T2,A,T71,F10.3)") "KERNEL| Short range HFX fraction:", &
800 tddfpt_control%stda_control%hfx_fraction
801 ELSE
802 WRITE (log_unit, "(T2,A,T79,A2)") "KERNEL| Exact exchange term", "NO"
803 END IF
804 WRITE (log_unit, "(T2,A,T66,E15.3)") "KERNEL| Transition density filter", &
805 tddfpt_control%stda_control%eps_td_filter
806 END IF
807 ELSE IF (tddfpt_control%kernel == tddfpt_kernel_none) THEN
808 ktype = "NONE"
809 IF (log_unit > 0) THEN
810 WRITE (log_unit, "(T2,A,T77,A4)") "KERNEL|", trim(ktype)
811 END IF
812 ELSE
813 !CPABORT("Unknown kernel")
814 END IF
815 !
816 IF (log_unit > 0) THEN
817 IF (tddfpt_control%rks_triplets) THEN
818 WRITE (log_unit, "(T2,A,T74,A7)") "KERNEL| Spin symmetry of excitations", "Triplet"
819 ELSE IF (lsd) THEN
820 WRITE (log_unit, "(T2,A,T69,A12)") "KERNEL| Spin symmetry of excitations", "Unrestricted"
821 ELSE
822 WRITE (log_unit, "(T2,A,T74,A7)") "KERNEL| Spin symmetry of excitations", "Singlet"
823 END IF
824 WRITE (log_unit, "(T2,A,T73,I8)") "TDDFPT| Number of states calculated", tddfpt_control%nstates
825 WRITE (log_unit, "(T2,A,T73,I8)") "TDDFPT| Number of Davidson iterations", tddfpt_control%niters
826 WRITE (log_unit, "(T2,A,T66,E15.3)") "TDDFPT| Davidson iteration convergence", tddfpt_control%conv
827 WRITE (log_unit, "(T2,A,T73,I8)") "TDDFPT| Max. number of Krylov space vectors", tddfpt_control%nkvs
828 END IF
829
830 END SUBROUTINE kernel_info
831
832! **************************************************************************************************
833!> \brief The energy cylculation has been moved to its own subroutine
834!> \param qs_env ...
835!> \param nstates ...
836!> \param work_matrices ...
837!> \param tddfpt_control ...
838!> \param logger ...
839!> \param tddfpt_print_section ...
840!> \param evects ...
841!> \param evals ...
842!> \param gs_mos ...
843!> \param tddfpt_section ...
844!> \param S_evects ...
845!> \param matrix_s ...
846!> \param kernel_env ...
847!> \param matrix_ks ...
848!> \param sub_env ...
849!> \param ostrength ...
850!> \param dipole_op_mos_occ ...
851!> \param mult ...
852!> \param xc_section ...
853!> \param full_kernel_env ...
854!> \param kernel_env_admm_aux ...
855! **************************************************************************************************
856 SUBROUTINE tddfpt_energies(qs_env, nstates, work_matrices, &
857 tddfpt_control, logger, tddfpt_print_section, evects, evals, &
858 gs_mos, tddfpt_section, S_evects, matrix_s, kernel_env, matrix_ks, &
859 sub_env, ostrength, dipole_op_mos_occ, mult, xc_section, full_kernel_env, &
860 kernel_env_admm_aux)
861
862 TYPE(qs_environment_type), POINTER :: qs_env
863 INTEGER :: nstates
864 TYPE(tddfpt_work_matrices) :: work_matrices
865 TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
866 TYPE(cp_logger_type), POINTER :: logger
867 TYPE(section_vals_type), POINTER :: tddfpt_print_section
868 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: evects
869 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: evals
870 TYPE(tddfpt_ground_state_mos), DIMENSION(:), &
871 POINTER :: gs_mos
872 TYPE(section_vals_type), POINTER :: tddfpt_section
873 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: s_evects
874 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s
875 TYPE(kernel_env_type) :: kernel_env
876 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks
877 TYPE(tddfpt_subgroup_env_type) :: sub_env
878 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: ostrength
879 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: dipole_op_mos_occ
880 INTEGER :: mult
881 TYPE(section_vals_type), POINTER :: xc_section
882 TYPE(full_kernel_env_type), TARGET :: full_kernel_env, kernel_env_admm_aux
883
884 CHARACTER(LEN=*), PARAMETER :: routinen = 'tddfpt_energies'
885
886 CHARACTER(len=20) :: nstates_str
887 INTEGER :: energy_unit, handle, iter, log_unit, &
888 niters, nocc, nstate_max, &
889 nstates_read, nvirt
890 LOGICAL :: do_admm, do_exck, do_soc, explicit, &
891 is_restarted
892 REAL(kind=dp) :: conv
893 TYPE(admm_type), POINTER :: admm_env
894 TYPE(cp_blacs_env_type), POINTER :: blacs_env
895 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks_oep
896 TYPE(section_vals_type), POINTER :: lri_section, namd_print_section, &
897 soc_section
898
899 CALL timeset(routinen, handle)
900
901 NULLIFY (admm_env, matrix_ks_oep)
902 do_admm = tddfpt_control%do_admm
903 IF (do_admm) CALL get_qs_env(qs_env, admm_env=admm_env)
904
905 ! setup for full_kernel and admm_kernel within tddfpt_energies due to dependence on multiplicity
906 IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN
907
909 rho_orb_struct=work_matrices%rho_orb_struct_sub, &
910 rho_xc_struct=work_matrices%rho_xc_struct_sub, &
911 is_rks_triplets=tddfpt_control%rks_triplets, &
912 qs_env=qs_env, sub_env=sub_env, &
913 wfm_rho_orb=work_matrices%rho_ao_orb_fm_sub)
914
915 IF (do_admm) THEN
916 ! Full kernel with ADMM
917 IF (tddfpt_control%admm_xc_correction) THEN
918 CALL create_kernel_env(kernel_env=full_kernel_env, &
919 rho_struct_sub=work_matrices%rho_orb_struct_sub, &
920 xc_section=admm_env%xc_section_primary, &
921 is_rks_triplets=tddfpt_control%rks_triplets, &
922 sub_env=sub_env)
923 ELSE
924 CALL create_kernel_env(kernel_env=full_kernel_env, &
925 rho_struct_sub=work_matrices%rho_orb_struct_sub, &
926 xc_section=xc_section, &
927 is_rks_triplets=tddfpt_control%rks_triplets, &
928 sub_env=sub_env)
929 END IF
930
932 rho_orb_struct=work_matrices%rho_orb_struct_sub, &
933 rho_aux_fit_struct=work_matrices%rho_aux_fit_struct_sub, &
934 local_rho_set=sub_env%local_rho_set_admm, &
935 qs_env=qs_env, sub_env=sub_env, &
936 wfm_rho_orb=work_matrices%rho_ao_orb_fm_sub, &
937 wfm_rho_aux_fit=work_matrices%rho_ao_aux_fit_fm_sub, &
938 wfm_aux_orb=work_matrices%wfm_aux_orb_sub)
939
940 CALL create_kernel_env(kernel_env=kernel_env_admm_aux, &
941 rho_struct_sub=work_matrices%rho_aux_fit_struct_sub, &
942 xc_section=admm_env%xc_section_aux, &
943 is_rks_triplets=tddfpt_control%rks_triplets, &
944 sub_env=sub_env)
945 kernel_env%full_kernel => full_kernel_env
946 kernel_env%admm_kernel => kernel_env_admm_aux
947 ELSE
948 ! Full kernel
949 CALL create_kernel_env(kernel_env=full_kernel_env, &
950 rho_struct_sub=work_matrices%rho_orb_struct_sub, &
951 xc_section=xc_section, &
952 is_rks_triplets=tddfpt_control%rks_triplets, &
953 sub_env=sub_env)
954 kernel_env%full_kernel => full_kernel_env
955 NULLIFY (kernel_env%admm_kernel)
956 END IF
957 ! Fxc from kernel definition
958 do_exck = tddfpt_control%do_exck
959 kernel_env%full_kernel%do_exck = do_exck
960 ! initilize xc kernel
961 IF (do_exck) THEN
962 CALL create_fxc_kernel(work_matrices%rho_orb_struct_sub, work_matrices%fxc_rspace_sub, &
963 xc_section, tddfpt_control%rks_triplets, sub_env, qs_env)
964 END IF
965 END IF
966
967 ! lri input
968 IF (tddfpt_control%do_lrigpw) THEN
969 lri_section => section_vals_get_subs_vals(tddfpt_section, "LRIGPW")
970 CALL tddfpt2_lri_init(qs_env, kernel_env, lri_section, &
971 tddfpt_print_section)
972 END IF
973
974 !! Too many states cal lead to Problems
975 !! You should be warned if there are mor states
976 !! then occ-virt Combinations!!
977 CALL cp_fm_get_info(gs_mos(1)%mos_occ, ncol_global=nocc)
978 CALL cp_fm_get_info(gs_mos(1)%mos_virt, ncol_global=nvirt)
979 nstate_max = nocc*nvirt
980 IF (nstates > nstate_max) THEN
981 cpwarn("NUMBER OF EXCITED STATES COULD LEAD TO PROBLEMS!")
982 cpwarn("Experimental: CHANGED NSTATES TO ITS MAXIMUM VALUE!")
983 nstates = nstate_max
984 END IF
985
986 soc_section => section_vals_get_subs_vals(tddfpt_section, "SOC")
987 CALL section_vals_get(soc_section, explicit=do_soc)
988
989 ! reuse Ritz vectors from the previous calculation if available
990 IF (tddfpt_control%is_restart .AND. .NOT. do_soc) THEN
991 CALL get_qs_env(qs_env, blacs_env=blacs_env)
992
993 nstates_read = tddfpt_read_restart( &
994 evects=evects, &
995 evals=evals, &
996 gs_mos=gs_mos, &
997 logger=logger, &
998 tddfpt_section=tddfpt_section, &
999 tddfpt_print_section=tddfpt_print_section, &
1000 fm_pool_ao_mo_occ=work_matrices%fm_pool_ao_mo_occ, &
1001 blacs_env_global=blacs_env)
1002 ELSE
1003 nstates_read = 0
1004 END IF
1005
1006 is_restarted = nstates_read >= nstates
1007
1008 ! build the list of missed singly excited states and sort them in ascending order
1009 ! according to their excitation energies
1010 log_unit = cp_print_key_unit_nr(logger, tddfpt_print_section, &
1011 "GUESS_VECTORS", extension=".tddfptLog")
1012 CALL tddfpt_guess_vectors(evects=evects, evals=evals, &
1013 gs_mos=gs_mos, log_unit=log_unit)
1014 CALL cp_print_key_finished_output(log_unit, logger, &
1015 tddfpt_print_section, "GUESS_VECTORS")
1016
1017 CALL tddfpt_orthogonalize_psi1_psi0(evects, work_matrices%S_C0_C0T)
1018 CALL tddfpt_orthonormalize_psi1_psi1(evects, &
1019 nstates, &
1020 s_evects, &
1021 matrix_s(1)%matrix)
1022
1023 niters = tddfpt_control%niters
1024 IF (niters > 0) THEN
1025 log_unit = cp_print_key_unit_nr(logger, tddfpt_print_section, &
1026 "ITERATION_INFO", extension=".tddfptLog")
1027 energy_unit = cp_print_key_unit_nr(logger, &
1028 tddfpt_print_section, &
1029 "DETAILED_ENERGY", &
1030 extension=".tddfptLog")
1031
1032 IF (log_unit > 0) THEN
1033 WRITE (log_unit, "(1X,A)") "", &
1034 "-------------------------------------------------------------------------------", &
1035 "- TDDFPT WAVEFUNCTION OPTIMIZATION -", &
1036 "-------------------------------------------------------------------------------"
1037
1038 WRITE (log_unit, '(/,T11,A,T27,A,T40,A,T62,A)') "Step", "Time", "Convergence", "Conv. states"
1039 WRITE (log_unit, '(1X,79("-"))')
1040 END IF
1041
1042 CALL cp_add_iter_level(logger%iter_info, "TDDFT_SCF")
1043
1044 DO
1045 ! *** perform Davidson iterations ***
1046 conv = tddfpt_davidson_solver( &
1047 evects=evects, &
1048 evals=evals, &
1049 s_evects=s_evects, &
1050 gs_mos=gs_mos, &
1051 tddfpt_control=tddfpt_control, &
1052 matrix_ks=matrix_ks, &
1053 qs_env=qs_env, &
1054 kernel_env=kernel_env, &
1055 sub_env=sub_env, &
1056 logger=logger, &
1057 iter_unit=log_unit, &
1058 energy_unit=energy_unit, &
1059 tddfpt_print_section=tddfpt_print_section, &
1060 work_matrices=work_matrices)
1061
1062 ! at this point at least one of the following conditions are met:
1063 ! a) convergence criteria has been achieved;
1064 ! b) maximum number of iterations has been reached;
1065 ! c) Davidson iterations must be restarted due to lack of Krylov vectors or numerical instability
1066
1067 CALL cp_iterate(logger%iter_info, increment=0, iter_nr_out=iter)
1068 ! terminate the loop if either (a) or (b) is true ...
1069 IF ((conv <= tddfpt_control%conv &
1070 .AND. is_restarted) .OR. iter >= niters) EXIT
1071
1072 ! ... otherwise restart Davidson iterations
1073 is_restarted = .true.
1074 IF (log_unit > 0) THEN
1075 WRITE (log_unit, '(1X,25("-"),1X,A,1X,25("-"))') "Restart Davidson iterations"
1076 CALL m_flush(log_unit)
1077 END IF
1078 END DO
1079
1080 ! write TDDFPT restart file at the last iteration if requested to do so
1081 CALL cp_iterate(logger%iter_info, increment=0, last=.true.)
1082 CALL tddfpt_write_restart(evects=evects, &
1083 evals=evals, &
1084 gs_mos=gs_mos, &
1085 logger=logger, &
1086 tddfpt_print_section=tddfpt_print_section)
1087
1088 CALL cp_rm_iter_level(logger%iter_info, "TDDFT_SCF")
1089
1090 ! print convergence summary
1091 IF (log_unit > 0) THEN
1092 CALL integer_to_string(iter, nstates_str)
1093 IF (conv <= tddfpt_control%conv) THEN
1094 WRITE (log_unit, "(1X,A)") "", &
1095 "-------------------------------------------------------------------------------", &
1096 "- TDDFPT run converged in "//trim(nstates_str)//" iteration(s) ", &
1097 "-------------------------------------------------------------------------------"
1098 ELSE
1099 WRITE (log_unit, "(1X,A)") "", &
1100 "-------------------------------------------------------------------------------", &
1101 "- TDDFPT run did NOT converge after "//trim(nstates_str)//" iteration(s) ", &
1102 "-------------------------------------------------------------------------------"
1103 END IF
1104 END IF
1105
1106 CALL cp_print_key_finished_output(energy_unit, logger, &
1107 tddfpt_print_section, "DETAILED_ENERGY")
1108 CALL cp_print_key_finished_output(log_unit, logger, &
1109 tddfpt_print_section, "ITERATION_INFO")
1110 ELSE
1111 CALL cp_warn(__location__, &
1112 "Skipping TDDFPT wavefunction optimization")
1113 END IF
1114
1115 IF (ASSOCIATED(matrix_ks_oep)) THEN
1116 IF (tddfpt_control%dipole_form == tddfpt_dipole_velocity) THEN
1117 CALL cp_warn(__location__, &
1118 "Transition dipole moments and oscillator strengths are likely to be incorrect "// &
1119 "when computed using an orbital energy correction XC-potential together with "// &
1120 "the velocity form of dipole transition integrals")
1121 END IF
1122 END IF
1123
1124 ! *** print summary information ***
1125 log_unit = cp_logger_get_default_io_unit(logger)
1126
1127 namd_print_section => section_vals_get_subs_vals( &
1128 tddfpt_print_section, &
1129 "NAMD_PRINT")
1130 CALL section_vals_get(namd_print_section, explicit=explicit)
1131 IF (explicit) THEN
1132 CALL tddfpt_write_newtonx_output(evects, &
1133 evals, &
1134 gs_mos, &
1135 logger, &
1136 tddfpt_print_section, &
1137 matrix_s(1)%matrix, &
1138 s_evects, &
1139 sub_env)
1140 END IF
1141 ALLOCATE (ostrength(nstates))
1142 ostrength = 0.0_dp
1143 CALL tddfpt_print_summary(log_unit, &
1144 evects, &
1145 evals, &
1146 ostrength, &
1147 mult, &
1148 dipole_op_mos_occ, &
1149 tddfpt_control%dipole_form)
1151 log_unit, &
1152 evects, &
1153 evals, &
1154 gs_mos, &
1155 matrix_s(1)%matrix, &
1156 min_amplitude=tddfpt_control%min_excitation_amplitude)
1157 CALL tddfpt_print_nto_analysis(qs_env, &
1158 evects, evals, &
1159 ostrength, &
1160 gs_mos, &
1161 matrix_s(1)%matrix, &
1162 tddfpt_print_section)
1163
1164 IF (tddfpt_control%do_lrigpw) THEN
1165 CALL lri_print_stat(qs_env, &
1166 ltddfpt=.true., &
1167 tddfpt_lri_env=kernel_env%full_kernel%lri_env)
1168 END IF
1169
1170 CALL timestop(handle)
1171 END SUBROUTINE tddfpt_energies
1172
1173! **************************************************************************************************
1174!> \brief Perform singlet and triplet computations for subsequent TDDFPT-SOC calculation.
1175!> \param qs_env Quickstep environment
1176!> \param nstates number of requested exited states
1177!> \param work_matrices ...
1178!> \param tddfpt_control ...
1179!> \param logger ...
1180!> \param tddfpt_print_section ...
1181!> \param evects Eigenvector of the requested multiplicity
1182!> \param evals Eigenvalue of the requested multiplicity
1183!> \param ostrength Oscillatorstrength
1184!> \param gs_mos ...
1185!> \param tddfpt_section ...
1186!> \param S_evects ...
1187!> \param matrix_s ...
1188!> \param kernel_env ...
1189!> \param matrix_ks ...
1190!> \param sub_env ...
1191!> \param dipole_op_mos_occ ...
1192!> \param lmult_tmp ...
1193!> \param xc_section ...
1194!> \param full_kernel_env ...
1195!> \param kernel_env_admm_aux ...
1196!> \par History
1197!> * 02.2023 created [Jan-Robert Vogt]
1198!> \note Based on tddfpt2_methods and xas_tdp_utils.
1199!> \note only the values of one multiplicity will be passed back for force calculations!
1200! **************************************************************************************************
1201
1202 SUBROUTINE tddfpt_soc_energies(qs_env, nstates, work_matrices, &
1203 tddfpt_control, logger, tddfpt_print_section, &
1204 evects, evals, ostrength, &
1205 gs_mos, tddfpt_section, S_evects, matrix_s, kernel_env, matrix_ks, &
1206 sub_env, dipole_op_mos_occ, lmult_tmp, xc_section, full_kernel_env, &
1207 kernel_env_admm_aux)
1208
1209 TYPE(qs_environment_type), INTENT(IN), POINTER :: qs_env
1210 INTEGER, INTENT(in) :: nstates
1211 TYPE(tddfpt_work_matrices) :: work_matrices
1212 TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
1213 TYPE(cp_logger_type), POINTER :: logger
1214 TYPE(section_vals_type), POINTER :: tddfpt_print_section
1215 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: evects
1216 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: evals, ostrength
1217 TYPE(tddfpt_ground_state_mos), DIMENSION(:), &
1218 POINTER :: gs_mos
1219 TYPE(section_vals_type), POINTER :: tddfpt_section
1220 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: s_evects
1221 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s
1222 TYPE(kernel_env_type) :: kernel_env
1223 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks
1224 TYPE(tddfpt_subgroup_env_type) :: sub_env
1225 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: dipole_op_mos_occ
1226 LOGICAL, INTENT(in) :: lmult_tmp
1227 TYPE(section_vals_type), POINTER :: xc_section
1228 TYPE(full_kernel_env_type), TARGET :: full_kernel_env, kernel_env_admm_aux
1229
1230 CHARACTER(LEN=*), PARAMETER :: routinen = 'tddfpt_soc_energies'
1231
1232 INTEGER :: handle, ispin, istate, log_unit, mult, &
1233 nspins
1234 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: evals_mult, ostrength_mult
1235 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: evects_mult
1236
1237 CALL timeset(routinen, handle)
1238
1239 log_unit = cp_print_key_unit_nr(logger, tddfpt_print_section, &
1240 "PROGRAM_BANNER", &
1241 extension=".tddfptLog")
1242 CALL tddfpt_soc_header(log_unit)
1243
1244 nspins = SIZE(gs_mos)
1245 ALLOCATE (evects_mult(nspins, nstates))
1246 ALLOCATE (evals_mult(nstates))
1247
1248 ! First multiplicity
1249 IF (lmult_tmp) THEN
1250 IF (log_unit > 0) THEN
1251 WRITE (log_unit, "(1X,A)") "", &
1252 "-------------------------------------------------------------------------------", &
1253 "- TDDFPT SINGLET ENERGIES -", &
1254 "-------------------------------------------------------------------------------"
1255 END IF
1256 mult = 1
1257 ELSE
1258 IF (log_unit > 0) THEN
1259 WRITE (log_unit, "(1X,A)") "", &
1260 "-------------------------------------------------------------------------------", &
1261 "- TDDFPT TRIPLET ENERGIES -", &
1262 "-------------------------------------------------------------------------------"
1263 END IF
1264 mult = 3
1265 END IF
1266
1267 CALL tddfpt_energies(qs_env, nstates, work_matrices, tddfpt_control, logger, &
1268 tddfpt_print_section, evects_mult, evals_mult, &
1269 gs_mos, tddfpt_section, s_evects, matrix_s, &
1270 kernel_env, matrix_ks, sub_env, ostrength_mult, &
1271 dipole_op_mos_occ, mult, xc_section, full_kernel_env, &
1272 kernel_env_admm_aux)
1273
1274 ! Clean up in between for full kernel
1275 IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN
1276 IF (tddfpt_control%do_admm) CALL release_kernel_env(kernel_env%admm_kernel)
1277 CALL release_kernel_env(kernel_env%full_kernel)
1278 CALL tddfpt_release_work_matrices(work_matrices, sub_env)
1279 CALL tddfpt_create_work_matrices(work_matrices, gs_mos, nstates, tddfpt_control%do_hfx, &
1280 tddfpt_control%do_admm, tddfpt_control%do_hfxlr, &
1281 tddfpt_control%do_exck, qs_env, sub_env)
1282 END IF
1283
1284 DO istate = 1, nstates
1285 DO ispin = 1, nspins
1286 CALL cp_fm_release(s_evects(ispin, istate))
1287 END DO
1288 END DO
1289
1290 DO istate = 1, nstates
1291 DO ispin = 1, nspins
1292 CALL fm_pool_create_fm( &
1293 work_matrices%fm_pool_ao_mo_occ(ispin)%pool, &
1294 s_evects(ispin, istate))
1295 END DO
1296 END DO
1297
1298 tddfpt_control%rks_triplets = lmult_tmp
1299
1300 ! Second multiplicity
1301 IF (lmult_tmp) THEN
1302 IF (log_unit > 0) THEN
1303 WRITE (log_unit, "(1X,A)") "", &
1304 " singlet excitations finished ", &
1305 " ", &
1306 "-------------------------------------------------------------------------------", &
1307 "- TDDFPT TRIPLET ENERGIES -", &
1308 "-------------------------------------------------------------------------------"
1309 END IF !log_unit
1310 mult = 3
1311 ELSE
1312 IF (log_unit > 0) THEN
1313 WRITE (log_unit, "(1X,A)") "", &
1314 " triplet excitations finished ", &
1315 " ", &
1316 "-------------------------------------------------------------------------------", &
1317 "- TDDFPT SINGLET ENERGIES -", &
1318 "-------------------------------------------------------------------------------"
1319 END IF !log_unit
1320 mult = 1
1321 END IF
1322
1323 CALL tddfpt_energies(qs_env, nstates, work_matrices, tddfpt_control, logger, &
1324 tddfpt_print_section, evects, evals, &
1325 gs_mos, tddfpt_section, s_evects, matrix_s, &
1326 kernel_env, matrix_ks, sub_env, ostrength, &
1327 dipole_op_mos_occ, mult, xc_section, full_kernel_env, &
1328 kernel_env_admm_aux)
1329
1330 ! Compute perturbative SOC correction
1331 ! Order should always be singlet triplet in tddfpt_soc
1332 IF (lmult_tmp) THEN
1333 CALL tddfpt_soc(qs_env, evals_mult, evals, evects_mult, evects, gs_mos) !mult=singlet
1334 ELSE
1335 CALL tddfpt_soc(qs_env, evals, evals_mult, evects, evects_mult, gs_mos) !mult=triplet
1336 END IF
1337
1338 ! deallocate the additional multiplicity
1339 DO ispin = 1, SIZE(evects_mult, 1)
1340 DO istate = 1, SIZE(evects_mult, 2)
1341 CALL cp_fm_release(evects_mult(ispin, istate))
1342 END DO
1343 END DO
1344 DEALLOCATE (evects_mult, evals_mult, ostrength_mult)
1345
1346 CALL timestop(handle)
1347
1348 END SUBROUTINE tddfpt_soc_energies
1349
1350END MODULE qs_tddfpt2_methods
Contains ADMM methods which require molecular orbitals.
subroutine, public admm_fit_mo_coeffs(admm_env, matrix_s_aux_fit, matrix_s_mixed, mos, mos_aux_fit, geometry_did_change)
...
Types and set/get functions for auxiliary density matrix methods.
Definition admm_types.F:15
subroutine, public get_admm_env(admm_env, mo_derivs_aux_fit, mos_aux_fit, sab_aux_fit, sab_aux_fit_asymm, sab_aux_fit_vs_orb, matrix_s_aux_fit, matrix_s_aux_fit_kp, matrix_s_aux_fit_vs_orb, matrix_s_aux_fit_vs_orb_kp, task_list_aux_fit, matrix_ks_aux_fit, matrix_ks_aux_fit_kp, matrix_ks_aux_fit_im, matrix_ks_aux_fit_dft, matrix_ks_aux_fit_hfx, matrix_ks_aux_fit_dft_kp, matrix_ks_aux_fit_hfx_kp, rho_aux_fit, rho_aux_fit_buffer, admm_dm)
Get routine for the ADMM env.
Definition admm_types.F:593
Define the atomic kind types and their sub types.
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public grimme2016
integer, save, public iannuzzi2005
integer, save, public grimme2013
Handles all functions related to the CELL.
Definition cell_types.F:15
methods related to the blacs parallel environment
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
DBCSR operations in CP2K.
pool for for elements that are retained and released
subroutine, public fm_pool_create_fm(pool, element, name)
returns an element, allocating it if none is in the pool
represent the structure of a full matrix
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, use_sp)
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,...
subroutine, public cp_iterate(iteration_info, last, iter_nr, increment, iter_nr_out)
adds one to the actual iteration
subroutine, public cp_rm_iter_level(iteration_info, level_name, n_rlevel_att)
Removes an iteration level.
subroutine, public cp_add_iter_level(iteration_info, level_name, n_rlevel_new)
Adds an iteration level.
Types for excited states potential energies.
subroutine, public tddfpt_header(iw)
...
Definition header.F:122
subroutine, public tddfpt_soc_header(iw)
...
Definition header.F:143
Utilities for hfx and admm methods.
subroutine, public aux_admm_init(qs_env, mos, admm_env, admm_control, basis_type)
Minimal setup routine for admm_env No forces No k-points No DFT correction terms.
Types and set/get functions for HFX.
Definition hfx_types.F:15
subroutine, public hfx_create(x_data, para_env, hfx_section, atomic_kind_set, qs_kind_set, particle_set, dft_control, cell, orb_basis, ri_basis, nelectron_total, nkp_grid)
This routine allocates and initializes all types in hfx_data
Definition hfx_types.F:594
subroutine, public compare_hfx_sections(hfx_section1, hfx_section2, is_identical, same_except_frac)
Compares the non-technical parts of two HFX input section and check whether they are the same Ignore ...
Definition hfx_types.F:2953
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_admm_purify_none
integer, parameter, public tddfpt_kernel_none
integer, parameter, public do_admm_basis_projection
integer, parameter, public do_admm_aux_exch_func_none
integer, parameter, public tddfpt_dipole_velocity
integer, parameter, public do_potential_truncated
integer, parameter, public tddfpt_kernel_full
integer, parameter, public tddfpt_kernel_stda
integer, parameter, public do_admm_exch_scaling_none
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_vals_val_set(section_vals, keyword_name, i_rep_section, i_rep_val, val, l_val, i_val, r_val, c_val, l_vals_ptr, i_vals_ptr, r_vals_ptr, c_vals_ptr)
sets the requested value
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_get(section_vals, ref_count, n_repetition, n_subs_vals_rep, section, explicit)
returns various attributes about the section_vals
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
Calculates integral matrices for LRIGPW method lri : local resolution of the identity.
subroutine, public lri_print_stat(qs_env, ltddfpt, tddfpt_lri_env)
...
contains the types and subroutines for dealing with the lri_env lri : local resolution of the identit...
subroutine, public lri_density_release(lri_density)
releases the given lri_density
subroutine, public lri_env_release(lri_env)
releases the given lri_env
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:106
Interface to the message passing library MPI.
generate or use from input minimal basis set
subroutine, public create_minbas_set(qs_env, unit_nr, basis_type, primitive)
...
Define the data structure for the particle information.
Definition of physical constants:
Definition physcon.F:68
real(kind=dp), parameter, public evolt
Definition physcon.F:183
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, rhs)
Get the QUICKSTEP environment.
subroutine, public create_fxc_kernel(rho_struct, fxc_rspace, xc_section, is_rks_triplets, sub_env, qs_env)
Create the xc kernel potential for the approximate Fxc kernel model.
subroutine, public create_kernel_env(kernel_env, xc_section, is_rks_triplets, rho_struct_sub, lsd_singlets, do_excitations, sub_env, qs_env)
Create kernel environment.
subroutine, public release_kernel_env(kernel_env)
Release kernel environment.
Define the quickstep kind type and their sub types.
Definition and initialisation of the mo data type.
Definition qs_mo_types.F:22
groups fairly general SCF methods, so that modules other than qs_scf can use them too split off from ...
subroutine, public eigensolver(matrix_ks_fm, mo_set, ortho, work, cholesky_method, do_level_shift, level_shift, matrix_u_fm, use_jacobi)
Diagonalise the Kohn-Sham matrix to get a new set of MO eigen- vectors and MO eigenvalues....
module that contains the definitions of the scf types
subroutine, public assign_state(qs_env, matrix_s, evects, psi0, wfn_history, my_state)
...
subroutine, public tddfpt_construct_aux_fit_density(rho_orb_struct, rho_aux_fit_struct, local_rho_set, qs_env, sub_env, wfm_rho_orb, wfm_rho_aux_fit, wfm_aux_orb)
Project a charge density expressed in primary basis set into the auxiliary basis set.
subroutine, public tddfpt_construct_ground_state_orb_density(rho_orb_struct, rho_xc_struct, is_rks_triplets, qs_env, sub_env, wfm_rho_orb)
Compute the ground-state charge density expressed in primary basis set.
subroutine, public tddfpt_orthonormalize_psi1_psi1(evects, nvects_new, s_evects, matrix_s)
Make new TDDFPT trial vectors orthonormal to all previous trial vectors.
subroutine, public tddfpt_orthogonalize_psi1_psi0(evects, s_c0_c0t)
Make TDDFPT trial vectors orthogonal to all occupied molecular orbitals.
real(kind=dp) function, public tddfpt_davidson_solver(evects, evals, s_evects, gs_mos, tddfpt_control, matrix_ks, qs_env, kernel_env, sub_env, logger, iter_unit, energy_unit, tddfpt_print_section, work_matrices)
Perform Davidson iterations.
subroutine, public tddfpt_forces_main(qs_env, gs_mos, ex_env, kernel_env, sub_env, work_matrices)
Perform TDDFPT gradient calculation.
subroutine, public tddfpt_print_forces(qs_env, evects, evals, ostrength, print_section, gs_mos, kernel_env, sub_env, work_matrices)
Calculate and print forces of selected excited states.
subroutine, public tddfpt2_lri_init(qs_env, kernel_env, lri_section, tddfpt_print_section)
Initialize LRI environment, basis, neighborlists and matrices.
subroutine, public tddfpt(qs_env, calc_forces)
Perform TDDFPT calculation.
subroutine, public tddfpt_energies(qs_env, nstates, work_matrices, tddfpt_control, logger, tddfpt_print_section, evects, evals, gs_mos, tddfpt_section, s_evects, matrix_s, kernel_env, matrix_ks, sub_env, ostrength, dipole_op_mos_occ, mult, xc_section, full_kernel_env, kernel_env_admm_aux)
The energy cylculation has been moved to its own subroutine.
subroutine, public tddfpt_input(qs_env, do_hfx, do_admm, do_exck, do_hfxsr, do_hfxlr, xc_section, tddfpt_print_section, lri_section, hfxsr_section)
TDDFPT input.
subroutine, public kernel_info(log_unit, dft_control, tddfpt_control, xc_section)
...
subroutine, public tddfpt_print_excitation_analysis(log_unit, evects, evals, gs_mos, matrix_s, min_amplitude)
Print excitation analysis.
subroutine, public tddfpt_dipole_operator(dipole_op_mos_occ, tddfpt_control, gs_mos, qs_env)
Compute the action of the dipole operator on the ground state wave function.
subroutine, public tddfpt_print_nto_analysis(qs_env, evects, evals, ostrength, gs_mos, matrix_s, print_section)
Print natural transition orbital analysis.
subroutine, public tddfpt_print_summary(log_unit, evects, evals, ostrength, mult, dipole_op_mos_occ, dipole_form)
Print final TDDFPT excitation energies and oscillator strengths.
integer function, public tddfpt_read_restart(evects, evals, gs_mos, logger, tddfpt_section, tddfpt_print_section, fm_pool_ao_mo_occ, blacs_env_global)
Initialise initial guess vectors by reading (un-normalised) Ritz vectors from a binary restart file.
subroutine, public tddfpt_write_newtonx_output(evects, evals, gs_mos, logger, tddfpt_print_section, matrix_s, s_evects, sub_env)
Write Ritz vectors to a binary restart file.
subroutine, public tddfpt_write_restart(evects, evals, gs_mos, logger, tddfpt_print_section)
Write Ritz vectors to a binary restart file.
subroutine, public tddfpt_soc(qs_env, evals_a, evals_b, evects_a, evects_b, gs_mos)
Perform TDDFPT-SOC calculation.
Simplified Tamm Dancoff approach (sTDA).
subroutine, public stda_init_param(qs_env, stda_kernel, stda_control)
Get the parameters needed for an sTDA calculation.
subroutine, public deallocate_stda_env(stda_kernel)
Deallocate the sTDA environment.
subroutine, public allocate_stda_env(qs_env, stda_kernel, n_ao, nactive)
Allocate the sTDA environment.
Simplified Tamm Dancoff approach (sTDA).
subroutine, public get_lowdin_mo_coefficients(qs_env, sub_env, work)
Calculate Lowdin MO coefficients.
subroutine, public stda_init_matrices(qs_env, stda_kernel, sub_env, work, tddfpt_control)
Calculate sTDA matrices.
subroutine, public tddfpt_sub_env_init(sub_env, qs_env, mos_occ, kernel)
Split MPI communicator to create a set of parallel (sub)groups.
subroutine, public tddfpt_sub_env_release(sub_env)
Release parallel group environment.
subroutine, public hfxsr_create_work_matrices(work_matrices, qs_env, admm_env)
Allocate work matrices for hfxsr.
subroutine, public tddfpt_release_work_matrices(work_matrices, sub_env)
Release work matrices.
subroutine, public stda_create_work_matrices(work_matrices, gs_mos, nstates, qs_env, sub_env)
Allocate work matrices for sTDA kernel.
subroutine, public tddfpt_create_work_matrices(work_matrices, gs_mos, nstates, do_hfx, do_admm, do_hfxlr, do_exck, qs_env, sub_env)
Allocate work matrices for full kernel.
subroutine, public tddfpt_release_ground_state_mos(gs_mos)
Release molecular orbitals.
subroutine, public tddfpt_guess_vectors(evects, evals, gs_mos, log_unit)
Generate missed guess vectors.
subroutine, public tddfpt_oecorr(qs_env, gs_mos, matrix_ks_oep)
Callculate orbital corrected KS matrix for TDDFPT.
subroutine, public tddfpt_init_mos(qs_env, gs_mos, iounit)
Prepare MOs for TDDFPT Calculations.
Utilities for string manipulations.
subroutine, public integer_to_string(inumber, string)
Converts an integer number to a string. The WRITE statement will return an error message,...
Writes information on XC functionals to output.
subroutine, public xc_write(iounit, xc_section, lsd)
...
stores some data used in wavefunction fitting
Definition admm_types.F:120
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
Definition cell_types.F:55
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
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...
Contains information on the excited states energy.
stores all the informations relevant to an mpi environment
Collection of variables required to evaluate adiabatic TDDFPT kernel.
Type to hold environments for the different kernels.
Provides all information about a quickstep kind.
Ground state molecular orbitals.
Set of temporary ("work") matrices.