(git:33f5bf2)
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-2025 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,&
17 cite_reference
18 USE cell_types, ONLY: cell_type
23 USE cp_dbcsr_api, ONLY: dbcsr_p_type
27 USE cp_fm_types, ONLY: cp_fm_create,&
41 USE header, ONLY: tddfpt_header,&
46 USE input_constants, ONLY: &
55 USE kinds, ONLY: dp
59 USE machine, ONLY: m_flush
63 USE physcon, ONLY: evolt
72 USE qs_mo_types, ONLY: mo_set_type
93 USE qs_tddfpt2_soc, ONLY: tddfpt_soc
113 USE rixs_types, ONLY: rixs_env_type,&
116 USE xc_write_output, ONLY: xc_write
117#include "./base/base_uses.f90"
118
119 IMPLICIT NONE
120
121 PRIVATE
122
123 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_tddfpt2_methods'
124
125 LOGICAL, PARAMETER, PRIVATE :: debug_this_module = .false.
126 ! number of first derivative components (3: d/dx, d/dy, d/dz)
127 INTEGER, PARAMETER, PRIVATE :: nderivs = 3
128 INTEGER, PARAMETER, PRIVATE :: maxspins = 2
129
131
132! **************************************************************************************************
133
134CONTAINS
135
136! **************************************************************************************************
137!> \brief Perform TDDFPT calculation. If calc_forces then it also builds the response vector for the
138!> Z-vector method and calculates some contributions to the force
139!> \param qs_env Quickstep environment
140!> \param calc_forces ...
141!> \param rixs_env ...
142!> \par History
143!> * 05.2016 created [Sergey Chulkov]
144!> * 06.2016 refactored to be used with Davidson eigensolver [Sergey Chulkov]
145!> * 03.2017 cleaned and refactored [Sergey Chulkov]
146!> \note Based on the subroutines tddfpt_env_init(), and tddfpt_env_deallocate().
147! **************************************************************************************************
148 SUBROUTINE tddfpt(qs_env, calc_forces, rixs_env)
149 TYPE(qs_environment_type), POINTER :: qs_env
150 LOGICAL, INTENT(IN) :: calc_forces
151 TYPE(rixs_env_type), OPTIONAL, POINTER :: rixs_env
152
153 CHARACTER(LEN=*), PARAMETER :: routinen = 'tddfpt'
154
155 INTEGER :: handle, ispin, istate, log_unit, mult, &
156 my_state, nao, nocc, nspins, &
157 nstate_max, nstates, nvirt, old_state
158 INTEGER, DIMENSION(maxspins) :: nactive
159 LOGICAL :: do_admm, do_exck, do_hfx, do_hfxlr, &
160 do_hfxsr, do_rixs, do_sf, do_soc, &
161 lmult_tmp, state_change
162 REAL(kind=dp) :: gsmin, gsval, xsval
163 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: evals, ostrength
164 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
165 TYPE(cell_type), POINTER :: cell
166 TYPE(cp_blacs_env_type), POINTER :: blacs_env
167 TYPE(cp_fm_struct_type), POINTER :: matrix_struct
168 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:) :: my_mos
169 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: dipole_op_mos_occ, evects, s_evects
170 TYPE(cp_logger_type), POINTER :: logger
171 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks, matrix_ks_oep, matrix_s, &
172 matrix_s_aux_fit, &
173 matrix_s_aux_fit_vs_orb
174 TYPE(dft_control_type), POINTER :: dft_control
175 TYPE(excited_energy_type), POINTER :: ex_env
176 TYPE(full_kernel_env_type), TARGET :: full_kernel_env, kernel_env_admm_aux
177 TYPE(kernel_env_type) :: kernel_env
178 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos, mos_aux_fit
179 TYPE(mp_para_env_type), POINTER :: para_env
180 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
181 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
182 TYPE(qs_scf_env_type), POINTER :: scf_env
183 TYPE(rixs_control_type), POINTER :: rixs_control
184 TYPE(section_vals_type), POINTER :: hfxsr_section, kernel_section, &
185 lri_section, soc_section, &
186 tddfpt_print_section, tddfpt_section, &
187 xc_section
188 TYPE(stda_env_type), TARGET :: stda_kernel
189 TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
190 TYPE(tddfpt2_valence_type), POINTER :: valence_state
191 TYPE(tddfpt_ground_state_mos), DIMENSION(:), &
192 POINTER :: gs_mos
193 TYPE(tddfpt_subgroup_env_type) :: sub_env
194 TYPE(tddfpt_work_matrices) :: work_matrices
195
196 CALL timeset(routinen, handle)
197
198 NULLIFY (logger)
199 logger => cp_get_default_logger()
200
201 ! input section print/xc
202 NULLIFY (tddfpt_section, tddfpt_control)
203
204 CALL tddfpt_input(qs_env, do_hfx, do_admm, do_exck, &
205 do_hfxsr, do_hfxlr, xc_section, tddfpt_print_section, &
206 lri_section, hfxsr_section)
207
208 log_unit = cp_print_key_unit_nr(logger, tddfpt_print_section, "PROGRAM_BANNER", &
209 extension=".tddfptLog")
210
211 CALL get_qs_env(qs_env, &
212 blacs_env=blacs_env, &
213 cell=cell, &
214 dft_control=dft_control, &
215 matrix_ks=matrix_ks, &
216 matrix_s=matrix_s, &
217 mos=mos, &
218 scf_env=scf_env, &
219 do_rixs=do_rixs)
220
221 IF (do_rixs) THEN
222 tddfpt_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%RIXS%TDDFPT")
223 NULLIFY (rixs_control, valence_state)
224 rixs_control => dft_control%rixs_control
225 tddfpt_control => rixs_control%tddfpt2_control
226 valence_state => rixs_env%valence_state
227 ELSE
228 tddfpt_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%TDDFPT")
229 tddfpt_control => dft_control%tddfpt2_control
230 END IF
231
232 tddfpt_control%do_hfx = do_hfx
233 tddfpt_control%do_admm = do_admm
234 tddfpt_control%do_hfxsr = do_hfxsr
235 tddfpt_control%hfxsr_primbas = 0
236 tddfpt_control%hfxsr_re_int = .true.
237 tddfpt_control%do_hfxlr = do_hfxlr
238 tddfpt_control%do_exck = do_exck
239 do_sf = tddfpt_control%spinflip /= no_sf_tddfpt
240 IF (do_sf) CALL cite_reference(hernandez2025)
241 IF (tddfpt_control%do_hfxlr) THEN
242 kernel_section => section_vals_get_subs_vals(tddfpt_section, "XC%HFX_KERNEL%HFXLR")
243 CALL section_vals_val_get(kernel_section, "RCUT", r_val=tddfpt_control%hfxlr_rcut)
244 CALL section_vals_val_get(kernel_section, "SCALE", r_val=tddfpt_control%hfxlr_scale)
245 END IF
246
247 soc_section => section_vals_get_subs_vals(tddfpt_section, "SOC")
248 CALL section_vals_get(soc_section, explicit=do_soc)
249
250 IF (do_soc) THEN
251 ! start with multiplicity that is not specified in input
252 ! so that excited-state gradient is for multiplicity given in input
253 lmult_tmp = tddfpt_control%rks_triplets
254 tddfpt_control%rks_triplets = .NOT. (tddfpt_control%rks_triplets)
255 END IF
256
257 CALL cite_reference(iannuzzi2005)
258 IF (tddfpt_control%kernel == tddfpt_kernel_stda) THEN
259 CALL cite_reference(grimme2013)
260 CALL cite_reference(grimme2016)
261 END IF
262
263 CALL tddfpt_header(log_unit)
264 CALL kernel_info(log_unit, dft_control, tddfpt_control, xc_section)
265 ! obtain occupied and virtual (unoccupied) ground-state Kohn-Sham orbitals
266 NULLIFY (gs_mos)
267
268 CALL tddfpt_init_mos(qs_env, gs_mos, log_unit)
269
270 ! obtain smeared occupation numbers
271 IF (tddfpt_control%do_smearing) THEN
272 CALL tddfpt_smeared_occupation(qs_env, gs_mos, log_unit)
273 END IF
274
275 ! obtain corrected KS-matrix
276 CALL tddfpt_oecorr(qs_env, gs_mos, matrix_ks_oep)
277
278 IF ((tddfpt_control%do_lrigpw) .AND. &
279 (tddfpt_control%kernel /= tddfpt_kernel_full)) THEN
280 CALL cp_abort(__location__, "LRI only implemented for full kernel")
281 END IF
282
283 IF (ASSOCIATED(matrix_ks_oep)) matrix_ks => matrix_ks_oep
284
285 ! components of the dipole operator
286 CALL tddfpt_dipole_operator(dipole_op_mos_occ, &
287 tddfpt_control, &
288 gs_mos, &
289 qs_env)
290
291 nspins = SIZE(gs_mos)
292 ! multiplicity of molecular system
293 IF (nspins > 1) THEN
294 mult = abs(SIZE(gs_mos(1)%evals_occ) - SIZE(gs_mos(2)%evals_occ)) + 1
295 IF (mult > 2) &
296 CALL cp_warn(__location__, "There is a convergence issue for multiplicity >= 3")
297 ELSE
298 IF (tddfpt_control%rks_triplets) THEN
299 mult = 3
300 ELSE
301 mult = 1
302 END IF
303 END IF
304
305 ! split mpi communicator
306 ALLOCATE (my_mos(nspins))
307 DO ispin = 1, nspins
308 my_mos(ispin) = gs_mos(ispin)%mos_occ
309 END DO
310 CALL tddfpt_sub_env_init(sub_env, qs_env, mos_occ=my_mos(:), &
311 kernel=tddfpt_control%kernel)
312 DEALLOCATE (my_mos)
313
314 IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN
315 ! create environment for Full Kernel
316 IF (dft_control%qs_control%xtb) THEN
317 cpabort("TDDFPT: xTB only works with sTDA Kernel")
318 END IF
319
320 IF (tddfpt_control%do_hfxsr) THEN
321 kernel_section => section_vals_get_subs_vals(tddfpt_section, "XC%HFX_KERNEL")
322 CALL section_vals_val_get(kernel_section, "HFXSR_PRIMBAS", &
323 i_val=tddfpt_control%hfxsr_primbas)
324 ! basis set
325 CALL create_minbas_set(qs_env, log_unit, basis_type="TDA_HFX", &
326 primitive=tddfpt_control%hfxsr_primbas)
327 ! admm control
328 ALLOCATE (full_kernel_env%admm_control)
329 full_kernel_env%admm_control%purification_method = do_admm_purify_none
330 full_kernel_env%admm_control%method = do_admm_basis_projection
331 full_kernel_env%admm_control%scaling_model = do_admm_exch_scaling_none
332 full_kernel_env%admm_control%aux_exch_func = do_admm_aux_exch_func_none
333 ! hfx section
334 full_kernel_env%hfxsr_section => hfxsr_section
335 !
336 CALL aux_admm_init(qs_env, mos, full_kernel_env%admm_env, &
337 full_kernel_env%admm_control, "TDA_HFX")
338 CALL get_admm_env(full_kernel_env%admm_env, mos_aux_fit=mos_aux_fit, &
339 matrix_s_aux_fit=matrix_s_aux_fit, &
340 matrix_s_aux_fit_vs_orb=matrix_s_aux_fit_vs_orb)
341 CALL admm_fit_mo_coeffs(full_kernel_env%admm_env, matrix_s_aux_fit, &
342 matrix_s_aux_fit_vs_orb, mos, mos_aux_fit, .true.)
343 ! x_data
344 CALL get_qs_env(qs_env, cell=cell, atomic_kind_set=atomic_kind_set, &
345 qs_kind_set=qs_kind_set, particle_set=particle_set, &
346 para_env=para_env)
347 CALL hfx_create(full_kernel_env%x_data, para_env, hfxsr_section, atomic_kind_set, &
348 qs_kind_set, particle_set, dft_control, cell, orb_basis="TDA_HFX")
349 END IF
350
351 ! allocate pools and work matrices
352 nstates = tddfpt_control%nstates
353 !! Too many states can lead to Problems
354 !! You should be warned if there are more states
355 !! than occ-virt Combinations!!
356 CALL cp_fm_get_info(gs_mos(1)%mos_occ, ncol_global=nocc)
357 IF (tddfpt_control%spinflip == no_sf_tddfpt) THEN
358 CALL cp_fm_get_info(gs_mos(1)%mos_virt, ncol_global=nvirt)
359 ELSE
360 CALL cp_fm_get_info(gs_mos(2)%mos_virt, ncol_global=nvirt)
361 END IF
362 nstate_max = nocc*nvirt
363 IF (nstates > nstate_max) THEN
364 cpwarn("NUMBER OF EXCITED STATES COULD LEAD TO PROBLEMS!")
365 cpwarn("Experimental: CHANGED NSTATES TO ITS MAXIMUM VALUE!")
366 nstates = nstate_max
367 tddfpt_control%nstates = nstate_max
368 END IF
369 CALL tddfpt_create_work_matrices(work_matrices, gs_mos, nstates, do_hfx, do_admm, &
370 do_hfxlr, do_exck, do_sf, qs_env, sub_env)
371
372 ! create full_kernel and admm_kernel within tddfpt_energies
373 kernel_env%full_kernel => full_kernel_env
374 kernel_env%admm_kernel => kernel_env_admm_aux
375 NULLIFY (kernel_env%stda_kernel)
376 IF (do_hfxsr) THEN
377 ! work matrices for SR HFX
378 CALL hfxsr_create_work_matrices(work_matrices, qs_env, full_kernel_env%admm_env)
379 END IF
380 IF (do_hfxlr) THEN
381 ! calculate S_half and Lowdin MO coefficients
382 CALL get_lowdin_mo_coefficients(qs_env, sub_env, work_matrices)
383 END IF
384 ELSE IF (tddfpt_control%kernel == tddfpt_kernel_stda) THEN
385 ! setup for kernel_stda outside tddfpt_energies
386 nactive = 0
387 CALL cp_fm_get_info(gs_mos(1)%mos_occ, nrow_global=nao)
388 DO ispin = 1, SIZE(gs_mos)
389 CALL cp_fm_get_info(gs_mos(ispin)%mos_occ, &
390 ncol_global=nactive(ispin))
391 END DO
392 CALL allocate_stda_env(qs_env, stda_kernel, nao, nactive)
393 ! sTDA parameters
394 CALL stda_init_param(qs_env, stda_kernel, tddfpt_control%stda_control)
395 ! allocate pools and work matrices
396 nstates = tddfpt_control%nstates
397 CALL stda_create_work_matrices(work_matrices, gs_mos, nstates, &
398 qs_env, sub_env)
399 !
400 CALL stda_init_matrices(qs_env, stda_kernel, sub_env, &
401 work_matrices, tddfpt_control)
402 !
403 kernel_env%stda_kernel => stda_kernel
404 NULLIFY (kernel_env%full_kernel)
405 NULLIFY (kernel_env%admm_kernel)
406 ELSE IF (tddfpt_control%kernel == tddfpt_kernel_none) THEN
407 ! allocate pools and work matrices
408 nstates = tddfpt_control%nstates
409 CALL stda_create_work_matrices(work_matrices, gs_mos, nstates, &
410 qs_env, sub_env)
411 NULLIFY (kernel_env%full_kernel)
412 NULLIFY (kernel_env%admm_kernel)
413 NULLIFY (kernel_env%stda_kernel)
414 END IF
415
416 IF (do_sf) THEN
417 ! only alpha -> beta excitations are considered in spin-flip TDDFT
418 ALLOCATE (evects(1, nstates))
419 ELSE
420 ALLOCATE (evects(nspins, nstates))
421 END IF
422 ALLOCATE (evals(nstates))
423 ALLOCATE (s_evects(SIZE(evects, 1), nstates))
424
425 DO istate = 1, nstates
426 DO ispin = 1, SIZE(evects, 1)
427 CALL fm_pool_create_fm( &
428 work_matrices%fm_pool_ao_mo_occ(ispin)%pool, &
429 s_evects(ispin, istate))
430 END DO
431 END DO
432
433 IF (.NOT. do_soc) THEN
434 ! compute tddfpt excitation energies of multiplicity mult
435 CALL tddfpt_energies(qs_env, nstates, nspins, work_matrices, &
436 tddfpt_control, logger, tddfpt_print_section, evects, evals, &
437 gs_mos, tddfpt_section, s_evects, matrix_s, kernel_env, matrix_ks, &
438 sub_env, ostrength, dipole_op_mos_occ, mult, xc_section, full_kernel_env, &
439 kernel_env_admm_aux)
440 ELSE
441 CALL tddfpt_soc_energies(qs_env, nstates, work_matrices, &
442 tddfpt_control, logger, tddfpt_print_section, &
443 evects, evals, ostrength, &
444 gs_mos, tddfpt_section, s_evects, matrix_s, kernel_env, matrix_ks, &
445 sub_env, dipole_op_mos_occ, lmult_tmp, xc_section, full_kernel_env, &
446 kernel_env_admm_aux)
447 END IF
448
449 !print forces for selected states
450 IF (calc_forces) THEN
451 CALL tddfpt_print_forces(qs_env, evects, evals, ostrength, &
452 tddfpt_print_section, gs_mos, &
453 kernel_env, sub_env, work_matrices)
454 END IF
455
456 ! excited state potential energy surface
457 IF (qs_env%excited_state) THEN
458 IF (sub_env%is_split) THEN
459 CALL cp_abort(__location__, &
460 "Excited state forces not possible when states"// &
461 " are distributed to different CPU pools.")
462 END IF
463 ! for gradients unshifted KS matrix
464 IF (ASSOCIATED(matrix_ks_oep)) CALL get_qs_env(qs_env, matrix_ks=matrix_ks)
465 CALL get_qs_env(qs_env, exstate_env=ex_env)
466 state_change = .false.
467 IF (ex_env%state > 0) THEN
468 my_state = ex_env%state
469 ELSEIF (ex_env%state < 0) THEN
470 ! state following
471 ALLOCATE (my_mos(nspins))
472 DO ispin = 1, nspins
473 my_mos(ispin) = gs_mos(ispin)%mos_occ
474 END DO
475 my_state = abs(ex_env%state)
476 CALL assign_state(qs_env, matrix_s, evects, my_mos, ex_env%wfn_history, my_state)
477 DEALLOCATE (my_mos)
478 IF (my_state /= abs(ex_env%state)) THEN
479 state_change = .true.
480 old_state = abs(ex_env%state)
481 END IF
482 ex_env%state = -my_state
483 ELSE
484 CALL cp_warn(__location__, &
485 "Active excited state not assigned. Use the first state.")
486 my_state = 1
487 END IF
488 cpassert(my_state > 0)
489 IF (my_state > nstates) THEN
490 CALL cp_warn(__location__, &
491 "There were not enough excited states calculated.")
492 cpabort("excited state potential energy surface")
493 END IF
494 !
495 ! energy
496 ex_env%evalue = evals(my_state)
497 ! excitation vector
498 CALL cp_fm_release(ex_env%evect)
499 ALLOCATE (ex_env%evect(SIZE(evects, 1)))
500 DO ispin = 1, SIZE(evects, 1)
501 CALL cp_fm_get_info(matrix=evects(ispin, 1), &
502 matrix_struct=matrix_struct)
503 CALL cp_fm_create(ex_env%evect(ispin), matrix_struct)
504 CALL cp_fm_to_fm(evects(ispin, my_state), ex_env%evect(ispin))
505 END DO
506
507 IF (log_unit > 0) THEN
508 gsval = ex_env%wfn_history%gsval
509 gsmin = ex_env%wfn_history%gsmin
510 xsval = ex_env%wfn_history%xsval
511 WRITE (log_unit, "(1X,A,T40,F10.6,A,T62,F10.6,A)") "Ground state orbital alignment:", &
512 gsmin, "[MinVal]", gsval, "[Average]"
513 WRITE (log_unit, "(1X,A,T71,F10.6)") "Excitation vector alignment:", xsval
514 IF (state_change) THEN
515 WRITE (log_unit, "(1X,A,I5,T60,A14,T76,I5)") &
516 "Target state has been changed from state ", &
517 old_state, " to new state ", my_state
518 END IF
519 WRITE (log_unit, "(1X,A,I4,A,F12.5,A)") "Calculate properties for state:", &
520 my_state, " with excitation energy ", ex_env%evalue*evolt, " eV"
521 END IF
522
523 ! Calculate response vector
524 IF (calc_forces) THEN
525 CALL tddfpt_forces_main(qs_env, gs_mos, ex_env, kernel_env, &
526 sub_env, work_matrices)
527 END IF
528 END IF
529
530 ! share evals, evects and mo_coefs with rixs
531 IF (do_rixs) THEN
532 ! copy evals
533 valence_state%nstates = nstates
534 ALLOCATE (valence_state%evals(SIZE(evals)))
535 valence_state%evals(:) = evals(:)
536
537 ALLOCATE (valence_state%evects(nspins, nstates))
538 ALLOCATE (valence_state%mos_occ(nspins))
539 DO ispin = 1, nspins
540 ! copy evects
541 DO istate = 1, nstates
542 CALL cp_fm_get_info(matrix=evects(ispin, istate), &
543 matrix_struct=matrix_struct)
544 CALL cp_fm_create(valence_state%evects(ispin, istate), matrix_struct)
545 CALL cp_fm_to_fm(evects(ispin, istate), valence_state%evects(ispin, istate))
546 END DO
547 ! copy mos_occ
548 CALL cp_fm_get_info(matrix=gs_mos(ispin)%mos_occ, &
549 matrix_struct=matrix_struct)
550 CALL cp_fm_create(valence_state%mos_occ(ispin), matrix_struct)
551 CALL cp_fm_to_fm(gs_mos(ispin)%mos_occ, valence_state%mos_occ(ispin))
552 END DO
553 END IF
554
555 ! clean up
556 CALL cp_fm_release(evects)
557 CALL cp_fm_release(s_evects)
558
559 CALL cp_print_key_finished_output(log_unit, &
560 logger, &
561 tddfpt_print_section, &
562 "PROGRAM_BANNER")
563
564 DEALLOCATE (evals, ostrength)
565
566 IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN
567 IF (do_admm) CALL release_kernel_env(kernel_env%admm_kernel)
568 IF (tddfpt_control%do_lrigpw) THEN
569 CALL lri_env_release(kernel_env%full_kernel%lri_env)
570 DEALLOCATE (kernel_env%full_kernel%lri_env)
571 CALL lri_density_release(kernel_env%full_kernel%lri_density)
572 DEALLOCATE (kernel_env%full_kernel%lri_density)
573 END IF
574 CALL release_kernel_env(kernel_env%full_kernel)
575 ELSE IF (tddfpt_control%kernel == tddfpt_kernel_stda) THEN
576 CALL deallocate_stda_env(stda_kernel)
577 ELSE IF (tddfpt_control%kernel == tddfpt_kernel_none) THEN
578 !
579 ELSE
580 cpabort('Unknown kernel type')
581 END IF
582 CALL tddfpt_release_work_matrices(work_matrices, sub_env)
583 CALL tddfpt_sub_env_release(sub_env)
584
585 CALL cp_fm_release(dipole_op_mos_occ)
586
587 DO ispin = nspins, 1, -1
588 CALL tddfpt_release_ground_state_mos(gs_mos(ispin))
589 END DO
590 DEALLOCATE (gs_mos)
591
592 IF (ASSOCIATED(matrix_ks_oep)) &
593 CALL dbcsr_deallocate_matrix_set(matrix_ks_oep)
594
595 CALL timestop(handle)
596
597 END SUBROUTINE tddfpt
598
599! **************************************************************************************************
600!> \brief TDDFPT input
601!> \param qs_env Quickstep environment
602!> \param do_hfx ...
603!> \param do_admm ...
604!> \param do_exck ...
605!> \param do_hfxsr ...
606!> \param do_hfxlr ...
607!> \param xc_section ...
608!> \param tddfpt_print_section ...
609!> \param lri_section ...
610!> \param hfxsr_section ...
611! **************************************************************************************************
612 SUBROUTINE tddfpt_input(qs_env, do_hfx, do_admm, do_exck, do_hfxsr, do_hfxlr, &
613 xc_section, tddfpt_print_section, lri_section, hfxsr_section)
614 TYPE(qs_environment_type), POINTER :: qs_env
615 LOGICAL, INTENT(INOUT) :: do_hfx, do_admm, do_exck, do_hfxsr, &
616 do_hfxlr
617 TYPE(section_vals_type), POINTER :: xc_section, tddfpt_print_section, &
618 lri_section, hfxsr_section
619
620 CHARACTER(len=20) :: nstates_str
621 LOGICAL :: exar, exf, exgcp, exhf, exhfxk, exk, &
622 explicit_root, expot, exvdw, exwfn, &
623 found, same_hfx
624 REAL(kind=dp) :: c_hf
625 TYPE(dft_control_type), POINTER :: dft_control
626 TYPE(section_vals_type), POINTER :: hfx_section, hfx_section_gs, input, &
627 tddfpt_section, xc_root, xc_sub
628 TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
629
630 NULLIFY (dft_control, input)
631 CALL get_qs_env(qs_env, dft_control=dft_control, input=input)
632 tddfpt_control => dft_control%tddfpt2_control
633
634 ! no k-points
635 IF (dft_control%nimages > 1) cpabort("k-points not implemented for TDDFPT")
636
637 IF (tddfpt_control%nstates <= 0) THEN
638 CALL integer_to_string(tddfpt_control%nstates, nstates_str)
639 CALL cp_warn(__location__, "TDDFPT calculation was requested for "// &
640 trim(nstates_str)//" excited states: nothing to do.")
641 RETURN
642 END IF
643
644 NULLIFY (tddfpt_section, tddfpt_print_section)
645 tddfpt_section => section_vals_get_subs_vals(input, "PROPERTIES%TDDFPT")
646 tddfpt_print_section => section_vals_get_subs_vals(tddfpt_section, "PRINT")
647
648 IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN
649 NULLIFY (xc_root)
650 xc_root => section_vals_get_subs_vals(tddfpt_section, "XC")
651 CALL section_vals_get(xc_root, explicit=explicit_root)
652 NULLIFY (xc_section)
653 IF (explicit_root) THEN
654 ! No ADIABATIC_RESCALING option possible
655 NULLIFY (xc_sub)
656 xc_sub => section_vals_get_subs_vals(xc_root, "ADIABATIC_RESCALING")
657 CALL section_vals_get(xc_sub, explicit=exar)
658 IF (exar) THEN
659 CALL cp_warn(__location__, "TDDFPT Kernel with ADIABATIC_RESCALING not possible.")
660 cpabort("TDDFPT Input")
661 END IF
662 ! No GCP_POTENTIAL option possible
663 NULLIFY (xc_sub)
664 xc_sub => section_vals_get_subs_vals(xc_root, "GCP_POTENTIAL")
665 CALL section_vals_get(xc_sub, explicit=exgcp)
666 IF (exgcp) THEN
667 CALL cp_warn(__location__, "TDDFPT Kernel with GCP_POTENTIAL not possible.")
668 cpabort("TDDFPT Input")
669 END IF
670 ! No VDW_POTENTIAL option possible
671 NULLIFY (xc_sub)
672 xc_sub => section_vals_get_subs_vals(xc_root, "VDW_POTENTIAL")
673 CALL section_vals_get(xc_sub, explicit=exvdw)
674 IF (exvdw) THEN
675 CALL cp_warn(__location__, "TDDFPT Kernel with VDW_POTENTIAL not possible.")
676 cpabort("TDDFPT Input")
677 END IF
678 ! No WF_CORRELATION option possible
679 NULLIFY (xc_sub)
680 xc_sub => section_vals_get_subs_vals(xc_root, "WF_CORRELATION")
681 CALL section_vals_get(xc_sub, explicit=exwfn)
682 IF (exwfn) THEN
683 CALL cp_warn(__location__, "TDDFPT Kernel with WF_CORRELATION not possible.")
684 cpabort("TDDFPT Input")
685 END IF
686 ! No XC_POTENTIAL option possible
687 NULLIFY (xc_sub)
688 xc_sub => section_vals_get_subs_vals(xc_root, "XC_POTENTIAL")
689 CALL section_vals_get(xc_sub, explicit=expot)
690 IF (expot) THEN
691 CALL cp_warn(__location__, "TDDFPT Kernel with XC_POTENTIAL not possible.")
692 cpabort("TDDFPT Input")
693 END IF
694 !
695 NULLIFY (xc_sub)
696 xc_sub => section_vals_get_subs_vals(xc_root, "XC_FUNCTIONAL")
697 CALL section_vals_get(xc_sub, explicit=exf)
698 NULLIFY (xc_sub)
699 xc_sub => section_vals_get_subs_vals(xc_root, "XC_KERNEL")
700 CALL section_vals_get(xc_sub, explicit=exk)
701 IF ((exf .AND. exk) .OR. .NOT. (exf .OR. exk)) THEN
702 CALL cp_warn(__location__, "TDDFPT Kernel needs XC_FUNCTIONAL or XC_KERNEL section.")
703 cpabort("TDDFPT Input")
704 END IF
705 NULLIFY (xc_sub)
706 xc_sub => section_vals_get_subs_vals(xc_root, "HF")
707 CALL section_vals_get(xc_sub, explicit=exhf)
708 NULLIFY (xc_sub)
709 xc_sub => section_vals_get_subs_vals(xc_root, "HFX_KERNEL")
710 CALL section_vals_get(xc_sub, explicit=exhfxk)
711 !
712 xc_section => xc_root
713 hfx_section => section_vals_get_subs_vals(xc_section, "HF")
714 CALL section_vals_get(hfx_section, explicit=do_hfx)
715 IF (do_hfx) THEN
716 CALL section_vals_val_get(hfx_section, "FRACTION", r_val=c_hf)
717 do_hfx = (c_hf /= 0.0_dp)
718 END IF
719 !TDDFPT only works if the kernel has the same HF section as the DFT%XC one
720 IF (do_hfx) THEN
721 hfx_section_gs => section_vals_get_subs_vals(input, "DFT%XC%HF")
722 CALL compare_hfx_sections(hfx_section, hfx_section_gs, same_hfx)
723 IF (.NOT. same_hfx) THEN
724 cpabort("TDDFPT Kernel must use the same HF section as DFT%XC or no HF at all.")
725 END IF
726 END IF
727
728 do_admm = do_hfx .AND. dft_control%do_admm
729 IF (do_admm) THEN
730 ! 'admm_env%xc_section_primary' and 'admm_env%xc_section_aux' need to be redefined
731 CALL cp_abort(__location__, &
732 "ADMM is not implemented for a TDDFT kernel XC-functional which is different from "// &
733 "the one used for the ground-state calculation. A ground-state 'admm_env' cannot be reused.")
734 END IF
735 ! SET HFX_KERNEL and/or XC_KERNEL
736 IF (exk) THEN
737 do_exck = .true.
738 ELSE
739 do_exck = .false.
740 END IF
741 IF (exhfxk) THEN
742 xc_sub => section_vals_get_subs_vals(xc_root, "HFX_KERNEL")
743 CALL section_vals_val_get(xc_sub, "DO_HFXSR", l_val=do_hfxsr)
744 xc_sub => section_vals_get_subs_vals(xc_root, "HFX_KERNEL%HFXLR")
745 CALL section_vals_get(xc_sub, explicit=do_hfxlr)
746 ELSE
747 do_hfxsr = .false.
748 do_hfxlr = .false.
749 END IF
750 ELSE
751 xc_section => section_vals_get_subs_vals(input, "DFT%XC")
752 hfx_section => section_vals_get_subs_vals(xc_section, "HF")
753 CALL section_vals_get(hfx_section, explicit=do_hfx)
754 IF (do_hfx) THEN
755 CALL section_vals_val_get(hfx_section, "FRACTION", r_val=c_hf)
756 do_hfx = (c_hf /= 0.0_dp)
757 END IF
758 do_admm = do_hfx .AND. dft_control%do_admm
759 do_exck = .false.
760 do_hfxsr = .false.
761 do_hfxlr = .false.
762 END IF
763 ELSE
764 do_hfx = .false.
765 do_admm = .false.
766 do_exck = .false.
767 do_hfxsr = .false.
768 do_hfxlr = .false.
769 END IF
770
771 ! reset rks_triplets if UKS is in use
772 IF (tddfpt_control%rks_triplets .AND. dft_control%nspins > 1) THEN
773 tddfpt_control%rks_triplets = .false.
774 CALL cp_warn(__location__, "Keyword RKS_TRIPLETS has been ignored for spin-polarised calculations")
775 END IF
776
777 ! lri input
778 IF (tddfpt_control%do_lrigpw) THEN
779 lri_section => section_vals_get_subs_vals(tddfpt_section, "LRIGPW")
780 END IF
781
782 ! set defaults for short range HFX
783 NULLIFY (hfxsr_section)
784 IF (do_hfxsr) THEN
785 hfxsr_section => section_vals_get_subs_vals(tddfpt_section, "XC%HFX_KERNEL%HF")
786 CALL section_vals_get(hfxsr_section, explicit=found)
787 IF (.NOT. found) THEN
788 cpabort("HFXSR option needs &HF section defined")
789 END IF
790 CALL section_vals_val_get(hfxsr_section, "INTERACTION_POTENTIAL%POTENTIAL_TYPE", explicit=found)
791 IF (.NOT. found) THEN
792 CALL section_vals_val_set(hfxsr_section, "INTERACTION_POTENTIAL%POTENTIAL_TYPE", &
794 END IF
795 CALL section_vals_val_get(hfxsr_section, "INTERACTION_POTENTIAL%CUTOFF_RADIUS", explicit=found)
796 IF (.NOT. found) THEN
797 CALL section_vals_val_set(hfxsr_section, "INTERACTION_POTENTIAL%CUTOFF_RADIUS", r_val=7.5589_dp)
798 END IF
799 CALL section_vals_val_get(hfxsr_section, "RI%_SECTION_PARAMETERS_", l_val=found)
800 IF (found) THEN
801 CALL cp_abort(__location__, "Short range TDA kernel with RI not possible")
802 END IF
803 END IF
804
805 END SUBROUTINE tddfpt_input
806
807! **************************************************************************************************
808!> \brief ...
809!> \param log_unit ...
810!> \param dft_control ...
811!> \param tddfpt_control ...
812!> \param xc_section ...
813! **************************************************************************************************
814 SUBROUTINE kernel_info(log_unit, dft_control, tddfpt_control, xc_section)
815 INTEGER, INTENT(IN) :: log_unit
816 TYPE(dft_control_type), POINTER :: dft_control
817 TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
818 TYPE(section_vals_type), POINTER :: xc_section
819
820 CHARACTER(LEN=4) :: ktype
821 LOGICAL :: lsd
822
823 lsd = (dft_control%nspins > 1)
824 IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN
825 ktype = "FULL"
826 IF (log_unit > 0) THEN
827 WRITE (log_unit, "(T2,A,T77,A4)") "KERNEL|", trim(ktype)
828 CALL xc_write(log_unit, xc_section, lsd)
829 IF (tddfpt_control%do_hfx) THEN
830 IF (tddfpt_control%do_admm) THEN
831 WRITE (log_unit, "(T2,A,T62,A19)") "KERNEL|", "ADMM Exact Exchange"
832 IF (tddfpt_control%admm_xc_correction) THEN
833 WRITE (log_unit, "(T2,A,T60,A21)") "KERNEL|", "Apply ADMM Kernel XC Correction"
834 END IF
835 IF (tddfpt_control%admm_symm) THEN
836 WRITE (log_unit, "(T2,A,T60,A21)") "KERNEL|", "Symmetric ADMM Kernel"
837 END IF
838 ELSE
839 WRITE (log_unit, "(T2,A,T67,A14)") "KERNEL|", "Exact Exchange"
840 END IF
841 END IF
842 IF (tddfpt_control%do_hfxsr) THEN
843 WRITE (log_unit, "(T2,A,T43,A38)") "KERNEL|", "Short range HFX approximation"
844 END IF
845 IF (tddfpt_control%do_hfxlr) THEN
846 WRITE (log_unit, "(T2,A,T43,A38)") "KERNEL|", "Long range HFX approximation"
847 END IF
848 IF (tddfpt_control%do_lrigpw) THEN
849 WRITE (log_unit, "(T2,A,T42,A39)") "KERNEL|", "LRI approximation of transition density"
850 END IF
851 END IF
852 ELSE IF (tddfpt_control%kernel == tddfpt_kernel_stda) THEN
853 ktype = "sTDA"
854 IF (log_unit > 0) THEN
855 WRITE (log_unit, "(T2,A,T77,A4)") "KERNEL|", trim(ktype)
856 IF (tddfpt_control%stda_control%do_ewald) THEN
857 WRITE (log_unit, "(T2,A,T78,A3)") "KERNEL| Coulomb term uses Ewald summation"
858 ELSE
859 WRITE (log_unit, "(T2,A,T78,A3)") "KERNEL| Coulomb term uses direct summation (MIC)"
860 END IF
861 IF (tddfpt_control%stda_control%do_exchange) THEN
862 WRITE (log_unit, "(T2,A,T78,A3)") "KERNEL| Exact exchange term", "YES"
863 WRITE (log_unit, "(T2,A,T71,F10.3)") "KERNEL| Short range HFX fraction:", &
864 tddfpt_control%stda_control%hfx_fraction
865 ELSE
866 WRITE (log_unit, "(T2,A,T79,A2)") "KERNEL| Exact exchange term", "NO"
867 END IF
868 WRITE (log_unit, "(T2,A,T66,E15.3)") "KERNEL| Transition density filter", &
869 tddfpt_control%stda_control%eps_td_filter
870 END IF
871 ELSE IF (tddfpt_control%kernel == tddfpt_kernel_none) THEN
872 ktype = "NONE"
873 IF (log_unit > 0) THEN
874 WRITE (log_unit, "(T2,A,T77,A4)") "KERNEL|", trim(ktype)
875 END IF
876 ELSE
877 !CPABORT("Unknown kernel")
878 END IF
879 !
880 IF (log_unit > 0) THEN
881 IF (tddfpt_control%rks_triplets) THEN
882 WRITE (log_unit, "(T2,A,T74,A7)") "KERNEL| Spin symmetry of excitations", "Triplet"
883 ELSE IF (lsd) THEN
884 ! Spin-conserving excitations where requested
885 IF (tddfpt_control%spinflip == no_sf_tddfpt) THEN
886 WRITE (log_unit, "(T2,A,T69,A12)") "KERNEL| Spin symmetry of excitations", "Unrestricted"
887 ! Spin-flip excitations with collinear exchange-correlation kernel requested
888 ELSE IF (tddfpt_control%spinflip == tddfpt_sf_col) THEN
889 WRITE (log_unit, "(T2,A,T72,A9)") "KERNEL| Spin flip", "Collinear"
890 ! Spin-flip excitations with noncollinear exchange-correlation kernel requested
891 ELSE IF (tddfpt_control%spinflip == tddfpt_sf_noncol) THEN
892 WRITE (log_unit, "(T2,A,T69,A12)") "KERNEL| Spin flip", "Noncollinear"
893 END IF
894 ELSE
895 WRITE (log_unit, "(T2,A,T74,A7)") "KERNEL| Spin symmetry of excitations", "Singlet"
896 END IF
897 WRITE (log_unit, "(T2,A,T73,I8)") "TDDFPT| Number of states calculated", tddfpt_control%nstates
898 WRITE (log_unit, "(T2,A,T73,I8)") "TDDFPT| Number of Davidson iterations", tddfpt_control%niters
899 WRITE (log_unit, "(T2,A,T66,E15.3)") "TDDFPT| Davidson iteration convergence", tddfpt_control%conv
900 WRITE (log_unit, "(T2,A,T73,I8)") "TDDFPT| Max. number of Krylov space vectors", tddfpt_control%nkvs
901 END IF
902
903 END SUBROUTINE kernel_info
904
905! **************************************************************************************************
906!> \brief The energy calculation has been moved to its own subroutine
907!> \param qs_env ...
908!> \param nstates ...
909!> \param nspins ...
910!> \param work_matrices ...
911!> \param tddfpt_control ...
912!> \param logger ...
913!> \param tddfpt_print_section ...
914!> \param evects ...
915!> \param evals ...
916!> \param gs_mos ...
917!> \param tddfpt_section ...
918!> \param S_evects ...
919!> \param matrix_s ...
920!> \param kernel_env ...
921!> \param matrix_ks ...
922!> \param sub_env ...
923!> \param ostrength ...
924!> \param dipole_op_mos_occ ...
925!> \param mult ...
926!> \param xc_section ...
927!> \param full_kernel_env ...
928!> \param kernel_env_admm_aux ...
929! **************************************************************************************************
930 SUBROUTINE tddfpt_energies(qs_env, nstates, nspins, work_matrices, &
931 tddfpt_control, logger, tddfpt_print_section, evects, evals, &
932 gs_mos, tddfpt_section, S_evects, matrix_s, kernel_env, matrix_ks, &
933 sub_env, ostrength, dipole_op_mos_occ, mult, xc_section, full_kernel_env, &
934 kernel_env_admm_aux)
935
936 TYPE(qs_environment_type), POINTER :: qs_env
937 INTEGER :: nstates, nspins
938 TYPE(tddfpt_work_matrices) :: work_matrices
939 TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
940 TYPE(cp_logger_type), POINTER :: logger
941 TYPE(section_vals_type), POINTER :: tddfpt_print_section
942 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: evects
943 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: evals
944 TYPE(tddfpt_ground_state_mos), DIMENSION(:), &
945 POINTER :: gs_mos
946 TYPE(section_vals_type), POINTER :: tddfpt_section
947 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: s_evects
948 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s
949 TYPE(kernel_env_type) :: kernel_env
950 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks
951 TYPE(tddfpt_subgroup_env_type) :: sub_env
952 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: ostrength
953 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: dipole_op_mos_occ
954 INTEGER :: mult
955 TYPE(section_vals_type), POINTER :: xc_section
956 TYPE(full_kernel_env_type), TARGET :: full_kernel_env, kernel_env_admm_aux
957
958 CHARACTER(LEN=*), PARAMETER :: routinen = 'tddfpt_energies'
959
960 CHARACTER(len=20) :: nstates_str
961 INTEGER :: energy_unit, handle, iter, log_unit, &
962 niters, nocc, nstate_max, &
963 nstates_read, nvirt
964 LOGICAL :: do_admm, do_exck, do_soc, explicit
965 REAL(kind=dp) :: conv
966 TYPE(admm_type), POINTER :: admm_env
967 TYPE(cp_blacs_env_type), POINTER :: blacs_env
968 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks_oep
969 TYPE(section_vals_type), POINTER :: lri_section, namd_print_section, &
970 soc_section
971
972 CALL timeset(routinen, handle)
973
974 NULLIFY (admm_env, matrix_ks_oep)
975 do_admm = tddfpt_control%do_admm
976 IF (do_admm) CALL get_qs_env(qs_env, admm_env=admm_env)
977
978 ! setup for full_kernel and admm_kernel within tddfpt_energies due to dependence on multiplicity
979 IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN
980
982 rho_orb_struct=work_matrices%rho_orb_struct_sub, &
983 rho_xc_struct=work_matrices%rho_xc_struct_sub, &
984 is_rks_triplets=tddfpt_control%rks_triplets, &
985 qs_env=qs_env, sub_env=sub_env, &
986 wfm_rho_orb=work_matrices%rho_ao_orb_fm_sub)
987
988 IF (do_admm) THEN
989 ! Full kernel with ADMM
990 IF (tddfpt_control%admm_xc_correction) THEN
991 CALL create_kernel_env(kernel_env=full_kernel_env, &
992 rho_struct_sub=work_matrices%rho_orb_struct_sub, &
993 xc_section=admm_env%xc_section_primary, &
994 is_rks_triplets=tddfpt_control%rks_triplets, &
995 sub_env=sub_env)
996 ELSE
997 CALL create_kernel_env(kernel_env=full_kernel_env, &
998 rho_struct_sub=work_matrices%rho_orb_struct_sub, &
999 xc_section=xc_section, &
1000 is_rks_triplets=tddfpt_control%rks_triplets, &
1001 sub_env=sub_env)
1002 END IF
1003
1005 rho_orb_struct=work_matrices%rho_orb_struct_sub, &
1006 rho_aux_fit_struct=work_matrices%rho_aux_fit_struct_sub, &
1007 local_rho_set=sub_env%local_rho_set_admm, &
1008 qs_env=qs_env, sub_env=sub_env, &
1009 wfm_rho_orb=work_matrices%rho_ao_orb_fm_sub, &
1010 wfm_rho_aux_fit=work_matrices%rho_ao_aux_fit_fm_sub, &
1011 wfm_aux_orb=work_matrices%wfm_aux_orb_sub)
1012
1013 CALL create_kernel_env(kernel_env=kernel_env_admm_aux, &
1014 rho_struct_sub=work_matrices%rho_aux_fit_struct_sub, &
1015 xc_section=admm_env%xc_section_aux, &
1016 is_rks_triplets=tddfpt_control%rks_triplets, &
1017 sub_env=sub_env)
1018 kernel_env%full_kernel => full_kernel_env
1019 kernel_env%admm_kernel => kernel_env_admm_aux
1020 ELSE
1021 ! Full kernel
1022 CALL create_kernel_env(kernel_env=full_kernel_env, &
1023 rho_struct_sub=work_matrices%rho_orb_struct_sub, &
1024 xc_section=xc_section, &
1025 is_rks_triplets=tddfpt_control%rks_triplets, &
1026 sub_env=sub_env)
1027 kernel_env%full_kernel => full_kernel_env
1028 NULLIFY (kernel_env%admm_kernel)
1029 END IF
1030 ! Fxc from kernel definition
1031 do_exck = tddfpt_control%do_exck
1032 kernel_env%full_kernel%do_exck = do_exck
1033 ! initilize xc kernel
1034 IF (do_exck) THEN
1035 CALL create_fxc_kernel(work_matrices%rho_orb_struct_sub, work_matrices%fxc_rspace_sub, &
1036 xc_section, tddfpt_control%rks_triplets, sub_env, qs_env)
1037 END IF
1038 END IF
1039
1040 ! lri input
1041 IF (tddfpt_control%do_lrigpw) THEN
1042 lri_section => section_vals_get_subs_vals(tddfpt_section, "LRIGPW")
1043 CALL tddfpt2_lri_init(qs_env, kernel_env, lri_section, &
1044 tddfpt_print_section)
1045 END IF
1046
1047 !! Too many states can lead to Problems
1048 !! You should be warned if there are more states
1049 !! than occ-virt Combinations!!
1050 CALL cp_fm_get_info(gs_mos(1)%mos_occ, ncol_global=nocc)
1051 IF (tddfpt_control%spinflip == no_sf_tddfpt) THEN
1052 CALL cp_fm_get_info(gs_mos(1)%mos_virt, ncol_global=nvirt)
1053 ELSE
1054 CALL cp_fm_get_info(gs_mos(2)%mos_virt, ncol_global=nvirt)
1055 END IF
1056 nstate_max = nocc*nvirt
1057 IF ((SIZE(gs_mos, 1) == 2) .AND. (tddfpt_control%spinflip == no_sf_tddfpt)) THEN
1058 CALL cp_fm_get_info(gs_mos(2)%mos_occ, ncol_global=nocc)
1059 CALL cp_fm_get_info(gs_mos(2)%mos_virt, ncol_global=nvirt)
1060 nstate_max = nocc*nvirt + nstate_max
1061 END IF
1062 IF (nstates > nstate_max) THEN
1063 cpwarn("NUMBER OF EXCITED STATES COULD LEAD TO PROBLEMS!")
1064 cpwarn("Experimental: CHANGED NSTATES TO ITS MAXIMUM VALUE!")
1065 nstates = nstate_max
1066 END IF
1067
1068 soc_section => section_vals_get_subs_vals(tddfpt_section, "SOC")
1069 CALL section_vals_get(soc_section, explicit=do_soc)
1070
1071 ! reuse Ritz vectors from the previous calculation if available
1072 IF (tddfpt_control%is_restart .AND. .NOT. do_soc) THEN
1073 CALL get_qs_env(qs_env, blacs_env=blacs_env)
1074
1075 nstates_read = tddfpt_read_restart( &
1076 evects=evects, &
1077 evals=evals, &
1078 gs_mos=gs_mos, &
1079 logger=logger, &
1080 tddfpt_section=tddfpt_section, &
1081 tddfpt_print_section=tddfpt_print_section, &
1082 fm_pool_ao_mo_occ=work_matrices%fm_pool_ao_mo_occ, &
1083 blacs_env_global=blacs_env)
1084 ELSE
1085 nstates_read = 0
1086 END IF
1087
1088 ! build the list of missed singly excited states and sort them in ascending order
1089 ! according to their excitation energies
1090 log_unit = cp_print_key_unit_nr(logger, tddfpt_print_section, &
1091 "GUESS_VECTORS", extension=".tddfptLog")
1092 CALL tddfpt_guess_vectors(evects=evects, evals=evals, &
1093 gs_mos=gs_mos, log_unit=log_unit, tddfpt_control=tddfpt_control, &
1094 qs_env=qs_env, nspins=nspins)
1095 CALL cp_print_key_finished_output(log_unit, logger, &
1096 tddfpt_print_section, "GUESS_VECTORS")
1097
1098 CALL tddfpt_orthogonalize_psi1_psi0(evects, work_matrices%S_C0_C0T, qs_env, &
1099 gs_mos, evals, tddfpt_control, work_matrices%S_C0)
1100 CALL tddfpt_orthonormalize_psi1_psi1(evects, &
1101 nstates, &
1102 s_evects, &
1103 matrix_s(1)%matrix)
1104
1105 niters = tddfpt_control%niters
1106 IF (niters > 0) THEN
1107 log_unit = cp_print_key_unit_nr(logger, tddfpt_print_section, &
1108 "ITERATION_INFO", extension=".tddfptLog")
1109 energy_unit = cp_print_key_unit_nr(logger, &
1110 tddfpt_print_section, &
1111 "DETAILED_ENERGY", &
1112 extension=".tddfptLog")
1113
1114 IF (log_unit > 0) THEN
1115 WRITE (log_unit, "(1X,A)") "", &
1116 "-------------------------------------------------------------------------------", &
1117 "- TDDFPT WAVEFUNCTION OPTIMIZATION -", &
1118 "-------------------------------------------------------------------------------"
1119
1120 WRITE (log_unit, '(/,T11,A,T27,A,T40,A,T62,A)') "Step", "Time", "Convergence", "Conv. states"
1121 WRITE (log_unit, '(1X,79("-"))')
1122 END IF
1123
1124 CALL cp_add_iter_level(logger%iter_info, "TDDFT_SCF")
1125
1126 DO
1127 ! *** perform Davidson iterations ***
1128 conv = tddfpt_davidson_solver( &
1129 evects=evects, &
1130 evals=evals, &
1131 s_evects=s_evects, &
1132 gs_mos=gs_mos, &
1133 tddfpt_control=tddfpt_control, &
1134 matrix_ks=matrix_ks, &
1135 qs_env=qs_env, &
1136 kernel_env=kernel_env, &
1137 sub_env=sub_env, &
1138 logger=logger, &
1139 iter_unit=log_unit, &
1140 energy_unit=energy_unit, &
1141 tddfpt_print_section=tddfpt_print_section, &
1142 work_matrices=work_matrices)
1143
1144 ! at this point at least one of the following conditions are met:
1145 ! a) convergence criteria has been achieved;
1146 ! b) maximum number of iterations has been reached;
1147 ! c) Davidson iterations must be restarted due to lack of Krylov vectors
1148
1149 CALL cp_iterate(logger%iter_info, increment=0, iter_nr_out=iter)
1150 ! terminate the loop if either (a) or (b) is true ...
1151 IF ((conv <= tddfpt_control%conv) .OR. iter >= niters) EXIT
1152
1153 ! ... otherwise restart Davidson iterations
1154 evals = 0.0_dp
1155 IF (log_unit > 0) THEN
1156 WRITE (log_unit, '(1X,25("-"),1X,A,1X,25("-"))') "Restart Davidson iterations"
1157 CALL m_flush(log_unit)
1158 END IF
1159 END DO
1160
1161 ! write TDDFPT restart file at the last iteration if requested to do so
1162 CALL cp_iterate(logger%iter_info, increment=0, last=.true.)
1163 CALL tddfpt_write_restart(evects=evects, &
1164 evals=evals, &
1165 gs_mos=gs_mos, &
1166 logger=logger, &
1167 tddfpt_print_section=tddfpt_print_section)
1168
1169 CALL cp_rm_iter_level(logger%iter_info, "TDDFT_SCF")
1170
1171 ! print convergence summary
1172 IF (log_unit > 0) THEN
1173 CALL integer_to_string(iter, nstates_str)
1174 IF (conv <= tddfpt_control%conv) THEN
1175 WRITE (log_unit, "(1X,A)") "", &
1176 "-------------------------------------------------------------------------------", &
1177 "- TDDFPT run converged in "//trim(nstates_str)//" iteration(s) ", &
1178 "-------------------------------------------------------------------------------"
1179 ELSE
1180 WRITE (log_unit, "(1X,A)") "", &
1181 "-------------------------------------------------------------------------------", &
1182 "- TDDFPT run did NOT converge after "//trim(nstates_str)//" iteration(s) ", &
1183 "-------------------------------------------------------------------------------"
1184 END IF
1185 END IF
1186
1187 CALL cp_print_key_finished_output(energy_unit, logger, &
1188 tddfpt_print_section, "DETAILED_ENERGY")
1189 CALL cp_print_key_finished_output(log_unit, logger, &
1190 tddfpt_print_section, "ITERATION_INFO")
1191 ELSE
1192 CALL cp_warn(__location__, &
1193 "Skipping TDDFPT wavefunction optimization")
1194 END IF
1195
1196 IF (ASSOCIATED(matrix_ks_oep)) THEN
1197 IF (tddfpt_control%dipole_form == tddfpt_dipole_velocity) THEN
1198 CALL cp_warn(__location__, &
1199 "Transition dipole moments and oscillator strengths are likely to be incorrect "// &
1200 "when computed using an orbital energy correction XC-potential together with "// &
1201 "the velocity form of dipole transition integrals")
1202 END IF
1203 END IF
1204
1205 ! *** print summary information ***
1206 log_unit = cp_logger_get_default_io_unit(logger)
1207
1208 namd_print_section => section_vals_get_subs_vals( &
1209 tddfpt_print_section, &
1210 "NAMD_PRINT")
1211 CALL section_vals_get(namd_print_section, explicit=explicit)
1212 IF (explicit) THEN
1213 CALL tddfpt_write_newtonx_output(evects, &
1214 evals, &
1215 gs_mos, &
1216 logger, &
1217 tddfpt_print_section, &
1218 matrix_s(1)%matrix, &
1219 s_evects, &
1220 sub_env)
1221 END IF
1222 ALLOCATE (ostrength(nstates))
1223 ostrength = 0.0_dp
1224 CALL tddfpt_print_summary(log_unit, &
1225 evects, &
1226 evals, &
1227 ostrength, &
1228 mult, &
1229 dipole_op_mos_occ, &
1230 tddfpt_control%dipole_form)
1232 log_unit, &
1233 evects, &
1234 evals, &
1235 gs_mos, &
1236 matrix_s(1)%matrix, &
1237 tddfpt_control%spinflip, &
1238 min_amplitude=tddfpt_control%min_excitation_amplitude)
1239 CALL tddfpt_print_nto_analysis(qs_env, &
1240 evects, evals, &
1241 ostrength, &
1242 gs_mos, &
1243 matrix_s(1)%matrix, &
1244 tddfpt_print_section)
1245 IF (tddfpt_control%do_exciton_descriptors) THEN
1247 log_unit, &
1248 evects, &
1249 gs_mos, &
1250 matrix_s(1)%matrix, &
1251 tddfpt_control%do_directional_exciton_descriptors, &
1252 qs_env)
1253 END IF
1254
1255 IF (tddfpt_control%do_lrigpw) THEN
1256 CALL lri_print_stat(qs_env, &
1257 ltddfpt=.true., &
1258 tddfpt_lri_env=kernel_env%full_kernel%lri_env)
1259 END IF
1260
1261 CALL timestop(handle)
1262 END SUBROUTINE tddfpt_energies
1263
1264! **************************************************************************************************
1265!> \brief Perform singlet and triplet computations for subsequent TDDFPT-SOC calculation.
1266!> \param qs_env Quickstep environment
1267!> \param nstates number of requested exited states
1268!> \param work_matrices ...
1269!> \param tddfpt_control ...
1270!> \param logger ...
1271!> \param tddfpt_print_section ...
1272!> \param evects Eigenvector of the requested multiplicity
1273!> \param evals Eigenvalue of the requested multiplicity
1274!> \param ostrength Oscillatorstrength
1275!> \param gs_mos ...
1276!> \param tddfpt_section ...
1277!> \param S_evects ...
1278!> \param matrix_s ...
1279!> \param kernel_env ...
1280!> \param matrix_ks ...
1281!> \param sub_env ...
1282!> \param dipole_op_mos_occ ...
1283!> \param lmult_tmp ...
1284!> \param xc_section ...
1285!> \param full_kernel_env ...
1286!> \param kernel_env_admm_aux ...
1287!> \par History
1288!> * 02.2023 created [Jan-Robert Vogt]
1289!> \note Based on tddfpt2_methods and xas_tdp_utils.
1290!> \note only the values of one multiplicity will be passed back for force calculations!
1291! **************************************************************************************************
1292
1293 SUBROUTINE tddfpt_soc_energies(qs_env, nstates, work_matrices, &
1294 tddfpt_control, logger, tddfpt_print_section, &
1295 evects, evals, ostrength, &
1296 gs_mos, tddfpt_section, S_evects, matrix_s, kernel_env, matrix_ks, &
1297 sub_env, dipole_op_mos_occ, lmult_tmp, xc_section, full_kernel_env, &
1298 kernel_env_admm_aux)
1299
1300 TYPE(qs_environment_type), INTENT(IN), POINTER :: qs_env
1301 INTEGER, INTENT(in) :: nstates
1302 TYPE(tddfpt_work_matrices) :: work_matrices
1303 TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
1304 TYPE(cp_logger_type), POINTER :: logger
1305 TYPE(section_vals_type), POINTER :: tddfpt_print_section
1306 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: evects
1307 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: evals, ostrength
1308 TYPE(tddfpt_ground_state_mos), DIMENSION(:), &
1309 POINTER :: gs_mos
1310 TYPE(section_vals_type), POINTER :: tddfpt_section
1311 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: s_evects
1312 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s
1313 TYPE(kernel_env_type) :: kernel_env
1314 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks
1315 TYPE(tddfpt_subgroup_env_type) :: sub_env
1316 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: dipole_op_mos_occ
1317 LOGICAL, INTENT(in) :: lmult_tmp
1318 TYPE(section_vals_type), POINTER :: xc_section
1319 TYPE(full_kernel_env_type), TARGET :: full_kernel_env, kernel_env_admm_aux
1320
1321 CHARACTER(LEN=*), PARAMETER :: routinen = 'tddfpt_soc_energies'
1322
1323 INTEGER :: handle, ispin, istate, log_unit, mult, &
1324 nspins
1325 LOGICAL :: do_sf
1326 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: evals_mult, ostrength_mult
1327 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: evects_mult
1328
1329 CALL timeset(routinen, handle)
1330
1331 log_unit = cp_print_key_unit_nr(logger, tddfpt_print_section, &
1332 "PROGRAM_BANNER", &
1333 extension=".tddfptLog")
1334 CALL tddfpt_soc_header(log_unit)
1335
1336 nspins = SIZE(gs_mos)
1337 ALLOCATE (evects_mult(nspins, nstates))
1338 ALLOCATE (evals_mult(nstates))
1339 do_sf = tddfpt_control%spinflip /= no_sf_tddfpt
1340
1341 ! First multiplicity
1342 IF (lmult_tmp) THEN
1343 IF (log_unit > 0) THEN
1344 WRITE (log_unit, "(1X,A)") "", &
1345 "-------------------------------------------------------------------------------", &
1346 "- TDDFPT SINGLET ENERGIES -", &
1347 "-------------------------------------------------------------------------------"
1348 END IF
1349 mult = 1
1350 ELSE
1351 IF (log_unit > 0) THEN
1352 WRITE (log_unit, "(1X,A)") "", &
1353 "-------------------------------------------------------------------------------", &
1354 "- TDDFPT TRIPLET ENERGIES -", &
1355 "-------------------------------------------------------------------------------"
1356 END IF
1357 mult = 3
1358 END IF
1359
1360 CALL tddfpt_energies(qs_env, nstates, nspins, work_matrices, tddfpt_control, logger, &
1361 tddfpt_print_section, evects_mult, evals_mult, &
1362 gs_mos, tddfpt_section, s_evects, matrix_s, &
1363 kernel_env, matrix_ks, sub_env, ostrength_mult, &
1364 dipole_op_mos_occ, mult, xc_section, full_kernel_env, &
1365 kernel_env_admm_aux)
1366
1367 ! Clean up in between for full kernel
1368 IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN
1369 IF (tddfpt_control%do_admm) CALL release_kernel_env(kernel_env%admm_kernel)
1370 CALL release_kernel_env(kernel_env%full_kernel)
1371 CALL tddfpt_release_work_matrices(work_matrices, sub_env)
1372 CALL tddfpt_create_work_matrices(work_matrices, gs_mos, nstates, tddfpt_control%do_hfx, &
1373 tddfpt_control%do_admm, tddfpt_control%do_hfxlr, &
1374 tddfpt_control%do_exck, do_sf, qs_env, sub_env)
1375 END IF
1376
1377 DO istate = 1, nstates
1378 DO ispin = 1, nspins
1379 CALL cp_fm_release(s_evects(ispin, istate))
1380 END DO
1381 END DO
1382
1383 DO istate = 1, nstates
1384 DO ispin = 1, nspins
1385 CALL fm_pool_create_fm( &
1386 work_matrices%fm_pool_ao_mo_occ(ispin)%pool, &
1387 s_evects(ispin, istate))
1388 END DO
1389 END DO
1390
1391 tddfpt_control%rks_triplets = lmult_tmp
1392
1393 ! Second multiplicity
1394 IF (lmult_tmp) THEN
1395 IF (log_unit > 0) THEN
1396 WRITE (log_unit, "(1X,A)") "", &
1397 " singlet excitations finished ", &
1398 " ", &
1399 "-------------------------------------------------------------------------------", &
1400 "- TDDFPT TRIPLET ENERGIES -", &
1401 "-------------------------------------------------------------------------------"
1402 END IF !log_unit
1403 mult = 3
1404 ELSE
1405 IF (log_unit > 0) THEN
1406 WRITE (log_unit, "(1X,A)") "", &
1407 " triplet excitations finished ", &
1408 " ", &
1409 "-------------------------------------------------------------------------------", &
1410 "- TDDFPT SINGLET ENERGIES -", &
1411 "-------------------------------------------------------------------------------"
1412 END IF !log_unit
1413 mult = 1
1414 END IF
1415
1416 CALL tddfpt_energies(qs_env, nstates, nspins, work_matrices, tddfpt_control, logger, &
1417 tddfpt_print_section, evects, evals, &
1418 gs_mos, tddfpt_section, s_evects, matrix_s, &
1419 kernel_env, matrix_ks, sub_env, ostrength, &
1420 dipole_op_mos_occ, mult, xc_section, full_kernel_env, &
1421 kernel_env_admm_aux)
1422
1423 ! Compute perturbative SOC correction
1424 ! Order should always be singlet triplet in tddfpt_soc
1425 IF (lmult_tmp) THEN
1426 CALL tddfpt_soc(qs_env, evals_mult, evals, evects_mult, evects, gs_mos) !mult=singlet
1427 ELSE
1428 CALL tddfpt_soc(qs_env, evals, evals_mult, evects, evects_mult, gs_mos) !mult=triplet
1429 END IF
1430
1431 ! deallocate the additional multiplicity
1432 DO ispin = 1, SIZE(evects_mult, 1)
1433 DO istate = 1, SIZE(evects_mult, 2)
1434 CALL cp_fm_release(evects_mult(ispin, istate))
1435 END DO
1436 END DO
1437 DEALLOCATE (evects_mult, evals_mult, ostrength_mult)
1438
1439 CALL timestop(handle)
1440
1441 END SUBROUTINE tddfpt_soc_energies
1442
1443END 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 hernandez2025
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:595
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:2957
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_sf_col
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_sf_noncol
integer, parameter, public tddfpt_kernel_stda
integer, parameter, public no_sf_tddfpt
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:136
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_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, 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.
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, qs_env, gs_mos, evals, tddfpt_control, s_c0)
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. This routine calculates the response vector R of Eq....
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, rixs_env)
Perform TDDFPT calculation. If calc_forces then it also builds the response vector for the Z-vector m...
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 tddfpt_energies(qs_env, nstates, nspins, 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 calculation has been moved to its own subroutine.
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.
subroutine, public tddfpt_print_excitation_analysis(log_unit, evects, evals, gs_mos, matrix_s, spinflip, min_amplitude)
Print excitation analysis.
subroutine, public tddfpt_print_exciton_descriptors(log_unit, evects, gs_mos, matrix_s, do_directional_exciton_descriptors, qs_env)
Print exciton descriptors, cf. Mewes et al., JCTC 14, 710-725 (2018)
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_smeared_occupation(qs_env, gs_mos, log_unit)
...
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_create_work_matrices(work_matrices, gs_mos, nstates, do_hfx, do_admm, do_hfxlr, do_exck, do_sf, qs_env, sub_env)
Allocate work matrices for full kernel.
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_guess_vectors(evects, evals, gs_mos, log_unit, tddfpt_control, qs_env, nspins)
Generate missed guess vectors.
subroutine, public tddfpt_release_ground_state_mos(gs_mos)
Release molecular orbitals.
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.
Define Resonant Inelastic XRAY Scattering (RIXS) control type and associated create,...
Definition rixs_types.F:13
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.
Valence state coming from the qs_tddfpt2 routine.
Definition rixs_types.F:40