(git:374b731)
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-2024 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
21 USE cp_output_handling, ONLY: cp_p_file,&
26 USE dbcsr_api, ONLY: dbcsr_p_type
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,&
60 USE qs_kind_types, ONLY: get_qs_kind,&
64 USE qs_linres_types, ONLY: epr_env_type,&
67! R0
76! R0
77 USE qs_rho_types, ONLY: qs_rho_get,&
82 USE qs_vxc, ONLY: qs_vxc_create
84 USE util, ONLY: get_limit
85#include "./base/base_uses.f90"
86
87 IMPLICIT NONE
88
89 PRIVATE
90 PUBLIC :: epr_nablavks
91
92 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_linres_epr_nablavks'
93
94CONTAINS
95
96! **************************************************************************************************
97!> \brief Evaluates Nabla V_KS on the grids
98!> \param epr_env ...
99!> \param qs_env ...
100!> \par History
101!> 06.2006 created [RD]
102!> \author RD
103! **************************************************************************************************
104 SUBROUTINE epr_nablavks(epr_env, qs_env)
105
106 TYPE(epr_env_type) :: epr_env
107 TYPE(qs_environment_type), POINTER :: qs_env
108
109 CHARACTER(LEN=default_string_length) :: ext, filename
110 COMPLEX(KIND=dp) :: gtemp
111 INTEGER :: bo_atom(2), ia, iat, iatom, idir, iexp, &
112 ig, ikind, ir, iso, ispin, ix, iy, iz, &
113 natom, nexp_ppl, nkind, nspins, &
114 output_unit, unit_nr
115 INTEGER, DIMENSION(2, 3) :: bo
116 INTEGER, DIMENSION(:), POINTER :: atom_list
117 LOGICAL :: gapw, gapw_xc, gth_gspace, ionode, &
118 make_soft, mpi_io, paw_atom
119 REAL(kind=dp) :: alpha, alpha_core, arg, charge, ehartree, exc, exc1, exp_rap, &
120 gapw_max_alpha, hard_radius, hard_value, soft_value, sqrt_alpha, sqrt_rap
121 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: vh1_rad_h, vh1_rad_s
122 REAL(kind=dp), DIMENSION(3) :: rap, ratom, roffset, rpoint
123 REAL(kind=dp), DIMENSION(:), POINTER :: cexp_ppl, rho_rad_z
124 REAL(kind=dp), DIMENSION(:, :), POINTER :: rho_rad_0
125 TYPE(all_potential_type), POINTER :: all_potential
126 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
127 TYPE(cell_type), POINTER :: cell
128 TYPE(cp_logger_type), POINTER :: logger
129 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: rho_ao
130 TYPE(dft_control_type), POINTER :: dft_control
131 TYPE(grid_atom_type), POINTER :: grid_atom
132 TYPE(gth_potential_type), POINTER :: gth_potential
133 TYPE(harmonics_atom_type), POINTER :: harmonics
134 TYPE(mp_para_env_type), POINTER :: para_env
135 TYPE(nablavks_atom_type), DIMENSION(:), POINTER :: nablavks_atom_set
136 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
137 POINTER :: sab
138 TYPE(oce_matrix_type), POINTER :: oce
139 TYPE(particle_list_type), POINTER :: particles
140 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
141 TYPE(pw_c1d_gs_type) :: rho_tot_gspace, v_coulomb_gspace, &
142 v_coulomb_gtemp, v_hartree_gspace, &
143 v_hartree_gtemp, v_xc_gtemp
144 TYPE(pw_env_type), POINTER :: pw_env
145 TYPE(pw_poisson_type), POINTER :: poisson_env
146 TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
147 TYPE(pw_r3d_rs_type) :: v_coulomb_rtemp, v_hartree_rtemp, &
148 v_xc_rtemp, wf_r
149 TYPE(pw_r3d_rs_type), DIMENSION(:), POINTER :: rho1_r, rho2_r, rho_r, v_rspace_new, &
150 v_tau_rspace
151 TYPE(pw_r3d_rs_type), POINTER :: pwx, pwy, pwz
152 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
153 TYPE(qs_ks_env_type), POINTER :: ks_env
154 TYPE(qs_rho_p_type), DIMENSION(:, :), POINTER :: nablavks_set
155 TYPE(qs_rho_type), POINTER :: rho, rho_xc
156 TYPE(qs_subsys_type), POINTER :: subsys
157 TYPE(rho0_atom_type), DIMENSION(:), POINTER :: rho0_atom_set
158 TYPE(rho_atom_coeff), DIMENSION(:), POINTER :: rho_rad_h, rho_rad_s
159 TYPE(rho_atom_coeff), DIMENSION(:, :), POINTER :: nablavks_vec_rad_h, nablavks_vec_rad_s
160 TYPE(rho_atom_type), DIMENSION(:), POINTER :: rho_atom_set
161 TYPE(rho_atom_type), POINTER :: rho_atom
162 TYPE(rhoz_type), DIMENSION(:), POINTER :: rhoz_set
163 TYPE(section_vals_type), POINTER :: g_section, input, lr_section, xc_section
164 TYPE(sgp_potential_type), POINTER :: sgp_potential
165
166! R0
167! R0
168! R0
169! R0
170! R0
171! R0
172
173 NULLIFY (auxbas_pw_pool)
174 NULLIFY (cell)
175 NULLIFY (dft_control)
176 NULLIFY (g_section)
177 NULLIFY (logger)
178 NULLIFY (lr_section)
179 NULLIFY (nablavks_set)
180 NULLIFY (nablavks_atom_set) ! R0
181 NULLIFY (nablavks_vec_rad_h) ! R0
182 NULLIFY (nablavks_vec_rad_s) ! R0
183 NULLIFY (para_env)
184 NULLIFY (particle_set)
185 NULLIFY (particles)
186 NULLIFY (poisson_env)
187 NULLIFY (pw_env)
188 NULLIFY (pwx) ! R0
189 NULLIFY (pwy) ! R0
190 NULLIFY (pwz) ! R0
191 NULLIFY (rho)
192 NULLIFY (rho_xc)
193 NULLIFY (rho0_atom_set)
194 NULLIFY (rho_atom_set)
195 NULLIFY (rhoz_set)
196 NULLIFY (subsys)
197 NULLIFY (v_rspace_new)
198 NULLIFY (v_tau_rspace)
199 NULLIFY (xc_section)
200 NULLIFY (input)
201 NULLIFY (ks_env)
202 NULLIFY (rho_r, rho_ao, rho1_r, rho2_r)
203 NULLIFY (oce, qs_kind_set, sab)
204
205 logger => cp_get_default_logger()
206 lr_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%LINRES")
207 ionode = logger%para_env%is_source()
208
209 output_unit = cp_print_key_unit_nr(logger, lr_section, "PRINT%PROGRAM_RUN_INFO", &
210 extension=".linresLog")
211
212! -------------------------------------
213! Read settings
214! -------------------------------------
215
216 g_section => section_vals_get_subs_vals(lr_section, &
217 "EPR%PRINT%G_TENSOR")
218
219 CALL section_vals_val_get(g_section, "gapw_max_alpha", r_val=gapw_max_alpha)
220
221 gth_gspace = .true.
222
223! -------------------------------------
224! Get nablavks arrays
225! -------------------------------------
226
227 CALL get_epr_env(epr_env, nablavks_set=nablavks_set, & ! R0
228 nablavks_atom_set=nablavks_atom_set) ! R0
229 ! R0
230
231 DO ispin = 1, SIZE(nablavks_set, 2)
232 DO idir = 1, SIZE(nablavks_set, 1)
233 CALL qs_rho_get(nablavks_set(idir, ispin)%rho, rho_r=rho_r)
234 CALL pw_zero(rho_r(1))
235 END DO
236 END DO
237
238 CALL qs_rho_get(nablavks_set(1, 1)%rho, rho_r=rho_r)
239 pwx => rho_r(1)
240 CALL qs_rho_get(nablavks_set(2, 1)%rho, rho_r=rho_r)
241 pwy => rho_r(1)
242 CALL qs_rho_get(nablavks_set(3, 1)%rho, rho_r=rho_r)
243 pwz => rho_r(1)
244
245 roffset = -real(modulo(pwx%pw_grid%npts, 2), dp)*pwx%pw_grid%dr/2.0_dp
246
247! -------------------------------------
248! Get grids / atom info
249! -------------------------------------
250
251 CALL get_qs_env(qs_env=qs_env, &
252 atomic_kind_set=atomic_kind_set, &
253 qs_kind_set=qs_kind_set, &
254 input=input, &
255 cell=cell, &
256 dft_control=dft_control, &
257 para_env=para_env, &
258 particle_set=particle_set, &
259 pw_env=pw_env, &
260 rho=rho, &
261 rho_xc=rho_xc, &
262 rho_atom_set=rho_atom_set, &
263 rho0_atom_set=rho0_atom_set, &
264 rhoz_set=rhoz_set, &
265 subsys=subsys, &
266 ks_env=ks_env, &
267 oce=oce, sab_orb=sab)
268
269 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool, &
270 poisson_env=poisson_env)
271
272 CALL qs_subsys_get(subsys, particles=particles)
273
274 gapw = dft_control%qs_control%gapw
275 gapw_xc = dft_control%qs_control%gapw_xc
276 nkind = SIZE(atomic_kind_set)
277 nspins = dft_control%nspins
278
279! -------------------------------------
280! Add Hartree potential
281! -------------------------------------
282
283 CALL auxbas_pw_pool%create_pw(v_hartree_gspace)
284 CALL auxbas_pw_pool%create_pw(v_hartree_gtemp)
285 CALL auxbas_pw_pool%create_pw(v_hartree_rtemp)
286 CALL auxbas_pw_pool%create_pw(rho_tot_gspace)
287
288 IF (gapw) THEN
289 ! need to rebuild the coeff !
290 CALL qs_rho_get(rho, rho_ao_kp=rho_ao)
291 CALL calculate_rho_atom_coeff(qs_env, rho_ao, rho_atom_set, qs_kind_set, oce, sab, para_env)
292
293 CALL prepare_gapw_den(qs_env, do_rho0=.true.)
294 END IF
295
296 CALL pw_zero(rho_tot_gspace)
297
298 CALL calc_rho_tot_gspace(rho_tot_gspace, qs_env, rho, &
299 skip_nuclear_density=.NOT. gapw)
300
301 CALL pw_poisson_solve(poisson_env, rho_tot_gspace, ehartree, &
302 v_hartree_gspace)
303
304 ! -------------------------------------
305 ! Atomic grids part
306 ! -------------------------------------
307
308 IF (gapw) THEN
309
310 DO ikind = 1, nkind ! loop over atom types
311
312 NULLIFY (atom_list)
313 NULLIFY (grid_atom)
314 NULLIFY (harmonics)
315 NULLIFY (rho_rad_z)
316
317 rho_rad_z => rhoz_set(ikind)%r_coef
318
319 CALL get_atomic_kind(atomic_kind_set(ikind), atom_list=atom_list, natom=natom)
320 CALL get_qs_kind(qs_kind_set(ikind), &
321 grid_atom=grid_atom, &
322 harmonics=harmonics, &
323 hard_radius=hard_radius, &
324 paw_atom=paw_atom, &
325 zeff=charge, &
326 alpha_core_charge=alpha_core)
327
328 IF (paw_atom) THEN
329
330 ALLOCATE (vh1_rad_h(grid_atom%nr, harmonics%max_iso_not0))
331 ALLOCATE (vh1_rad_s(grid_atom%nr, harmonics%max_iso_not0))
332
333 ! DO iat = 1, natom ! natom = # atoms for ikind
334 !
335 ! iatom = atom_list(iat)
336 ! ratom = particle_set(iatom)%r
337 !
338 ! DO ig = v_hartree_gspace%pw_grid%first_gne0,v_hartree_gspace%pw_grid%ngpts_cut_local
339 !
340 ! gtemp = fourpi * charge / cell%deth * &
341 ! EXP ( - v_hartree_gspace%pw_grid%gsq(ig) / (4.0_dp * alpha_core) ) &
342 ! / v_hartree_gspace%pw_grid%gsq(ig)
343 !
344 ! arg = DOT_PRODUCT(v_hartree_gspace%pw_grid%g(:,ig),ratom)
345 !
346 ! gtemp = gtemp * CMPLX(COS(arg),-SIN(arg),KIND=dp)
347 !
348 ! v_hartree_gspace%array(ig) = v_hartree_gspace%array(ig) + gtemp
349 ! END DO
350 ! IF ( v_hartree_gspace%pw_grid%have_g0 ) v_hartree_gspace%array(1) = 0.0_dp
351 !
352 ! END DO
353
354 bo_atom = get_limit(natom, para_env%num_pe, para_env%mepos)
355
356 DO iat = bo_atom(1), bo_atom(2) ! natomkind = # atoms for ikind
357
358 iatom = atom_list(iat)
359 ratom = particle_set(iatom)%r
360
361 nablavks_vec_rad_h => nablavks_atom_set(iatom)%nablavks_vec_rad_h
362 nablavks_vec_rad_s => nablavks_atom_set(iatom)%nablavks_vec_rad_s
363
364 DO ispin = 1, nspins
365 DO idir = 1, 3
366 nablavks_vec_rad_h(idir, ispin)%r_coef(:, :) = 0.0_dp
367 nablavks_vec_rad_s(idir, ispin)%r_coef(:, :) = 0.0_dp
368 END DO ! idir
369 END DO ! ispin
370
371 rho_atom => rho_atom_set(iatom)
372 NULLIFY (rho_rad_h, rho_rad_s, rho_rad_0)
373 CALL get_rho_atom(rho_atom=rho_atom, rho_rad_h=rho_rad_h, &
374 rho_rad_s=rho_rad_s)
375 rho_rad_0 => rho0_atom_set(iatom)%rho0_rad_h%r_coef
376 vh1_rad_h = 0.0_dp
377 vh1_rad_s = 0.0_dp
378
379 CALL calculate_vh_1center(vh1_rad_h, vh1_rad_s, rho_rad_h, rho_rad_s, rho_rad_0, rho_rad_z, grid_atom)
380
381 DO ir = 2, grid_atom%nr
382
383 IF (grid_atom%rad(ir) >= hard_radius) cycle
384
385 DO ia = 1, grid_atom%ng_sphere
386
387 ! hard part
388
389 DO idir = 1, 3
390 hard_value = 0.0_dp
391 DO iso = 1, harmonics%max_iso_not0
392 hard_value = hard_value + &
393 vh1_rad_h(ir, iso)*harmonics%dslm_dxyz(idir, ia, iso) + &
394 harmonics%slm(ia, iso)* &
395 (vh1_rad_h(ir - 1, iso) - vh1_rad_h(ir, iso))/ &
396 (grid_atom%rad(ir - 1) - grid_atom%rad(ir))* &
397 (harmonics%a(idir, ia))
398 END DO
399 nablavks_vec_rad_h(idir, 1)%r_coef(ir, ia) = hard_value
400 END DO
401
402 ! soft part
403
404 DO idir = 1, 3
405 soft_value = 0.0_dp
406 DO iso = 1, harmonics%max_iso_not0
407 soft_value = soft_value + &
408 vh1_rad_s(ir, iso)*harmonics%dslm_dxyz(idir, ia, iso) + &
409 harmonics%slm(ia, iso)* &
410 (vh1_rad_s(ir - 1, iso) - vh1_rad_s(ir, iso))/ &
411 (grid_atom%rad(ir - 1) - grid_atom%rad(ir))* &
412 (harmonics%a(idir, ia))
413 END DO
414 nablavks_vec_rad_s(idir, 1)%r_coef(ir, ia) = soft_value
415 END DO
416
417 END DO ! ia
418
419 END DO ! ir
420
421 DO idir = 1, 3
422 nablavks_vec_rad_h(idir, 2)%r_coef(:, :) = nablavks_vec_rad_h(idir, 1)%r_coef(:, :)
423 nablavks_vec_rad_s(idir, 2)%r_coef(:, :) = nablavks_vec_rad_s(idir, 1)%r_coef(:, :)
424 END DO
425
426 END DO ! iat
427
428 DEALLOCATE (vh1_rad_h)
429 DEALLOCATE (vh1_rad_s)
430
431 END IF ! paw_atom
432
433 END DO ! ikind
434
435 END IF ! gapw
436
437 CALL pw_copy(v_hartree_gspace, v_hartree_gtemp)
438 CALL pw_derive(v_hartree_gtemp, (/1, 0, 0/))
439 CALL pw_transfer(v_hartree_gtemp, v_hartree_rtemp)
440 CALL pw_copy(v_hartree_rtemp, pwx)
441
442 CALL pw_copy(v_hartree_gspace, v_hartree_gtemp)
443 CALL pw_derive(v_hartree_gtemp, (/0, 1, 0/))
444 CALL pw_transfer(v_hartree_gtemp, v_hartree_rtemp)
445 CALL pw_copy(v_hartree_rtemp, pwy)
446
447 CALL pw_copy(v_hartree_gspace, v_hartree_gtemp)
448 CALL pw_derive(v_hartree_gtemp, (/0, 0, 1/))
449 CALL pw_transfer(v_hartree_gtemp, v_hartree_rtemp)
450 CALL pw_copy(v_hartree_rtemp, pwz)
451
452 CALL auxbas_pw_pool%give_back_pw(v_hartree_gspace)
453 CALL auxbas_pw_pool%give_back_pw(v_hartree_gtemp)
454 CALL auxbas_pw_pool%give_back_pw(v_hartree_rtemp)
455 CALL auxbas_pw_pool%give_back_pw(rho_tot_gspace)
456
457! -------------------------------------
458! Add Coulomb potential
459! -------------------------------------
460
461 DO ikind = 1, nkind ! loop over atom types
462
463 NULLIFY (atom_list)
464 NULLIFY (grid_atom)
465 NULLIFY (harmonics)
466
467 CALL get_atomic_kind(atomic_kind_set(ikind), atom_list=atom_list, natom=natom)
468 CALL get_qs_kind(qs_kind_set(ikind), &
469 grid_atom=grid_atom, &
470 harmonics=harmonics, &
471 hard_radius=hard_radius, &
472 gth_potential=gth_potential, &
473 sgp_potential=sgp_potential, &
474 all_potential=all_potential, &
475 paw_atom=paw_atom)
476
477 IF (ASSOCIATED(gth_potential)) THEN
478
479 NULLIFY (cexp_ppl)
480
481 CALL get_potential(potential=gth_potential, &
482 zeff=charge, &
483 alpha_ppl=alpha, &
484 nexp_ppl=nexp_ppl, &
485 cexp_ppl=cexp_ppl)
486
487 sqrt_alpha = sqrt(alpha)
488
489 IF (gapw .AND. paw_atom .AND. alpha > gapw_max_alpha) THEN
490 make_soft = .true.
491 ELSE
492 make_soft = .false.
493 END IF
494
495 ! -------------------------------------
496 ! PW grid part
497 ! -------------------------------------
498
499 IF (gth_gspace) THEN
500
501 CALL auxbas_pw_pool%create_pw(v_coulomb_gspace)
502 CALL auxbas_pw_pool%create_pw(v_coulomb_gtemp)
503 CALL auxbas_pw_pool%create_pw(v_coulomb_rtemp)
504
505 CALL pw_zero(v_coulomb_gspace)
506
507 DO iat = 1, natom ! natom = # atoms for ikind
508
509 iatom = atom_list(iat)
510 ratom = particle_set(iatom)%r
511
512 DO ig = v_coulomb_gspace%pw_grid%first_gne0, v_coulomb_gspace%pw_grid%ngpts_cut_local
513 gtemp = 0.0_dp
514 ! gtemp = - fourpi * charge / cell%deth * &
515 ! EXP ( - v_coulomb_gspace%pw_grid%gsq(ig) / (4.0_dp * alpha) ) &
516 ! / v_coulomb_gspace%pw_grid%gsq(ig)
517
518 IF (.NOT. make_soft) THEN
519
520 SELECT CASE (nexp_ppl)
521 CASE (1)
522 gtemp = gtemp + &
523 (twopi)**(1.5_dp)/(cell%deth*(2.0_dp*alpha)**(1.5_dp))* &
524 exp(-v_coulomb_gspace%pw_grid%gsq(ig)/(4.0_dp*alpha))*( &
525 ! C1
526 +cexp_ppl(1) &
527 )
528 CASE (2)
529 gtemp = gtemp + &
530 (twopi)**(1.5_dp)/(cell%deth*(2.0_dp*alpha)**(1.5_dp))* &
531 exp(-v_coulomb_gspace%pw_grid%gsq(ig)/(4.0_dp*alpha))*( &
532 ! C1
533 +cexp_ppl(1) &
534 ! C2
535 + cexp_ppl(2)/(2.0_dp*alpha)* &
536 (3.0_dp - v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha)) &
537 )
538 CASE (3)
539 gtemp = gtemp + &
540 (twopi)**(1.5_dp)/(cell%deth*(2.0_dp*alpha)**(1.5_dp))* &
541 exp(-v_coulomb_gspace%pw_grid%gsq(ig)/(4.0_dp*alpha))*( &
542 ! C1
543 +cexp_ppl(1) &
544 ! C2
545 + cexp_ppl(2)/(2.0_dp*alpha)* &
546 (3.0_dp - v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha)) &
547 ! C3
548 + cexp_ppl(3)/(2.0_dp*alpha)**2* &
549 (15.0_dp - 10.0_dp*v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha) &
550 + (v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha))**2) &
551 )
552 CASE (4)
553 gtemp = gtemp + &
554 (twopi)**(1.5_dp)/(cell%deth*(2.0_dp*alpha)**(1.5_dp))* &
555 exp(-v_coulomb_gspace%pw_grid%gsq(ig)/(4.0_dp*alpha))*( &
556 ! C1
557 +cexp_ppl(1) &
558 ! C2
559 + cexp_ppl(2)/(2.0_dp*alpha)* &
560 (3.0_dp - v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha)) &
561 ! C3
562 + cexp_ppl(3)/(2.0_dp*alpha)**2* &
563 (15.0_dp - 10.0_dp*v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha) &
564 + (v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha))**2) &
565 ! C4
566 + cexp_ppl(4)/(2.0_dp*alpha)**3* &
567 (105.0_dp - 105.0_dp*v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha) &
568 + 21.0_dp*(v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha))**2 &
569 - (v_coulomb_gspace%pw_grid%gsq(ig)/(2.0_dp*alpha))**3) &
570 )
571 END SELECT
572
573 END IF
574
575 arg = dot_product(v_coulomb_gspace%pw_grid%g(:, ig), ratom)
576
577 gtemp = gtemp*cmplx(cos(arg), -sin(arg), kind=dp)
578 v_coulomb_gspace%array(ig) = v_coulomb_gspace%array(ig) + gtemp
579 END DO
580 IF (v_coulomb_gspace%pw_grid%have_g0) v_coulomb_gspace%array(1) = 0.0_dp
581
582 END DO
583
584 CALL pw_copy(v_coulomb_gspace, v_coulomb_gtemp)
585 CALL pw_derive(v_coulomb_gtemp, (/1, 0, 0/))
586 CALL pw_transfer(v_coulomb_gtemp, v_coulomb_rtemp)
587 CALL pw_axpy(v_coulomb_rtemp, pwx)
588
589 CALL pw_copy(v_coulomb_gspace, v_coulomb_gtemp)
590 CALL pw_derive(v_coulomb_gtemp, (/0, 1, 0/))
591 CALL pw_transfer(v_coulomb_gtemp, v_coulomb_rtemp)
592 CALL pw_axpy(v_coulomb_rtemp, pwy)
593
594 CALL pw_copy(v_coulomb_gspace, v_coulomb_gtemp)
595 CALL pw_derive(v_coulomb_gtemp, (/0, 0, 1/))
596 CALL pw_transfer(v_coulomb_gtemp, v_coulomb_rtemp)
597 CALL pw_axpy(v_coulomb_rtemp, pwz)
598
599 CALL auxbas_pw_pool%give_back_pw(v_coulomb_gspace)
600 CALL auxbas_pw_pool%give_back_pw(v_coulomb_gtemp)
601 CALL auxbas_pw_pool%give_back_pw(v_coulomb_rtemp)
602 ELSE
603
604 ! Attic of the atomic parallellisation
605 !
606 ! bo(2)
607 ! bo = get_limit(natom, para_env%num_pe, para_env%mepos)
608 ! DO iat = bo(1),bo(2) ! natom = # atoms for ikind
609 ! DO ix = lbound(pwx%array,1), ubound(pwx%array,1)
610 ! DO iy = lbound(pwx%array,2), ubound(pwx%array,2)
611 ! DO iz = lbound(pwx%array,3), ubound(pwx%array,3)
612
613 bo = pwx%pw_grid%bounds_local
614
615 DO iat = 1, natom ! natom = # atoms for ikind
616
617 iatom = atom_list(iat)
618 ratom = particle_set(iatom)%r
619
620 DO ix = bo(1, 1), bo(2, 1)
621 DO iy = bo(1, 2), bo(2, 2)
622 DO iz = bo(1, 3), bo(2, 3)
623 rpoint = (/real(ix, dp)*pwx%pw_grid%dr(1), &
624 REAL(iy, dp)*pwx%pw_grid%dr(2), &
625 REAL(iz, dp)*pwx%pw_grid%dr(3)/)
626 rpoint = rpoint + roffset
627 rap = rpoint - ratom
628 rap(1) = modulo(rap(1), cell%hmat(1, 1)) - cell%hmat(1, 1)/2._dp
629 rap(2) = modulo(rap(2), cell%hmat(2, 2)) - cell%hmat(2, 2)/2._dp
630 rap(3) = modulo(rap(3), cell%hmat(3, 3)) - cell%hmat(3, 3)/2._dp
631 sqrt_rap = sqrt(dot_product(rap, rap))
632 exp_rap = exp(-alpha*sqrt_rap**2)
633 sqrt_rap = max(sqrt_rap, 1.e-10_dp)
634 ! d_x
635
636 pwx%array(ix, iy, iz) = pwx%array(ix, iy, iz) + charge*( &
637 -2.0_dp*sqrt_alpha*exp(-sqrt_rap**2*sqrt_alpha**2)*rap(1) &
638 /(rootpi*sqrt_rap**2) &
639 + erf(sqrt_rap*sqrt_alpha)*rap(1) &
640 /sqrt_rap**3)
641
642 ! d_y
643
644 pwy%array(ix, iy, iz) = pwy%array(ix, iy, iz) + charge*( &
645 -2.0_dp*sqrt_alpha*exp(-sqrt_rap**2*sqrt_alpha**2)*rap(2) &
646 /(rootpi*sqrt_rap**2) &
647 + erf(sqrt_rap*sqrt_alpha)*rap(2) &
648 /sqrt_rap**3)
649
650 ! d_z
651
652 pwz%array(ix, iy, iz) = pwz%array(ix, iy, iz) + charge*( &
653 -2.0_dp*sqrt_alpha*exp(-sqrt_rap**2*sqrt_alpha**2)*rap(3) &
654 /(rootpi*sqrt_rap**2) &
655 + erf(sqrt_rap*sqrt_alpha)*rap(3) &
656 /sqrt_rap**3)
657
658 IF (make_soft) cycle
659
660 ! d_x
661
662 DO iexp = 1, nexp_ppl
663 pwx%array(ix, iy, iz) = pwx%array(ix, iy, iz) + ( &
664 -2.0_dp*alpha*rap(1)*exp_rap* &
665 cexp_ppl(iexp)*(sqrt_rap**2)**(iexp - 1))
666 IF (iexp > 1) THEN
667 pwx%array(ix, iy, iz) = pwx%array(ix, iy, iz) + ( &
668 2.0_dp*exp_rap*cexp_ppl(iexp)* &
669 (sqrt_rap**2)**(iexp - 2)*real(iexp - 1, dp)*rap(1))
670 END IF
671 END DO
672
673 ! d_y
674
675 DO iexp = 1, nexp_ppl
676 pwy%array(ix, iy, iz) = pwy%array(ix, iy, iz) + ( &
677 -2.0_dp*alpha*rap(2)*exp_rap* &
678 cexp_ppl(iexp)*(sqrt_rap**2)**(iexp - 1))
679 IF (iexp > 1) THEN
680 pwy%array(ix, iy, iz) = pwy%array(ix, iy, iz) + ( &
681 2.0_dp*exp_rap*cexp_ppl(iexp)* &
682 (sqrt_rap**2)**(iexp - 2)*real(iexp - 1, dp)*rap(2))
683 END IF
684 END DO
685
686 ! d_z
687
688 DO iexp = 1, nexp_ppl
689 pwz%array(ix, iy, iz) = pwz%array(ix, iy, iz) + ( &
690 -2.0_dp*alpha*rap(3)*exp_rap* &
691 cexp_ppl(iexp)*(sqrt_rap**2)**(iexp - 1))
692 IF (iexp > 1) THEN
693 pwz%array(ix, iy, iz) = pwz%array(ix, iy, iz) + ( &
694 2.0_dp*exp_rap*cexp_ppl(iexp)* &
695 (sqrt_rap**2)**(iexp - 2)*real(iexp - 1, dp)*rap(3))
696 END IF
697 END DO
698
699 END DO ! iz
700 END DO ! iy
701 END DO ! ix
702 END DO ! iat
703 END IF ! gth_gspace
704
705 ! -------------------------------------
706 ! Atomic grids part
707 ! -------------------------------------
708
709 IF (gapw .AND. paw_atom) THEN
710
711 bo_atom = get_limit(natom, para_env%num_pe, para_env%mepos)
712
713 DO iat = bo_atom(1), bo_atom(2) ! natom = # atoms for ikind
714
715 iatom = atom_list(iat)
716
717 nablavks_vec_rad_h => nablavks_atom_set(iatom)%nablavks_vec_rad_h
718 nablavks_vec_rad_s => nablavks_atom_set(iatom)%nablavks_vec_rad_s
719
720 DO ir = 1, grid_atom%nr
721
722 IF (grid_atom%rad(ir) >= hard_radius) cycle
723
724 exp_rap = exp(-alpha*grid_atom%rad(ir)**2)
725
726 DO ia = 1, grid_atom%ng_sphere
727
728 DO idir = 1, 3
729 hard_value = 0.0_dp
730 hard_value = charge*( &
731 -2.0_dp*sqrt_alpha*exp(-grid_atom%rad(ir)**2*sqrt_alpha**2) &
732 *grid_atom%rad(ir)*harmonics%a(idir, ia) &
733 /(rootpi*grid_atom%rad(ir)**2) &
734 + erf(grid_atom%rad(ir)*sqrt_alpha) &
735 *grid_atom%rad(ir)*harmonics%a(idir, ia) &
736 /grid_atom%rad(ir)**3)
737 soft_value = hard_value
738 DO iexp = 1, nexp_ppl
739 hard_value = hard_value + ( &
740 -2.0_dp*alpha*grid_atom%rad(ir)*harmonics%a(idir, ia) &
741 *exp_rap*cexp_ppl(iexp)*(grid_atom%rad(ir)**2)**(iexp - 1))
742 IF (iexp > 1) THEN
743 hard_value = hard_value + ( &
744 2.0_dp*exp_rap*cexp_ppl(iexp) &
745 *(grid_atom%rad(ir)**2)**(iexp - 2)*real(iexp - 1, dp) &
746 *grid_atom%rad(ir)*harmonics%a(idir, ia))
747 END IF
748 END DO
749 nablavks_vec_rad_h(idir, 1)%r_coef(ir, ia) = &
750 nablavks_vec_rad_h(idir, 1)%r_coef(ir, ia) + hard_value
751 IF (make_soft) THEN
752 nablavks_vec_rad_s(idir, 1)%r_coef(ir, ia) = &
753 nablavks_vec_rad_s(idir, 1)%r_coef(ir, ia) + soft_value
754 ELSE
755 nablavks_vec_rad_s(idir, 1)%r_coef(ir, ia) = &
756 nablavks_vec_rad_s(idir, 1)%r_coef(ir, ia) + hard_value
757 END IF
758 END DO
759
760 END DO ! ia
761 END DO ! ir
762
763 DO ispin = 2, nspins
764 DO idir = 1, 3
765 nablavks_vec_rad_h(idir, ispin)%r_coef(:, :) = nablavks_vec_rad_h(idir, 1)%r_coef(:, :)
766 nablavks_vec_rad_s(idir, ispin)%r_coef(:, :) = nablavks_vec_rad_s(idir, 1)%r_coef(:, :)
767 END DO
768 END DO
769
770 END DO
771
772 END IF
773
774 ELSE IF (ASSOCIATED(sgp_potential)) THEN
775
776 cpabort("EPR with SGP potentials is not implemented")
777
778 ELSE IF (ASSOCIATED(all_potential)) THEN
779
780 CALL get_potential(potential=all_potential, &
781 alpha_core_charge=alpha, &
782 zeff=charge)
783
784 sqrt_alpha = sqrt(alpha)
785
786 ! -------------------------------------
787 ! Atomic grids part
788 ! -------------------------------------
789
790 bo_atom = get_limit(natom, para_env%num_pe, para_env%mepos)
791
792 DO iat = bo_atom(1), bo_atom(2) ! natom = # atoms for ikind
793
794 iatom = atom_list(iat)
795
796 nablavks_vec_rad_h => nablavks_atom_set(iatom)%nablavks_vec_rad_h
797
798 DO ir = 1, grid_atom%nr
799
800 IF (grid_atom%rad(ir) >= hard_radius) cycle
801
802 DO ia = 1, grid_atom%ng_sphere
803
804 DO idir = 1, 3
805 hard_value = 0.0_dp
806 hard_value = charge*( &
807 2.0_dp*sqrt_alpha*exp(-grid_atom%rad(ir)**2*sqrt_alpha**2) &
808 *grid_atom%rad(ir)*harmonics%a(idir, ia) &
809 /(rootpi*grid_atom%rad(ir)**2) &
810 + erfc(grid_atom%rad(ir)*sqrt_alpha) &
811 *grid_atom%rad(ir)*harmonics%a(idir, ia) &
812 /grid_atom%rad(ir)**3)
813 nablavks_vec_rad_h(idir, 1)%r_coef(ir, ia) = &
814 nablavks_vec_rad_h(idir, 1)%r_coef(ir, ia) + hard_value
815 END DO
816
817 END DO ! ia
818 END DO ! ir
819
820 DO ispin = 2, nspins
821 DO idir = 1, 3
822 nablavks_vec_rad_h(idir, ispin)%r_coef(:, :) = nablavks_vec_rad_h(idir, 1)%r_coef(:, :)
823 END DO
824 END DO
825
826 END DO
827
828 ELSE
829 cycle
830 END IF
831
832 END DO
833
834 DO idir = 1, 3
835 CALL qs_rho_get(nablavks_set(idir, 1)%rho, rho_r=rho1_r)
836 CALL qs_rho_get(nablavks_set(idir, 2)%rho, rho_r=rho2_r)
837 CALL pw_copy(rho1_r(1), rho2_r(1))
838 END DO
839
840! -------------------------------------
841! Add V_xc potential
842! -------------------------------------
843
844 CALL auxbas_pw_pool%create_pw(v_xc_gtemp)
845 CALL auxbas_pw_pool%create_pw(v_xc_rtemp)
846
847 xc_section => section_vals_get_subs_vals(input, "PROPERTIES%LINRES%EPR%PRINT%G_TENSOR%XC")
848 ! a possible vdW section in xc_section will be ignored
849
850 IF (gapw_xc) THEN
851 CALL qs_vxc_create(ks_env=ks_env, rho_struct=rho_xc, xc_section=xc_section, &
852 vxc_rho=v_rspace_new, vxc_tau=v_tau_rspace, exc=exc, just_energy=.false.)
853 ELSE
854 CALL qs_vxc_create(ks_env=ks_env, rho_struct=rho, xc_section=xc_section, &
855 vxc_rho=v_rspace_new, vxc_tau=v_tau_rspace, exc=exc, just_energy=.false.)
856 END IF
857
858 IF (ASSOCIATED(v_rspace_new)) THEN
859
860 DO ispin = 1, nspins
861
862 CALL pw_transfer(v_rspace_new(ispin), v_xc_gtemp)
863 CALL pw_derive(v_xc_gtemp, (/1, 0, 0/))
864 CALL pw_transfer(v_xc_gtemp, v_xc_rtemp)
865 CALL qs_rho_get(nablavks_set(1, ispin)%rho, rho_r=rho_r)
866 CALL pw_axpy(v_xc_rtemp, rho_r(1))
867
868 CALL pw_transfer(v_rspace_new(ispin), v_xc_gtemp)
869 CALL pw_derive(v_xc_gtemp, (/0, 1, 0/))
870 CALL pw_transfer(v_xc_gtemp, v_xc_rtemp)
871 CALL qs_rho_get(nablavks_set(2, ispin)%rho, rho_r=rho_r)
872 CALL pw_axpy(v_xc_rtemp, rho_r(1))
873
874 CALL pw_transfer(v_rspace_new(ispin), v_xc_gtemp)
875 CALL pw_derive(v_xc_gtemp, (/0, 0, 1/))
876 CALL pw_transfer(v_xc_gtemp, v_xc_rtemp)
877 CALL qs_rho_get(nablavks_set(3, ispin)%rho, rho_r=rho_r)
878 CALL pw_axpy(v_xc_rtemp, rho_r(1))
879
880 CALL auxbas_pw_pool%give_back_pw(v_rspace_new(ispin))
881
882 END DO
883
884 DEALLOCATE (v_rspace_new)
885 END IF
886
887 IF (ASSOCIATED(v_tau_rspace)) THEN
888
889 DO ispin = 1, nspins
890
891 CALL pw_transfer(v_tau_rspace(ispin), v_xc_gtemp)
892 CALL pw_derive(v_xc_gtemp, (/1, 0, 0/))
893 CALL pw_transfer(v_xc_gtemp, v_xc_rtemp)
894 CALL qs_rho_get(nablavks_set(1, ispin)%rho, rho_r=rho_r)
895 CALL pw_axpy(v_xc_rtemp, rho_r(1))
896
897 CALL pw_transfer(v_tau_rspace(ispin), v_xc_gtemp)
898 CALL pw_derive(v_xc_gtemp, (/0, 1, 0/))
899 CALL pw_transfer(v_xc_gtemp, v_xc_rtemp)
900 CALL qs_rho_get(nablavks_set(2, ispin)%rho, rho_r=rho_r)
901 CALL pw_axpy(v_xc_rtemp, rho_r(1))
902
903 CALL pw_transfer(v_tau_rspace(ispin), v_xc_gtemp)
904 CALL pw_derive(v_xc_gtemp, (/0, 0, 1/))
905 CALL pw_transfer(v_xc_gtemp, v_xc_rtemp)
906 CALL qs_rho_get(nablavks_set(3, ispin)%rho, rho_r=rho_r)
907 CALL pw_axpy(v_xc_rtemp, rho_r(1))
908
909 CALL auxbas_pw_pool%give_back_pw(v_tau_rspace(ispin))
910
911 END DO
912
913 DEALLOCATE (v_tau_rspace)
914 END IF
915
916 CALL auxbas_pw_pool%give_back_pw(v_xc_gtemp)
917 CALL auxbas_pw_pool%give_back_pw(v_xc_rtemp)
918
919 IF (gapw .OR. gapw_xc) THEN
920 CALL calculate_vxc_atom(qs_env=qs_env, energy_only=.false., exc1=exc1, &
921 gradient_atom_set=nablavks_atom_set)
922 END IF
923
924! -------------------------------------
925! Write Nabla V_KS (local) to cubes
926! -------------------------------------
927
928 IF (btest(cp_print_key_should_output(logger%iter_info, lr_section, &
929 "EPR%PRINT%NABLAVKS_CUBES"), cp_p_file)) THEN
930 CALL auxbas_pw_pool%create_pw(wf_r)
931 DO idir = 1, 3
932 CALL pw_zero(wf_r)
933 CALL qs_rho_get(nablavks_set(idir, 1)%rho, rho_r=rho_r)
934 CALL pw_copy(rho_r(1), wf_r) ! RA
935 filename = "nablavks"
936 mpi_io = .true.
937 WRITE (ext, '(a2,I1,a5)') "_d", idir, ".cube"
938 unit_nr = cp_print_key_unit_nr(logger, lr_section, "EPR%PRINT%NABLAVKS_CUBES", &
939 extension=trim(ext), middle_name=trim(filename), &
940 log_filename=.false., file_position="REWIND", &
941 mpi_io=mpi_io)
942 CALL cp_pw_to_cube(wf_r, unit_nr, "NABLA V_KS ", &
943 particles=particles, &
944 stride=section_get_ivals(lr_section, &
945 "EPR%PRINT%NABLAVKS_CUBES%STRIDE"), &
946 mpi_io=mpi_io)
947 CALL cp_print_key_finished_output(unit_nr, logger, lr_section, &
948 "EPR%PRINT%NABLAVKS_CUBES", mpi_io=mpi_io)
949 END DO
950 CALL auxbas_pw_pool%give_back_pw(wf_r)
951 END IF
952
953 CALL cp_print_key_finished_output(output_unit, logger, lr_section, &
954 "PRINT%PROGRAM_RUN_INFO")
955
956 END SUBROUTINE epr_nablavks
957
958END MODULE qs_linres_epr_nablavks
959
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 ...
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_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, 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, rhs)
Get the QUICKSTEP environment.
subroutine, public prepare_gapw_den(qs_env, local_rho_set, do_rho0, kind_set_external)
...
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, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, 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_r3d_rs_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_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:87
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.