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