(git:15c1bfc)
Loading...
Searching...
No Matches
qs_linres_epr_nablavks.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
8! **************************************************************************************************
9!> \brief Calculates Nabla V_KS (local part if PSP) on the different grids
10!> \par History
11!> created 06-2007 [RD]
12!> \author RD
13! **************************************************************************************************
17 USE cell_types, ONLY: cell_type
19 USE cp_dbcsr_api, ONLY: dbcsr_p_type
22 USE cp_output_handling, ONLY: cp_p_file,&
36 USE kinds, ONLY: default_string_length,&
37 dp
38 USE mathconstants, ONLY: rootpi,&
39 twopi
43 USE pw_env_types, ONLY: pw_env_get,&
45 USE pw_methods, ONLY: pw_axpy,&
46 pw_copy,&
47 pw_derive,&
53 USE pw_types, ONLY: pw_c1d_gs_type,&
61 USE qs_kind_types, ONLY: get_qs_kind,&
65 USE qs_linres_types, ONLY: epr_env_type,&
68! R0
77! R0
78 USE qs_rho_types, ONLY: qs_rho_get,&
83 USE qs_vxc, ONLY: qs_vxc_create
85 USE util, ONLY: get_limit
86#include "./base/base_uses.f90"
87
88 IMPLICIT NONE
89
90 PRIVATE
91 PUBLIC :: epr_nablavks
92
93 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_linres_epr_nablavks'
94
95CONTAINS
96
97! **************************************************************************************************
98!> \brief Evaluates Nabla V_KS on the grids
99!> \param epr_env ...
100!> \param qs_env ...
101!> \par History
102!> 06.2006 created [RD]
103!> \author RD
104! **************************************************************************************************
105 SUBROUTINE epr_nablavks(epr_env, qs_env)
106
107 TYPE(epr_env_type) :: epr_env
108 TYPE(qs_environment_type), POINTER :: qs_env
109
110 CHARACTER(LEN=default_string_length) :: ext, filename
111 COMPLEX(KIND=dp) :: gtemp
112 INTEGER :: bo_atom(2), ia, iat, iatom, idir, iexp, &
113 ig, ikind, ir, iso, ispin, ix, iy, iz, &
114 natom, nexp_ppl, nkind, nspins, &
115 output_unit, unit_nr
116 INTEGER, DIMENSION(2, 3) :: bo
117 INTEGER, DIMENSION(:), POINTER :: atom_list
118 LOGICAL :: gapw, gapw_xc, gth_gspace, ionode, &
119 make_soft, mpi_io, paw_atom
120 REAL(kind=dp) :: alpha, alpha_core, arg, charge, ehartree, exc, exc1, exp_rap, &
121 gapw_max_alpha, hard_radius, hard_value, soft_value, sqrt_alpha, sqrt_rap
122 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: vh1_rad_h, vh1_rad_s
123 REAL(kind=dp), DIMENSION(3) :: rap, ratom, roffset, rpoint
124 REAL(kind=dp), DIMENSION(:), POINTER :: cexp_ppl, rho_rad_z
125 REAL(kind=dp), DIMENSION(:, :), POINTER :: rho_rad_0
126 TYPE(all_potential_type), POINTER :: all_potential
127 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
128 TYPE(cell_type), POINTER :: cell
129 TYPE(cneo_potential_type), POINTER :: cneo_potential
130 TYPE(cp_logger_type), POINTER :: logger
131 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: rho_ao
132 TYPE(dft_control_type), POINTER :: dft_control
133 TYPE(grid_atom_type), POINTER :: grid_atom
134 TYPE(gth_potential_type), POINTER :: gth_potential
135 TYPE(harmonics_atom_type), POINTER :: harmonics
136 TYPE(mp_para_env_type), POINTER :: para_env
137 TYPE(nablavks_atom_type), DIMENSION(:), POINTER :: nablavks_atom_set
138 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
139 POINTER :: sab
140 TYPE(oce_matrix_type), POINTER :: oce
141 TYPE(particle_list_type), POINTER :: particles
142 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
143 TYPE(pw_c1d_gs_type) :: rho_tot_gspace, v_coulomb_gspace, &
144 v_coulomb_gtemp, v_hartree_gspace, &
145 v_hartree_gtemp, v_xc_gtemp
146 TYPE(pw_env_type), POINTER :: pw_env
147 TYPE(pw_poisson_type), POINTER :: poisson_env
148 TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
149 TYPE(pw_r3d_rs_type) :: v_coulomb_rtemp, v_hartree_rtemp, &
150 v_xc_rtemp, wf_r
151 TYPE(pw_r3d_rs_type), DIMENSION(:), POINTER :: rho1_r, rho2_r, rho_r, v_rspace_new, &
152 v_tau_rspace
153 TYPE(pw_r3d_rs_type), POINTER :: pwx, pwy, pwz
154 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
155 TYPE(qs_ks_env_type), POINTER :: ks_env
156 TYPE(qs_rho_p_type), DIMENSION(:, :), POINTER :: nablavks_set
157 TYPE(qs_rho_type), POINTER :: rho, rho_xc
158 TYPE(qs_subsys_type), POINTER :: subsys
159 TYPE(rho0_atom_type), DIMENSION(:), POINTER :: rho0_atom_set
160 TYPE(rho_atom_coeff), DIMENSION(:), POINTER :: rho_rad_h, rho_rad_s
161 TYPE(rho_atom_coeff), DIMENSION(:, :), POINTER :: nablavks_vec_rad_h, nablavks_vec_rad_s
162 TYPE(rho_atom_type), DIMENSION(:), POINTER :: rho_atom_set
163 TYPE(rho_atom_type), POINTER :: rho_atom
164 TYPE(rhoz_type), DIMENSION(:), POINTER :: rhoz_set
165 TYPE(section_vals_type), POINTER :: g_section, input, lr_section, xc_section
166 TYPE(sgp_potential_type), POINTER :: sgp_potential
167
168! R0
169! R0
170! R0
171! R0
172! R0
173! R0
174
175 NULLIFY (auxbas_pw_pool)
176 NULLIFY (cell)
177 NULLIFY (dft_control)
178 NULLIFY (g_section)
179 NULLIFY (logger)
180 NULLIFY (lr_section)
181 NULLIFY (nablavks_set)
182 NULLIFY (nablavks_atom_set) ! R0
183 NULLIFY (nablavks_vec_rad_h) ! R0
184 NULLIFY (nablavks_vec_rad_s) ! R0
185 NULLIFY (para_env)
186 NULLIFY (particle_set)
187 NULLIFY (particles)
188 NULLIFY (poisson_env)
189 NULLIFY (pw_env)
190 NULLIFY (pwx) ! R0
191 NULLIFY (pwy) ! R0
192 NULLIFY (pwz) ! R0
193 NULLIFY (rho)
194 NULLIFY (rho_xc)
195 NULLIFY (rho0_atom_set)
196 NULLIFY (rho_atom_set)
197 NULLIFY (rhoz_set)
198 NULLIFY (subsys)
199 NULLIFY (v_rspace_new)
200 NULLIFY (v_tau_rspace)
201 NULLIFY (xc_section)
202 NULLIFY (input)
203 NULLIFY (ks_env)
204 NULLIFY (rho_r, rho_ao, rho1_r, rho2_r)
205 NULLIFY (oce, qs_kind_set, sab)
206
207 logger => cp_get_default_logger()
208 lr_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%LINRES")
209 ionode = logger%para_env%is_source()
210
211 output_unit = cp_print_key_unit_nr(logger, lr_section, "PRINT%PROGRAM_RUN_INFO", &
212 extension=".linresLog")
213
214! -------------------------------------
215! Read settings
216! -------------------------------------
217
218 g_section => section_vals_get_subs_vals(lr_section, &
219 "EPR%PRINT%G_TENSOR")
220
221 CALL section_vals_val_get(g_section, "gapw_max_alpha", r_val=gapw_max_alpha)
222
223 gth_gspace = .true.
224
225! -------------------------------------
226! Get nablavks arrays
227! -------------------------------------
228
229 CALL get_epr_env(epr_env, nablavks_set=nablavks_set, & ! R0
230 nablavks_atom_set=nablavks_atom_set) ! R0
231 ! R0
232
233 DO ispin = 1, SIZE(nablavks_set, 2)
234 DO idir = 1, SIZE(nablavks_set, 1)
235 CALL qs_rho_get(nablavks_set(idir, ispin)%rho, rho_r=rho_r)
236 CALL pw_zero(rho_r(1))
237 END DO
238 END DO
239
240 CALL qs_rho_get(nablavks_set(1, 1)%rho, rho_r=rho_r)
241 pwx => rho_r(1)
242 CALL qs_rho_get(nablavks_set(2, 1)%rho, rho_r=rho_r)
243 pwy => rho_r(1)
244 CALL qs_rho_get(nablavks_set(3, 1)%rho, rho_r=rho_r)
245 pwz => rho_r(1)
246
247 roffset = -real(modulo(pwx%pw_grid%npts, 2), dp)*pwx%pw_grid%dr/2.0_dp
248
249! -------------------------------------
250! Get grids / atom info
251! -------------------------------------
252
253 CALL get_qs_env(qs_env=qs_env, &
254 atomic_kind_set=atomic_kind_set, &
255 qs_kind_set=qs_kind_set, &
256 input=input, &
257 cell=cell, &
258 dft_control=dft_control, &
259 para_env=para_env, &
260 particle_set=particle_set, &
261 pw_env=pw_env, &
262 rho=rho, &
263 rho_xc=rho_xc, &
264 rho_atom_set=rho_atom_set, &
265 rho0_atom_set=rho0_atom_set, &
266 rhoz_set=rhoz_set, &
267 subsys=subsys, &
268 ks_env=ks_env, &
269 oce=oce, sab_orb=sab)
270
271 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool, &
272 poisson_env=poisson_env)
273
274 CALL qs_subsys_get(subsys, particles=particles)
275
276 gapw = dft_control%qs_control%gapw
277 gapw_xc = dft_control%qs_control%gapw_xc
278 nkind = SIZE(atomic_kind_set)
279 nspins = dft_control%nspins
280
281! -------------------------------------
282! Add Hartree potential
283! -------------------------------------
284
285 CALL auxbas_pw_pool%create_pw(v_hartree_gspace)
286 CALL auxbas_pw_pool%create_pw(v_hartree_gtemp)
287 CALL auxbas_pw_pool%create_pw(v_hartree_rtemp)
288 CALL auxbas_pw_pool%create_pw(rho_tot_gspace)
289
290 IF (gapw) THEN
291 ! need to rebuild the coeff !
292 CALL qs_rho_get(rho, rho_ao_kp=rho_ao)
293 CALL calculate_rho_atom_coeff(qs_env, rho_ao, rho_atom_set, qs_kind_set, oce, sab, para_env)
294
295 CALL prepare_gapw_den(qs_env, do_rho0=.true.)
296 END IF
297
298 CALL pw_zero(rho_tot_gspace)
299
300 CALL calc_rho_tot_gspace(rho_tot_gspace, qs_env, rho, &
301 skip_nuclear_density=.NOT. gapw)
302
303 CALL pw_poisson_solve(poisson_env, rho_tot_gspace, ehartree, &
304 v_hartree_gspace)
305
306 ! -------------------------------------
307 ! Atomic grids part
308 ! -------------------------------------
309
310 IF (gapw) THEN
311
312 DO ikind = 1, nkind ! loop over atom types
313
314 NULLIFY (atom_list)
315 NULLIFY (grid_atom)
316 NULLIFY (harmonics)
317 NULLIFY (rho_rad_z)
318
319 rho_rad_z => rhoz_set(ikind)%r_coef
320
321 CALL get_atomic_kind(atomic_kind_set(ikind), atom_list=atom_list, natom=natom)
322 CALL get_qs_kind(qs_kind_set(ikind), &
323 grid_atom=grid_atom, &
324 harmonics=harmonics, &
325 hard_radius=hard_radius, &
326 paw_atom=paw_atom, &
327 zeff=charge, &
328 alpha_core_charge=alpha_core)
329
330 IF (paw_atom) THEN
331
332 ALLOCATE (vh1_rad_h(grid_atom%nr, harmonics%max_iso_not0))
333 ALLOCATE (vh1_rad_s(grid_atom%nr, harmonics%max_iso_not0))
334
335 ! DO iat = 1, natom ! natom = # atoms for ikind
336 !
337 ! iatom = atom_list(iat)
338 ! ratom = particle_set(iatom)%r
339 !
340 ! DO ig = v_hartree_gspace%pw_grid%first_gne0,v_hartree_gspace%pw_grid%ngpts_cut_local
341 !
342 ! gtemp = fourpi * charge / cell%deth * &
343 ! EXP ( - v_hartree_gspace%pw_grid%gsq(ig) / (4.0_dp * alpha_core) ) &
344 ! / v_hartree_gspace%pw_grid%gsq(ig)
345 !
346 ! arg = DOT_PRODUCT(v_hartree_gspace%pw_grid%g(:,ig),ratom)
347 !
348 ! gtemp = gtemp * CMPLX(COS(arg),-SIN(arg),KIND=dp)
349 !
350 ! v_hartree_gspace%array(ig) = v_hartree_gspace%array(ig) + gtemp
351 ! END DO
352 ! IF ( v_hartree_gspace%pw_grid%have_g0 ) v_hartree_gspace%array(1) = 0.0_dp
353 !
354 ! END DO
355
356 bo_atom = get_limit(natom, para_env%num_pe, para_env%mepos)
357
358 DO iat = bo_atom(1), bo_atom(2) ! natomkind = # atoms for ikind
359
360 iatom = atom_list(iat)
361 ratom = particle_set(iatom)%r
362
363 nablavks_vec_rad_h => nablavks_atom_set(iatom)%nablavks_vec_rad_h
364 nablavks_vec_rad_s => nablavks_atom_set(iatom)%nablavks_vec_rad_s
365
366 DO ispin = 1, nspins
367 DO idir = 1, 3
368 nablavks_vec_rad_h(idir, ispin)%r_coef(:, :) = 0.0_dp
369 nablavks_vec_rad_s(idir, ispin)%r_coef(:, :) = 0.0_dp
370 END DO ! idir
371 END DO ! ispin
372
373 rho_atom => rho_atom_set(iatom)
374 NULLIFY (rho_rad_h, rho_rad_s, rho_rad_0)
375 CALL get_rho_atom(rho_atom=rho_atom, rho_rad_h=rho_rad_h, &
376 rho_rad_s=rho_rad_s)
377 rho_rad_0 => rho0_atom_set(iatom)%rho0_rad_h%r_coef
378 vh1_rad_h = 0.0_dp
379 vh1_rad_s = 0.0_dp
380
381 CALL calculate_vh_1center(vh1_rad_h, vh1_rad_s, rho_rad_h, rho_rad_s, rho_rad_0, rho_rad_z, grid_atom)
382
383 DO ir = 2, grid_atom%nr
384
385 IF (grid_atom%rad(ir) >= hard_radius) cycle
386
387 DO ia = 1, grid_atom%ng_sphere
388
389 ! hard part
390
391 DO idir = 1, 3
392 hard_value = 0.0_dp
393 DO iso = 1, harmonics%max_iso_not0
394 hard_value = hard_value + &
395 vh1_rad_h(ir, iso)*harmonics%dslm_dxyz(idir, ia, iso) + &
396 harmonics%slm(ia, iso)* &
397 (vh1_rad_h(ir - 1, iso) - vh1_rad_h(ir, iso))/ &
398 (grid_atom%rad(ir - 1) - grid_atom%rad(ir))* &
399 (harmonics%a(idir, ia))
400 END DO
401 nablavks_vec_rad_h(idir, 1)%r_coef(ir, ia) = hard_value
402 END DO
403
404 ! soft part
405
406 DO idir = 1, 3
407 soft_value = 0.0_dp
408 DO iso = 1, harmonics%max_iso_not0
409 soft_value = soft_value + &
410 vh1_rad_s(ir, iso)*harmonics%dslm_dxyz(idir, ia, iso) + &
411 harmonics%slm(ia, iso)* &
412 (vh1_rad_s(ir - 1, iso) - vh1_rad_s(ir, iso))/ &
413 (grid_atom%rad(ir - 1) - grid_atom%rad(ir))* &
414 (harmonics%a(idir, ia))
415 END DO
416 nablavks_vec_rad_s(idir, 1)%r_coef(ir, ia) = soft_value
417 END DO
418
419 END DO ! ia
420
421 END DO ! ir
422
423 DO idir = 1, 3
424 nablavks_vec_rad_h(idir, 2)%r_coef(:, :) = nablavks_vec_rad_h(idir, 1)%r_coef(:, :)
425 nablavks_vec_rad_s(idir, 2)%r_coef(:, :) = nablavks_vec_rad_s(idir, 1)%r_coef(:, :)
426 END DO
427
428 END DO ! iat
429
430 DEALLOCATE (vh1_rad_h)
431 DEALLOCATE (vh1_rad_s)
432
433 END IF ! paw_atom
434
435 END DO ! ikind
436
437 END IF ! gapw
438
439 CALL pw_copy(v_hartree_gspace, v_hartree_gtemp)
440 CALL pw_derive(v_hartree_gtemp, (/1, 0, 0/))
441 CALL pw_transfer(v_hartree_gtemp, v_hartree_rtemp)
442 CALL pw_copy(v_hartree_rtemp, pwx)
443
444 CALL pw_copy(v_hartree_gspace, v_hartree_gtemp)
445 CALL pw_derive(v_hartree_gtemp, (/0, 1, 0/))
446 CALL pw_transfer(v_hartree_gtemp, v_hartree_rtemp)
447 CALL pw_copy(v_hartree_rtemp, pwy)
448
449 CALL pw_copy(v_hartree_gspace, v_hartree_gtemp)
450 CALL pw_derive(v_hartree_gtemp, (/0, 0, 1/))
451 CALL pw_transfer(v_hartree_gtemp, v_hartree_rtemp)
452 CALL pw_copy(v_hartree_rtemp, pwz)
453
454 CALL auxbas_pw_pool%give_back_pw(v_hartree_gspace)
455 CALL auxbas_pw_pool%give_back_pw(v_hartree_gtemp)
456 CALL auxbas_pw_pool%give_back_pw(v_hartree_rtemp)
457 CALL auxbas_pw_pool%give_back_pw(rho_tot_gspace)
458
459! -------------------------------------
460! Add Coulomb potential
461! -------------------------------------
462
463 DO ikind = 1, nkind ! loop over atom types
464
465 NULLIFY (atom_list)
466 NULLIFY (grid_atom)
467 NULLIFY (harmonics)
468
469 CALL get_atomic_kind(atomic_kind_set(ikind), atom_list=atom_list, natom=natom)
470 CALL get_qs_kind(qs_kind_set(ikind), &
471 grid_atom=grid_atom, &
472 harmonics=harmonics, &
473 hard_radius=hard_radius, &
474 gth_potential=gth_potential, &
475 sgp_potential=sgp_potential, &
476 all_potential=all_potential, &
477 cneo_potential=cneo_potential, &
478 paw_atom=paw_atom)
479
480 IF (ASSOCIATED(gth_potential)) THEN
481
482 NULLIFY (cexp_ppl)
483
484 CALL get_potential(potential=gth_potential, &
485 zeff=charge, &
486 alpha_ppl=alpha, &
487 nexp_ppl=nexp_ppl, &
488 cexp_ppl=cexp_ppl)
489
490 sqrt_alpha = sqrt(alpha)
491
492 IF (gapw .AND. paw_atom .AND. alpha > gapw_max_alpha) THEN
493 make_soft = .true.
494 ELSE
495 make_soft = .false.
496 END IF
497
498 ! -------------------------------------
499 ! PW grid part
500 ! -------------------------------------
501
502 IF (gth_gspace) THEN
503
504 CALL auxbas_pw_pool%create_pw(v_coulomb_gspace)
505 CALL auxbas_pw_pool%create_pw(v_coulomb_gtemp)
506 CALL auxbas_pw_pool%create_pw(v_coulomb_rtemp)
507
508 CALL pw_zero(v_coulomb_gspace)
509
510 DO iat = 1, natom ! natom = # atoms for ikind
511
512 iatom = atom_list(iat)
513 ratom = particle_set(iatom)%r
514
515 DO ig = v_coulomb_gspace%pw_grid%first_gne0, v_coulomb_gspace%pw_grid%ngpts_cut_local
516 gtemp = 0.0_dp
517 ! gtemp = - fourpi * charge / cell%deth * &
518 ! EXP ( - v_coulomb_gspace%pw_grid%gsq(ig) / (4.0_dp * alpha) ) &
519 ! / v_coulomb_gspace%pw_grid%gsq(ig)
520
521 IF (.NOT. make_soft) THEN
522
523 SELECT CASE (nexp_ppl)
524 CASE (1)
525 gtemp = gtemp + &
526 (twopi)**(1.5_dp)/(cell%deth*(2.0_dp*alpha)**(1.5_dp))* &
527 exp(-v_coulomb_gspace%pw_grid%gsq(ig)/(4.0_dp*alpha))*( &
528 ! C1
529 +cexp_ppl(1) &
530 )
531 CASE (2)
532 gtemp = gtemp + &
533 (twopi)**(1.5_dp)/(cell%deth*(2.0_dp*alpha)**(1.5_dp))* &
534 exp(-v_coulomb_gspace%pw_grid%gsq(ig)/(4.0_dp*alpha))*( &
535 ! C1
536 +cexp_ppl(1) &
537 ! C2
538 + cexp_ppl(2)/(2.0_dp*alpha)* &
539 (3.0_dp - v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha)) &
540 )
541 CASE (3)
542 gtemp = gtemp + &
543 (twopi)**(1.5_dp)/(cell%deth*(2.0_dp*alpha)**(1.5_dp))* &
544 exp(-v_coulomb_gspace%pw_grid%gsq(ig)/(4.0_dp*alpha))*( &
545 ! C1
546 +cexp_ppl(1) &
547 ! C2
548 + cexp_ppl(2)/(2.0_dp*alpha)* &
549 (3.0_dp - v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha)) &
550 ! C3
551 + cexp_ppl(3)/(2.0_dp*alpha)**2* &
552 (15.0_dp - 10.0_dp*v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha) &
553 + (v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha))**2) &
554 )
555 CASE (4)
556 gtemp = gtemp + &
557 (twopi)**(1.5_dp)/(cell%deth*(2.0_dp*alpha)**(1.5_dp))* &
558 exp(-v_coulomb_gspace%pw_grid%gsq(ig)/(4.0_dp*alpha))*( &
559 ! C1
560 +cexp_ppl(1) &
561 ! C2
562 + cexp_ppl(2)/(2.0_dp*alpha)* &
563 (3.0_dp - v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha)) &
564 ! C3
565 + cexp_ppl(3)/(2.0_dp*alpha)**2* &
566 (15.0_dp - 10.0_dp*v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha) &
567 + (v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha))**2) &
568 ! C4
569 + cexp_ppl(4)/(2.0_dp*alpha)**3* &
570 (105.0_dp - 105.0_dp*v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha) &
571 + 21.0_dp*(v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha))**2 &
572 - (v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha))**3) &
573 )
574 END SELECT
575
576 END IF
577
578 arg = dot_product(v_coulomb_gspace%pw_grid%g(:, ig), ratom)
579
580 gtemp = gtemp*cmplx(cos(arg), -sin(arg), kind=dp)
581 v_coulomb_gspace%array(ig) = v_coulomb_gspace%array(ig) + gtemp
582 END DO
583 IF (v_coulomb_gspace%pw_grid%have_g0) v_coulomb_gspace%array(1) = 0.0_dp
584
585 END DO
586
587 CALL pw_copy(v_coulomb_gspace, v_coulomb_gtemp)
588 CALL pw_derive(v_coulomb_gtemp, (/1, 0, 0/))
589 CALL pw_transfer(v_coulomb_gtemp, v_coulomb_rtemp)
590 CALL pw_axpy(v_coulomb_rtemp, pwx)
591
592 CALL pw_copy(v_coulomb_gspace, v_coulomb_gtemp)
593 CALL pw_derive(v_coulomb_gtemp, (/0, 1, 0/))
594 CALL pw_transfer(v_coulomb_gtemp, v_coulomb_rtemp)
595 CALL pw_axpy(v_coulomb_rtemp, pwy)
596
597 CALL pw_copy(v_coulomb_gspace, v_coulomb_gtemp)
598 CALL pw_derive(v_coulomb_gtemp, (/0, 0, 1/))
599 CALL pw_transfer(v_coulomb_gtemp, v_coulomb_rtemp)
600 CALL pw_axpy(v_coulomb_rtemp, pwz)
601
602 CALL auxbas_pw_pool%give_back_pw(v_coulomb_gspace)
603 CALL auxbas_pw_pool%give_back_pw(v_coulomb_gtemp)
604 CALL auxbas_pw_pool%give_back_pw(v_coulomb_rtemp)
605 ELSE
606
607 ! Attic of the atomic parallellisation
608 !
609 ! bo(2)
610 ! bo = get_limit(natom, para_env%num_pe, para_env%mepos)
611 ! DO iat = bo(1),bo(2) ! natom = # atoms for ikind
612 ! DO ix = lbound(pwx%array,1), ubound(pwx%array,1)
613 ! DO iy = lbound(pwx%array,2), ubound(pwx%array,2)
614 ! DO iz = lbound(pwx%array,3), ubound(pwx%array,3)
615
616 bo = pwx%pw_grid%bounds_local
617
618 DO iat = 1, natom ! natom = # atoms for ikind
619
620 iatom = atom_list(iat)
621 ratom = particle_set(iatom)%r
622
623 DO ix = bo(1, 1), bo(2, 1)
624 DO iy = bo(1, 2), bo(2, 2)
625 DO iz = bo(1, 3), bo(2, 3)
626 rpoint = (/real(ix, dp)*pwx%pw_grid%dr(1), &
627 REAL(iy, dp)*pwx%pw_grid%dr(2), &
628 REAL(iz, dp)*pwx%pw_grid%dr(3)/)
629 rpoint = rpoint + roffset
630 rap = rpoint - ratom
631 rap(1) = modulo(rap(1), cell%hmat(1, 1)) - cell%hmat(1, 1)/2._dp
632 rap(2) = modulo(rap(2), cell%hmat(2, 2)) - cell%hmat(2, 2)/2._dp
633 rap(3) = modulo(rap(3), cell%hmat(3, 3)) - cell%hmat(3, 3)/2._dp
634 sqrt_rap = sqrt(dot_product(rap, rap))
635 exp_rap = exp(-alpha*sqrt_rap**2)
636 sqrt_rap = max(sqrt_rap, 1.e-10_dp)
637 ! d_x
638
639 pwx%array(ix, iy, iz) = pwx%array(ix, iy, iz) + charge*( &
640 -2.0_dp*sqrt_alpha*exp(-sqrt_rap**2*sqrt_alpha**2)*rap(1) &
641 /(rootpi*sqrt_rap**2) &
642 + erf(sqrt_rap*sqrt_alpha)*rap(1) &
643 /sqrt_rap**3)
644
645 ! d_y
646
647 pwy%array(ix, iy, iz) = pwy%array(ix, iy, iz) + charge*( &
648 -2.0_dp*sqrt_alpha*exp(-sqrt_rap**2*sqrt_alpha**2)*rap(2) &
649 /(rootpi*sqrt_rap**2) &
650 + erf(sqrt_rap*sqrt_alpha)*rap(2) &
651 /sqrt_rap**3)
652
653 ! d_z
654
655 pwz%array(ix, iy, iz) = pwz%array(ix, iy, iz) + charge*( &
656 -2.0_dp*sqrt_alpha*exp(-sqrt_rap**2*sqrt_alpha**2)*rap(3) &
657 /(rootpi*sqrt_rap**2) &
658 + erf(sqrt_rap*sqrt_alpha)*rap(3) &
659 /sqrt_rap**3)
660
661 IF (make_soft) cycle
662
663 ! d_x
664
665 DO iexp = 1, nexp_ppl
666 pwx%array(ix, iy, iz) = pwx%array(ix, iy, iz) + ( &
667 -2.0_dp*alpha*rap(1)*exp_rap* &
668 cexp_ppl(iexp)*(sqrt_rap**2)**(iexp - 1))
669 IF (iexp > 1) THEN
670 pwx%array(ix, iy, iz) = pwx%array(ix, iy, iz) + ( &
671 2.0_dp*exp_rap*cexp_ppl(iexp)* &
672 (sqrt_rap**2)**(iexp - 2)*real(iexp - 1, dp)*rap(1))
673 END IF
674 END DO
675
676 ! d_y
677
678 DO iexp = 1, nexp_ppl
679 pwy%array(ix, iy, iz) = pwy%array(ix, iy, iz) + ( &
680 -2.0_dp*alpha*rap(2)*exp_rap* &
681 cexp_ppl(iexp)*(sqrt_rap**2)**(iexp - 1))
682 IF (iexp > 1) THEN
683 pwy%array(ix, iy, iz) = pwy%array(ix, iy, iz) + ( &
684 2.0_dp*exp_rap*cexp_ppl(iexp)* &
685 (sqrt_rap**2)**(iexp - 2)*real(iexp - 1, dp)*rap(2))
686 END IF
687 END DO
688
689 ! d_z
690
691 DO iexp = 1, nexp_ppl
692 pwz%array(ix, iy, iz) = pwz%array(ix, iy, iz) + ( &
693 -2.0_dp*alpha*rap(3)*exp_rap* &
694 cexp_ppl(iexp)*(sqrt_rap**2)**(iexp - 1))
695 IF (iexp > 1) THEN
696 pwz%array(ix, iy, iz) = pwz%array(ix, iy, iz) + ( &
697 2.0_dp*exp_rap*cexp_ppl(iexp)* &
698 (sqrt_rap**2)**(iexp - 2)*real(iexp - 1, dp)*rap(3))
699 END IF
700 END DO
701
702 END DO ! iz
703 END DO ! iy
704 END DO ! ix
705 END DO ! iat
706 END IF ! gth_gspace
707
708 ! -------------------------------------
709 ! Atomic grids part
710 ! -------------------------------------
711
712 IF (gapw .AND. paw_atom) THEN
713
714 bo_atom = get_limit(natom, para_env%num_pe, para_env%mepos)
715
716 DO iat = bo_atom(1), bo_atom(2) ! natom = # atoms for ikind
717
718 iatom = atom_list(iat)
719
720 nablavks_vec_rad_h => nablavks_atom_set(iatom)%nablavks_vec_rad_h
721 nablavks_vec_rad_s => nablavks_atom_set(iatom)%nablavks_vec_rad_s
722
723 DO ir = 1, grid_atom%nr
724
725 IF (grid_atom%rad(ir) >= hard_radius) cycle
726
727 exp_rap = exp(-alpha*grid_atom%rad(ir)**2)
728
729 DO ia = 1, grid_atom%ng_sphere
730
731 DO idir = 1, 3
732 hard_value = 0.0_dp
733 hard_value = charge*( &
734 -2.0_dp*sqrt_alpha*exp(-grid_atom%rad(ir)**2*sqrt_alpha**2) &
735 *grid_atom%rad(ir)*harmonics%a(idir, ia) &
736 /(rootpi*grid_atom%rad(ir)**2) &
737 + erf(grid_atom%rad(ir)*sqrt_alpha) &
738 *grid_atom%rad(ir)*harmonics%a(idir, ia) &
739 /grid_atom%rad(ir)**3)
740 soft_value = hard_value
741 DO iexp = 1, nexp_ppl
742 hard_value = hard_value + ( &
743 -2.0_dp*alpha*grid_atom%rad(ir)*harmonics%a(idir, ia) &
744 *exp_rap*cexp_ppl(iexp)*(grid_atom%rad(ir)**2)**(iexp - 1))
745 IF (iexp > 1) THEN
746 hard_value = hard_value + ( &
747 2.0_dp*exp_rap*cexp_ppl(iexp) &
748 *(grid_atom%rad(ir)**2)**(iexp - 2)*real(iexp - 1, dp) &
749 *grid_atom%rad(ir)*harmonics%a(idir, ia))
750 END IF
751 END DO
752 nablavks_vec_rad_h(idir, 1)%r_coef(ir, ia) = &
753 nablavks_vec_rad_h(idir, 1)%r_coef(ir, ia) + hard_value
754 IF (make_soft) THEN
755 nablavks_vec_rad_s(idir, 1)%r_coef(ir, ia) = &
756 nablavks_vec_rad_s(idir, 1)%r_coef(ir, ia) + soft_value
757 ELSE
758 nablavks_vec_rad_s(idir, 1)%r_coef(ir, ia) = &
759 nablavks_vec_rad_s(idir, 1)%r_coef(ir, ia) + hard_value
760 END IF
761 END DO
762
763 END DO ! ia
764 END DO ! ir
765
766 DO ispin = 2, nspins
767 DO idir = 1, 3
768 nablavks_vec_rad_h(idir, ispin)%r_coef(:, :) = nablavks_vec_rad_h(idir, 1)%r_coef(:, :)
769 nablavks_vec_rad_s(idir, ispin)%r_coef(:, :) = nablavks_vec_rad_s(idir, 1)%r_coef(:, :)
770 END DO
771 END DO
772
773 END DO
774
775 END IF
776
777 ELSE IF (ASSOCIATED(sgp_potential)) THEN
778
779 cpabort("EPR with SGP potentials is not implemented")
780
781 ELSE IF (ASSOCIATED(cneo_potential)) THEN
782
783 cpabort("EPR with CNEO potentials is not implemented")
784
785 ELSE IF (ASSOCIATED(all_potential)) THEN
786
787 CALL get_potential(potential=all_potential, &
788 alpha_core_charge=alpha, &
789 zeff=charge)
790
791 sqrt_alpha = sqrt(alpha)
792
793 ! -------------------------------------
794 ! Atomic grids part
795 ! -------------------------------------
796
797 bo_atom = get_limit(natom, para_env%num_pe, para_env%mepos)
798
799 DO iat = bo_atom(1), bo_atom(2) ! natom = # atoms for ikind
800
801 iatom = atom_list(iat)
802
803 nablavks_vec_rad_h => nablavks_atom_set(iatom)%nablavks_vec_rad_h
804
805 DO ir = 1, grid_atom%nr
806
807 IF (grid_atom%rad(ir) >= hard_radius) cycle
808
809 DO ia = 1, grid_atom%ng_sphere
810
811 DO idir = 1, 3
812 hard_value = 0.0_dp
813 hard_value = charge*( &
814 2.0_dp*sqrt_alpha*exp(-grid_atom%rad(ir)**2*sqrt_alpha**2) &
815 *grid_atom%rad(ir)*harmonics%a(idir, ia) &
816 /(rootpi*grid_atom%rad(ir)**2) &
817 + erfc(grid_atom%rad(ir)*sqrt_alpha) &
818 *grid_atom%rad(ir)*harmonics%a(idir, ia) &
819 /grid_atom%rad(ir)**3)
820 nablavks_vec_rad_h(idir, 1)%r_coef(ir, ia) = &
821 nablavks_vec_rad_h(idir, 1)%r_coef(ir, ia) + hard_value
822 END DO
823
824 END DO ! ia
825 END DO ! ir
826
827 DO ispin = 2, nspins
828 DO idir = 1, 3
829 nablavks_vec_rad_h(idir, ispin)%r_coef(:, :) = nablavks_vec_rad_h(idir, 1)%r_coef(:, :)
830 END DO
831 END DO
832
833 END DO
834
835 ELSE
836 cycle
837 END IF
838
839 END DO
840
841 DO idir = 1, 3
842 CALL qs_rho_get(nablavks_set(idir, 1)%rho, rho_r=rho1_r)
843 CALL qs_rho_get(nablavks_set(idir, 2)%rho, rho_r=rho2_r)
844 CALL pw_copy(rho1_r(1), rho2_r(1))
845 END DO
846
847! -------------------------------------
848! Add V_xc potential
849! -------------------------------------
850
851 CALL auxbas_pw_pool%create_pw(v_xc_gtemp)
852 CALL auxbas_pw_pool%create_pw(v_xc_rtemp)
853
854 xc_section => section_vals_get_subs_vals(input, "PROPERTIES%LINRES%EPR%PRINT%G_TENSOR%XC")
855 ! a possible vdW section in xc_section will be ignored
856
857 IF (gapw_xc) THEN
858 CALL qs_vxc_create(ks_env=ks_env, rho_struct=rho_xc, xc_section=xc_section, &
859 vxc_rho=v_rspace_new, vxc_tau=v_tau_rspace, exc=exc, just_energy=.false.)
860 ELSE
861 CALL qs_vxc_create(ks_env=ks_env, rho_struct=rho, xc_section=xc_section, &
862 vxc_rho=v_rspace_new, vxc_tau=v_tau_rspace, exc=exc, just_energy=.false.)
863 END IF
864
865 IF (ASSOCIATED(v_rspace_new)) THEN
866
867 DO ispin = 1, nspins
868
869 CALL pw_transfer(v_rspace_new(ispin), v_xc_gtemp)
870 CALL pw_derive(v_xc_gtemp, (/1, 0, 0/))
871 CALL pw_transfer(v_xc_gtemp, v_xc_rtemp)
872 CALL qs_rho_get(nablavks_set(1, ispin)%rho, rho_r=rho_r)
873 CALL pw_axpy(v_xc_rtemp, rho_r(1))
874
875 CALL pw_transfer(v_rspace_new(ispin), v_xc_gtemp)
876 CALL pw_derive(v_xc_gtemp, (/0, 1, 0/))
877 CALL pw_transfer(v_xc_gtemp, v_xc_rtemp)
878 CALL qs_rho_get(nablavks_set(2, ispin)%rho, rho_r=rho_r)
879 CALL pw_axpy(v_xc_rtemp, rho_r(1))
880
881 CALL pw_transfer(v_rspace_new(ispin), v_xc_gtemp)
882 CALL pw_derive(v_xc_gtemp, (/0, 0, 1/))
883 CALL pw_transfer(v_xc_gtemp, v_xc_rtemp)
884 CALL qs_rho_get(nablavks_set(3, ispin)%rho, rho_r=rho_r)
885 CALL pw_axpy(v_xc_rtemp, rho_r(1))
886
887 CALL auxbas_pw_pool%give_back_pw(v_rspace_new(ispin))
888
889 END DO
890
891 DEALLOCATE (v_rspace_new)
892 END IF
893
894 IF (ASSOCIATED(v_tau_rspace)) THEN
895
896 DO ispin = 1, nspins
897
898 CALL pw_transfer(v_tau_rspace(ispin), v_xc_gtemp)
899 CALL pw_derive(v_xc_gtemp, (/1, 0, 0/))
900 CALL pw_transfer(v_xc_gtemp, v_xc_rtemp)
901 CALL qs_rho_get(nablavks_set(1, ispin)%rho, rho_r=rho_r)
902 CALL pw_axpy(v_xc_rtemp, rho_r(1))
903
904 CALL pw_transfer(v_tau_rspace(ispin), v_xc_gtemp)
905 CALL pw_derive(v_xc_gtemp, (/0, 1, 0/))
906 CALL pw_transfer(v_xc_gtemp, v_xc_rtemp)
907 CALL qs_rho_get(nablavks_set(2, ispin)%rho, rho_r=rho_r)
908 CALL pw_axpy(v_xc_rtemp, rho_r(1))
909
910 CALL pw_transfer(v_tau_rspace(ispin), v_xc_gtemp)
911 CALL pw_derive(v_xc_gtemp, (/0, 0, 1/))
912 CALL pw_transfer(v_xc_gtemp, v_xc_rtemp)
913 CALL qs_rho_get(nablavks_set(3, ispin)%rho, rho_r=rho_r)
914 CALL pw_axpy(v_xc_rtemp, rho_r(1))
915
916 CALL auxbas_pw_pool%give_back_pw(v_tau_rspace(ispin))
917
918 END DO
919
920 DEALLOCATE (v_tau_rspace)
921 END IF
922
923 CALL auxbas_pw_pool%give_back_pw(v_xc_gtemp)
924 CALL auxbas_pw_pool%give_back_pw(v_xc_rtemp)
925
926 IF (gapw .OR. gapw_xc) THEN
927 CALL calculate_vxc_atom(qs_env=qs_env, energy_only=.false., exc1=exc1, &
928 gradient_atom_set=nablavks_atom_set)
929 END IF
930
931! -------------------------------------
932! Write Nabla V_KS (local) to cubes
933! -------------------------------------
934
935 IF (btest(cp_print_key_should_output(logger%iter_info, lr_section, &
936 "EPR%PRINT%NABLAVKS_CUBES"), cp_p_file)) THEN
937 CALL auxbas_pw_pool%create_pw(wf_r)
938 DO idir = 1, 3
939 CALL pw_zero(wf_r)
940 CALL qs_rho_get(nablavks_set(idir, 1)%rho, rho_r=rho_r)
941 CALL pw_copy(rho_r(1), wf_r) ! RA
942 filename = "nablavks"
943 mpi_io = .true.
944 WRITE (ext, '(a2,I1,a5)') "_d", idir, ".cube"
945 unit_nr = cp_print_key_unit_nr(logger, lr_section, "EPR%PRINT%NABLAVKS_CUBES", &
946 extension=trim(ext), middle_name=trim(filename), &
947 log_filename=.false., file_position="REWIND", &
948 mpi_io=mpi_io)
949 CALL cp_pw_to_cube(wf_r, unit_nr, "NABLA V_KS ", &
950 particles=particles, &
951 stride=section_get_ivals(lr_section, &
952 "EPR%PRINT%NABLAVKS_CUBES%STRIDE"), &
953 mpi_io=mpi_io)
954 CALL cp_print_key_finished_output(unit_nr, logger, lr_section, &
955 "EPR%PRINT%NABLAVKS_CUBES", mpi_io=mpi_io)
956 END DO
957 CALL auxbas_pw_pool%give_back_pw(wf_r)
958 END IF
959
960 CALL cp_print_key_finished_output(output_unit, logger, lr_section, &
961 "PRINT%PROGRAM_RUN_INFO")
962
963 END SUBROUTINE epr_nablavks
964
965END MODULE qs_linres_epr_nablavks
966
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
Handles all functions related to the CELL.
Definition cell_types.F:15
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
various routines to log and control the output. The idea is that decisions about where to log should ...
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,...
integer, parameter, public cp_p_file
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
A wrapper around pw_to_cube() which accepts particle_list_type.
subroutine, public cp_pw_to_cube(pw, unit_nr, title, particles, stride, zero_tails, silent, mpi_io)
...
Definition of the atomic potential types.
subroutine, public calculate_vh_1center(vrad_h, vrad_s, rrad_h, rrad_s, rrad_0, rrad_z, grid_atom)
Calculates Hartree potential for hard and soft densities (including nuclear charge and compensation c...
objects that represent the structure of input sections and the data contained in an input section
integer function, dimension(:), pointer, public section_get_ivals(section_vals, keyword_name)
...
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_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
integer, parameter, public default_string_length
Definition kinds.F:57
Definition of mathematical constants and functions.
real(kind=dp), parameter, public rootpi
real(kind=dp), parameter, public twopi
Interface to the message passing library MPI.
represent a simple array based list of the given type
Define the data structure for the particle information.
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
subroutine, public pw_derive(pw, n)
Calculate the derivative of a plane wave vector.
functions related to the poisson solver on regular grids
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
Types used by CNEO-DFT (see J. Chem. Theory Comput. 2025, 21, 16, 7865–7877)
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 prepare_gapw_den(qs_env, local_rho_set, do_rho0, kind_set_external, pw_env_sub)
...
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, cneo_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
routines that build the Kohn-Sham matrix (i.e calculate the coulomb and xc parts
subroutine, public calc_rho_tot_gspace(rho_tot_gspace, qs_env, rho, skip_nuclear_density)
...
Calculates Nabla V_KS (local part if PSP) on the different grids.
subroutine, public epr_nablavks(epr_env, qs_env)
Evaluates Nabla V_KS on the grids.
Type definitiona for linear response calculations.
subroutine, public get_epr_env(epr_env, g_total, g_so, g_soo, nablavks_set, nablavks_atom_set, bind_set, bind_atom_set)
...
Define the neighbor list data types and the corresponding functionality.
subroutine, public calculate_rho_atom_coeff(qs_env, rho_ao, rho_atom_set, qs_kind_set, oce, sab, para_env)
...
subroutine, public get_rho_atom(rho_atom, cpc_h, cpc_s, rho_rad_h, rho_rad_s, drho_rad_h, drho_rad_s, vrho_rad_h, vrho_rad_s, rho_rad_h_d, rho_rad_s_d, ga_vlocal_gb_h, ga_vlocal_gb_s, int_scr_h, int_scr_s)
...
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...
types that represent a quickstep subsys
subroutine, public qs_subsys_get(subsys, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell, cell_ref, use_ref_cell, energy, force, qs_kind_set, cp_subsys, nelectron_total, nelectron_spin)
...
routines that build the integrals of the Vxc potential calculated for the atomic density in the basis...
Definition qs_vxc_atom.F:12
subroutine, public calculate_vxc_atom(qs_env, energy_only, exc1, gradient_atom_set, adiabatic_rescale_factor, kind_set_external, rho_atom_set_external, xc_section_external)
...
Definition qs_vxc_atom.F:85
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)
calculates and allocates the xc potential, already reducing it to the dependence on rho and the one o...
Definition qs_vxc.F:98
All kind of helpful little routines.
Definition util.F:14
pure integer function, dimension(2), public get_limit(m, n, me)
divide m entries into n parts, return size of part me
Definition util.F:333
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
Definition cell_types.F:55
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment
contained for different pw related things
environment for the poisson solver
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
Provides all information about a quickstep kind.
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...
keeps the density in various representations, keeping track of which ones are valid.