(git:6768d83)
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-2026 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_create,&
26 dbcsr_set,&
28 dbcsr_type_antisymmetric,&
29 dbcsr_type_symmetric
54 USE header, ONLY: tddfpt_header,&
59 USE input_constants, ONLY: &
69 USE kinds, ONLY: dp
71 USE kpoint_types, ONLY: get_kpoint_info,&
78 USE machine, ONLY: m_flush
83 USE physcon, ONLY: evolt
93 USE qs_mo_types, ONLY: get_mo_set,&
118 USE qs_tddfpt2_soc, ONLY: tddfpt_soc
138 USE rixs_types, ONLY: rixs_env_type,&
141 USE util, ONLY: sort
142 USE xc_write_output, ONLY: xc_write
143#include "./base/base_uses.f90"
144
145 IMPLICIT NONE
146
147 PRIVATE
148
149 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_tddfpt2_methods'
150
151 LOGICAL, PARAMETER, PRIVATE :: debug_this_module = .false.
152 ! number of first derivative components (3: d/dx, d/dy, d/dz)
153 INTEGER, PARAMETER, PRIVATE :: nderivs = 3
154 INTEGER, PARAMETER, PRIVATE :: maxspins = 2
155
157
158! **************************************************************************************************
159
160CONTAINS
161
162! **************************************************************************************************
163!> \brief Perform TDDFPT calculation. If calc_forces then it also builds the response vector for the
164!> Z-vector method and calculates some contributions to the force
165!> \param qs_env Quickstep environment
166!> \param calc_forces ...
167!> \param rixs_env ...
168!> \par History
169!> * 05.2016 created [Sergey Chulkov]
170!> * 06.2016 refactored to be used with Davidson eigensolver [Sergey Chulkov]
171!> * 03.2017 cleaned and refactored [Sergey Chulkov]
172!> \note Based on the subroutines tddfpt_env_init(), and tddfpt_env_deallocate().
173! **************************************************************************************************
174 SUBROUTINE tddfpt(qs_env, calc_forces, rixs_env)
175 TYPE(qs_environment_type), POINTER :: qs_env
176 LOGICAL, INTENT(IN) :: calc_forces
177 TYPE(rixs_env_type), OPTIONAL, POINTER :: rixs_env
178
179 CHARACTER(LEN=*), PARAMETER :: routinen = 'tddfpt'
180
181 INTEGER :: handle, ispin, istate, log_unit, mult, &
182 my_state, nao, nocc, nspins, &
183 nstate_max, nstates, nvirt, old_state
184 INTEGER, DIMENSION(maxspins) :: nactive
185 LOGICAL :: do_admm, do_exck, do_hfx, do_hfxlr, &
186 do_hfxsr, do_kpoints, do_rixs, do_sf, &
187 do_soc, lmult_tmp, state_change
188 REAL(kind=dp) :: gsmin, gsval, xsval
189 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: evals, ostrength
190 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
191 TYPE(cell_type), POINTER :: cell
192 TYPE(cp_blacs_env_type), POINTER :: blacs_env
193 TYPE(cp_fm_struct_type), POINTER :: matrix_struct
194 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:) :: my_active, my_mos
195 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: dipole_op_mos_occ, evects, s_evects
196 TYPE(cp_logger_type), POINTER :: logger
197 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks, matrix_ks_oep, matrix_s, &
198 matrix_s_aux_fit, &
199 matrix_s_aux_fit_vs_orb
200 TYPE(dft_control_type), POINTER :: dft_control
201 TYPE(excited_energy_type), POINTER :: ex_env
202 TYPE(full_kernel_env_type), TARGET :: full_kernel_env, kernel_env_admm_aux
203 TYPE(kernel_env_type) :: kernel_env
204 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos, mos_aux_fit
205 TYPE(mp_para_env_type), POINTER :: para_env
206 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
207 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
208 TYPE(qs_scf_env_type), POINTER :: scf_env
209 TYPE(rixs_control_type), POINTER :: rixs_control
210 TYPE(section_vals_type), POINTER :: hfxsr_section, kernel_section, &
211 lri_section, soc_section, &
212 tddfpt_print_section, tddfpt_section, &
213 xc_section
214 TYPE(stda_env_type), TARGET :: stda_kernel
215 TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
216 TYPE(tddfpt2_valence_type), POINTER :: valence_state
217 TYPE(tddfpt_ground_state_mos), DIMENSION(:), &
218 POINTER :: gs_mos
219 TYPE(tddfpt_subgroup_env_type) :: sub_env
220 TYPE(tddfpt_work_matrices) :: work_matrices
221
222 CALL timeset(routinen, handle)
223
224 NULLIFY (logger)
225 logger => cp_get_default_logger()
226
227 NULLIFY (tddfpt_section, tddfpt_control)
228
229 CALL get_qs_env(qs_env, &
230 dft_control=dft_control, &
231 do_rixs=do_rixs)
232 do_kpoints = dft_control%nimages > 1
233
234 IF (do_rixs) THEN
235 tddfpt_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%RIXS%TDDFPT")
236 NULLIFY (rixs_control, valence_state)
237 rixs_control => dft_control%rixs_control
238 tddfpt_control => rixs_control%tddfpt2_control
239 valence_state => rixs_env%valence_state
240 ELSE
241 tddfpt_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%TDDFPT")
242 tddfpt_control => dft_control%tddfpt2_control
243 END IF
244
245 ! input section print/xc
246 CALL tddfpt_input(qs_env, tddfpt_section, tddfpt_control, do_hfx, do_admm, do_exck, &
247 do_hfxsr, do_hfxlr, xc_section, tddfpt_print_section, &
248 lri_section, hfxsr_section)
249
250 log_unit = cp_print_key_unit_nr(logger, tddfpt_print_section, "PROGRAM_BANNER", &
251 extension=".tddfptLog")
252
253 tddfpt_control%do_hfx = do_hfx
254 tddfpt_control%do_admm = do_admm
255 tddfpt_control%do_hfxsr = do_hfxsr
256 tddfpt_control%hfxsr_primbas = 0
257 tddfpt_control%hfxsr_re_int = .true.
258 tddfpt_control%do_hfxlr = do_hfxlr
259 tddfpt_control%do_exck = do_exck
260 do_sf = tddfpt_control%spinflip /= no_sf_tddfpt
261 IF (do_sf) CALL cite_reference(hernandez2025)
262 IF (tddfpt_control%do_hfxlr) THEN
263 kernel_section => section_vals_get_subs_vals(tddfpt_section, "XC%HFX_KERNEL%HFXLR")
264 CALL section_vals_val_get(kernel_section, "RCUT", r_val=tddfpt_control%hfxlr_rcut)
265 CALL section_vals_val_get(kernel_section, "SCALE", r_val=tddfpt_control%hfxlr_scale)
266 END IF
267
268 soc_section => section_vals_get_subs_vals(tddfpt_section, "SOC")
269 CALL section_vals_get(soc_section, explicit=do_soc)
270
271 IF (do_soc) THEN
272 ! start with multiplicity that is not specified in input
273 ! so that excited-state gradient is for multiplicity given in input
274 lmult_tmp = tddfpt_control%rks_triplets
275 tddfpt_control%rks_triplets = .NOT. (tddfpt_control%rks_triplets)
276 END IF
277
278 CALL cite_reference(iannuzzi2005)
279 IF (tddfpt_control%kernel == tddfpt_kernel_stda) THEN
280 CALL cite_reference(grimme2013)
281 CALL cite_reference(grimme2016)
282 END IF
283
284 CALL tddfpt_header(log_unit)
285 CALL kernel_info(log_unit, dft_control, tddfpt_control, xc_section)
286
287 IF (do_kpoints) THEN
288 IF (calc_forces) &
289 cpabort("TDDFPT forces are not implemented for k-points")
290 IF (do_rixs) &
291 cpabort("RIXS/TDDFPT is not implemented for k-points")
292 IF (do_soc) &
293 cpabort("TDDFPT-SOC is not implemented for k-points")
294 CALL tddfpt_kpoint_independent_particle(qs_env, logger, tddfpt_control)
295 CALL cp_print_key_finished_output(log_unit, &
296 logger, &
297 tddfpt_print_section, &
298 "PROGRAM_BANNER")
299 CALL timestop(handle)
300 RETURN
301 END IF
302
303 CALL get_qs_env(qs_env, &
304 blacs_env=blacs_env, &
305 cell=cell, &
306 matrix_ks=matrix_ks, &
307 matrix_s=matrix_s, &
308 mos=mos, &
309 scf_env=scf_env)
310
311 ! obtain occupied and virtual (unoccupied) ground-state Kohn-Sham orbitals
312 NULLIFY (gs_mos)
313 CALL tddfpt_init_mos(qs_env, gs_mos, log_unit)
314
315 ! obtain smeared occupation numbers
316 IF (tddfpt_control%do_smearing) THEN
317 CALL tddfpt_smeared_occupation(qs_env, gs_mos, log_unit)
318 END IF
319
320 ! obtain corrected KS-matrix
321 CALL tddfpt_oecorr(qs_env, gs_mos, matrix_ks_oep)
322
323 IF ((tddfpt_control%do_lrigpw) .AND. &
324 (tddfpt_control%kernel /= tddfpt_kernel_full)) THEN
325 CALL cp_abort(__location__, "LRI only implemented for full kernel")
326 END IF
327
328 IF (ASSOCIATED(matrix_ks_oep)) matrix_ks => matrix_ks_oep
329
330 ! determine active orbitals
331 ! default is all occupied MOs
332 CALL init_res_method(qs_env, gs_mos, tddfpt_control, tddfpt_section, log_unit)
333
334 ! components of the dipole operator
335 CALL tddfpt_dipole_operator(dipole_op_mos_occ, &
336 tddfpt_control, &
337 gs_mos, &
338 qs_env)
339
340 nspins = SIZE(gs_mos)
341 ! multiplicity of molecular system
342 IF (nspins > 1) THEN
343 mult = abs(SIZE(gs_mos(1)%evals_occ) - SIZE(gs_mos(2)%evals_occ)) + 1
344 IF (mult > 2) &
345 CALL cp_warn(__location__, "There is a convergence issue for multiplicity >= 3")
346 ELSE
347 IF (tddfpt_control%rks_triplets) THEN
348 mult = 3
349 ELSE
350 mult = 1
351 END IF
352 END IF
353
354 ! split mpi communicator
355 ALLOCATE (my_mos(nspins), my_active(nspins))
356 DO ispin = 1, nspins
357 my_mos(ispin) = gs_mos(ispin)%mos_occ
358 my_active(ispin) = gs_mos(ispin)%mos_active
359 END DO
360 CALL tddfpt_sub_env_init(sub_env, qs_env, &
361 mos_occ=my_mos(:), mos_active=my_active(:), &
362 kernel=tddfpt_control%kernel)
363 DEALLOCATE (my_mos, my_active)
364
365 IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN
366 ! create environment for Full Kernel
367 IF (dft_control%qs_control%xtb) THEN
368 cpabort("TDDFPT: xTB only works with sTDA Kernel")
369 END IF
370
371 IF (tddfpt_control%do_hfxsr) THEN
372 kernel_section => section_vals_get_subs_vals(tddfpt_section, "XC%HFX_KERNEL")
373 CALL section_vals_val_get(kernel_section, "HFXSR_PRIMBAS", &
374 i_val=tddfpt_control%hfxsr_primbas)
375 ! basis set
376 CALL create_minbas_set(qs_env, log_unit, basis_type="TDA_HFX", &
377 primitive=tddfpt_control%hfxsr_primbas)
378 ! admm control
379 ALLOCATE (full_kernel_env%admm_control)
380 full_kernel_env%admm_control%purification_method = do_admm_purify_none
381 full_kernel_env%admm_control%method = do_admm_basis_projection
382 full_kernel_env%admm_control%scaling_model = do_admm_exch_scaling_none
383 full_kernel_env%admm_control%aux_exch_func = do_admm_aux_exch_func_none
384 ! hfx section
385 full_kernel_env%hfxsr_section => hfxsr_section
386 !
387 CALL aux_admm_init(qs_env, mos, full_kernel_env%admm_env, &
388 full_kernel_env%admm_control, "TDA_HFX")
389 CALL get_admm_env(full_kernel_env%admm_env, mos_aux_fit=mos_aux_fit, &
390 matrix_s_aux_fit=matrix_s_aux_fit, &
391 matrix_s_aux_fit_vs_orb=matrix_s_aux_fit_vs_orb)
392 CALL admm_fit_mo_coeffs(full_kernel_env%admm_env, matrix_s_aux_fit, &
393 matrix_s_aux_fit_vs_orb, mos, mos_aux_fit, .true.)
394 ! x_data
395 CALL get_qs_env(qs_env, cell=cell, atomic_kind_set=atomic_kind_set, &
396 qs_kind_set=qs_kind_set, particle_set=particle_set, &
397 para_env=para_env)
398 CALL hfx_create(full_kernel_env%x_data, para_env, hfxsr_section, atomic_kind_set, &
399 qs_kind_set, particle_set, dft_control, cell, orb_basis="TDA_HFX")
400 END IF
401
402 ! allocate pools and work matrices
403 nstates = tddfpt_control%nstates
404 !! Too many states can lead to Problems
405 !! You should be warned if there are more states
406 !! than occ-virt Combinations!!
407 CALL cp_fm_get_info(gs_mos(1)%mos_occ, ncol_global=nocc)
408 IF (tddfpt_control%spinflip == no_sf_tddfpt) THEN
409 CALL cp_fm_get_info(gs_mos(1)%mos_virt, ncol_global=nvirt)
410 ELSE
411 CALL cp_fm_get_info(gs_mos(2)%mos_virt, ncol_global=nvirt)
412 END IF
413 nstate_max = nocc*nvirt
414 IF (nstates > nstate_max) THEN
415 cpwarn("NUMBER OF EXCITED STATES COULD LEAD TO PROBLEMS!")
416 cpwarn("Experimental: CHANGED NSTATES TO ITS MAXIMUM VALUE!")
417 nstates = nstate_max
418 tddfpt_control%nstates = nstate_max
419 END IF
420 CALL tddfpt_create_work_matrices(work_matrices, gs_mos, nstates, &
421 do_hfx, do_admm, do_hfxlr, do_exck, do_sf, qs_env, sub_env)
422
423 ! create full_kernel and admm_kernel within tddfpt_energies
424 kernel_env%full_kernel => full_kernel_env
425 kernel_env%admm_kernel => kernel_env_admm_aux
426 NULLIFY (kernel_env%stda_kernel)
427 IF (do_hfxsr) THEN
428 ! work matrices for SR HFX
429 CALL hfxsr_create_work_matrices(work_matrices, qs_env, full_kernel_env%admm_env)
430 END IF
431 IF (do_hfxlr) THEN
432 ! calculate S_half and Lowdin MO coefficients
433 CALL get_lowdin_mo_coefficients(qs_env, sub_env, work_matrices)
434 END IF
435 ELSE IF (tddfpt_control%kernel == tddfpt_kernel_stda) THEN
436 ! setup for kernel_stda outside tddfpt_energies
437 CALL cp_fm_get_info(gs_mos(1)%mos_occ, nrow_global=nao)
438 nactive = tddfpt_control%nactive
439 CALL allocate_stda_env(qs_env, stda_kernel, nao, nactive)
440 ! sTDA parameters
441 CALL stda_init_param(qs_env, stda_kernel, tddfpt_control%stda_control)
442 ! allocate pools and work matrices
443 nstates = tddfpt_control%nstates
444 CALL stda_create_work_matrices(work_matrices, gs_mos, nstates, qs_env, sub_env)
445 !
446 CALL stda_init_matrices(qs_env, stda_kernel, sub_env, &
447 work_matrices, tddfpt_control)
448 !
449 kernel_env%stda_kernel => stda_kernel
450 NULLIFY (kernel_env%full_kernel)
451 NULLIFY (kernel_env%admm_kernel)
452 ELSE IF (tddfpt_control%kernel == tddfpt_kernel_none) THEN
453 ! allocate pools and work matrices
454 nstates = tddfpt_control%nstates
455 CALL stda_create_work_matrices(work_matrices, gs_mos, nstates, qs_env, sub_env)
456 NULLIFY (kernel_env%full_kernel)
457 NULLIFY (kernel_env%admm_kernel)
458 NULLIFY (kernel_env%stda_kernel)
459 END IF
460
461 IF (do_sf) THEN
462 ! only alpha -> beta excitations are considered in spin-flip TDDFT
463 ALLOCATE (evects(1, nstates))
464 ELSE
465 ALLOCATE (evects(nspins, nstates))
466 END IF
467 ALLOCATE (evals(nstates))
468 ALLOCATE (s_evects(SIZE(evects, 1), nstates))
469
470 DO istate = 1, nstates
471 DO ispin = 1, SIZE(evects, 1)
472 CALL fm_pool_create_fm( &
473 work_matrices%fm_pool_ao_mo_active(ispin)%pool, &
474 s_evects(ispin, istate))
475 END DO
476 END DO
477
478 IF (.NOT. do_soc) THEN
479 ! compute tddfpt excitation energies of multiplicity mult
480 CALL tddfpt_energies(qs_env, nstates, nspins, work_matrices, &
481 tddfpt_control, logger, tddfpt_print_section, evects, evals, &
482 gs_mos, tddfpt_section, s_evects, matrix_s, kernel_env, matrix_ks, &
483 sub_env, ostrength, dipole_op_mos_occ, mult, xc_section, full_kernel_env, &
484 kernel_env_admm_aux)
485 ELSE
486 CALL tddfpt_soc_energies(qs_env, nstates, work_matrices, &
487 tddfpt_control, logger, tddfpt_print_section, &
488 evects, evals, ostrength, &
489 gs_mos, tddfpt_section, s_evects, matrix_s, kernel_env, matrix_ks, &
490 sub_env, dipole_op_mos_occ, lmult_tmp, xc_section, full_kernel_env, &
491 kernel_env_admm_aux)
492 END IF
493
494 !print forces for selected states
495 IF (calc_forces) THEN
496 CALL tddfpt_print_forces(qs_env, evects, evals, ostrength, &
497 tddfpt_print_section, gs_mos, &
498 kernel_env, sub_env, work_matrices)
499 END IF
500
501 ! excited state potential energy surface
502 IF (qs_env%excited_state) THEN
503 IF (sub_env%is_split) THEN
504 CALL cp_abort(__location__, &
505 "Excited state forces not possible when states"// &
506 " are distributed to different CPU pools.")
507 END IF
508 ! for gradients unshifted KS matrix
509 IF (ASSOCIATED(matrix_ks_oep)) CALL get_qs_env(qs_env, matrix_ks=matrix_ks)
510 CALL get_qs_env(qs_env, exstate_env=ex_env)
511 state_change = .false.
512 IF (ex_env%state > 0) THEN
513 my_state = ex_env%state
514 ELSEIF (ex_env%state < 0) THEN
515 ! state following
516 ALLOCATE (my_mos(nspins))
517 DO ispin = 1, nspins
518 my_mos(ispin) = gs_mos(ispin)%mos_occ
519 END DO
520 my_state = abs(ex_env%state)
521 CALL assign_state(qs_env, matrix_s, evects, my_mos, ex_env%wfn_history, my_state)
522 DEALLOCATE (my_mos)
523 IF (my_state /= abs(ex_env%state)) THEN
524 state_change = .true.
525 old_state = abs(ex_env%state)
526 END IF
527 ex_env%state = -my_state
528 ELSE
529 CALL cp_warn(__location__, &
530 "Active excited state not assigned. Use the first state.")
531 my_state = 1
532 END IF
533 cpassert(my_state > 0)
534 IF (my_state > nstates) THEN
535 CALL cp_warn(__location__, &
536 "There were not enough excited states calculated.")
537 cpabort("excited state potential energy surface")
538 END IF
539 !
540 ! energy
541 ex_env%evalue = evals(my_state)
542 ! excitation vector
543 CALL cp_fm_release(ex_env%evect)
544 ALLOCATE (ex_env%evect(SIZE(evects, 1)))
545 DO ispin = 1, SIZE(evects, 1)
546 CALL cp_fm_get_info(matrix=evects(ispin, 1), &
547 matrix_struct=matrix_struct)
548 CALL cp_fm_create(ex_env%evect(ispin), matrix_struct)
549 CALL cp_fm_to_fm(evects(ispin, my_state), ex_env%evect(ispin))
550 END DO
551
552 IF (log_unit > 0) THEN
553 gsval = ex_env%wfn_history%gsval
554 gsmin = ex_env%wfn_history%gsmin
555 xsval = ex_env%wfn_history%xsval
556 WRITE (log_unit, "(1X,A,T40,F10.6,A,T62,F10.6,A)") "Ground state orbital alignment:", &
557 gsmin, "[MinVal]", gsval, "[Average]"
558 WRITE (log_unit, "(1X,A,T71,F10.6)") "Excitation vector alignment:", xsval
559 IF (state_change) THEN
560 WRITE (log_unit, "(1X,A,I5,T60,A14,T76,I5)") &
561 "Target state has been changed from state ", &
562 old_state, " to new state ", my_state
563 END IF
564 WRITE (log_unit, "(1X,A,I4,A,F12.5,A)") "Calculate properties for state:", &
565 my_state, " with excitation energy ", ex_env%evalue*evolt, " eV"
566 END IF
567
568 ! Calculate response vector
569 IF (calc_forces) THEN
570 CALL tddfpt_forces_main(qs_env, gs_mos, ex_env, kernel_env, &
571 sub_env, work_matrices)
572 END IF
573 END IF
574
575 ! share evals, evects and mo_coefs with rixs
576 IF (do_rixs) THEN
577 ! copy evals
578 valence_state%nstates = nstates
579 ALLOCATE (valence_state%evals(SIZE(evals)))
580 valence_state%evals(:) = evals(:)
581
582 ALLOCATE (valence_state%evects(nspins, nstates))
583 ALLOCATE (valence_state%mos_active(nspins))
584 DO ispin = 1, nspins
585 ! copy evects
586 DO istate = 1, nstates
587 CALL cp_fm_get_info(matrix=evects(ispin, istate), &
588 matrix_struct=matrix_struct)
589 CALL cp_fm_create(valence_state%evects(ispin, istate), matrix_struct)
590 CALL cp_fm_to_fm(evects(ispin, istate), valence_state%evects(ispin, istate))
591 END DO
592 ! copy mos_occ
593 CALL cp_fm_get_info(matrix=gs_mos(ispin)%mos_active, &
594 matrix_struct=matrix_struct)
595 CALL cp_fm_create(valence_state%mos_active(ispin), matrix_struct)
596 CALL cp_fm_to_fm(gs_mos(ispin)%mos_active, valence_state%mos_active(ispin))
597 END DO
598 END IF
599
600 ! clean up
601 CALL cp_fm_release(evects)
602 CALL cp_fm_release(s_evects)
603
604 CALL cp_print_key_finished_output(log_unit, &
605 logger, &
606 tddfpt_print_section, &
607 "PROGRAM_BANNER")
608
609 DEALLOCATE (evals, ostrength)
610
611 IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN
612 IF (do_admm) CALL release_kernel_env(kernel_env%admm_kernel)
613 IF (tddfpt_control%do_lrigpw) THEN
614 CALL lri_env_release(kernel_env%full_kernel%lri_env)
615 DEALLOCATE (kernel_env%full_kernel%lri_env)
616 CALL lri_density_release(kernel_env%full_kernel%lri_density)
617 DEALLOCATE (kernel_env%full_kernel%lri_density)
618 END IF
619 CALL release_kernel_env(kernel_env%full_kernel)
620 ELSE IF (tddfpt_control%kernel == tddfpt_kernel_stda) THEN
621 CALL deallocate_stda_env(stda_kernel)
622 ELSE IF (tddfpt_control%kernel == tddfpt_kernel_none) THEN
623 !
624 ELSE
625 cpabort('Unknown kernel type')
626 END IF
627 CALL tddfpt_release_work_matrices(work_matrices, sub_env)
628 CALL tddfpt_sub_env_release(sub_env)
629
630 CALL cp_fm_release(dipole_op_mos_occ)
631
632 DO ispin = nspins, 1, -1
633 CALL tddfpt_release_ground_state_mos(gs_mos(ispin))
634 END DO
635 DEALLOCATE (gs_mos)
636
637 IF (ASSOCIATED(matrix_ks_oep)) &
638 CALL dbcsr_deallocate_matrix_set(matrix_ks_oep)
639
640 CALL timestop(handle)
641
642 END SUBROUTINE tddfpt
643
644! **************************************************************************************************
645!> \brief TDDFPT input
646!> \param qs_env Quickstep environment
647!> \param tddfpt_section ...
648!> \param tddfpt_control ...
649!> \param do_hfx ...
650!> \param do_admm ...
651!> \param do_exck ...
652!> \param do_hfxsr ...
653!> \param do_hfxlr ...
654!> \param xc_section ...
655!> \param tddfpt_print_section ...
656!> \param lri_section ...
657!> \param hfxsr_section ...
658! **************************************************************************************************
659 SUBROUTINE tddfpt_input(qs_env, tddfpt_section, tddfpt_control, do_hfx, do_admm, do_exck, &
660 do_hfxsr, do_hfxlr, xc_section, tddfpt_print_section, lri_section, &
661 hfxsr_section)
662 TYPE(qs_environment_type), POINTER :: qs_env
663 TYPE(section_vals_type), POINTER :: tddfpt_section
664 TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
665 LOGICAL, INTENT(INOUT) :: do_hfx, do_admm, do_exck, do_hfxsr, &
666 do_hfxlr
667 TYPE(section_vals_type), POINTER :: xc_section, tddfpt_print_section, &
668 lri_section, hfxsr_section
669
670 CHARACTER(len=20) :: nstates_str
671 LOGICAL :: exar, exf, exgcp, exhf, exhfxk, exk, &
672 explicit, explicit_root, expot, exvdw, &
673 exwfn, found, same_hfx, use_real_wfn
674 REAL(kind=dp) :: c_hf
675 TYPE(dft_control_type), POINTER :: dft_control
676 TYPE(kpoint_type), POINTER :: kpoints
677 TYPE(section_vals_type), POINTER :: hfx_section, hfx_section_gs, input, &
678 print_sub, xc_root, xc_sub
679
680 NULLIFY (dft_control, input, kpoints)
681 CALL get_qs_env(qs_env, dft_control=dft_control, input=input, kpoints=kpoints)
682
683 IF (dft_control%nimages > 1) THEN
684 IF (tddfpt_control%kernel /= tddfpt_kernel_none) &
685 cpabort("TDDFPT with k-points currently supports only KERNEL NONE")
686 CALL get_kpoint_info(kpoints, use_real_wfn=use_real_wfn)
687 IF (use_real_wfn) &
688 cpabort("K-point TDDFPT requires complex wavefunctions")
689 IF (tddfpt_control%spinflip /= no_sf_tddfpt) &
690 cpabort("Spin-flip TDDFPT is not implemented for k-points")
691 IF (tddfpt_control%do_smearing) &
692 cpabort("Smeared-occupation TDDFPT is not implemented for k-points")
693 IF (tddfpt_control%oe_corr /= oe_none) &
694 cpabort("Orbital-energy-corrected TDDFPT is not implemented for k-points")
695 IF (tddfpt_control%dipole_form /= 0 .AND. &
696 tddfpt_control%dipole_form /= tddfpt_dipole_velocity .AND. &
697 tddfpt_control%dipole_form /= tddfpt_dipole_scf_moment) &
698 cpabort("K-point TDDFPT supports only velocity-form or SCF_MOMENT transition dipoles")
699 END IF
700
701 IF (tddfpt_control%nstates <= 0) THEN
702 CALL integer_to_string(tddfpt_control%nstates, nstates_str)
703 CALL cp_warn(__location__, "TDDFPT calculation was requested for "// &
704 trim(nstates_str)//" excited states: nothing to do.")
705 RETURN
706 END IF
707
708 NULLIFY (tddfpt_print_section)
709 tddfpt_print_section => section_vals_get_subs_vals(tddfpt_section, "PRINT")
710
711 IF (dft_control%nimages > 1) THEN
712 IF (tddfpt_control%do_exciton_descriptors .OR. &
713 tddfpt_control%do_directional_exciton_descriptors) &
714 cpabort("Exciton descriptors are not implemented for k-point TDDFPT")
715 print_sub => section_vals_get_subs_vals(tddfpt_print_section, "NTO_ANALYSIS")
716 CALL section_vals_get(print_sub, explicit=explicit)
717 IF (explicit) cpabort("NTO analysis is not implemented for k-point TDDFPT")
718 print_sub => section_vals_get_subs_vals(tddfpt_print_section, "NAMD_PRINT")
719 CALL section_vals_get(print_sub, explicit=explicit)
720 IF (explicit) cpabort("NAMD_PRINT is not implemented for k-point TDDFPT")
721 END IF
722
723 IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN
724 NULLIFY (xc_root)
725 xc_root => section_vals_get_subs_vals(tddfpt_section, "XC")
726 CALL section_vals_get(xc_root, explicit=explicit_root)
727 NULLIFY (xc_section)
728 IF (explicit_root) THEN
729 ! No ADIABATIC_RESCALING option possible
730 NULLIFY (xc_sub)
731 xc_sub => section_vals_get_subs_vals(xc_root, "ADIABATIC_RESCALING")
732 CALL section_vals_get(xc_sub, explicit=exar)
733 IF (exar) THEN
734 CALL cp_warn(__location__, "TDDFPT Kernel with ADIABATIC_RESCALING not possible.")
735 cpabort("TDDFPT Input")
736 END IF
737 ! No GCP_POTENTIAL option possible
738 NULLIFY (xc_sub)
739 xc_sub => section_vals_get_subs_vals(xc_root, "GCP_POTENTIAL")
740 CALL section_vals_get(xc_sub, explicit=exgcp)
741 IF (exgcp) THEN
742 CALL cp_warn(__location__, "TDDFPT Kernel with GCP_POTENTIAL not possible.")
743 cpabort("TDDFPT Input")
744 END IF
745 ! No VDW_POTENTIAL option possible
746 NULLIFY (xc_sub)
747 xc_sub => section_vals_get_subs_vals(xc_root, "VDW_POTENTIAL")
748 CALL section_vals_get(xc_sub, explicit=exvdw)
749 IF (exvdw) THEN
750 CALL cp_warn(__location__, "TDDFPT Kernel with VDW_POTENTIAL not possible.")
751 cpabort("TDDFPT Input")
752 END IF
753 ! No WF_CORRELATION option possible
754 NULLIFY (xc_sub)
755 xc_sub => section_vals_get_subs_vals(xc_root, "WF_CORRELATION")
756 CALL section_vals_get(xc_sub, explicit=exwfn)
757 IF (exwfn) THEN
758 CALL cp_warn(__location__, "TDDFPT Kernel with WF_CORRELATION not possible.")
759 cpabort("TDDFPT Input")
760 END IF
761 ! No XC_POTENTIAL option possible
762 NULLIFY (xc_sub)
763 xc_sub => section_vals_get_subs_vals(xc_root, "XC_POTENTIAL")
764 CALL section_vals_get(xc_sub, explicit=expot)
765 IF (expot) THEN
766 CALL cp_warn(__location__, "TDDFPT Kernel with XC_POTENTIAL not possible.")
767 cpabort("TDDFPT Input")
768 END IF
769 !
770 NULLIFY (xc_sub)
771 xc_sub => section_vals_get_subs_vals(xc_root, "XC_FUNCTIONAL")
772 CALL section_vals_get(xc_sub, explicit=exf)
773 NULLIFY (xc_sub)
774 xc_sub => section_vals_get_subs_vals(xc_root, "XC_KERNEL")
775 CALL section_vals_get(xc_sub, explicit=exk)
776 IF ((exf .AND. exk) .OR. .NOT. (exf .OR. exk)) THEN
777 CALL cp_warn(__location__, "TDDFPT Kernel needs XC_FUNCTIONAL or XC_KERNEL section.")
778 cpabort("TDDFPT Input")
779 END IF
780 NULLIFY (xc_sub)
781 xc_sub => section_vals_get_subs_vals(xc_root, "HF")
782 CALL section_vals_get(xc_sub, explicit=exhf)
783 NULLIFY (xc_sub)
784 xc_sub => section_vals_get_subs_vals(xc_root, "HFX_KERNEL")
785 CALL section_vals_get(xc_sub, explicit=exhfxk)
786 !
787 xc_section => xc_root
788 hfx_section => section_vals_get_subs_vals(xc_section, "HF")
789 CALL section_vals_get(hfx_section, explicit=do_hfx)
790 IF (do_hfx) THEN
791 CALL section_vals_val_get(hfx_section, "FRACTION", r_val=c_hf)
792 do_hfx = (c_hf /= 0.0_dp)
793 END IF
794 !TDDFPT only works if the kernel has the same HF section as the DFT%XC one
795 IF (do_hfx) THEN
796 hfx_section_gs => section_vals_get_subs_vals(input, "DFT%XC%HF")
797 CALL compare_hfx_sections(hfx_section, hfx_section_gs, same_hfx)
798 IF (.NOT. same_hfx) THEN
799 cpabort("TDDFPT Kernel must use the same HF section as DFT%XC or no HF at all.")
800 END IF
801 END IF
802
803 do_admm = do_hfx .AND. dft_control%do_admm
804 IF (do_admm) THEN
805 ! 'admm_env%xc_section_primary' and 'admm_env%xc_section_aux' need to be redefined
806 CALL cp_abort(__location__, &
807 "ADMM is not implemented for a TDDFT kernel XC-functional which is different from "// &
808 "the one used for the ground-state calculation. A ground-state 'admm_env' cannot be reused.")
809 END IF
810 ! SET HFX_KERNEL and/or XC_KERNEL
811 IF (exk) THEN
812 do_exck = .true.
813 ELSE
814 do_exck = .false.
815 END IF
816 IF (exhfxk) THEN
817 xc_sub => section_vals_get_subs_vals(xc_root, "HFX_KERNEL")
818 CALL section_vals_val_get(xc_sub, "DO_HFXSR", l_val=do_hfxsr)
819 xc_sub => section_vals_get_subs_vals(xc_root, "HFX_KERNEL%HFXLR")
820 CALL section_vals_get(xc_sub, explicit=do_hfxlr)
821 ELSE
822 do_hfxsr = .false.
823 do_hfxlr = .false.
824 END IF
825 ELSE
826 xc_section => section_vals_get_subs_vals(input, "DFT%XC")
827 hfx_section => section_vals_get_subs_vals(xc_section, "HF")
828 CALL section_vals_get(hfx_section, explicit=do_hfx)
829 IF (do_hfx) THEN
830 CALL section_vals_val_get(hfx_section, "FRACTION", r_val=c_hf)
831 do_hfx = (c_hf /= 0.0_dp)
832 END IF
833 do_admm = do_hfx .AND. dft_control%do_admm
834 do_exck = .false.
835 do_hfxsr = .false.
836 do_hfxlr = .false.
837 END IF
838 ELSE
839 do_hfx = .false.
840 do_admm = .false.
841 do_exck = .false.
842 do_hfxsr = .false.
843 do_hfxlr = .false.
844 END IF
845
846 ! reset rks_triplets if UKS is in use
847 IF (tddfpt_control%rks_triplets .AND. dft_control%nspins > 1) THEN
848 tddfpt_control%rks_triplets = .false.
849 CALL cp_warn(__location__, "Keyword RKS_TRIPLETS has been ignored for spin-polarised calculations")
850 END IF
851
852 ! lri input
853 IF (tddfpt_control%do_lrigpw) THEN
854 lri_section => section_vals_get_subs_vals(tddfpt_section, "LRIGPW")
855 END IF
856
857 ! set defaults for short range HFX
858 NULLIFY (hfxsr_section)
859 IF (do_hfxsr) THEN
860 hfxsr_section => section_vals_get_subs_vals(tddfpt_section, "XC%HFX_KERNEL%HF")
861 CALL section_vals_get(hfxsr_section, explicit=found)
862 IF (.NOT. found) THEN
863 cpabort("HFXSR option needs &HF section defined")
864 END IF
865 CALL section_vals_val_get(hfxsr_section, "INTERACTION_POTENTIAL%POTENTIAL_TYPE", explicit=found)
866 IF (.NOT. found) THEN
867 CALL section_vals_val_set(hfxsr_section, "INTERACTION_POTENTIAL%POTENTIAL_TYPE", &
869 END IF
870 CALL section_vals_val_get(hfxsr_section, "INTERACTION_POTENTIAL%CUTOFF_RADIUS", explicit=found)
871 IF (.NOT. found) THEN
872 CALL section_vals_val_set(hfxsr_section, "INTERACTION_POTENTIAL%CUTOFF_RADIUS", r_val=7.5589_dp)
873 END IF
874 CALL section_vals_val_get(hfxsr_section, "RI%_SECTION_PARAMETERS_", l_val=found)
875 IF (found) THEN
876 CALL cp_abort(__location__, "Short range TDA kernel with RI not possible")
877 END IF
878 END IF
879
880 END SUBROUTINE tddfpt_input
881
882! **************************************************************************************************
883!> \brief ...
884!> \param log_unit ...
885!> \param dft_control ...
886!> \param tddfpt_control ...
887!> \param xc_section ...
888! **************************************************************************************************
889 SUBROUTINE kernel_info(log_unit, dft_control, tddfpt_control, xc_section)
890 INTEGER, INTENT(IN) :: log_unit
891 TYPE(dft_control_type), POINTER :: dft_control
892 TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
893 TYPE(section_vals_type), POINTER :: xc_section
894
895 CHARACTER(LEN=4) :: ktype
896 LOGICAL :: lsd
897
898 lsd = (dft_control%nspins > 1)
899 IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN
900 ktype = "FULL"
901 IF (log_unit > 0) THEN
902 WRITE (log_unit, "(T2,A,T77,A4)") "KERNEL|", trim(ktype)
903 CALL xc_write(log_unit, xc_section, lsd)
904 IF (tddfpt_control%do_hfx) THEN
905 IF (tddfpt_control%do_admm) THEN
906 WRITE (log_unit, "(T2,A,T62,A19)") "KERNEL|", "ADMM Exact Exchange"
907 IF (tddfpt_control%admm_xc_correction) THEN
908 WRITE (log_unit, "(T2,A,T60,A21)") "KERNEL|", "Apply ADMM Kernel XC Correction"
909 END IF
910 IF (tddfpt_control%admm_symm) THEN
911 WRITE (log_unit, "(T2,A,T60,A21)") "KERNEL|", "Symmetric ADMM Kernel"
912 END IF
913 ELSE
914 WRITE (log_unit, "(T2,A,T67,A14)") "KERNEL|", "Exact Exchange"
915 END IF
916 END IF
917 IF (tddfpt_control%do_hfxsr) THEN
918 WRITE (log_unit, "(T2,A,T43,A38)") "KERNEL|", "Short range HFX approximation"
919 END IF
920 IF (tddfpt_control%do_hfxlr) THEN
921 WRITE (log_unit, "(T2,A,T43,A38)") "KERNEL|", "Long range HFX approximation"
922 END IF
923 IF (tddfpt_control%do_lrigpw) THEN
924 WRITE (log_unit, "(T2,A,T42,A39)") "KERNEL|", "LRI approximation of transition density"
925 END IF
926 END IF
927 ELSE IF (tddfpt_control%kernel == tddfpt_kernel_stda) THEN
928 ktype = "sTDA"
929 IF (log_unit > 0) THEN
930 WRITE (log_unit, "(T2,A,T77,A4)") "KERNEL|", trim(ktype)
931 IF (tddfpt_control%stda_control%do_ewald) THEN
932 WRITE (log_unit, "(T2,A,T78,A3)") "KERNEL| Coulomb term uses Ewald summation"
933 ELSE
934 WRITE (log_unit, "(T2,A,T78,A3)") "KERNEL| Coulomb term uses direct summation (MIC)"
935 END IF
936 IF (tddfpt_control%stda_control%do_exchange) THEN
937 WRITE (log_unit, "(T2,A,T78,A3)") "KERNEL| Exact exchange term", "YES"
938 WRITE (log_unit, "(T2,A,T71,F10.3)") "KERNEL| Short range HFX fraction:", &
939 tddfpt_control%stda_control%hfx_fraction
940 ELSE
941 WRITE (log_unit, "(T2,A,T79,A2)") "KERNEL| Exact exchange term", "NO"
942 END IF
943 WRITE (log_unit, "(T2,A,T66,E15.3)") "KERNEL| Transition density filter", &
944 tddfpt_control%stda_control%eps_td_filter
945 END IF
946 ELSE IF (tddfpt_control%kernel == tddfpt_kernel_none) THEN
947 ktype = "NONE"
948 IF (log_unit > 0) THEN
949 WRITE (log_unit, "(T2,A,T77,A4)") "KERNEL|", trim(ktype)
950 END IF
951 ELSE
952 !CPABORT("Unknown kernel")
953 END IF
954 !
955 IF (log_unit > 0) THEN
956 IF (tddfpt_control%rks_triplets) THEN
957 WRITE (log_unit, "(T2,A,T74,A7)") "KERNEL| Spin symmetry of excitations", "Triplet"
958 ELSE IF (lsd) THEN
959 ! Spin-conserving excitations where requested
960 IF (tddfpt_control%spinflip == no_sf_tddfpt) THEN
961 WRITE (log_unit, "(T2,A,T69,A12)") "KERNEL| Spin symmetry of excitations", "Unrestricted"
962 ! Spin-flip excitations with collinear exchange-correlation kernel requested
963 ELSE IF (tddfpt_control%spinflip == tddfpt_sf_col) THEN
964 WRITE (log_unit, "(T2,A,T72,A9)") "KERNEL| Spin flip", "Collinear"
965 ! Spin-flip excitations with noncollinear exchange-correlation kernel requested
966 ELSE IF (tddfpt_control%spinflip == tddfpt_sf_noncol) THEN
967 WRITE (log_unit, "(T2,A,T69,A12)") "KERNEL| Spin flip", "Noncollinear"
968 END IF
969 ELSE
970 WRITE (log_unit, "(T2,A,T74,A7)") "KERNEL| Spin symmetry of excitations", "Singlet"
971 END IF
972 WRITE (log_unit, "(T2,A,T73,I8)") "TDDFPT| Number of states calculated", tddfpt_control%nstates
973 WRITE (log_unit, "(T2,A,T73,I8)") "TDDFPT| Number of Davidson iterations", tddfpt_control%niters
974 WRITE (log_unit, "(T2,A,T66,E15.3)") "TDDFPT| Davidson iteration convergence", tddfpt_control%conv
975 WRITE (log_unit, "(T2,A,T73,I8)") "TDDFPT| Max. number of Krylov space vectors", tddfpt_control%nkvs
976 END IF
977
978 END SUBROUTINE kernel_info
979
980! **************************************************************************************************
981!> \brief Print independent-particle vertical transitions for k-point calculations.
982!> \param qs_env ...
983!> \param logger ...
984!> \param tddfpt_control ...
985! **************************************************************************************************
986 SUBROUTINE tddfpt_kpoint_independent_particle(qs_env, logger, tddfpt_control)
987 TYPE(qs_environment_type), POINTER :: qs_env
988 TYPE(cp_logger_type), POINTER :: logger
989 TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
990
991 CHARACTER(LEN=*), PARAMETER :: routinen = 'tddfpt_kpoint_independent_particle'
992
993 COMPLEX(KIND=dp), ALLOCATABLE, &
994 DIMENSION(:, :, :, :, :) :: kpoint_dipole
995 INTEGER :: handle, ideriv, ikp, ikp_local, iocc, ispin, istate, itrans, ivirt, log_unit, &
996 nao, nkp, nkp_local, nspins, nstates, ntrans_kpoint, ntrans_spin, ntrans_total, &
997 spin_offset, trans_index
998 INTEGER, ALLOCATABLE, DIMENSION(:) :: inds
999 INTEGER, DIMENSION(2) :: kp_range
1000 INTEGER, DIMENSION(:, :, :), POINTER :: cell_to_index
1001 INTEGER, DIMENSION(maxspins) :: homo_spin, nao_spin, nmo_spin, nvirt_spin
1002 LOGICAL :: my_kpgrp, use_scf_moment_dipoles
1003 REAL(kind=dp) :: checksum, dipole_im, dipole_re, fsum, &
1004 gap, oscillator_factor, spin_factor
1005 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: eigenvalues_kp, evals, &
1006 oscillator_strength, transition_energy
1007 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: transition_dipole_im, &
1008 transition_dipole_re
1009 REAL(kind=dp), DIMENSION(:), POINTER :: eigenvalues, wkp
1010 REAL(kind=dp), DIMENSION(nderivs) :: transition_dipole_abs
1011 TYPE(cp_blacs_env_type), POINTER :: blacs_env, blacs_env_all
1012 TYPE(cp_fm_struct_type), POINTER :: fm_struct, moment_struct
1013 TYPE(cp_fm_type) :: fm_dummy, fm_tmp, mo_coeff_im_global, &
1014 mo_coeff_re_global, moment_im, &
1015 moment_re
1016 TYPE(cp_fm_type), POINTER :: mo_coeff_im, mo_coeff_re
1017 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: overlap_deriv
1018 TYPE(dbcsr_type), POINTER :: cmatrix, rmatrix
1019 TYPE(dft_control_type), POINTER :: dft_control
1020 TYPE(kpoint_env_p_type), DIMENSION(:), POINTER :: kp_env
1021 TYPE(kpoint_env_type), POINTER :: kp
1022 TYPE(kpoint_type), POINTER :: kpoints
1023 TYPE(mo_set_type), DIMENSION(:, :), POINTER :: mos_kp
1024 TYPE(mp_para_env_type), POINTER :: para_env, para_env_inter_kp, para_env_kp
1025 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
1026 POINTER :: sab_kp, sab_orb
1027 TYPE(qs_ks_env_type), POINTER :: ks_env
1028
1029 CALL timeset(routinen, handle)
1030
1031 NULLIFY (blacs_env, blacs_env_all, cell_to_index, cmatrix, dft_control, eigenvalues, &
1032 fm_struct, kp, kp_env, kpoints, ks_env, mo_coeff_im, mo_coeff_re, &
1033 moment_struct, mos_kp, overlap_deriv, para_env, para_env_inter_kp, para_env_kp, &
1034 rmatrix, sab_kp, sab_orb, wkp)
1035 CALL get_qs_env(qs_env, dft_control=dft_control, kpoints=kpoints, ks_env=ks_env, &
1036 sab_orb=sab_orb)
1037 cpassert(ASSOCIATED(kpoints))
1038
1039 CALL get_kpoint_info(kpoints, nkp=nkp, kp_range=kp_range, kp_env=kp_env, &
1040 para_env=para_env, blacs_env_all=blacs_env_all, &
1041 para_env_inter_kp=para_env_inter_kp, para_env_kp=para_env_kp, &
1042 blacs_env=blacs_env, wkp=wkp, cell_to_index=cell_to_index, &
1043 sab_nl=sab_kp)
1044 cpassert(ASSOCIATED(para_env))
1045 cpassert(ASSOCIATED(para_env_inter_kp))
1046 cpassert(ASSOCIATED(para_env_kp))
1047 cpassert(ASSOCIATED(blacs_env_all))
1048 cpassert(ASSOCIATED(blacs_env))
1049 cpassert(ASSOCIATED(kp_env))
1050 cpassert(ASSOCIATED(ks_env))
1051 cpassert(ASSOCIATED(sab_orb))
1052 cpassert(ASSOCIATED(sab_kp))
1053 cpassert(ASSOCIATED(cell_to_index))
1054
1055 nspins = dft_control%nspins
1056 nmo_spin = 0
1057 homo_spin = 0
1058 nao_spin = 0
1059 nkp_local = max(0, kp_range(2) - kp_range(1) + 1)
1060 IF (nkp_local > 0) THEN
1061 kp => kp_env(1)%kpoint_env
1062 mos_kp => kp%mos
1063 cpassert(ASSOCIATED(mos_kp))
1064 cpassert(SIZE(mos_kp, 2) == nspins)
1065 DO ispin = 1, nspins
1066 CALL get_mo_set(mos_kp(1, ispin), nmo=nmo_spin(ispin), homo=homo_spin(ispin), &
1067 nao=nao_spin(ispin))
1068 END DO
1069 END IF
1070 CALL para_env%max(nmo_spin)
1071 CALL para_env%max(homo_spin)
1072 CALL para_env%max(nao_spin)
1073
1074 ntrans_kpoint = 0
1075 DO ispin = 1, nspins
1076 nvirt_spin(ispin) = nmo_spin(ispin) - homo_spin(ispin)
1077 IF (homo_spin(ispin) <= 0 .OR. nvirt_spin(ispin) <= 0) &
1078 cpabort("At least one occupied and one unoccupied MO are required for k-point TDDFPT")
1079 ntrans_kpoint = ntrans_kpoint + homo_spin(ispin)*nvirt_spin(ispin)
1080 END DO
1081 ntrans_total = nkp*ntrans_kpoint
1082 IF (ntrans_total <= 0) &
1083 cpabort("No independent-particle k-point transitions available")
1084
1085 ALLOCATE (transition_energy(ntrans_total), transition_dipole_re(ntrans_total, nderivs), &
1086 transition_dipole_im(ntrans_total, nderivs), oscillator_strength(ntrans_total), &
1087 inds(ntrans_total))
1088 transition_energy = 0.0_dp
1089 transition_dipole_re = 0.0_dp
1090 transition_dipole_im = 0.0_dp
1091 oscillator_strength = 0.0_dp
1092 use_scf_moment_dipoles = (tddfpt_control%dipole_form == tddfpt_dipole_scf_moment)
1093 IF (use_scf_moment_dipoles) THEN
1094 CALL cp_warn(__location__, "SCF_MOMENT k-point dipoles use direct SCF MO matrix "// &
1095 "elements; compare folded energy blocks, not individual degenerate states.")
1096 CALL qs_moment_kpoints_scf_mos(qs_env, kpoint_dipole)
1097 END IF
1098
1099 IF (.NOT. use_scf_moment_dipoles) THEN
1100 CALL build_overlap_matrix(ks_env, matrixkp_s=overlap_deriv, nderivative=1, &
1101 basis_type_a="ORB", basis_type_b="ORB", sab_nl=sab_orb, &
1102 ext_kpoints=kpoints)
1103
1104 ALLOCATE (rmatrix, cmatrix)
1105 CALL dbcsr_create(rmatrix, template=overlap_deriv(1, 1)%matrix, &
1106 matrix_type=dbcsr_type_symmetric)
1107 CALL dbcsr_create(cmatrix, template=overlap_deriv(1, 1)%matrix, &
1108 matrix_type=dbcsr_type_antisymmetric)
1109 CALL cp_dbcsr_alloc_block_from_nbl(rmatrix, sab_kp)
1110 CALL cp_dbcsr_alloc_block_from_nbl(cmatrix, sab_kp)
1111 END IF
1112
1113 DO ikp = 1, nkp
1114 my_kpgrp = (ikp >= kp_range(1) .AND. ikp <= kp_range(2))
1115 IF (my_kpgrp) THEN
1116 ikp_local = ikp - kp_range(1) + 1
1117 kp => kp_env(ikp_local)%kpoint_env
1118 mos_kp => kp%mos
1119 ELSE
1120 NULLIFY (kp, mos_kp)
1121 END IF
1122 spin_offset = 0
1123 DO ispin = 1, nspins
1124 nao = nao_spin(ispin)
1125 ALLOCATE (eigenvalues_kp(nmo_spin(ispin)))
1126 eigenvalues_kp = 0.0_dp
1127
1128 IF (.NOT. use_scf_moment_dipoles) THEN
1129 CALL cp_fm_struct_create(fm_struct, nrow_global=nao, ncol_global=nmo_spin(ispin), &
1130 para_env=para_env, context=blacs_env_all)
1131 CALL cp_fm_create(mo_coeff_re_global, fm_struct)
1132 CALL cp_fm_create(mo_coeff_im_global, fm_struct)
1133 CALL cp_fm_create(fm_tmp, fm_struct)
1134 CALL cp_fm_struct_release(fm_struct)
1135 CALL cp_fm_struct_create(moment_struct, nrow_global=nmo_spin(ispin), &
1136 ncol_global=nmo_spin(ispin), para_env=para_env, &
1137 context=blacs_env_all)
1138 CALL cp_fm_create(moment_re, moment_struct)
1139 CALL cp_fm_create(moment_im, moment_struct)
1140 CALL cp_fm_struct_release(moment_struct)
1141 END IF
1142
1143 IF (my_kpgrp) THEN
1144 CALL get_mo_set(mos_kp(1, ispin), eigenvalues=eigenvalues)
1145 cpassert(ASSOCIATED(eigenvalues))
1146 IF (para_env_kp%is_source()) &
1147 eigenvalues_kp(1:nmo_spin(ispin)) = eigenvalues(1:nmo_spin(ispin))
1148 IF (.NOT. use_scf_moment_dipoles) THEN
1149 CALL get_mo_set(mos_kp(1, ispin), mo_coeff=mo_coeff_re)
1150 CALL get_mo_set(mos_kp(2, ispin), mo_coeff=mo_coeff_im)
1151 cpassert(ASSOCIATED(mo_coeff_re))
1152 cpassert(ASSOCIATED(mo_coeff_im))
1153 CALL cp_fm_copy_general(mo_coeff_re, mo_coeff_re_global, para_env)
1154 CALL cp_fm_copy_general(mo_coeff_im, mo_coeff_im_global, para_env)
1155 END IF
1156 ELSE IF (.NOT. use_scf_moment_dipoles) THEN
1157 CALL cp_fm_copy_general(fm_dummy, mo_coeff_re_global, para_env)
1158 CALL cp_fm_copy_general(fm_dummy, mo_coeff_im_global, para_env)
1159 END IF
1160 CALL para_env%sum(eigenvalues_kp)
1161
1162 spin_factor = 1.0_dp
1163 IF (nspins == 1) THEN
1164 IF (tddfpt_control%rks_triplets) THEN
1165 spin_factor = 0.0_dp
1166 ELSE
1167 spin_factor = 2.0_dp
1168 END IF
1169 END IF
1170
1171 DO ideriv = 1, nderivs
1172 IF (.NOT. use_scf_moment_dipoles) THEN
1173 CALL dbcsr_set(rmatrix, 0.0_dp)
1174 CALL dbcsr_set(cmatrix, 0.0_dp)
1175 CALL rskp_transform(rmatrix=rmatrix, cmatrix=cmatrix, rsmat=overlap_deriv, &
1176 ispin=ideriv + 1, xkp=kpoints%xkp(:, ikp), &
1177 cell_to_index=cell_to_index, sab_nl=sab_kp)
1178
1179 CALL cp_dbcsr_sm_fm_multiply(rmatrix, mo_coeff_re_global, fm_tmp, nmo_spin(ispin))
1180 CALL parallel_gemm("T", "N", nmo_spin(ispin), nmo_spin(ispin), nao, &
1181 1.0_dp, mo_coeff_re_global, fm_tmp, 0.0_dp, moment_re)
1182 CALL parallel_gemm("T", "N", nmo_spin(ispin), nmo_spin(ispin), nao, &
1183 1.0_dp, mo_coeff_im_global, fm_tmp, 0.0_dp, moment_im)
1184
1185 CALL cp_dbcsr_sm_fm_multiply(rmatrix, mo_coeff_im_global, fm_tmp, nmo_spin(ispin))
1186 CALL parallel_gemm("T", "N", nmo_spin(ispin), nmo_spin(ispin), nao, &
1187 1.0_dp, mo_coeff_re_global, fm_tmp, 1.0_dp, moment_im)
1188 CALL parallel_gemm("T", "N", nmo_spin(ispin), nmo_spin(ispin), nao, &
1189 -1.0_dp, mo_coeff_im_global, fm_tmp, 1.0_dp, moment_re)
1190
1191 CALL cp_dbcsr_sm_fm_multiply(cmatrix, mo_coeff_re_global, fm_tmp, nmo_spin(ispin))
1192 CALL parallel_gemm("T", "N", nmo_spin(ispin), nmo_spin(ispin), nao, &
1193 1.0_dp, mo_coeff_re_global, fm_tmp, 1.0_dp, moment_im)
1194 CALL parallel_gemm("T", "N", nmo_spin(ispin), nmo_spin(ispin), nao, &
1195 -1.0_dp, mo_coeff_im_global, fm_tmp, 1.0_dp, moment_re)
1196
1197 CALL cp_dbcsr_sm_fm_multiply(cmatrix, mo_coeff_im_global, fm_tmp, nmo_spin(ispin))
1198 CALL parallel_gemm("T", "N", nmo_spin(ispin), nmo_spin(ispin), nao, &
1199 -1.0_dp, mo_coeff_re_global, fm_tmp, 1.0_dp, moment_re)
1200 CALL parallel_gemm("T", "N", nmo_spin(ispin), nmo_spin(ispin), nao, &
1201 -1.0_dp, mo_coeff_im_global, fm_tmp, 1.0_dp, moment_im)
1202 END IF
1203
1204 DO iocc = 1, homo_spin(ispin)
1205 DO ivirt = homo_spin(ispin) + 1, nmo_spin(ispin)
1206 trans_index = (ikp - 1)*ntrans_kpoint + spin_offset + &
1207 (iocc - 1)*nvirt_spin(ispin) + ivirt - homo_spin(ispin)
1208 gap = eigenvalues_kp(ivirt) - eigenvalues_kp(iocc)
1209 IF (gap <= 0.0_dp) &
1210 cpabort("K-point TDDFPT requires positive occupied-virtual energy gaps")
1211 IF (use_scf_moment_dipoles) THEN
1212 oscillator_factor = sqrt(spin_factor*wkp(ikp))
1213 dipole_re = real(kpoint_dipole(ispin, ikp, ideriv, iocc, ivirt), kind=dp)
1214 dipole_im = aimag(kpoint_dipole(ispin, ikp, ideriv, iocc, ivirt))
1215 ELSE
1216 oscillator_factor = sqrt(spin_factor*wkp(ikp))/gap
1217 CALL cp_fm_get_element(moment_re, ivirt, iocc, dipole_re)
1218 CALL cp_fm_get_element(moment_im, ivirt, iocc, dipole_im)
1219 END IF
1220 transition_dipole_re(trans_index, ideriv) = oscillator_factor*dipole_re
1221 transition_dipole_im(trans_index, ideriv) = oscillator_factor*dipole_im
1222 END DO
1223 END DO
1224 END DO
1225
1226 DO iocc = 1, homo_spin(ispin)
1227 DO ivirt = homo_spin(ispin) + 1, nmo_spin(ispin)
1228 trans_index = (ikp - 1)*ntrans_kpoint + spin_offset + &
1229 (iocc - 1)*nvirt_spin(ispin) + ivirt - homo_spin(ispin)
1230 transition_energy(trans_index) = eigenvalues_kp(ivirt) - eigenvalues_kp(iocc)
1231 oscillator_strength(trans_index) = 2.0_dp/3.0_dp*transition_energy(trans_index)* &
1232 sum(transition_dipole_re(trans_index, :)**2 + &
1233 transition_dipole_im(trans_index, :)**2)
1234 END DO
1235 END DO
1236 IF (.NOT. use_scf_moment_dipoles) THEN
1237 CALL cp_fm_release(moment_im)
1238 CALL cp_fm_release(moment_re)
1239 CALL cp_fm_release(fm_tmp)
1240 CALL cp_fm_release(mo_coeff_im_global)
1241 CALL cp_fm_release(mo_coeff_re_global)
1242 END IF
1243 DEALLOCATE (eigenvalues_kp)
1244 spin_offset = spin_offset + homo_spin(ispin)*nvirt_spin(ispin)
1245 END DO
1246 END DO
1247
1248 IF (any(transition_energy <= 0.0_dp)) &
1249 cpabort("K-point TDDFPT KERNEL NONE requires positive occupied-virtual energy gaps")
1250
1251 CALL sort(transition_energy, ntrans_total, inds)
1252 nstates = min(tddfpt_control%nstates, ntrans_total)
1253 IF (tddfpt_control%nstates > ntrans_total) THEN
1254 cpwarn("Requested more TDDFPT states than independent-particle k-point transitions")
1255 END IF
1256
1257 ALLOCATE (evals(nstates))
1258 evals(1:nstates) = transition_energy(1:nstates)
1259 checksum = sqrt(sum(evals**2))
1260
1261 log_unit = cp_logger_get_default_io_unit(logger)
1262 IF (log_unit > 0) THEN
1263 WRITE (log_unit, "(1X,A)") "", &
1264 "-------------------------------------------------------------------------------", &
1265 "- TDDFPT K-point Independent-particle Transitions -", &
1266 "-------------------------------------------------------------------------------"
1267 WRITE (log_unit, "(1X,A)") &
1268 "Only KERNEL NONE is active for k-point TDDFPT; transition dipole magnitudes are shown."
1269 WRITE (log_unit, '(/,T10,A,T19,A,T37,A,T69,A)') "State", "Excitation", &
1270 "Transition dipole (a.u.)", "Oscillator"
1271 WRITE (log_unit, '(T10,A,T19,A,T37,A,T49,A,T61,A,T67,A)') "number", "energy (eV)", &
1272 "x", "y", "z", "strength (a.u.)"
1273 WRITE (log_unit, '(T10,72("-"))')
1274 END IF
1275
1276 fsum = 0.0_dp
1277 DO istate = 1, nstates
1278 itrans = inds(istate) - 1
1279 ikp = itrans/ntrans_kpoint + 1
1280 itrans = mod(itrans, ntrans_kpoint)
1281 spin_offset = 0
1282 DO ispin = 1, nspins
1283 ntrans_spin = homo_spin(ispin)*nvirt_spin(ispin)
1284 IF (itrans < spin_offset + ntrans_spin) THEN
1285 itrans = itrans - spin_offset
1286 iocc = itrans/nvirt_spin(ispin) + 1
1287 ivirt = mod(itrans, nvirt_spin(ispin)) + homo_spin(ispin) + 1
1288 EXIT
1289 END IF
1290 spin_offset = spin_offset + ntrans_spin
1291 END DO
1292
1293 IF (log_unit > 0) THEN
1294 transition_dipole_abs(1:nderivs) = &
1295 sqrt(transition_dipole_re(inds(istate), 1:nderivs)**2 + &
1296 transition_dipole_im(inds(istate), 1:nderivs)**2)
1297 WRITE (log_unit, '(1X,A,T9,I7,T19,F11.5,T31,3(1X,ES11.4E2),T69,ES12.5E2)') &
1298 "TDDFPT|", istate, evals(istate)*evolt, transition_dipole_abs, &
1299 oscillator_strength(inds(istate))
1300 fsum = fsum + oscillator_strength(inds(istate))**2
1301 WRITE (log_unit, '(1X,A,T18,I7,T28,I7,T38,I7,T50,I7,T62,I7,T74,F10.5)') &
1302 "TDDFPT_KPOINT|", istate, ikp, ispin, iocc, ivirt, wkp(ikp)
1303 END IF
1304 END DO
1305
1306 IF (log_unit > 0) THEN
1307 WRITE (log_unit, '(/,T2,A,E16.8)') 'TDDFPT : CheckSum E = ', checksum
1308 WRITE (log_unit, '(T2,A,E16.8)') 'TDDFPT : CheckSum F = ', sqrt(fsum)
1309 WRITE (log_unit, "(1X,A)") &
1310 "-------------------------------------------------------------------------------"
1311 END IF
1312
1313 IF (use_scf_moment_dipoles) THEN
1314 DEALLOCATE (kpoint_dipole)
1315 ELSE
1316 CALL dbcsr_deallocate_matrix(rmatrix)
1317 CALL dbcsr_deallocate_matrix(cmatrix)
1318 CALL dbcsr_deallocate_matrix_set(overlap_deriv)
1319 END IF
1320
1321 DEALLOCATE (evals, inds, oscillator_strength, transition_dipole_im, transition_dipole_re, &
1322 transition_energy)
1323
1324 CALL timestop(handle)
1325
1326 END SUBROUTINE tddfpt_kpoint_independent_particle
1327
1328! **************************************************************************************************
1329!> \brief The energy calculation has been moved to its own subroutine
1330!> \param qs_env ...
1331!> \param nstates ...
1332!> \param nspins ...
1333!> \param work_matrices ...
1334!> \param tddfpt_control ...
1335!> \param logger ...
1336!> \param tddfpt_print_section ...
1337!> \param evects ...
1338!> \param evals ...
1339!> \param gs_mos ...
1340!> \param tddfpt_section ...
1341!> \param S_evects ...
1342!> \param matrix_s ...
1343!> \param kernel_env ...
1344!> \param matrix_ks ...
1345!> \param sub_env ...
1346!> \param ostrength ...
1347!> \param dipole_op_mos_occ ...
1348!> \param mult ...
1349!> \param xc_section ...
1350!> \param full_kernel_env ...
1351!> \param kernel_env_admm_aux ...
1352! **************************************************************************************************
1353 SUBROUTINE tddfpt_energies(qs_env, nstates, nspins, work_matrices, &
1354 tddfpt_control, logger, tddfpt_print_section, evects, evals, &
1355 gs_mos, tddfpt_section, S_evects, matrix_s, kernel_env, matrix_ks, &
1356 sub_env, ostrength, dipole_op_mos_occ, mult, xc_section, full_kernel_env, &
1357 kernel_env_admm_aux)
1358
1359 TYPE(qs_environment_type), POINTER :: qs_env
1360 INTEGER :: nstates, nspins
1361 TYPE(tddfpt_work_matrices) :: work_matrices
1362 TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
1363 TYPE(cp_logger_type), POINTER :: logger
1364 TYPE(section_vals_type), POINTER :: tddfpt_print_section
1365 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: evects
1366 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: evals
1367 TYPE(tddfpt_ground_state_mos), DIMENSION(:), &
1368 POINTER :: gs_mos
1369 TYPE(section_vals_type), POINTER :: tddfpt_section
1370 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: s_evects
1371 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s
1372 TYPE(kernel_env_type) :: kernel_env
1373 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks
1374 TYPE(tddfpt_subgroup_env_type) :: sub_env
1375 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: ostrength
1376 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: dipole_op_mos_occ
1377 INTEGER :: mult
1378 TYPE(section_vals_type), POINTER :: xc_section
1379 TYPE(full_kernel_env_type), TARGET :: full_kernel_env, kernel_env_admm_aux
1380
1381 CHARACTER(LEN=*), PARAMETER :: routinen = 'tddfpt_energies'
1382
1383 CHARACTER(len=20) :: nstates_str
1384 INTEGER :: energy_unit, handle, iter, log_unit, &
1385 niters, nocc, nstate_max, &
1386 nstates_read, nvirt
1387 LOGICAL :: do_admm, do_exck, do_soc, explicit
1388 REAL(kind=dp) :: conv
1389 TYPE(admm_type), POINTER :: admm_env
1390 TYPE(cp_blacs_env_type), POINTER :: blacs_env
1391 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks_oep
1392 TYPE(section_vals_type), POINTER :: lri_section, namd_print_section, &
1393 soc_section
1394
1395 CALL timeset(routinen, handle)
1396
1397 NULLIFY (admm_env, matrix_ks_oep)
1398 do_admm = tddfpt_control%do_admm
1399 IF (do_admm) CALL get_qs_env(qs_env, admm_env=admm_env)
1400
1401 ! setup for full_kernel and admm_kernel within tddfpt_energies due to dependence on multiplicity
1402 IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN
1403
1405 rho_orb_struct=work_matrices%rho_orb_struct_sub, &
1406 rho_xc_struct=work_matrices%rho_xc_struct_sub, &
1407 is_rks_triplets=tddfpt_control%rks_triplets, &
1408 qs_env=qs_env, sub_env=sub_env, &
1409 wfm_rho_orb=work_matrices%rho_ao_orb_fm_sub)
1410
1411 IF (do_admm) THEN
1412 ! Full kernel with ADMM
1413 IF (tddfpt_control%admm_xc_correction) THEN
1414 CALL create_kernel_env(kernel_env=full_kernel_env, &
1415 rho_struct_sub=work_matrices%rho_orb_struct_sub, &
1416 xc_section=admm_env%xc_section_primary, &
1417 is_rks_triplets=tddfpt_control%rks_triplets, &
1418 sub_env=sub_env)
1419 ELSE
1420 CALL create_kernel_env(kernel_env=full_kernel_env, &
1421 rho_struct_sub=work_matrices%rho_orb_struct_sub, &
1422 xc_section=xc_section, &
1423 is_rks_triplets=tddfpt_control%rks_triplets, &
1424 sub_env=sub_env)
1425 END IF
1426
1428 rho_orb_struct=work_matrices%rho_orb_struct_sub, &
1429 rho_aux_fit_struct=work_matrices%rho_aux_fit_struct_sub, &
1430 local_rho_set=sub_env%local_rho_set_admm, &
1431 qs_env=qs_env, sub_env=sub_env, &
1432 wfm_rho_orb=work_matrices%rho_ao_orb_fm_sub, &
1433 wfm_rho_aux_fit=work_matrices%rho_ao_aux_fit_fm_sub, &
1434 wfm_aux_orb=work_matrices%wfm_aux_orb_sub)
1435
1436 CALL create_kernel_env(kernel_env=kernel_env_admm_aux, &
1437 rho_struct_sub=work_matrices%rho_aux_fit_struct_sub, &
1438 xc_section=admm_env%xc_section_aux, &
1439 is_rks_triplets=tddfpt_control%rks_triplets, &
1440 sub_env=sub_env)
1441 kernel_env%full_kernel => full_kernel_env
1442 kernel_env%admm_kernel => kernel_env_admm_aux
1443 ELSE
1444 ! Full kernel
1445 CALL create_kernel_env(kernel_env=full_kernel_env, &
1446 rho_struct_sub=work_matrices%rho_orb_struct_sub, &
1447 xc_section=xc_section, &
1448 is_rks_triplets=tddfpt_control%rks_triplets, &
1449 sub_env=sub_env)
1450 kernel_env%full_kernel => full_kernel_env
1451 NULLIFY (kernel_env%admm_kernel)
1452 END IF
1453 ! Fxc from kernel definition
1454 do_exck = tddfpt_control%do_exck
1455 kernel_env%full_kernel%do_exck = do_exck
1456 ! initilize xc kernel
1457 IF (do_exck) THEN
1458 CALL create_fxc_kernel(work_matrices%rho_orb_struct_sub, work_matrices%fxc_rspace_sub, &
1459 xc_section, tddfpt_control%rks_triplets, sub_env, qs_env)
1460 END IF
1461 END IF
1462
1463 ! lri input
1464 IF (tddfpt_control%do_lrigpw) THEN
1465 lri_section => section_vals_get_subs_vals(tddfpt_section, "LRIGPW")
1466 CALL tddfpt2_lri_init(qs_env, kernel_env, lri_section, &
1467 tddfpt_print_section)
1468 END IF
1469
1470 !! Too many states can lead to Problems
1471 !! You should be warned if there are more states
1472 !! than occ-virt Combinations!!
1473 CALL cp_fm_get_info(gs_mos(1)%mos_occ, ncol_global=nocc)
1474 IF (tddfpt_control%spinflip == no_sf_tddfpt) THEN
1475 CALL cp_fm_get_info(gs_mos(1)%mos_virt, ncol_global=nvirt)
1476 ELSE
1477 CALL cp_fm_get_info(gs_mos(2)%mos_virt, ncol_global=nvirt)
1478 END IF
1479 nstate_max = nocc*nvirt
1480 IF ((SIZE(gs_mos, 1) == 2) .AND. (tddfpt_control%spinflip == no_sf_tddfpt)) THEN
1481 CALL cp_fm_get_info(gs_mos(2)%mos_occ, ncol_global=nocc)
1482 CALL cp_fm_get_info(gs_mos(2)%mos_virt, ncol_global=nvirt)
1483 nstate_max = nocc*nvirt + nstate_max
1484 END IF
1485 IF (nstates > nstate_max) THEN
1486 cpwarn("NUMBER OF EXCITED STATES COULD LEAD TO PROBLEMS!")
1487 cpwarn("Experimental: CHANGED NSTATES TO ITS MAXIMUM VALUE!")
1488 nstates = nstate_max
1489 END IF
1490
1491 soc_section => section_vals_get_subs_vals(tddfpt_section, "SOC")
1492 CALL section_vals_get(soc_section, explicit=do_soc)
1493
1494 ! reuse Ritz vectors from the previous calculation if available
1495 IF (tddfpt_control%is_restart .AND. .NOT. do_soc) THEN
1496 CALL get_qs_env(qs_env, blacs_env=blacs_env)
1497
1498 nstates_read = tddfpt_read_restart( &
1499 evects=evects, &
1500 evals=evals, &
1501 gs_mos=gs_mos, &
1502 logger=logger, &
1503 tddfpt_section=tddfpt_section, &
1504 tddfpt_print_section=tddfpt_print_section, &
1505 fm_pool_ao_mo_active=work_matrices%fm_pool_ao_mo_active, &
1506 blacs_env_global=blacs_env)
1507 ELSE
1508 nstates_read = 0
1509 END IF
1510
1511 ! build the list of missed singly excited states and sort them in ascending order
1512 ! according to their excitation energies
1513 log_unit = cp_print_key_unit_nr(logger, tddfpt_print_section, &
1514 "GUESS_VECTORS", extension=".tddfptLog")
1515 CALL tddfpt_guess_vectors(evects=evects, evals=evals, &
1516 gs_mos=gs_mos, log_unit=log_unit, tddfpt_control=tddfpt_control, &
1517 fm_pool_ao_mo_active=work_matrices%fm_pool_ao_mo_active, &
1518 qs_env=qs_env, nspins=nspins)
1519 CALL cp_print_key_finished_output(log_unit, logger, &
1520 tddfpt_print_section, "GUESS_VECTORS")
1521
1522 CALL tddfpt_orthogonalize_psi1_psi0(evects, work_matrices%S_C0_C0T, qs_env, &
1523 gs_mos, evals, tddfpt_control, work_matrices%S_C0)
1524 CALL tddfpt_orthonormalize_psi1_psi1(evects, nstates, s_evects, matrix_s(1)%matrix)
1525
1526 niters = tddfpt_control%niters
1527 IF (niters > 0) THEN
1528 log_unit = cp_print_key_unit_nr(logger, tddfpt_print_section, &
1529 "ITERATION_INFO", extension=".tddfptLog")
1530 energy_unit = cp_print_key_unit_nr(logger, &
1531 tddfpt_print_section, &
1532 "DETAILED_ENERGY", &
1533 extension=".tddfptLog")
1534
1535 IF (log_unit > 0) THEN
1536 WRITE (log_unit, "(1X,A)") "", &
1537 "-------------------------------------------------------------------------------", &
1538 "- TDDFPT WAVEFUNCTION OPTIMIZATION -", &
1539 "-------------------------------------------------------------------------------"
1540
1541 WRITE (log_unit, '(/,T11,A,T27,A,T40,A,T62,A)') "Step", "Time", "Convergence", "Conv. states"
1542 WRITE (log_unit, '(1X,79("-"))')
1543 END IF
1544
1545 CALL cp_add_iter_level(logger%iter_info, "TDDFT_SCF")
1546
1547 DO
1548 ! *** perform Davidson iterations ***
1549 conv = tddfpt_davidson_solver( &
1550 evects=evects, &
1551 evals=evals, &
1552 s_evects=s_evects, &
1553 gs_mos=gs_mos, &
1554 tddfpt_control=tddfpt_control, &
1555 matrix_ks=matrix_ks, &
1556 qs_env=qs_env, &
1557 kernel_env=kernel_env, &
1558 sub_env=sub_env, &
1559 logger=logger, &
1560 iter_unit=log_unit, &
1561 energy_unit=energy_unit, &
1562 tddfpt_print_section=tddfpt_print_section, &
1563 work_matrices=work_matrices)
1564
1565 ! at this point at least one of the following conditions are met:
1566 ! a) convergence criteria has been achieved;
1567 ! b) maximum number of iterations has been reached;
1568 ! c) Davidson iterations must be restarted due to lack of Krylov vectors
1569
1570 CALL cp_iterate(logger%iter_info, increment=0, iter_nr_out=iter)
1571 ! terminate the loop if either (a) or (b) is true ...
1572 IF ((conv <= tddfpt_control%conv) .OR. iter >= niters) EXIT
1573
1574 ! ... otherwise restart Davidson iterations
1575 evals = 0.0_dp
1576 IF (log_unit > 0) THEN
1577 WRITE (log_unit, '(1X,25("-"),1X,A,1X,25("-"))') "Restart Davidson iterations"
1578 CALL m_flush(log_unit)
1579 END IF
1580 END DO
1581
1582 ! write TDDFPT restart file at the last iteration if requested to do so
1583 CALL cp_iterate(logger%iter_info, increment=0, last=.true.)
1584 CALL tddfpt_write_restart(evects=evects, &
1585 evals=evals, &
1586 gs_mos=gs_mos, &
1587 logger=logger, &
1588 tddfpt_print_section=tddfpt_print_section)
1589
1590 CALL cp_rm_iter_level(logger%iter_info, "TDDFT_SCF")
1591
1592 ! print convergence summary
1593 IF (log_unit > 0) THEN
1594 CALL integer_to_string(iter, nstates_str)
1595 IF (conv <= tddfpt_control%conv) THEN
1596 WRITE (log_unit, "(1X,A)") "", &
1597 "-------------------------------------------------------------------------------", &
1598 "- TDDFPT run converged in "//trim(nstates_str)//" iteration(s) ", &
1599 "-------------------------------------------------------------------------------"
1600 ELSE
1601 WRITE (log_unit, "(1X,A)") "", &
1602 "-------------------------------------------------------------------------------", &
1603 "- TDDFPT run did NOT converge after "//trim(nstates_str)//" iteration(s) ", &
1604 "-------------------------------------------------------------------------------"
1605 END IF
1606 END IF
1607
1608 CALL cp_print_key_finished_output(energy_unit, logger, &
1609 tddfpt_print_section, "DETAILED_ENERGY")
1610 CALL cp_print_key_finished_output(log_unit, logger, &
1611 tddfpt_print_section, "ITERATION_INFO")
1612 ELSE
1613 CALL cp_warn(__location__, &
1614 "Skipping TDDFPT wavefunction optimization")
1615 END IF
1616
1617 IF (ASSOCIATED(matrix_ks_oep)) THEN
1618 IF (tddfpt_control%dipole_form == tddfpt_dipole_velocity) THEN
1619 CALL cp_warn(__location__, &
1620 "Transition dipole moments and oscillator strengths are likely to be incorrect "// &
1621 "when computed using an orbital energy correction XC-potential together with "// &
1622 "the velocity form of dipole transition integrals")
1623 END IF
1624 END IF
1625
1626 ! *** print summary information ***
1627 log_unit = cp_logger_get_default_io_unit(logger)
1628
1629 namd_print_section => section_vals_get_subs_vals( &
1630 tddfpt_print_section, &
1631 "NAMD_PRINT")
1632 CALL section_vals_get(namd_print_section, explicit=explicit)
1633 IF (explicit) THEN
1634 CALL tddfpt_write_newtonx_output(evects, &
1635 evals, &
1636 gs_mos, &
1637 logger, &
1638 tddfpt_print_section, &
1639 matrix_s(1)%matrix, &
1640 s_evects, &
1641 sub_env)
1642 END IF
1643 ALLOCATE (ostrength(nstates))
1644 ostrength = 0.0_dp
1645 CALL tddfpt_print_summary(log_unit, &
1646 evects, &
1647 evals, &
1648 gs_mos, &
1649 ostrength, &
1650 mult, &
1651 dipole_op_mos_occ, &
1652 tddfpt_control%dipole_form)
1654 log_unit, &
1655 evects, &
1656 evals, &
1657 gs_mos, &
1658 matrix_s(1)%matrix, &
1659 tddfpt_control%spinflip, &
1660 min_amplitude=tddfpt_control%min_excitation_amplitude)
1661 CALL tddfpt_print_nto_analysis(qs_env, &
1662 evects, evals, &
1663 ostrength, &
1664 gs_mos, &
1665 matrix_s(1)%matrix, &
1666 tddfpt_print_section)
1667 IF (tddfpt_control%do_exciton_descriptors) THEN
1669 log_unit, &
1670 evects, &
1671 gs_mos, &
1672 matrix_s(1)%matrix, &
1673 tddfpt_control%do_directional_exciton_descriptors, &
1674 qs_env)
1675 END IF
1676
1677 IF (tddfpt_control%do_lrigpw) THEN
1678 CALL lri_print_stat(qs_env, &
1679 ltddfpt=.true., &
1680 tddfpt_lri_env=kernel_env%full_kernel%lri_env)
1681 END IF
1682
1683 CALL timestop(handle)
1684 END SUBROUTINE tddfpt_energies
1685
1686! **************************************************************************************************
1687!> \brief Perform singlet and triplet computations for subsequent TDDFPT-SOC calculation.
1688!> \param qs_env Quickstep environment
1689!> \param nstates number of requested exited states
1690!> \param work_matrices ...
1691!> \param tddfpt_control ...
1692!> \param logger ...
1693!> \param tddfpt_print_section ...
1694!> \param evects Eigenvector of the requested multiplicity
1695!> \param evals Eigenvalue of the requested multiplicity
1696!> \param ostrength Oscillatorstrength
1697!> \param gs_mos ...
1698!> \param tddfpt_section ...
1699!> \param S_evects ...
1700!> \param matrix_s ...
1701!> \param kernel_env ...
1702!> \param matrix_ks ...
1703!> \param sub_env ...
1704!> \param dipole_op_mos_occ ...
1705!> \param lmult_tmp ...
1706!> \param xc_section ...
1707!> \param full_kernel_env ...
1708!> \param kernel_env_admm_aux ...
1709!> \par History
1710!> * 02.2023 created [Jan-Robert Vogt]
1711!> \note Based on tddfpt2_methods and xas_tdp_utils.
1712!> \note only the values of one multiplicity will be passed back for force calculations!
1713! **************************************************************************************************
1714
1715 SUBROUTINE tddfpt_soc_energies(qs_env, nstates, work_matrices, &
1716 tddfpt_control, logger, tddfpt_print_section, &
1717 evects, evals, ostrength, &
1718 gs_mos, tddfpt_section, S_evects, matrix_s, kernel_env, matrix_ks, &
1719 sub_env, dipole_op_mos_occ, lmult_tmp, xc_section, full_kernel_env, &
1720 kernel_env_admm_aux)
1721
1722 TYPE(qs_environment_type), INTENT(IN), POINTER :: qs_env
1723 INTEGER, INTENT(in) :: nstates
1724 TYPE(tddfpt_work_matrices) :: work_matrices
1725 TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
1726 TYPE(cp_logger_type), POINTER :: logger
1727 TYPE(section_vals_type), POINTER :: tddfpt_print_section
1728 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: evects
1729 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: evals, ostrength
1730 TYPE(tddfpt_ground_state_mos), DIMENSION(:), &
1731 POINTER :: gs_mos
1732 TYPE(section_vals_type), POINTER :: tddfpt_section
1733 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: s_evects
1734 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s
1735 TYPE(kernel_env_type) :: kernel_env
1736 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks
1737 TYPE(tddfpt_subgroup_env_type) :: sub_env
1738 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: dipole_op_mos_occ
1739 LOGICAL, INTENT(in) :: lmult_tmp
1740 TYPE(section_vals_type), POINTER :: xc_section
1741 TYPE(full_kernel_env_type), TARGET :: full_kernel_env, kernel_env_admm_aux
1742
1743 CHARACTER(LEN=*), PARAMETER :: routinen = 'tddfpt_soc_energies'
1744
1745 INTEGER :: handle, ispin, istate, log_unit, mult, &
1746 nspins
1747 LOGICAL :: do_sf
1748 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: evals_mult, ostrength_mult
1749 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: evects_mult
1750
1751 CALL timeset(routinen, handle)
1752
1753 log_unit = cp_print_key_unit_nr(logger, tddfpt_print_section, &
1754 "PROGRAM_BANNER", &
1755 extension=".tddfptLog")
1756 CALL tddfpt_soc_header(log_unit)
1757
1758 nspins = SIZE(gs_mos)
1759 ALLOCATE (evects_mult(nspins, nstates))
1760 ALLOCATE (evals_mult(nstates))
1761 do_sf = tddfpt_control%spinflip /= no_sf_tddfpt
1762
1763 ! First multiplicity
1764 IF (lmult_tmp) THEN
1765 IF (log_unit > 0) THEN
1766 WRITE (log_unit, "(1X,A)") "", &
1767 "-------------------------------------------------------------------------------", &
1768 "- TDDFPT SINGLET ENERGIES -", &
1769 "-------------------------------------------------------------------------------"
1770 END IF
1771 mult = 1
1772 ELSE
1773 IF (log_unit > 0) THEN
1774 WRITE (log_unit, "(1X,A)") "", &
1775 "-------------------------------------------------------------------------------", &
1776 "- TDDFPT TRIPLET ENERGIES -", &
1777 "-------------------------------------------------------------------------------"
1778 END IF
1779 mult = 3
1780 END IF
1781
1782 CALL tddfpt_energies(qs_env, nstates, nspins, work_matrices, tddfpt_control, logger, &
1783 tddfpt_print_section, evects_mult, evals_mult, &
1784 gs_mos, tddfpt_section, s_evects, matrix_s, &
1785 kernel_env, matrix_ks, sub_env, ostrength_mult, &
1786 dipole_op_mos_occ, mult, xc_section, full_kernel_env, &
1787 kernel_env_admm_aux)
1788
1789 ! Clean up in between for full kernel
1790 IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN
1791 IF (tddfpt_control%do_admm) CALL release_kernel_env(kernel_env%admm_kernel)
1792 CALL release_kernel_env(kernel_env%full_kernel)
1793 CALL tddfpt_release_work_matrices(work_matrices, sub_env)
1794 CALL tddfpt_create_work_matrices(work_matrices, gs_mos, nstates, &
1795 tddfpt_control%do_hfx, &
1796 tddfpt_control%do_admm, tddfpt_control%do_hfxlr, &
1797 tddfpt_control%do_exck, do_sf, qs_env, sub_env)
1798 END IF
1799
1800 DO istate = 1, nstates
1801 DO ispin = 1, nspins
1802 CALL cp_fm_release(s_evects(ispin, istate))
1803 END DO
1804 END DO
1805
1806 DO istate = 1, nstates
1807 DO ispin = 1, nspins
1808 CALL fm_pool_create_fm( &
1809 work_matrices%fm_pool_ao_mo_active(ispin)%pool, &
1810 s_evects(ispin, istate))
1811 END DO
1812 END DO
1813
1814 tddfpt_control%rks_triplets = lmult_tmp
1815
1816 ! Second multiplicity
1817 IF (lmult_tmp) THEN
1818 IF (log_unit > 0) THEN
1819 WRITE (log_unit, "(1X,A)") "", &
1820 " singlet excitations finished ", &
1821 " ", &
1822 "-------------------------------------------------------------------------------", &
1823 "- TDDFPT TRIPLET ENERGIES -", &
1824 "-------------------------------------------------------------------------------"
1825 END IF !log_unit
1826 mult = 3
1827 ELSE
1828 IF (log_unit > 0) THEN
1829 WRITE (log_unit, "(1X,A)") "", &
1830 " triplet excitations finished ", &
1831 " ", &
1832 "-------------------------------------------------------------------------------", &
1833 "- TDDFPT SINGLET ENERGIES -", &
1834 "-------------------------------------------------------------------------------"
1835 END IF !log_unit
1836 mult = 1
1837 END IF
1838
1839 CALL tddfpt_energies(qs_env, nstates, nspins, work_matrices, tddfpt_control, logger, &
1840 tddfpt_print_section, evects, evals, &
1841 gs_mos, tddfpt_section, s_evects, matrix_s, &
1842 kernel_env, matrix_ks, sub_env, ostrength, &
1843 dipole_op_mos_occ, mult, xc_section, full_kernel_env, &
1844 kernel_env_admm_aux)
1845
1846 ! Compute perturbative SOC correction
1847 ! Order should always be singlet triplet in tddfpt_soc
1848 IF (lmult_tmp) THEN
1849 CALL tddfpt_soc(qs_env, evals_mult, evals, evects_mult, evects, gs_mos) !mult=singlet
1850 ELSE
1851 CALL tddfpt_soc(qs_env, evals, evals_mult, evects, evects_mult, gs_mos) !mult=triplet
1852 END IF
1853
1854 ! deallocate the additional multiplicity
1855 DO ispin = 1, SIZE(evects_mult, 1)
1856 DO istate = 1, SIZE(evects_mult, 2)
1857 CALL cp_fm_release(evects_mult(ispin, istate))
1858 END DO
1859 END DO
1860 DEALLOCATE (evects_mult, evals_mult, ostrength_mult)
1861
1862 CALL timestop(handle)
1863
1864 END SUBROUTINE tddfpt_soc_energies
1865
1866! **************************************************************************************************
1867!> \brief ...
1868!> \param qs_env ...
1869!> \param gs_mos ...
1870!> \param tddfpt_control ...
1871!> \param tddfpt_section ...
1872!> \param iounit ...
1873! **************************************************************************************************
1874 SUBROUTINE init_res_method(qs_env, gs_mos, tddfpt_control, tddfpt_section, iounit)
1875
1876 TYPE(qs_environment_type), POINTER :: qs_env
1877 TYPE(tddfpt_ground_state_mos), DIMENSION(:), &
1878 POINTER :: gs_mos
1879 TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
1880 TYPE(section_vals_type), POINTER :: tddfpt_section
1881 INTEGER, INTENT(IN) :: iounit
1882
1883 CHARACTER(LEN=*), PARAMETER :: routinen = 'init_res_method'
1884
1885 INTEGER :: handle, i, io, ispin, nao, nmo, nmol, &
1886 nspins
1887 INTEGER, ALLOCATABLE, DIMENSION(:, :) :: orblist
1888 INTEGER, DIMENSION(:), POINTER :: mollist
1889 LOGICAL :: do_res, do_sf, ew1, ew2, ew3, ewcut, lms
1890 REAL(kind=dp) :: eclow, ecup, eint, emo
1891 REAL(kind=dp), DIMENSION(:), POINTER :: rvint
1892 TYPE(cp_blacs_env_type), POINTER :: blacs_env
1893 TYPE(cp_fm_struct_type), POINTER :: fm_struct
1894 TYPE(section_vals_type), POINTER :: res_section
1895
1896 CALL timeset(routinen, handle)
1897
1898 res_section => section_vals_get_subs_vals(tddfpt_section, "REDUCED_EXCITATION_SPACE")
1899 CALL section_vals_val_get(res_section, "_SECTION_PARAMETERS_", l_val=do_res)
1900
1901 ! spin flip TDA
1902 IF (tddfpt_control%spinflip == no_sf_tddfpt) THEN
1903 do_sf = .false.
1904 ELSE
1905 do_sf = .true.
1906 END IF
1907
1908 nspins = SIZE(gs_mos)
1909 IF (.NOT. do_res) THEN
1910 DO ispin = 1, nspins
1911 nmo = gs_mos(ispin)%nmo_occ
1912 tddfpt_control%nactive(ispin) = nmo
1913 gs_mos(ispin)%nmo_active = nmo
1914 ALLOCATE (gs_mos(ispin)%index_active(nmo))
1915 DO i = 1, nmo
1916 gs_mos(ispin)%index_active(i) = i
1917 END DO
1918 END DO
1919 ELSE
1920 IF (iounit > 0) THEN
1921 WRITE (iounit, "(/,1X,27('='),A,26('='))") ' REDUCED EXCITATION SPACE '
1922 END IF
1923 CALL section_vals_val_get(res_section, "ENERGY_WINDOW", explicit=ew1)
1924 CALL section_vals_val_get(res_section, "UPPER_ENERGY_CUTOFF", explicit=ew2)
1925 CALL section_vals_val_get(res_section, "LOWER_ENERGY_CUTOFF", explicit=ew3)
1926 ewcut = (ew1 .OR. ew2 .OR. ew3)
1927 CALL section_vals_val_get(res_section, "MOLECULE_LIST", explicit=lms)
1928
1929 CALL section_vals_val_get(res_section, "ENERGY_WINDOW", r_vals=rvint)
1930 cpassert(SIZE(rvint) == 2)
1931 eclow = rvint(1)
1932 ecup = rvint(2)
1933 CALL section_vals_val_get(res_section, "UPPER_ENERGY_CUTOFF", r_val=eint)
1934 ecup = min(ecup, eint)
1935 CALL section_vals_val_get(res_section, "LOWER_ENERGY_CUTOFF", r_val=eint)
1936 eclow = max(eclow, eint)
1937 IF (ewcut .AND. (iounit > 0)) THEN
1938 IF (eclow < -1.e8_dp .AND. ecup > 1.e8_dp) THEN
1939 WRITE (iounit, "(1X,A,T51,A10,T71,A10)") &
1940 'Orbital Energy Window [eV]', " -Inf", " Inf"
1941 ELSE IF (eclow < -1.e8_dp) THEN
1942 WRITE (iounit, "(1X,A,T51,A10,T71,F10.4)") &
1943 'Orbital Energy Window [eV]', " -Inf", evolt*ecup
1944 ELSE IF (ecup > 1.e8_dp) THEN
1945 WRITE (iounit, "(1X,A,T51,F10.4,T71,A10)") &
1946 'Orbital Energy Window [eV]', evolt*eclow, " Inf"
1947 ELSE
1948 WRITE (iounit, "(1X,A,T51,F10.4,T71,F10.4)") &
1949 'Orbital Energy Window [eV]', evolt*eclow, evolt*ecup
1950 END IF
1951 END IF
1952
1953 nmol = 0
1954 IF (lms) THEN
1955 CALL section_vals_val_get(res_section, "MOLECULE_LIST", i_vals=mollist)
1956 nmol = SIZE(mollist)
1957 WRITE (iounit, "(1X,A)") 'List of Selected Molecules'
1958 WRITE (iounit, "(1X,15(I5))") mollist(1:nmol)
1959 END IF
1960
1961 DO ispin = 1, nspins
1962 tddfpt_control%nactive(ispin) = gs_mos(ispin)%nmo_occ
1963 END DO
1964 nmo = maxval(tddfpt_control%nactive)
1965 ALLOCATE (orblist(nmo, nspins))
1966 orblist = 0
1967
1968 IF (lms) THEN
1969 ! ignore for now
1970 orblist = 1
1971 DO ispin = 1, nspins
1972 cpassert(.NOT. ASSOCIATED(gs_mos(ispin)%evals_occ_matrix))
1973 END DO
1974 ELSEIF (ewcut) THEN
1975 ! Filter orbitals wrt energy window
1976 DO ispin = 1, nspins
1977 DO i = 1, gs_mos(ispin)%nmo_occ
1978 emo = gs_mos(ispin)%evals_occ(i)
1979 IF (emo > eclow .AND. emo < ecup) orblist(i, ispin) = 1
1980 END DO
1981 END DO
1982 ELSE
1983 orblist = 1
1984 END IF
1985
1986 ! count active orbitals
1987 nmo = sum(orblist)
1988 IF (nmo == 0) THEN
1989 cpabort("RSE TDA: no active orbitals selected.")
1990 END IF
1991 DO ispin = 1, nspins
1992 nmo = sum(orblist(:, ispin))
1993 tddfpt_control%nactive(ispin) = nmo
1994 gs_mos(ispin)%nmo_active = nmo
1995 ALLOCATE (gs_mos(ispin)%index_active(nmo))
1996 io = 0
1997 DO i = 1, SIZE(orblist, 1)
1998 IF (orblist(i, ispin) == 1) THEN
1999 io = io + 1
2000 gs_mos(ispin)%index_active(io) = i
2001 END IF
2002 END DO
2003 END DO
2004 DEALLOCATE (orblist)
2005
2006 IF (lms) THEN
2007 ! output information
2008 ELSE
2009 IF (iounit > 0) THEN
2010 WRITE (iounit, "(1X,A)") 'List of Selected States'
2011 IF (nspins == 1) THEN
2012 WRITE (iounit, "(A,T67,A)") ' Active State Orbital', 'Orbital Energy'
2013 DO i = 1, gs_mos(1)%nmo_active
2014 io = gs_mos(1)%index_active(i)
2015 WRITE (iounit, "(T8,I6,T21,I6,T61,F20.4)") i, io, gs_mos(1)%evals_occ(io)*evolt
2016 END DO
2017 ELSE
2018 DO ispin = 1, nspins
2019 WRITE (iounit, "(1X,A,I2)") 'Spin ', ispin
2020 WRITE (iounit, "(A,T67,A)") ' Active State Orbital', 'Orbital Energy'
2021 DO i = 1, gs_mos(ispin)%nmo_active
2022 io = gs_mos(ispin)%index_active(i)
2023 WRITE (iounit, "(T8,I6,T21,I6,T61,F20.4)") i, io, gs_mos(ispin)%evals_occ(io)*evolt
2024 END DO
2025 END DO
2026 END IF
2027 END IF
2028 END IF
2029
2030 IF (do_sf) THEN
2031 cpabort("Restricted Active Space with spin flip TDA NYA")
2032 END IF
2033
2034 IF (iounit > 0) THEN
2035 WRITE (iounit, "(1X,79('='))")
2036 END IF
2037 END IF
2038
2039 ! Allocate mos_active
2040 DO ispin = 1, nspins
2041 CALL get_qs_env(qs_env, blacs_env=blacs_env)
2042 CALL cp_fm_get_info(gs_mos(ispin)%mos_occ, nrow_global=nao)
2043 nmo = gs_mos(ispin)%nmo_active
2044 CALL cp_fm_struct_create(fm_struct, template_fmstruct=gs_mos(ispin)%mos_occ%matrix_struct, &
2045 ncol_global=nmo, context=blacs_env)
2046 NULLIFY (gs_mos(ispin)%mos_active)
2047 ALLOCATE (gs_mos(ispin)%mos_active)
2048 CALL cp_fm_create(gs_mos(ispin)%mos_active, fm_struct)
2049 CALL cp_fm_struct_release(fm_struct)
2050 ! copy the active orbitals
2051 IF (gs_mos(ispin)%nmo_active == gs_mos(ispin)%nmo_occ) THEN
2052 DO i = 1, gs_mos(ispin)%nmo_active
2053 cpassert(i == gs_mos(ispin)%index_active(i))
2054 END DO
2055 CALL cp_fm_to_fm_submat(gs_mos(ispin)%mos_occ, gs_mos(ispin)%mos_active, &
2056 nao, nmo, 1, 1, 1, 1)
2057 ELSE
2058 DO i = 1, gs_mos(ispin)%nmo_active
2059 io = gs_mos(ispin)%index_active(i)
2060 CALL cp_fm_to_fm_submat(gs_mos(ispin)%mos_occ, gs_mos(ispin)%mos_active, &
2061 nao, 1, 1, io, 1, i)
2062 END DO
2063 END IF
2064 END DO
2065
2066 CALL timestop(handle)
2067
2068 END SUBROUTINE init_res_method
2069
2070END 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...
subroutine, public dbcsr_deallocate_matrix(matrix)
...
subroutine, public dbcsr_set(matrix, alpha)
...
DBCSR operations in CP2K.
subroutine, public cp_dbcsr_sm_fm_multiply(matrix, fm_in, fm_out, ncol, alpha, beta)
multiply a dbcsr with a fm matrix
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
subroutine, public cp_fm_struct_create(fmstruct, para_env, context, nrow_global, ncol_global, nrow_block, ncol_block, descriptor, first_p_pos, local_leading_dimension, template_fmstruct, square_blocks, force_block)
allocates and initializes a full matrix structure
subroutine, public cp_fm_struct_release(fmstruct)
releases a full matrix structure
represent a full matrix distributed on many processors
Definition cp_fm_types.F:15
subroutine, public cp_fm_copy_general(source, destination, para_env)
General copy of a fm matrix to another fm matrix. Uses non-blocking MPI rather than ScaLAPACK.
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, nrow, ncol, set_zero)
creates a new full matrix with the given structure
subroutine, public cp_fm_get_element(matrix, irow_global, icol_global, alpha, local)
returns an element of a fm this value is valid on every cpu using this call is expensive
subroutine, public cp_fm_to_fm_submat(msource, mtarget, nrow, ncol, s_firstrow, s_firstcol, t_firstrow, t_firstcol)
copy just a part ot the matrix
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:604
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:3025
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 tddfpt_dipole_scf_moment
integer, parameter, public oe_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
Routines needed for kpoint calculation.
subroutine, public rskp_transform(rmatrix, cmatrix, rsmat, ispin, xkp, cell_to_index, sab_nl, is_complex, rs_sign)
Transformation of real space matrices to a kpoint.
Types and basic routines needed for a kpoint calculation.
subroutine, public get_kpoint_info(kpoint, kp_scheme, nkp_grid, kp_shift, symmetry, verbose, full_grid, use_real_wfn, eps_geo, parallel_group_size, kp_range, nkp, xkp, wkp, para_env, blacs_env_all, para_env_kp, para_env_inter_kp, blacs_env, kp_env, kp_aux_env, mpools, iogrp, nkp_groups, kp_dist, cell_to_index, index_to_cell, sab_nl, sab_nl_nosym, inversion_symmetry_only, symmetry_backend, symmetry_reduction_method, gamma_centered)
Retrieve information from a kpoint environment.
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)
...
basic linear algebra operations for full matrixes
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, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
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
subroutine, public get_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, mo_coeff, mo_coeff_b, uniform_occupation, kts, mu, flexible_electron_count)
Get the components of a MO set data structure.
Calculates the moment integrals <a|r^m|b> and <a|r x d/dr|b>
Definition qs_moments.F:14
subroutine, public qs_moment_kpoints_scf_mos(qs_env, dipole, rcc, nmo_spin_out)
Calculates interband k-point dipoles in the existing SCF MO basis.
Define the neighbor list data types and the corresponding functionality.
Calculation of overlap matrix, its derivatives and forces.
Definition qs_overlap.F:19
subroutine, public build_overlap_matrix(ks_env, matrix_s, matrixkp_s, matrix_name, nderivative, basis_type_a, basis_type_b, sab_nl, calculate_forces, matrix_p, matrixkp_p, ext_kpoints)
Calculation of the overlap matrix over Cartesian Gaussian functions.
Definition qs_overlap.F:121
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, tddfpt_section, tddfpt_control, 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_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)
subroutine, public tddfpt_print_summary(log_unit, evects, evals, gs_mos, ostrength, mult, dipole_op_mos_occ, dipole_form)
Print final TDDFPT excitation energies and oscillator strengths.
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.
integer function, public tddfpt_read_restart(evects, evals, gs_mos, logger, tddfpt_section, tddfpt_print_section, fm_pool_ao_mo_active, blacs_env_global)
Initialise initial guess vectors by reading (un-normalised) Ritz vectors from 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, mos_active, 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_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_guess_vectors(evects, evals, gs_mos, log_unit, tddfpt_control, fm_pool_ao_mo_active, qs_env, nspins)
Generate missed guess vectors.
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,...
All kind of helpful little routines.
Definition util.F:14
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:60
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.
Keeps information about a specific k-point.
Contains information about kpoints.
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.
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...
Ground state molecular orbitals.
Set of temporary ("work") matrices.
Valence state coming from the qs_tddfpt2 routine.
Definition rixs_types.F:40