(git:27c966b)
Loading...
Searching...
No Matches
hfx_exx.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Routines to calculate EXX in RPA and energy correction methods
10!> \par History
11!> 07.2020 separated from mp2.F [F. Stein, code by Jan Wilhelm]
12!> 06.2022 EXX contribution to the forces [A. Bussy]
13!> 03.2023 Generalized for energy correction methods
14!> \author Jan Wilhelm, Frederick Stein, Augustin Bussy, Fabian Belleflamme
15! **************************************************************************************************
16MODULE hfx_exx
18 USE admm_types, ONLY: admm_env_create,&
20 admm_type,&
23 USE cp_dbcsr_api, ONLY: dbcsr_add,&
29 dbcsr_set,&
42 USE hfx_ri, ONLY: hfx_ri_update_forces,&
44 USE hfx_types, ONLY: hfx_type
54 USE kinds, ONLY: dp
55 USE machine, ONLY: m_walltime
58 USE pw_env_types, ONLY: pw_env_get,&
60 USE pw_methods, ONLY: pw_scale
62 USE pw_types, ONLY: pw_r3d_rs_type
66 USE qs_integrate_potential, ONLY: integrate_v_rspace
68 USE qs_rho_types, ONLY: qs_rho_get,&
70 USE qs_vxc, ONLY: qs_vxc_create
72 USE virial_types, ONLY: virial_type
73
74!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads
75
76#include "./base/base_uses.f90"
77
78 IMPLICIT NONE
79
80 PRIVATE
81
82 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'hfx_exx'
83
85
86CONTAINS
87
88! **************************************************************************************************
89!> \brief ...
90!> \param qs_env ...
91!> \param unit_nr ...
92!> \param hfx_sections ...
93!> \param x_data ...
94!> \param do_gw ...
95!> \param do_admm ...
96!> \param calc_forces ...
97!> \param reuse_hfx ...
98!> \param do_im_time ...
99!> \param E_ex_from_GW ...
100!> \param E_admm_from_GW ...
101!> \param t3 ...
102! **************************************************************************************************
103 SUBROUTINE calculate_exx(qs_env, unit_nr, hfx_sections, x_data, &
104 do_gw, do_admm, calc_forces, reuse_hfx, do_im_time, &
105 E_ex_from_GW, E_admm_from_GW, t3)
106 TYPE(qs_environment_type), POINTER :: qs_env
107 INTEGER, INTENT(IN) :: unit_nr
108 TYPE(section_vals_type), POINTER :: hfx_sections
109 TYPE(hfx_type), DIMENSION(:, :), POINTER :: x_data
110 LOGICAL, INTENT(IN) :: do_gw, do_admm, calc_forces, reuse_hfx, &
111 do_im_time
112 REAL(kind=dp), INTENT(IN) :: e_ex_from_gw, e_admm_from_gw(2), t3
113
114 CHARACTER(len=*), PARAMETER :: routinen = 'calculate_exx'
115
116 INTEGER :: handle, i, irep, ispin, mspin, n_rep_hf, &
117 nspins
118 LOGICAL :: calc_ints, hfx_treat_lsd_in_core, &
119 use_virial
120 REAL(kind=dp) :: eh1, ehfx, t1, t2, tf1, tf2
121 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks, matrix_ks_aux_fit, rho_ao, &
122 rho_ao_aux_fit, rho_ao_resp
123 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: matrix_ks_2d, rho_ao_2d
124 TYPE(dft_control_type), POINTER :: dft_control
125 TYPE(mp_para_env_type), POINTER :: para_env
126 TYPE(qs_energy_type), POINTER :: energy
127 TYPE(qs_rho_type), POINTER :: rho, rho_aux_fit
128 TYPE(section_vals_type), POINTER :: input
129 TYPE(virial_type), POINTER :: virial
130
131 CALL timeset(routinen, handle)
132
133 t1 = m_walltime()
134
135 NULLIFY (input, para_env, matrix_ks, matrix_ks_aux_fit, rho, rho_ao, virial, &
136 dft_control, rho_aux_fit, rho_ao_aux_fit)
137
138 CALL exx_pre_hfx(hfx_sections, x_data, reuse_hfx)
139
140 CALL get_qs_env(qs_env=qs_env, &
141 input=input, &
142 para_env=para_env, &
143 energy=energy, &
144 rho=rho, &
145 matrix_ks=matrix_ks, &
146 virial=virial, &
147 dft_control=dft_control)
148 CALL qs_rho_get(rho, rho_ao=rho_ao)
149
150 IF (do_admm) THEN
151 CALL get_admm_env(qs_env%admm_env, &
152 matrix_ks_aux_fit=matrix_ks_aux_fit, &
153 rho_aux_fit=rho_aux_fit)
154 CALL qs_rho_get(rho_aux_fit, rho_ao=rho_ao_aux_fit)
155
156 IF (qs_env%admm_env%do_gapw) THEN
157 cpabort("ADMM EXX only implmented with GPW")
158 END IF
159 END IF
160
161 CALL section_vals_get(hfx_sections, n_repetition=n_rep_hf)
162 CALL section_vals_val_get(hfx_sections, "TREAT_LSD_IN_CORE", l_val=hfx_treat_lsd_in_core, &
163 i_rep_section=1)
164
165 ! put matrix_ks to zero
166 DO i = 1, SIZE(matrix_ks)
167 CALL dbcsr_set(matrix_ks(i)%matrix, 0.0_dp)
168 IF (do_admm) THEN
169 CALL dbcsr_set(matrix_ks_aux_fit(i)%matrix, 0.0_dp)
170 END IF
171 END DO
172
173 ! take the exact exchange energy from GW or calculate it
174 IF (do_gw) THEN
175
176 IF (calc_forces) cpabort("Not implemented")
177
178 IF (qs_env%mp2_env%ri_g0w0%update_xc_energy) THEN
179 CALL remove_exc_energy(energy)
180 energy%total = energy%total + e_ex_from_gw
181 energy%ex = e_ex_from_gw
182 IF (do_admm) THEN
183 energy%total = energy%total + e_admm_from_gw(1) + e_admm_from_gw(2)
184 energy%exc = e_admm_from_gw(1)
185 energy%exc_aux_fit = e_admm_from_gw(2)
186 END IF
187 t2 = m_walltime()
188
189 IF (unit_nr > 0) WRITE (unit_nr, '(T3,A,T56,F25.6)') 'Total EXX Time=', t2 - t1 + t3
190 IF (unit_nr > 0) WRITE (unit_nr, '(T3,A,T56,F25.14)') 'EXX energy = ', energy%ex
191 IF (do_admm .AND. unit_nr > 0) WRITE (unit_nr, '(T3,A,T56,F25.14)') &
192 'EXX ADMM XC correction = ', e_admm_from_gw(1) + e_admm_from_gw(2)
193 END IF
194
195 ELSE
196
197 CALL remove_exc_energy(energy)
198
199 nspins = dft_control%nspins
200 mspin = 1
201 IF (hfx_treat_lsd_in_core) mspin = nspins
202
203 calc_ints = .true.
204 IF (reuse_hfx) calc_ints = .false.
205 IF (calc_forces .AND. do_im_time) calc_ints = .false.
206
207 ehfx = 0.0_dp
208 IF (do_admm) THEN
209 matrix_ks_2d(1:nspins, 1:1) => matrix_ks_aux_fit(1:nspins)
210 rho_ao_2d(1:nspins, 1:1) => rho_ao_aux_fit(1:nspins)
211 ELSE
212 matrix_ks_2d(1:nspins, 1:1) => matrix_ks(1:nspins)
213 rho_ao_2d(1:nspins, 1:1) => rho_ao(1:nspins)
214 END IF
215
216 DO irep = 1, n_rep_hf
217
218 IF (x_data(irep, 1)%do_hfx_ri) THEN
219 CALL hfx_ri_update_ks(qs_env, x_data(irep, 1)%ri_data, matrix_ks_2d, ehfx, &
220 rho_ao=rho_ao_2d, geometry_did_change=calc_ints, nspins=nspins, &
221 hf_fraction=x_data(irep, 1)%general_parameter%fraction)
222 ELSE
223
224 DO ispin = 1, mspin
225
226 CALL integrate_four_center(qs_env, x_data, matrix_ks_2d, eh1, &
227 rho_ao_2d, hfx_sections, para_env, &
228 calc_ints, irep, .true., ispin=ispin)
229 ehfx = ehfx + eh1
230 END DO
231 END IF
232 END DO
233
234 ! include the EXX contribution to the total energy
235 energy%ex = ehfx
236 energy%total = energy%total + energy%ex
237
238 use_virial = virial%pv_availability .AND. (.NOT. virial%pv_numer)
239 IF (use_virial) THEN
240 virial%pv_calculate = .true.
241 virial%pv_fock_4c = 0.0_dp
242 END IF
243
244 IF (calc_forces) THEN
245 tf1 = m_walltime()
246
247 !Note: no need to remove xc forces: they are not even calculated in the first place
248 NULLIFY (rho_ao_resp)
249
250 DO irep = 1, n_rep_hf
251
252 IF (x_data(irep, 1)%do_hfx_ri) THEN
253
254 CALL hfx_ri_update_forces(qs_env, x_data(irep, 1)%ri_data, nspins, &
255 x_data(irep, 1)%general_parameter%fraction, &
256 rho_ao=rho_ao_2d, rho_ao_resp=rho_ao_resp, &
257 use_virial=use_virial)
258 ELSE
259
260 CALL derivatives_four_center(qs_env, rho_ao_2d, rho_ao_resp, &
261 hfx_sections, para_env, irep, &
262 use_virial, external_x_data=x_data)
263
264 END IF
265
266 END DO !irep
267
268 tf2 = m_walltime()
269 IF (unit_nr > 0) WRITE (unit_nr, '(T3,A,T56,F25.6)') 'Total EXX Force Time=', tf2 - tf1
270 END IF
271
272 IF (use_virial) THEN
273 virial%pv_exx = virial%pv_exx - virial%pv_fock_4c
274 virial%pv_virial = virial%pv_virial - virial%pv_fock_4c
275 END IF
276
277 ! ADMM XC correction
278 IF (do_admm) THEN
279
280 CALL calc_exx_admm_xc_contributions(qs_env, matrix_ks, matrix_ks_aux_fit, x_data, &
281 energy%exc, energy%exc_aux_fit, &
282 calc_forces, use_virial)
283
284 ! ADMM overlap forces
285 IF (calc_forces) CALL admm_projection_derivative(qs_env, matrix_ks_aux_fit, rho_ao)
286
287 energy%total = energy%total + energy%exc_aux_fit
288 energy%total = energy%total + energy%exc
289
290 END IF
291
292 IF (use_virial) THEN
293 virial%pv_calculate = .false.
294 END IF
295
296 t2 = m_walltime()
297
298 IF (unit_nr > 0) WRITE (unit_nr, '(T3,A,T56,F25.6)') 'Total EXX Time=', t2 - t1 + t3
299 IF (unit_nr > 0) WRITE (unit_nr, '(T3,A,T56,F25.14)') 'EXX energy = ', energy%ex
300 IF (do_admm .AND. unit_nr > 0) THEN
301 WRITE (unit_nr, '(T3,A,T56,F25.14)') 'EXX ADMM XC correction = ', energy%exc + energy%exc_aux_fit
302 END IF
303 END IF
304
305 CALL exx_post_hfx(qs_env, x_data, reuse_hfx)
306
307 CALL timestop(handle)
308
309 END SUBROUTINE calculate_exx
310
311! **************************************************************************************************
312!> \brief Add the EXX contribution to the RHS of the Z-vector equation, namely the HF Hamiltonian
313!> \param rhs ...
314!> \param qs_env ...
315!> \param ext_hfx_section ...
316!> \param x_data ...
317!> \param recalc_integrals ...
318!> \param do_admm ...
319!> \param do_ec ...
320!> \param do_exx ...
321!> \param reuse_hfx ...
322! **************************************************************************************************
323 SUBROUTINE add_exx_to_rhs(rhs, qs_env, ext_hfx_section, x_data, &
324 recalc_integrals, do_admm, do_ec, do_exx, reuse_hfx)
325
326 TYPE(dbcsr_p_type), DIMENSION(:), INTENT(IN) :: rhs
327 TYPE(qs_environment_type), POINTER :: qs_env
328 TYPE(section_vals_type), POINTER :: ext_hfx_section
329 TYPE(hfx_type), DIMENSION(:, :), POINTER :: x_data
330 LOGICAL, INTENT(IN), OPTIONAL :: recalc_integrals, do_admm, do_ec, &
331 do_exx, reuse_hfx
332
333 CHARACTER(LEN=*), PARAMETER :: routinen = 'add_exx_to_rhs'
334
335 INTEGER :: handle, ispin, nao, nao_aux, nspins, &
336 unit_nr
337 LOGICAL :: calc_ints, do_hfx, my_do_ec, my_do_exx, &
338 my_recalc_integrals
339 REAL(dp) :: dummy_real1, dummy_real2
340 TYPE(admm_type), POINTER :: admm_env
341 TYPE(cp_logger_type), POINTER :: logger
342 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: dbcsr_work, matrix_ks, matrix_s_aux, &
343 rho_ao, rho_ao_aux, work_admm
344 TYPE(dbcsr_type) :: dbcsr_tmp
345 TYPE(dft_control_type), POINTER :: dft_control
346 TYPE(pw_env_type), POINTER :: pw_env
347 TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
348 TYPE(pw_r3d_rs_type) :: vh_rspace
349 TYPE(pw_r3d_rs_type), DIMENSION(:), POINTER :: vadmm_rspace, vtau_rspace, vxc_rspace
350 TYPE(qs_rho_type), POINTER :: rho, rho_aux_fit
351 TYPE(section_vals_type), POINTER :: hfx_section
352 TYPE(task_list_type), POINTER :: task_list_aux_fit
353
354 NULLIFY (dbcsr_work, matrix_ks, rho, hfx_section, pw_env, vadmm_rspace, vtau_rspace, vxc_rspace, &
355 auxbas_pw_pool, dft_control, rho_ao, rho_aux_fit, rho_ao_aux, work_admm, &
356 matrix_s_aux, admm_env, task_list_aux_fit)
357
358 logger => cp_get_default_logger()
359 IF (logger%para_env%is_source()) THEN
360 unit_nr = cp_logger_get_default_unit_nr(logger, local=.true.)
361 ELSE
362 unit_nr = -1
363 END IF
364
365 CALL timeset(routinen, handle)
366
367 my_recalc_integrals = .false.
368 IF (PRESENT(recalc_integrals)) my_recalc_integrals = recalc_integrals
369 my_do_ec = .false.
370 IF (PRESENT(do_ec)) my_do_ec = do_ec
371 my_do_exx = .true.
372 IF (PRESENT(do_exx)) my_do_exx = do_exx
373
374 ! Strategy: we take the ks_matrix, remove the current xc contribution, and then add the RPA HF one
375 CALL get_qs_env(qs_env, matrix_ks=matrix_ks, rho=rho, pw_env=pw_env, dft_control=dft_control)
376 nspins = dft_control%nspins
377
378 ! do_exx ; subtract XC and EX
379 ! do_dcdft: subtract EX
380
381 CALL dbcsr_allocate_matrix_set(dbcsr_work, nspins)
382 DO ispin = 1, nspins
383 ALLOCATE (dbcsr_work(ispin)%matrix)
384 CALL dbcsr_copy(dbcsr_work(ispin)%matrix, matrix_ks(ispin)%matrix)
385 CALL dbcsr_set(dbcsr_work(ispin)%matrix, 0.0_dp)
386 END DO
387
388 IF (dft_control%do_admm) THEN
389 CALL get_qs_env(qs_env, admm_env=admm_env)
390 CALL get_admm_env(admm_env, matrix_s_aux_fit=matrix_s_aux, task_list_aux_fit=task_list_aux_fit, &
391 rho_aux_fit=rho_aux_fit)
392 CALL dbcsr_allocate_matrix_set(work_admm, nspins)
393 DO ispin = 1, nspins
394 ALLOCATE (work_admm(ispin)%matrix)
395 CALL dbcsr_create(work_admm(ispin)%matrix, template=matrix_s_aux(1)%matrix)
396 CALL dbcsr_copy(work_admm(ispin)%matrix, matrix_s_aux(1)%matrix)
397 CALL dbcsr_set(work_admm(ispin)%matrix, 0.0_dp)
398 END DO
399 CALL dbcsr_create(dbcsr_tmp, template=matrix_ks(1)%matrix)
400 CALL dbcsr_copy(dbcsr_tmp, matrix_ks(1)%matrix)
401
402 nao = admm_env%nao_orb
403 nao_aux = admm_env%nao_aux_fit
404 CALL qs_rho_get(rho_aux_fit, rho_ao=rho_ao_aux)
405 END IF
406
407 CALL qs_rho_get(rho, rho_ao=rho_ao)
408
409 ! Remove the standard XC + HFX contribution
410 CALL ks_ref_potential(qs_env, vh_rspace, vxc_rspace, vtau_rspace, vadmm_rspace, dummy_real1, dummy_real2)
411
412 ! Only remove standard XC and/or HFX
413 ! (due to different requirements for RHS)
414 IF (my_do_exx) THEN
415
416 DO ispin = 1, nspins
417 CALL dbcsr_copy(dbcsr_work(ispin)%matrix, matrix_ks(ispin)%matrix)
418 END DO
419
420 DO ispin = 1, nspins
421 CALL pw_scale(vxc_rspace(ispin), -1.0_dp)
422 CALL integrate_v_rspace(v_rspace=vxc_rspace(ispin), hmat=dbcsr_work(ispin), qs_env=qs_env, &
423 calculate_forces=.false.)
424 IF (ASSOCIATED(vtau_rspace)) THEN
425 CALL pw_scale(vtau_rspace(ispin), -1.0_dp)
426 CALL integrate_v_rspace(v_rspace=vtau_rspace(ispin), hmat=dbcsr_work(ispin), qs_env=qs_env, &
427 calculate_forces=.false., compute_tau=.true.)
428 END IF
429 END DO
430
431 END IF ! do_exx
432
433 ! Remove standard HFX
434 IF (my_do_exx .OR. my_do_ec) THEN
435
436 hfx_section => section_vals_get_subs_vals(qs_env%input, "DFT%XC%HF")
437 CALL section_vals_get(hfx_section, explicit=do_hfx)
438 IF (do_hfx) THEN
439 IF (dft_control%do_admm) THEN
440
441 !note: factor -1.0 taken care of later, after HFX ADMM contribution is taken
442 IF (.NOT. qs_env%admm_env%aux_exch_func == do_admm_aux_exch_func_none) THEN
443 DO ispin = 1, nspins
444 CALL integrate_v_rspace(v_rspace=vadmm_rspace(ispin), hmat=work_admm(ispin), &
445 qs_env=qs_env, calculate_forces=.false., basis_type="AUX_FIT", &
446 task_list_external=task_list_aux_fit)
447 END DO
448 END IF
449
450 CALL tddft_hfx_matrix(work_admm, rho_ao_aux, qs_env, .false., my_recalc_integrals)
451
452 DO ispin = 1, nspins
453 CALL copy_dbcsr_to_fm(work_admm(ispin)%matrix, admm_env%work_aux_aux)
454 CALL parallel_gemm('N', 'N', nao_aux, nao, nao_aux, 1.0_dp, admm_env%work_aux_aux, admm_env%A, &
455 0.0_dp, admm_env%work_aux_orb)
456 CALL parallel_gemm('T', 'N', nao, nao, nao_aux, 1.0_dp, admm_env%A, admm_env%work_aux_orb, &
457 0.0_dp, admm_env%work_orb_orb)
458 CALL copy_fm_to_dbcsr(admm_env%work_orb_orb, dbcsr_tmp, keep_sparsity=.true.)
459 CALL dbcsr_add(dbcsr_work(ispin)%matrix, dbcsr_tmp, 1.0_dp, -1.0_dp)
460 END DO
461 ELSE
462 DO ispin = 1, nspins
463 CALL dbcsr_scale(rho_ao(ispin)%matrix, -1.0_dp)
464 END DO
465 CALL tddft_hfx_matrix(dbcsr_work, rho_ao, qs_env, .false., my_recalc_integrals)
466 DO ispin = 1, nspins
467 CALL dbcsr_scale(rho_ao(ispin)%matrix, -1.0_dp)
468 END DO
469 END IF
470 END IF !do_hfx
471
472 END IF ! do_exx
473
474 ! Clean
475 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
476 CALL auxbas_pw_pool%give_back_pw(vh_rspace)
477 DO ispin = 1, nspins
478 CALL auxbas_pw_pool%give_back_pw(vxc_rspace(ispin))
479 IF (ASSOCIATED(vtau_rspace)) THEN
480 CALL auxbas_pw_pool%give_back_pw(vtau_rspace(ispin))
481 END IF
482 END DO
483 DEALLOCATE (vxc_rspace)
484 IF (ASSOCIATED(vtau_rspace)) DEALLOCATE (vtau_rspace)
485
486 IF (dft_control%do_admm) THEN
487 DO ispin = 1, nspins
488 IF (ASSOCIATED(vadmm_rspace)) THEN
489 CALL auxbas_pw_pool%give_back_pw(vadmm_rspace(ispin))
490 END IF
491 END DO
492 IF (ASSOCIATED(vadmm_rspace)) DEALLOCATE (vadmm_rspace)
493 END IF
494
495 !Add the HF contribution from RI_RPA/EC_ENV to the ks matrix
496 CALL exx_pre_hfx(ext_hfx_section, x_data, reuse_hfx)
497
498 calc_ints = .true.
499 IF (reuse_hfx) calc_ints = .false.
500 IF (do_admm) THEN
501 DO ispin = 1, nspins
502 CALL dbcsr_set(work_admm(ispin)%matrix, 0.0_dp)
503 END DO
504
505 CALL tddft_hfx_matrix(work_admm, rho_ao_aux, qs_env, .false., calc_ints, ext_hfx_section, &
506 x_data)
507
508 !ADMM XC correction
509 CALL calc_exx_admm_xc_contributions(qs_env, dbcsr_work, work_admm, x_data, dummy_real1, &
510 dummy_real2, .false., .false.)
511
512 DO ispin = 1, nspins
513 CALL copy_dbcsr_to_fm(work_admm(ispin)%matrix, admm_env%work_aux_aux)
514 CALL parallel_gemm('N', 'N', nao_aux, nao, nao_aux, 1.0_dp, admm_env%work_aux_aux, admm_env%A, &
515 0.0_dp, admm_env%work_aux_orb)
516 CALL parallel_gemm('T', 'N', nao, nao, nao_aux, 1.0_dp, admm_env%A, admm_env%work_aux_orb, &
517 0.0_dp, admm_env%work_orb_orb)
518 CALL copy_fm_to_dbcsr(admm_env%work_orb_orb, dbcsr_tmp, keep_sparsity=.true.)
519 CALL dbcsr_add(dbcsr_work(ispin)%matrix, dbcsr_tmp, 1.0_dp, 1.0_dp)
520 END DO
521
522 ELSE
523 CALL tddft_hfx_matrix(dbcsr_work, rho_ao, qs_env, .false., calc_ints, ext_hfx_section, x_data)
524 END IF
525 CALL exx_post_hfx(qs_env, x_data, reuse_hfx)
526
527 !Update the RHS
528 DO ispin = 1, nspins
529 CALL dbcsr_add(rhs(ispin)%matrix, dbcsr_work(ispin)%matrix, 1.0_dp, 1.0_dp)
530 END DO
531
532 CALL dbcsr_deallocate_matrix_set(dbcsr_work)
533 IF (dft_control%do_admm) THEN
534 CALL dbcsr_deallocate_matrix_set(work_admm)
535 CALL dbcsr_release(dbcsr_tmp)
536 END IF
537
538 CALL timestop(handle)
539
540 END SUBROUTINE add_exx_to_rhs
541
542! **************************************************************************************************
543!> \brief get the ADMM XC section from the ri_rpa/ec_env type if available, create and store them otherwise
544!> \param qs_env ...
545!> \param x_data ...
546!> \param xc_section_aux ...
547!> \param xc_section_primary ...
548! **************************************************************************************************
549 SUBROUTINE get_exx_admm_xc_sections(qs_env, x_data, xc_section_aux, xc_section_primary)
550 TYPE(qs_environment_type), POINTER :: qs_env
551 TYPE(hfx_type), DIMENSION(:, :), POINTER :: x_data
552 TYPE(section_vals_type), POINTER :: xc_section_aux, xc_section_primary
553
554 INTEGER :: natom
555 TYPE(admm_type), POINTER :: qs_admm_env, tmp_admm_env
556 TYPE(dft_control_type), POINTER :: dft_control
557 TYPE(mp_para_env_type), POINTER :: para_env
558 TYPE(section_vals_type), POINTER :: xc_fun, xc_fun_empty, xc_section, &
559 xc_section_empty
560
561 NULLIFY (qs_admm_env, tmp_admm_env, para_env, xc_section, xc_section_empty, xc_fun_empty, &
562 xc_fun, dft_control)
563
564 IF (ASSOCIATED(qs_env%mp2_env)) THEN
565 IF (ASSOCIATED(qs_env%mp2_env%ri_rpa%xc_section_aux) .AND. &
566 ASSOCIATED(qs_env%mp2_env%ri_rpa%xc_section_primary)) THEN
567 xc_section_aux => qs_env%mp2_env%ri_rpa%xc_section_aux
568 xc_section_primary => qs_env%mp2_env%ri_rpa%xc_section_primary
569 END IF
570 ELSE IF (qs_env%energy_correction) THEN
571 IF (ASSOCIATED(qs_env%ec_env%xc_section_aux) .AND. &
572 ASSOCIATED(qs_env%ec_env%xc_section_primary)) THEN
573 xc_section_aux => qs_env%ec_env%xc_section_aux
574 xc_section_primary => qs_env%ec_env%xc_section_primary
575 END IF
576 END IF
577
578 IF (.NOT. ASSOCIATED(xc_section_aux) .OR. .NOT. ASSOCIATED(xc_section_primary)) THEN
579
580 CALL get_qs_env(qs_env, admm_env=qs_admm_env, natom=natom, para_env=para_env, dft_control=dft_control)
581 cpassert(ASSOCIATED(qs_admm_env))
582
583 !create XC section with XC_FUNCITONAL NONE (aka empty XC_FUNCTIONAL section)
584 xc_section => section_vals_get_subs_vals(qs_env%input, "DFT%XC")
585 xc_fun => section_vals_get_subs_vals(xc_section, "XC_FUNCTIONAL")
586 CALL section_vals_duplicate(xc_section, xc_section_empty)
587 CALL section_vals_create(xc_fun_empty, xc_fun%section)
588 CALL section_vals_set_subs_vals(xc_section_empty, "XC_FUNCTIONAL", xc_fun_empty)
589
590 CALL admm_env_create(tmp_admm_env, dft_control%admm_control, qs_admm_env%mos_aux_fit, &
591 para_env, natom, qs_admm_env%nao_aux_fit)
592
593 CALL create_admm_xc_section(x_data=x_data, xc_section=xc_section_empty, &
594 admm_env=tmp_admm_env)
595
596 CALL section_vals_duplicate(tmp_admm_env%xc_section_aux, xc_section_aux)
597 CALL section_vals_duplicate(tmp_admm_env%xc_section_primary, xc_section_primary)
598
599 IF (ASSOCIATED(qs_env%mp2_env)) THEN
600 qs_env%mp2_env%ri_rpa%xc_section_aux => xc_section_aux
601 qs_env%mp2_env%ri_rpa%xc_section_primary => xc_section_primary
602 END IF
603 IF (qs_env%energy_correction) THEN
604 qs_env%ec_env%xc_section_aux => xc_section_aux
605 qs_env%ec_env%xc_section_primary => xc_section_primary
606 END IF
607
608 CALL section_vals_release(xc_section_empty)
609 CALL section_vals_release(xc_fun_empty)
610 CALL admm_env_release(tmp_admm_env)
611
612 END IF
613
614 END SUBROUTINE get_exx_admm_xc_sections
615
616! **************************************************************************************************
617!> \brief Calculate the RI_RPA%HF / EC_ENV%HF ADMM XC contributions to the KS matrices and the respective energies
618!> \param qs_env ...
619!> \param matrix_prim ...
620!> \param matrix_aux ...
621!> \param x_data ...
622!> \param exc ...
623!> \param exc_aux_fit ...
624!> \param calc_forces ...
625!> \param use_virial ...
626! **************************************************************************************************
627 SUBROUTINE calc_exx_admm_xc_contributions(qs_env, matrix_prim, matrix_aux, x_data, exc, &
628 exc_aux_fit, calc_forces, use_virial)
629 TYPE(qs_environment_type), POINTER :: qs_env
630 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_prim, matrix_aux
631 TYPE(hfx_type), DIMENSION(:, :), POINTER :: x_data
632 REAL(dp), INTENT(INOUT) :: exc, exc_aux_fit
633 LOGICAL, INTENT(IN) :: calc_forces, use_virial
634
635 INTEGER :: ispin, nspins
636 REAL(dp) :: edisp
637 REAL(dp), DIMENSION(3, 3) :: pv_loc
638 TYPE(admm_type), POINTER :: admm_env
639 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: rho_ao, rho_ao_aux_fit
640 TYPE(dft_control_type), POINTER :: dft_control
641 TYPE(pw_env_type), POINTER :: pw_env
642 TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
643 TYPE(pw_r3d_rs_type), DIMENSION(:), POINTER :: v_dummy, v_rspace, v_rspace_aux_fit
644 TYPE(qs_rho_type), POINTER :: rho, rho_aux_fit
645 TYPE(section_vals_type), POINTER :: xc_section_aux, xc_section_primary
646 TYPE(virial_type), POINTER :: virial
647
648 NULLIFY (xc_section_aux, xc_section_primary, rho, rho_aux_fit, v_dummy, v_rspace, v_rspace_aux_fit, &
649 auxbas_pw_pool, pw_env, rho_ao, rho_ao_aux_fit, dft_control, admm_env)
650
651 CALL get_qs_env(qs_env, dft_control=dft_control, pw_env=pw_env, rho=rho, &
652 admm_env=admm_env, virial=virial)
653 CALL get_admm_env(admm_env, rho_aux_fit=rho_aux_fit)
654
655 nspins = dft_control%nspins
656 CALL qs_rho_get(rho, rho_ao=rho_ao)
657 CALL qs_rho_get(rho_aux_fit, rho_ao=rho_ao_aux_fit)
658 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
659
660 CALL get_exx_admm_xc_sections(qs_env, x_data, xc_section_aux, xc_section_primary)
661
662 IF (use_virial) virial%pv_xc = 0.0_dp
663 CALL qs_vxc_create(qs_env%ks_env, rho_struct=rho_aux_fit, xc_section=xc_section_aux, &
664 vxc_rho=v_rspace_aux_fit, vxc_tau=v_dummy, exc=exc_aux_fit)
665 IF (use_virial) THEN
666 virial%pv_exc = virial%pv_exc - virial%pv_xc
667 virial%pv_virial = virial%pv_virial - virial%pv_xc
668 END IF
669
670 IF (.NOT. dft_control%admm_control%aux_exch_func == do_admm_aux_exch_func_none) THEN
671 IF (use_virial) pv_loc = virial%pv_virial
672 DO ispin = 1, nspins
673 CALL pw_scale(v_rspace_aux_fit(ispin), v_rspace_aux_fit(ispin)%pw_grid%dvol)
674 CALL integrate_v_rspace(v_rspace=v_rspace_aux_fit(ispin), hmat=matrix_aux(ispin), &
675 pmat=rho_ao_aux_fit(ispin), qs_env=qs_env, &
676 basis_type="AUX_FIT", calculate_forces=calc_forces, &
677 task_list_external=qs_env%admm_env%task_list_aux_fit)
678 END DO
679 IF (use_virial) virial%pv_ehartree = virial%pv_ehartree + (virial%pv_virial - pv_loc)
680 END IF
681
682 IF (ASSOCIATED(v_rspace_aux_fit)) THEN
683 DO ispin = 1, nspins
684 CALL auxbas_pw_pool%give_back_pw(v_rspace_aux_fit(ispin))
685 END DO
686 DEALLOCATE (v_rspace_aux_fit)
687 END IF
688 IF (ASSOCIATED(v_dummy)) THEN
689 DO ispin = 1, nspins
690 CALL auxbas_pw_pool%give_back_pw(v_dummy(ispin))
691 END DO
692 DEALLOCATE (v_dummy)
693 END IF
694
695 IF (use_virial) virial%pv_xc = 0.0_dp
696 CALL qs_vxc_create(qs_env%ks_env, rho_struct=rho, xc_section=xc_section_primary, &
697 vxc_rho=v_rspace, vxc_tau=v_dummy, exc=exc, edisp=edisp, &
698 dispersion_env=qs_env%dispersion_env)
699 IF (edisp /= 0.0_dp) exc = exc + edisp
700 IF (use_virial) THEN
701 virial%pv_exc = virial%pv_exc - virial%pv_xc
702 virial%pv_virial = virial%pv_virial - virial%pv_xc
703 END IF
704
705 IF (.NOT. dft_control%admm_control%aux_exch_func == do_admm_aux_exch_func_none) THEN
706 IF (use_virial) pv_loc = virial%pv_virial
707 DO ispin = 1, nspins
708 CALL pw_scale(v_rspace(ispin), v_rspace(ispin)%pw_grid%dvol)
709 CALL integrate_v_rspace(v_rspace=v_rspace(ispin), hmat=matrix_prim(ispin), &
710 pmat=rho_ao(ispin), qs_env=qs_env, &
711 calculate_forces=calc_forces)
712 END DO
713 IF (use_virial) virial%pv_ehartree = virial%pv_ehartree + (virial%pv_virial - pv_loc)
714 END IF
715
716 IF (ASSOCIATED(v_rspace)) THEN
717 DO ispin = 1, nspins
718 CALL auxbas_pw_pool%give_back_pw(v_rspace(ispin))
719 END DO
720 DEALLOCATE (v_rspace)
721 END IF
722 IF (ASSOCIATED(v_dummy)) THEN
723 DO ispin = 1, nspins
724 CALL auxbas_pw_pool%give_back_pw(v_dummy(ispin))
725 END DO
726 DEALLOCATE (v_dummy)
727 END IF
728
729 END SUBROUTINE calc_exx_admm_xc_contributions
730
731! **************************************************************************************************
732!> \brief Prepare the external x_data for integration. Simply change the HFX fraction in case the
733!> qs_env%x_data is reused
734!> \param ext_hfx_section ...
735!> \param x_data ...
736!> \param reuse_hfx ...
737! **************************************************************************************************
738 SUBROUTINE exx_pre_hfx(ext_hfx_section, x_data, reuse_hfx)
739 TYPE(section_vals_type), POINTER :: ext_hfx_section
740 TYPE(hfx_type), DIMENSION(:, :), POINTER :: x_data
741 LOGICAL :: reuse_hfx
742
743 INTEGER :: irep, n_rep_hf
744 REAL(dp) :: frac
745
746 IF (.NOT. reuse_hfx) RETURN
747
748 CALL section_vals_get(ext_hfx_section, n_repetition=n_rep_hf)
749
750 DO irep = 1, n_rep_hf
751 CALL section_vals_val_get(ext_hfx_section, "FRACTION", r_val=frac, i_rep_section=irep)
752 x_data(irep, :)%general_parameter%fraction = frac
753 END DO
754
755 END SUBROUTINE exx_pre_hfx
756
757! **************************************************************************************************
758!> \brief Revert back to the proper HFX fraction in case qs_env%x_data is reused
759!> \param qs_env ...
760!> \param x_data ...
761!> \param reuse_hfx ...
762! **************************************************************************************************
763 SUBROUTINE exx_post_hfx(qs_env, x_data, reuse_hfx)
764 TYPE(qs_environment_type), POINTER :: qs_env
765 TYPE(hfx_type), DIMENSION(:, :), POINTER :: x_data
766 LOGICAL :: reuse_hfx
767
768 INTEGER :: irep, n_rep_hf
769 REAL(dp) :: frac
770 TYPE(section_vals_type), POINTER :: input, qs_hfx_section
771
772 IF (.NOT. reuse_hfx) RETURN
773
774 CALL get_qs_env(qs_env, input=input)
775 qs_hfx_section => section_vals_get_subs_vals(input, "DFT%XC%HF")
776 CALL section_vals_get(qs_hfx_section, n_repetition=n_rep_hf)
777
778 DO irep = 1, n_rep_hf
779 CALL section_vals_val_get(qs_hfx_section, "FRACTION", r_val=frac, i_rep_section=irep)
780 x_data(irep, :)%general_parameter%fraction = frac
781 END DO
782
783 END SUBROUTINE exx_post_hfx
784
785! **************************************************************************************************
786!> \brief ...
787!> \param energy ...
788! **************************************************************************************************
789 ELEMENTAL SUBROUTINE remove_exc_energy(energy)
790 TYPE(qs_energy_type), INTENT(INOUT) :: energy
791
792 ! Remove the Exchange-correlation energy contributions from the total energy
793 energy%total = energy%total - (energy%exc + energy%exc1 + energy%ex + &
794 energy%exc_aux_fit + energy%exc1_aux_fit)
795
796 energy%exc = 0.0_dp
797 energy%exc1 = 0.0_dp
798 energy%exc_aux_fit = 0.0_dp
799 energy%exc1_aux_fit = 0.0_dp
800 energy%ex = 0.0_dp
801
802 END SUBROUTINE remove_exc_energy
803
804END MODULE hfx_exx
805
Contains ADMM methods which require molecular orbitals.
subroutine, public admm_projection_derivative(qs_env, matrix_hz, matrix_pz, fval)
Calculate derivatives terms from overlap matrices.
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:599
subroutine, public admm_env_release(admm_env)
releases the ADMM environment, cleans up all types
Definition admm_types.F:429
subroutine, public admm_env_create(admm_env, admm_control, mos, para_env, natoms, nao_aux_fit, blacs_env_ext)
creates ADMM environment, initializes the basic types
Definition admm_types.F:220
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_scale(matrix, alpha_scalar)
...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_release(matrix)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
DBCSR operations in CP2K.
subroutine, public copy_dbcsr_to_fm(matrix, fm, plan, check_plan)
Copy a DBCSR matrix to a BLACS matrix.
subroutine, public copy_fm_to_dbcsr(fm, matrix, keep_sparsity)
Copy a BLACS matrix to a dbcsr matrix.
various routines to log and control the output. The idea is that decisions about where to log should ...
recursive integer function, public cp_logger_get_default_unit_nr(logger, local, skip_not_ionode)
asks the default unit number of the given logger. try to use cp_logger_get_unit_nr
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
Utilities for hfx and admm methods.
subroutine, public tddft_hfx_matrix(matrix_ks, rho_ao, qs_env, update_energy, recalc_integrals, external_hfx_sections, external_x_data, external_para_env)
Add the hfx contributions to the Hamiltonian.
subroutine, public create_admm_xc_section(x_data, xc_section, admm_env)
This routine modifies the xc section depending on the potential type used for the HF exchange and the...
Routines to calculate derivatives with respect to basis function origin.
subroutine, public derivatives_four_center(qs_env, rho_ao, rho_ao_resp, hfx_section, para_env, irep, use_virial, adiabatic_rescale_factor, resp_only, external_x_data, nspins)
computes four center derivatives for a full basis set and updates the forcesfock_4c arrays....
Routines to calculate HFX energy and potential.
subroutine, public integrate_four_center(qs_env, x_data, ks_matrix, ehfx, rho_ao, hfx_section, para_env, geometry_did_change, irep, distribute_fock_matrix, ispin, nspins)
computes four center integrals for a full basis set and updates the Kohn-Sham-Matrix and energy....
Routines to calculate EXX in RPA and energy correction methods.
Definition hfx_exx.F:16
subroutine, public calc_exx_admm_xc_contributions(qs_env, matrix_prim, matrix_aux, x_data, exc, exc_aux_fit, calc_forces, use_virial)
Calculate the RI_RPAHF / EC_ENVHF ADMM XC contributions to the KS matrices and the respective energie...
Definition hfx_exx.F:629
subroutine, public calculate_exx(qs_env, unit_nr, hfx_sections, x_data, do_gw, do_admm, calc_forces, reuse_hfx, do_im_time, e_ex_from_gw, e_admm_from_gw, t3)
...
Definition hfx_exx.F:106
subroutine, public exx_pre_hfx(ext_hfx_section, x_data, reuse_hfx)
Prepare the external x_data for integration. Simply change the HFX fraction in case the qs_envx_data ...
Definition hfx_exx.F:739
subroutine, public exx_post_hfx(qs_env, x_data, reuse_hfx)
Revert back to the proper HFX fraction in case qs_envx_data is reused.
Definition hfx_exx.F:764
subroutine, public add_exx_to_rhs(rhs, qs_env, ext_hfx_section, x_data, recalc_integrals, do_admm, do_ec, do_exx, reuse_hfx)
Add the EXX contribution to the RHS of the Z-vector equation, namely the HF Hamiltonian.
Definition hfx_exx.F:325
RI-methods for HFX.
Definition hfx_ri.F:12
subroutine, public hfx_ri_update_ks(qs_env, ri_data, ks_matrix, ehfx, mos, rho_ao, geometry_did_change, nspins, hf_fraction)
...
Definition hfx_ri.F:1041
subroutine, public hfx_ri_update_forces(qs_env, ri_data, nspins, hf_fraction, rho_ao, rho_ao_resp, mos, use_virial, resp_only, rescale_factor)
the general routine that calls the relevant force code
Definition hfx_ri.F:3046
Types and set/get functions for HFX.
Definition hfx_types.F:16
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_admm_aux_exch_func_none
objects that represent the structure of input sections and the data contained in an input section
recursive subroutine, public section_vals_create(section_vals, section)
creates a object where to store the values of a section
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_set_subs_vals(section_vals, subsection_name, new_section_vals, i_rep_section)
replaces of the requested subsection with the one given
subroutine, public section_vals_duplicate(section_vals_in, section_vals_out, i_rep_start, i_rep_end)
creates a deep copy from section_vals_in to section_vals_out
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
recursive subroutine, public section_vals_release(section_vals)
releases the given object
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Machine interface based on Fortran 2003 and POSIX.
Definition machine.F:17
real(kind=dp) function, public m_walltime()
returns time from a real-time clock, protected against rolling early/easily
Definition machine.F:144
Interface to the message passing library MPI.
basic linear algebra operations for full matrixes
container for various plainwaves related things
subroutine, public pw_env_get(pw_env, pw_pools, cube_info, gridlevel_info, auxbas_pw_pool, auxbas_grid, auxbas_rs_desc, auxbas_rs_grid, rs_descs, rs_grids, xc_pw_pool, vdw_pw_pool, poisson_env, interp_section)
returns the various attributes of the pw env
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
Integrate single or product functions over a potential on a RS grid.
Calculate the KS reference potentials.
subroutine, public ks_ref_potential(qs_env, vh_rspace, vxc_rspace, vtau_rspace, vadmm_rspace, ehartree, exc, h_stress, vadmm_tau_rspace)
calculate the Kohn-Sham reference potential
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public qs_rho_get(rho_struct, rho_ao, rho_ao_im, rho_ao_kp, rho_ao_im_kp, rho_r, drho_r, rho_g, drho_g, tau_r, tau_g, rho_r_valid, drho_r_valid, rho_g_valid, drho_g_valid, tau_r_valid, tau_g_valid, tot_rho_r, tot_rho_g, rho_r_sccs, soft_valid, complex_rho_ao)
returns info about the density described by this object. If some representation is not available an e...
subroutine, public qs_vxc_create(ks_env, rho_struct, xc_section, vxc_rho, vxc_tau, exc, just_energy, edisp, dispersion_env, adiabatic_rescale_factor, pw_env_external, native_skala_atom_force, qs_env_external, native_gapw_composite_override, native_skala_defer_to_atom_composite)
calculates and allocates the xc potential, already reducing it to the dependence on rho and the one o...
Definition qs_vxc.F:120
types for task lists
stores some data used in wavefunction fitting
Definition admm_types.F:120
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores some data used in construction of Kohn-Sham matrix
Definition hfx_types.F:474
stores all the informations relevant to an mpi environment
contained for different pw related things
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
keeps the density in various representations, keeping track of which ones are valid.