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