(git:374b731)
Loading...
Searching...
No Matches
qs_linres_epr_ownutils.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!> \par History
10!> created 06-2006 [RD]
11!> \author RD
12! **************************************************************************************************
16 USE cell_types, ONLY: cell_type
20 USE cp_output_handling, ONLY: cp_p_file,&
24 USE dbcsr_api, ONLY: dbcsr_p_type
28 USE kinds, ONLY: default_string_length,&
29 dp
30 USE mathlib, ONLY: diamat_all
33 USE pw_env_types, ONLY: pw_env_get,&
35 USE pw_methods, ONLY: pw_axpy,&
37 pw_scale,&
40 USE pw_pool_types, ONLY: pw_pool_p_type,&
50 USE pw_types, ONLY: pw_c1d_gs_type,&
57 USE qs_kind_types, ONLY: get_qs_kind,&
60 USE qs_linres_op, ONLY: fac_vecp,&
61 set_vecp,&
72 USE qs_rho_types, ONLY: qs_rho_get,&
76 USE util, ONLY: get_limit
77#include "./base/base_uses.f90"
78
79 IMPLICIT NONE
80
81 PRIVATE
83
84 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_linres_epr_ownutils'
85
86CONTAINS
87
88! **************************************************************************************************
89!> \brief Prints the g tensor
90!> \param epr_env ...
91!> \param qs_env ...
92!> \par History
93!> 06.2006 created [RD]
94!> \author RD
95! **************************************************************************************************
96 SUBROUTINE epr_g_print(epr_env, qs_env)
97
98 TYPE(epr_env_type) :: epr_env
99 TYPE(qs_environment_type), POINTER :: qs_env
100
101 CHARACTER(LEN=default_string_length) :: title
102 INTEGER :: idir1, idir2, output_unit, unit_nr
103 REAL(kind=dp) :: eigenv_g(3), g_sym(3, 3), gsum
104 TYPE(cp_logger_type), POINTER :: logger
105 TYPE(section_vals_type), POINTER :: lr_section
106
107 NULLIFY (logger, lr_section)
108
109 logger => cp_get_default_logger()
110 lr_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%LINRES")
111
112 output_unit = cp_print_key_unit_nr(logger, lr_section, "PRINT%PROGRAM_RUN_INFO", &
113 extension=".linresLog")
114
115 gsum = 0.0_dp
116
117 DO idir1 = 1, 3
118 DO idir2 = 1, 3
119 gsum = gsum + epr_env%g_total(idir1, idir2)
120 END DO
121 END DO
122
123 IF (output_unit > 0) THEN
124 WRITE (unit=output_unit, fmt="(T2,A,T56,E14.6)") &
125 "epr|TOT:checksum", gsum
126 END IF
127
128 CALL cp_print_key_finished_output(output_unit, logger, lr_section, &
129 "PRINT%PROGRAM_RUN_INFO")
130
131 IF (btest(cp_print_key_should_output(logger%iter_info, lr_section, &
132 "EPR%PRINT%G_TENSOR"), cp_p_file)) THEN
133
134 unit_nr = cp_print_key_unit_nr(logger, lr_section, "EPR%PRINT%G_TENSOR", &
135 extension=".data", middle_name="GTENSOR", &
136 log_filename=.false.)
137
138 IF (unit_nr > 0) THEN
139
140 WRITE (title, "(A)") "G tensor "
141 WRITE (unit_nr, "(T2,A)") title
142
143 WRITE (unit_nr, "(T2,A)") "gmatrix_zke"
144 WRITE (unit_nr, "(3(A,f15.10))") " XX=", epr_env%g_zke, &
145 " XY=", 0.0_dp, " XZ=", 0.0_dp
146 WRITE (unit_nr, "(3(A,f15.10))") " YX=", 0.0_dp, &
147 " YY=", epr_env%g_zke, " YZ=", 0.0_dp
148 WRITE (unit_nr, "(3(A,f15.10))") " ZX=", 0.0_dp, &
149 " ZY=", 0.0_dp, " ZZ=", epr_env%g_zke
150
151 WRITE (unit_nr, "(T2,A)") "gmatrix_so"
152 WRITE (unit_nr, "(3(A,f15.10))") " XX=", epr_env%g_so(1, 1), &
153 " XY=", epr_env%g_so(1, 2), " XZ=", epr_env%g_so(1, 3)
154 WRITE (unit_nr, "(3(A,f15.10))") " YX=", epr_env%g_so(2, 1), &
155 " YY=", epr_env%g_so(2, 2), " YZ=", epr_env%g_so(2, 3)
156 WRITE (unit_nr, "(3(A,f15.10))") " ZX=", epr_env%g_so(3, 1), &
157 " ZY=", epr_env%g_so(3, 2), " ZZ=", epr_env%g_so(3, 3)
158
159 WRITE (unit_nr, "(T2,A)") "gmatrix_soo"
160 WRITE (unit_nr, "(3(A,f15.10))") " XX=", epr_env%g_soo(1, 1), &
161 " XY=", epr_env%g_soo(1, 2), " XZ=", epr_env%g_soo(1, 3)
162 WRITE (unit_nr, "(3(A,f15.10))") " YX=", epr_env%g_soo(2, 1), &
163 " YY=", epr_env%g_soo(2, 2), " YZ=", epr_env%g_soo(2, 3)
164 WRITE (unit_nr, "(3(A,f15.10))") " ZX=", epr_env%g_soo(3, 1), &
165 " ZY=", epr_env%g_soo(3, 2), " ZZ=", epr_env%g_soo(3, 3)
166
167 WRITE (unit_nr, "(T2,A)") "gmatrix_total"
168 WRITE (unit_nr, "(3(A,f15.10))") " XX=", epr_env%g_total(1, 1) + epr_env%g_free_factor, &
169 " XY=", epr_env%g_total(1, 2), " XZ=", epr_env%g_total(1, 3)
170 WRITE (unit_nr, "(3(A,f15.10))") " YX=", epr_env%g_total(2, 1), &
171 " YY=", epr_env%g_total(2, 2) + epr_env%g_free_factor, " YZ=", epr_env%g_total(2, 3)
172 WRITE (unit_nr, "(3(A,f15.10))") " ZX=", epr_env%g_total(3, 1), &
173 " ZY=", epr_env%g_total(3, 2), " ZZ=", epr_env%g_total(3, 3) + epr_env%g_free_factor
174
175 DO idir1 = 1, 3
176 DO idir2 = 1, 3
177 g_sym(idir1, idir2) = (epr_env%g_total(idir1, idir2) + &
178 epr_env%g_total(idir2, idir1))/2.0_dp
179 END DO
180 END DO
181
182 WRITE (unit_nr, "(T2,A)") "gtensor_total"
183 WRITE (unit_nr, "(3(A,f15.10))") " XX=", g_sym(1, 1) + epr_env%g_free_factor, &
184 " XY=", g_sym(1, 2), " XZ=", g_sym(1, 3)
185 WRITE (unit_nr, "(3(A,f15.10))") " YX=", g_sym(2, 1), &
186 " YY=", g_sym(2, 2) + epr_env%g_free_factor, " YZ=", g_sym(2, 3)
187 WRITE (unit_nr, "(3(A,f15.10))") " ZX=", g_sym(3, 1), &
188 " ZY=", g_sym(3, 2), " ZZ=", g_sym(3, 3) + epr_env%g_free_factor
189
190 CALL diamat_all(g_sym, eigenv_g)
191 eigenv_g(:) = eigenv_g(:)*1.0e6_dp
192
193 WRITE (unit_nr, "(T2,A)") "delta_g principal values in ppm"
194 WRITE (unit_nr, "(f15.3,3(A,f15.10))") eigenv_g(1), " X=", g_sym(1, 1), &
195 " Y=", g_sym(2, 1), " Z=", g_sym(3, 1)
196 WRITE (unit_nr, "(f15.3,3(A,f15.10))") eigenv_g(2), " X=", g_sym(1, 2), &
197 " Y=", g_sym(2, 2), " Z=", g_sym(3, 2)
198 WRITE (unit_nr, "(f15.3,3(A,f15.10))") eigenv_g(3), " X=", g_sym(1, 3), &
199 " Y=", g_sym(2, 3), " Z=", g_sym(3, 3)
200
201 END IF
202
203 CALL cp_print_key_finished_output(unit_nr, logger, lr_section,&
204 & "EPR%PRINT%G_TENSOR")
205
206 END IF
207
208 END SUBROUTINE epr_g_print
209
210! **************************************************************************************************
211!> \brief Calculate zke part of the g tensor
212!> \param epr_env ...
213!> \param qs_env ...
214!> \par History
215!> 06.2006 created [RD]
216!> \author RD
217! **************************************************************************************************
218 SUBROUTINE epr_g_zke(epr_env, qs_env)
219
220 TYPE(epr_env_type) :: epr_env
221 TYPE(qs_environment_type), POINTER :: qs_env
222
223 INTEGER :: i1, ispin, output_unit
224 REAL(kind=dp) :: epr_g_zke_temp(2)
225 TYPE(cp_logger_type), POINTER :: logger
226 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: kinetic, rho_ao
227 TYPE(dft_control_type), POINTER :: dft_control
228 TYPE(mp_para_env_type), POINTER :: para_env
229 TYPE(qs_rho_type), POINTER :: rho
230 TYPE(section_vals_type), POINTER :: lr_section
231
232 NULLIFY (dft_control, logger, lr_section, rho, kinetic, para_env, rho_ao)
233
234 logger => cp_get_default_logger()
235 lr_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%LINRES")
236
237 output_unit = cp_print_key_unit_nr(logger, lr_section, "PRINT%PROGRAM_RUN_INFO", &
238 extension=".linresLog")
239
240 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control, &
241 kinetic=kinetic, rho=rho, para_env=para_env)
242
243 CALL qs_rho_get(rho, rho_ao=rho_ao)
244
245 DO ispin = 1, dft_control%nspins
246 CALL calculate_ptrace(kinetic(1)%matrix, rho_ao(ispin)%matrix, &
247 ecore=epr_g_zke_temp(ispin))
248 END DO
249
250 epr_env%g_zke = epr_env%g_zke_factor*(epr_g_zke_temp(1) - epr_g_zke_temp(2))
251 DO i1 = 1, 3
252 epr_env%g_total(i1, i1) = epr_env%g_total(i1, i1) + epr_env%g_zke
253 END DO
254
255 IF (output_unit > 0) THEN
256 WRITE (unit=output_unit, fmt="(T2,A,T56,E24.16)") &
257 "epr|ZKE:g_zke", epr_env%g_zke
258 END IF
259
260 CALL cp_print_key_finished_output(output_unit, logger, lr_section, &
261 "PRINT%PROGRAM_RUN_INFO")
262
263 END SUBROUTINE epr_g_zke
264
265! **************************************************************************************************
266!> \brief Calculates g_so
267!> \param epr_env ...
268!> \param current_env ...
269!> \param qs_env ...
270!> \param iB ...
271!> \par History
272!> 06.2006 created [RD]
273!> \author RD
274! **************************************************************************************************
275 SUBROUTINE epr_g_so(epr_env, current_env, qs_env, iB)
276
277 TYPE(epr_env_type) :: epr_env
278 TYPE(current_env_type) :: current_env
279 TYPE(qs_environment_type), POINTER :: qs_env
280 INTEGER, INTENT(IN) :: ib
281
282 INTEGER :: aint_precond, ia, iat, iatom, idir1, &
283 idir2, idir3, ikind, ir, ispin, &
284 max_iter, natom, nkind, nspins, &
285 output_unit, precond_kind
286 INTEGER, DIMENSION(2) :: bo
287 INTEGER, DIMENSION(:), POINTER :: atom_list
288 LOGICAL :: gapw, paw_atom, success
289 REAL(dp) :: eps_r, eps_x, hard_radius, temp_so_soft, &
290 vks_ra_idir2, vks_ra_idir3
291 REAL(dp), DIMENSION(3, 3) :: temp_so_gapw
292 REAL(dp), DIMENSION(:, :), POINTER :: g_so, g_total
293 REAL(kind=dp), DIMENSION(3) :: ra
294 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
295 TYPE(cp_logger_type), POINTER :: logger
296 TYPE(dft_control_type), POINTER :: dft_control
297 TYPE(grid_atom_type), POINTER :: grid_atom
298 TYPE(harmonics_atom_type), POINTER :: harmonics
299 TYPE(jrho_atom_type), DIMENSION(:), POINTER :: jrho1_atom_set
300 TYPE(jrho_atom_type), POINTER :: jrho1_atom
301 TYPE(mp_para_env_type), POINTER :: para_env
302 TYPE(nablavks_atom_type), DIMENSION(:), POINTER :: nablavks_atom_set
303 TYPE(nablavks_atom_type), POINTER :: nablavks_atom
304 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
305 TYPE(pw_env_type), POINTER :: pw_env
306 TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
307 TYPE(pw_r3d_rs_type), ALLOCATABLE, DIMENSION(:, :) :: vks_pw_spline
308 TYPE(pw_r3d_rs_type), DIMENSION(:), POINTER :: jrho2_r, jrho3_r, nrho1_r, nrho2_r, &
309 nrho3_r
310 TYPE(pw_spline_precond_type) :: precond
311 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
312 TYPE(qs_rho_p_type), DIMENSION(:), POINTER :: jrho1_set
313 TYPE(qs_rho_p_type), DIMENSION(:, :), POINTER :: nablavks_set
314 TYPE(section_vals_type), POINTER :: interp_section, lr_section
315
316 NULLIFY (atomic_kind_set, qs_kind_set, atom_list, dft_control, &
317 grid_atom, g_so, g_total, harmonics, interp_section, jrho1_atom_set, &
318 jrho1_set, logger, lr_section, nablavks_atom, nablavks_atom_set, &
319 nablavks_set, para_env, particle_set, jrho2_r, jrho3_r, nrho1_r, nrho2_r, nrho3_r)
320
321 logger => cp_get_default_logger()
322 lr_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%LINRES")
323
324 output_unit = cp_print_key_unit_nr(logger, lr_section, "PRINT%PROGRAM_RUN_INFO", &
325 extension=".linresLog")
326
327 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control, &
328 atomic_kind_set=atomic_kind_set, &
329 qs_kind_set=qs_kind_set, &
330 para_env=para_env, pw_env=pw_env, &
331 particle_set=particle_set)
332
333 CALL get_epr_env(epr_env=epr_env, &
334 nablavks_set=nablavks_set, &
335 nablavks_atom_set=nablavks_atom_set, &
336 g_total=g_total, g_so=g_so)
337
338 CALL get_current_env(current_env=current_env, &
339 jrho1_set=jrho1_set, jrho1_atom_set=jrho1_atom_set)
340
341 gapw = dft_control%qs_control%gapw
342 nkind = SIZE(qs_kind_set, 1)
343 nspins = dft_control%nspins
344
345 DO idir1 = 1, 3
346 CALL set_vecp(idir1, idir2, idir3)
347 ! j_pw x nabla_vks_pw
348 temp_so_soft = 0.0_dp
349 DO ispin = 1, nspins
350 CALL qs_rho_get(jrho1_set(idir2)%rho, rho_r=jrho2_r)
351 CALL qs_rho_get(jrho1_set(idir3)%rho, rho_r=jrho3_r)
352 CALL qs_rho_get(nablavks_set(idir2, ispin)%rho, rho_r=nrho2_r)
353 CALL qs_rho_get(nablavks_set(idir3, ispin)%rho, rho_r=nrho3_r)
354 temp_so_soft = temp_so_soft + (-1.0_dp)**(1 + ispin)*( &
355 pw_integral_ab(jrho2_r(ispin), nrho3_r(1)) - &
356 pw_integral_ab(jrho3_r(ispin), nrho2_r(1)))
357 END DO
358 temp_so_soft = -1.0_dp*epr_env%g_so_factor*temp_so_soft
359 IF (output_unit > 0) THEN
360 WRITE (unit=output_unit, fmt="(T2,A,T18,I1,I1,T56,E24.16)") &
361 "epr|SOX:soft", ib, idir1, temp_so_soft
362 END IF
363 g_so(ib, idir1) = temp_so_soft
364 END DO !idir1
365
366 IF (gapw) THEN
367
368 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
369 ALLOCATE (vks_pw_spline(3, nspins))
370
371 interp_section => section_vals_get_subs_vals(lr_section, &
372 "EPR%INTERPOLATOR")
373 CALL section_vals_val_get(interp_section, "aint_precond", &
374 i_val=aint_precond)
375 CALL section_vals_val_get(interp_section, "precond", i_val=precond_kind)
376 CALL section_vals_val_get(interp_section, "max_iter", i_val=max_iter)
377 CALL section_vals_val_get(interp_section, "eps_r", r_val=eps_r)
378 CALL section_vals_val_get(interp_section, "eps_x", r_val=eps_x)
379
380 DO ispin = 1, nspins
381 DO idir1 = 1, 3
382 CALL auxbas_pw_pool%create_pw(vks_pw_spline(idir1, ispin))
383 ! calculate spline coefficients
384 CALL pw_spline_precond_create(precond, precond_kind=aint_precond, &
385 pool=auxbas_pw_pool, pbc=.true., transpose=.false.)
386 CALL qs_rho_get(nablavks_set(idir1, ispin)%rho, rho_r=nrho1_r)
387 CALL pw_spline_do_precond(precond, nrho1_r(1), &
388 vks_pw_spline(idir1, ispin))
389 CALL pw_spline_precond_set_kind(precond, precond_kind)
390 success = find_coeffs(values=nrho1_r(1), &
391 coeffs=vks_pw_spline(idir1, ispin), linop=spl3_pbc, &
392 preconditioner=precond, pool=auxbas_pw_pool, &
393 eps_r=eps_r, eps_x=eps_x, max_iter=max_iter)
394 cpassert(success)
395 CALL pw_spline_precond_release(precond)
396 END DO ! idir1
397 END DO ! ispin
398
399 temp_so_gapw = 0.0_dp
400
401 DO ikind = 1, nkind
402 NULLIFY (atom_list, grid_atom, harmonics)
403 CALL get_atomic_kind(atomic_kind_set(ikind), atom_list=atom_list, natom=natom)
404 CALL get_qs_kind(qs_kind_set(ikind), &
405 hard_radius=hard_radius, &
406 grid_atom=grid_atom, &
407 harmonics=harmonics, &
408 paw_atom=paw_atom)
409
410 IF (.NOT. paw_atom) cycle
411
412 ! Distribute the atoms of this kind
413
414 bo = get_limit(natom, para_env%num_pe, para_env%mepos)
415
416 DO iat = 1, natom !bo(1),bo(2)! this partitioning blocks the interpolation
417 ! ! routines (i.e. waiting for parallel sum)
418 iatom = atom_list(iat)
419 NULLIFY (jrho1_atom, nablavks_atom)
420 jrho1_atom => jrho1_atom_set(iatom)
421 nablavks_atom => nablavks_atom_set(iatom)
422 DO idir1 = 1, 3
423 CALL set_vecp(idir1, idir2, idir3)
424 DO ispin = 1, nspins
425 DO ir = 1, grid_atom%nr
426
427 IF (grid_atom%rad(ir) >= hard_radius) cycle
428
429 DO ia = 1, grid_atom%ng_sphere
430
431 ra = particle_set(iatom)%r
432 ra(:) = ra(:) + grid_atom%rad(ir)*harmonics%a(:, ia)
433 vks_ra_idir2 = eval_interp_spl3_pbc(ra, &
434 vks_pw_spline(idir2, ispin))
435 vks_ra_idir3 = eval_interp_spl3_pbc(ra, &
436 vks_pw_spline(idir3, ispin))
437
438 IF (iat .LT. bo(1) .OR. iat .GT. bo(2)) cycle !quick and dirty:
439 ! !here take care of the partition
440
441 ! + sum_A j_loc_h_A x nabla_vks_s_A
442 temp_so_gapw(ib, idir1) = temp_so_gapw(ib, idir1) + &
443 (-1.0_dp)**(1 + ispin)*( &
444 jrho1_atom%jrho_vec_rad_h(idir2, ispin)%r_coef(ir, ia)* &
445 vks_ra_idir3 - &
446 jrho1_atom%jrho_vec_rad_h(idir3, ispin)%r_coef(ir, ia)* &
447 vks_ra_idir2 &
448 )*grid_atom%wr(ir)*grid_atom%wa(ia)
449
450 ! - sum_A j_loc_s_A x nabla_vks_s_A
451 temp_so_gapw(ib, idir1) = temp_so_gapw(ib, idir1) - &
452 (-1.0_dp)**(1 + ispin)*( &
453 jrho1_atom%jrho_vec_rad_s(idir2, ispin)%r_coef(ir, ia)* &
454 vks_ra_idir3 - &
455 jrho1_atom%jrho_vec_rad_s(idir3, ispin)%r_coef(ir, ia)* &
456 vks_ra_idir2 &
457 )*grid_atom%wr(ir)*grid_atom%wa(ia)
458
459 ! + sum_A j_loc_h_A x nabla_vks_loc_h_A
460 temp_so_gapw(ib, idir1) = temp_so_gapw(ib, idir1) + &
461 (-1.0_dp)**(1 + ispin)*( &
462 jrho1_atom%jrho_vec_rad_h(idir2, ispin)%r_coef(ir, ia)* &
463 nablavks_atom%nablavks_vec_rad_h(idir3, ispin)%r_coef(ir, ia) - &
464 jrho1_atom%jrho_vec_rad_h(idir3, ispin)%r_coef(ir, ia)* &
465 nablavks_atom%nablavks_vec_rad_h(idir2, ispin)%r_coef(ir, ia) &
466 )*grid_atom%wr(ir)*grid_atom%wa(ia)
467
468 ! - sum_A j_loc_h_A x nabla_vks_loc_s_A
469 temp_so_gapw(ib, idir1) = temp_so_gapw(ib, idir1) - &
470 (-1.0_dp)**(1 + ispin)*( &
471 jrho1_atom%jrho_vec_rad_h(idir2, ispin)%r_coef(ir, ia)* &
472 nablavks_atom%nablavks_vec_rad_s(idir3, ispin)%r_coef(ir, ia) - &
473 jrho1_atom%jrho_vec_rad_h(idir3, ispin)%r_coef(ir, ia)* &
474 nablavks_atom%nablavks_vec_rad_s(idir2, ispin)%r_coef(ir, ia) &
475 )*grid_atom%wr(ir)*grid_atom%wa(ia)
476
477! ORIGINAL
478! ! + sum_A j_loc_h_A x nabla_vks_loc_h_A
479! temp_so_gapw(iB,idir1) = temp_so_gapw(iB,idir1) + &
480! (-1.0_dp)**(1.0_dp + REAL(ispin,KIND=dp)) * ( &
481! jrho1_atom%jrho_vec_rad_h(idir2,iB,ispin)%r_coef(ir,ia) * &
482! nablavks_atom%nablavks_vec_rad_h(idir3,ispin)%r_coef(ir,ia) - &
483! jrho1_atom%jrho_vec_rad_h(idir3,iB,ispin)%r_coef(ir,ia) * &
484! nablavks_atom%nablavks_vec_rad_h(idir2,ispin)%r_coef(ir,ia) &
485! ) * grid_atom%wr(ir)*grid_atom%wa(ia)
486! ! - sum_A j_loc_s_A x nabla_vks_loc_s_A
487! temp_so_gapw(iB,idir1) = temp_so_gapw(iB,idir1) - &
488! (-1.0_dp)**(1.0_dp + REAL(ispin,KIND=dp)) * ( &
489! jrho1_atom%jrho_vec_rad_s(idir2,iB,ispin)%r_coef(ir,ia) * &
490! nablavks_atom%nablavks_vec_rad_s(idir3,ispin)%r_coef(ir,ia) - &
491! jrho1_atom%jrho_vec_rad_s(idir3,iB,ispin)%r_coef(ir,ia) * &
492! nablavks_atom%nablavks_vec_rad_s(idir2,ispin)%r_coef(ir,ia) &
493! ) * grid_atom%wr(ir)*grid_atom%wa(ia)
494 END DO !ia
495 END DO !ir
496 END DO !ispin
497 END DO !idir1
498 END DO !iat
499 END DO !ikind
500
501 CALL para_env%sum(temp_so_gapw)
502 temp_so_gapw(:, :) = -1.0_dp*epr_env%g_so_factor_gapw*temp_so_gapw(:, :)
503
504 IF (output_unit > 0) THEN
505 DO idir1 = 1, 3
506 WRITE (unit=output_unit, fmt="(T2,A,T18,I1,I1,T56,E24.16)") &
507 "epr|SOX:gapw", ib, idir1, temp_so_gapw(ib, idir1)
508 END DO
509 END IF
510
511 g_so(ib, :) = g_so(ib, :) + temp_so_gapw(ib, :)
512
513 DO ispin = 1, nspins
514 DO idir1 = 1, 3
515 CALL auxbas_pw_pool%give_back_pw(vks_pw_spline(idir1, ispin))
516 END DO
517 END DO
518 DEALLOCATE (vks_pw_spline)
519
520 END IF ! gapw
521
522 g_total(ib, :) = g_total(ib, :) + g_so(ib, :)
523
524 CALL cp_print_key_finished_output(output_unit, logger, lr_section, &
525 "PRINT%PROGRAM_RUN_INFO")
526
527 END SUBROUTINE epr_g_so
528
529! **************************************************************************************************
530!> \brief Calculates g_soo (soft part only for now)
531!> \param epr_env ...
532!> \param current_env ...
533!> \param qs_env ...
534!> \param iB ...
535!> \par History
536!> 06.2006 created [RD]
537!> \author RD
538! **************************************************************************************************
539 SUBROUTINE epr_g_soo(epr_env, current_env, qs_env, iB)
540
541 TYPE(epr_env_type) :: epr_env
542 TYPE(current_env_type) :: current_env
543 TYPE(qs_environment_type), POINTER :: qs_env
544 INTEGER, INTENT(IN) :: ib
545
546 INTEGER :: aint_precond, ia, iat, iatom, idir1, &
547 ikind, ir, iso, ispin, max_iter, &
548 natom, nkind, nspins, output_unit, &
549 precond_kind
550 INTEGER, DIMENSION(2) :: bo
551 INTEGER, DIMENSION(:), POINTER :: atom_list
552 LOGICAL :: gapw, paw_atom, soo_rho_hard, success
553 REAL(dp) :: bind_ra_idir1, chi_tensor(3, 3, 2), &
554 eps_r, eps_x, hard_radius, rho_spin, &
555 temp_soo_soft
556 REAL(dp), DIMENSION(3, 3) :: temp_soo_gapw
557 REAL(dp), DIMENSION(:, :), POINTER :: g_soo, g_total
558 REAL(kind=dp), DIMENSION(3) :: ra
559 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
560 TYPE(cp_logger_type), POINTER :: logger
561 TYPE(dft_control_type), POINTER :: dft_control
562 TYPE(grid_atom_type), POINTER :: grid_atom
563 TYPE(harmonics_atom_type), POINTER :: harmonics
564 TYPE(mp_para_env_type), POINTER :: para_env
565 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
566 TYPE(pw_env_type), POINTER :: pw_env
567 TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
568 TYPE(pw_r3d_rs_type), ALLOCATABLE, DIMENSION(:, :) :: bind_pw_spline
569 TYPE(pw_r3d_rs_type), DIMENSION(:), POINTER :: brho1_r, rho_r
570 TYPE(pw_spline_precond_type) :: precond
571 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
572 TYPE(qs_rho_p_type), DIMENSION(:, :), POINTER :: bind_set
573 TYPE(qs_rho_type), POINTER :: rho
574 TYPE(rho_atom_coeff), DIMENSION(:), POINTER :: rho_rad_h, rho_rad_s
575 TYPE(rho_atom_type), DIMENSION(:), POINTER :: rho_atom_set
576 TYPE(rho_atom_type), POINTER :: rho_atom
577 TYPE(section_vals_type), POINTER :: g_section, interp_section, lr_section
578
579 NULLIFY (atomic_kind_set, qs_kind_set, atom_list, bind_set, dft_control, &
580 grid_atom, g_section, g_soo, g_total, harmonics, interp_section, &
581 logger, lr_section, para_env, particle_set, rho, rho_atom, &
582 rho_atom_set, rho_r, brho1_r)
583
584 logger => cp_get_default_logger()
585 lr_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%LINRES")
586
587 output_unit = cp_print_key_unit_nr(logger, lr_section, "PRINT%PROGRAM_RUN_INFO", &
588 extension=".linresLog")
589
590 g_section => section_vals_get_subs_vals(lr_section, &
591 "EPR%PRINT%G_TENSOR")
592
593 CALL section_vals_val_get(g_section, "soo_rho_hard", l_val=soo_rho_hard)
594
595 CALL get_qs_env(qs_env=qs_env, atomic_kind_set=atomic_kind_set, qs_kind_set=qs_kind_set, &
596 dft_control=dft_control, para_env=para_env, particle_set=particle_set, &
597 pw_env=pw_env, rho=rho, rho_atom_set=rho_atom_set)
598
599 CALL get_epr_env(epr_env=epr_env, bind_set=bind_set, &
600 g_soo=g_soo, g_total=g_total)
601
602 CALL get_current_env(current_env=current_env, &
603 chi_tensor=chi_tensor)
604 CALL qs_rho_get(rho, rho_r=rho_r)
605
606 gapw = dft_control%qs_control%gapw
607 nkind = SIZE(qs_kind_set, 1)
608 nspins = dft_control%nspins
609
610 DO idir1 = 1, 3
611 temp_soo_soft = 0.0_dp
612 DO ispin = 1, nspins
613 CALL qs_rho_get(bind_set(idir1, ib)%rho, rho_r=brho1_r)
614 temp_soo_soft = temp_soo_soft + (-1.0_dp)**(1 + ispin)* &
615 pw_integral_ab(brho1_r(1), rho_r(ispin))
616 END DO
617 temp_soo_soft = 1.0_dp*epr_env%g_soo_factor*temp_soo_soft
618 IF (output_unit > 0) THEN
619 WRITE (unit=output_unit, fmt="(T2,A,T18,i1,i1,T56,E24.16)") &
620 "epr|SOO:soft", ib, idir1, temp_soo_soft
621 END IF
622 g_soo(ib, idir1) = temp_soo_soft
623 END DO
624
625 DO idir1 = 1, 3
626 temp_soo_soft = 1.0_dp*epr_env%g_soo_chicorr_factor*chi_tensor(idir1, ib, 2)* &
627 (real(dft_control%multiplicity, kind=dp) - 1.0_dp)
628 IF (output_unit > 0) THEN
629 WRITE (unit=output_unit, fmt="(T2,A,T18,i1,i1,T56,E24.16)") &
630 "epr|SOO:soft_g0", ib, idir1, temp_soo_soft
631 END IF
632 g_soo(ib, idir1) = g_soo(ib, idir1) + temp_soo_soft
633 END DO
634
635 IF (gapw .AND. soo_rho_hard) THEN
636
637 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
638 ALLOCATE (bind_pw_spline(3, 3))
639
640 interp_section => section_vals_get_subs_vals(lr_section, &
641 "EPR%INTERPOLATOR")
642 CALL section_vals_val_get(interp_section, "aint_precond", &
643 i_val=aint_precond)
644 CALL section_vals_val_get(interp_section, "precond", i_val=precond_kind)
645 CALL section_vals_val_get(interp_section, "max_iter", i_val=max_iter)
646 CALL section_vals_val_get(interp_section, "eps_r", r_val=eps_r)
647 CALL section_vals_val_get(interp_section, "eps_x", r_val=eps_x)
648
649 DO idir1 = 1, 3
650 CALL auxbas_pw_pool%create_pw(bind_pw_spline(idir1, ib))
651 ! calculate spline coefficients
652 CALL pw_spline_precond_create(precond, precond_kind=aint_precond, &
653 pool=auxbas_pw_pool, pbc=.true., transpose=.false.)
654 CALL qs_rho_get(bind_set(idir1, ib)%rho, rho_r=brho1_r)
655 CALL pw_spline_do_precond(precond, brho1_r(1), &
656 bind_pw_spline(idir1, ib))
657 CALL pw_spline_precond_set_kind(precond, precond_kind)
658 success = find_coeffs(values=brho1_r(1), &
659 coeffs=bind_pw_spline(idir1, ib), linop=spl3_pbc, &
660 preconditioner=precond, pool=auxbas_pw_pool, &
661 eps_r=eps_r, eps_x=eps_x, max_iter=max_iter)
662 cpassert(success)
663 CALL pw_spline_precond_release(precond)
664 END DO ! idir1
665
666 temp_soo_gapw = 0.0_dp
667
668 DO ikind = 1, nkind
669 NULLIFY (atom_list, grid_atom, harmonics)
670 CALL get_atomic_kind(atomic_kind_set(ikind), atom_list=atom_list, natom=natom)
671 CALL get_qs_kind(qs_kind_set(ikind), &
672 hard_radius=hard_radius, &
673 grid_atom=grid_atom, &
674 harmonics=harmonics, &
675 paw_atom=paw_atom)
676
677 IF (.NOT. paw_atom) cycle
678
679 ! Distribute the atoms of this kind
680
681 bo = get_limit(natom, para_env%num_pe, para_env%mepos)
682
683 DO iat = 1, natom !bo(1),bo(2)! this partitioning blocks the interpolation
684 ! ! routines (i.e. waiting for parallel sum)
685 iatom = atom_list(iat)
686 rho_atom => rho_atom_set(iatom)
687 NULLIFY (rho_rad_h, rho_rad_s)
688 CALL get_rho_atom(rho_atom=rho_atom, rho_rad_h=rho_rad_h, &
689 rho_rad_s=rho_rad_s)
690 DO idir1 = 1, 3
691 DO ispin = 1, nspins
692 DO ir = 1, grid_atom%nr
693
694 IF (grid_atom%rad(ir) >= hard_radius) cycle
695
696 DO ia = 1, grid_atom%ng_sphere
697
698 ra = particle_set(iatom)%r
699 ra(:) = ra(:) + grid_atom%rad(ir)*harmonics%a(:, ia)
700 bind_ra_idir1 = eval_interp_spl3_pbc(ra, &
701 bind_pw_spline(idir1, ib))
702
703 IF (iat .LT. bo(1) .OR. iat .GT. bo(2)) cycle !quick and dirty:
704 ! !here take care of the partition
705
706 rho_spin = 0.0_dp
707
708 DO iso = 1, harmonics%max_iso_not0
709 rho_spin = rho_spin + &
710 (rho_rad_h(ispin)%r_coef(ir, iso) - &
711 rho_rad_s(ispin)%r_coef(ir, iso))* &
712 harmonics%slm(ia, iso)
713 END DO
714
715 temp_soo_gapw(ib, idir1) = temp_soo_gapw(ib, idir1) + &
716 (-1.0_dp)**(1 + ispin)*( &
717 bind_ra_idir1*rho_spin &
718 )*grid_atom%wr(ir)*grid_atom%wa(ia)
719
720 END DO !ia
721 END DO !ir
722 END DO ! ispin
723 END DO !idir1
724 END DO !iat
725 END DO !ikind
726
727 CALL para_env%sum(temp_soo_gapw)
728 temp_soo_gapw(:, :) = 1.0_dp*epr_env%g_soo_factor*temp_soo_gapw(:, :)
729
730 IF (output_unit > 0) THEN
731 DO idir1 = 1, 3
732 WRITE (unit=output_unit, fmt="(T2,A,T18,I1,I1,T56,E24.16)") &
733 "epr|SOO:gapw", ib, idir1, temp_soo_gapw(ib, idir1)
734 END DO
735 END IF
736
737 g_soo(ib, :) = g_soo(ib, :) + temp_soo_gapw(ib, :)
738
739 DO idir1 = 1, 3
740 CALL auxbas_pw_pool%give_back_pw(bind_pw_spline(idir1, ib))
741 END DO
742 DEALLOCATE (bind_pw_spline)
743
744 END IF ! gapw
745
746 g_total(ib, :) = g_total(ib, :) + g_soo(ib, :)
747
748 CALL cp_print_key_finished_output(output_unit, logger, lr_section, &
749 "PRINT%PROGRAM_RUN_INFO")
750
751 END SUBROUTINE epr_g_soo
752
753! **************************************************************************************************
754!> \brief ...
755!> \param epr_env ...
756!> \param current_env ...
757!> \param qs_env ...
758!> \param iB ...
759! **************************************************************************************************
760 SUBROUTINE epr_ind_magnetic_field(epr_env, current_env, qs_env, iB)
761
762 TYPE(epr_env_type) :: epr_env
763 TYPE(current_env_type) :: current_env
764 TYPE(qs_environment_type), POINTER :: qs_env
765 INTEGER, INTENT(IN) :: ib
766
767 CHARACTER(LEN=*), PARAMETER :: routinen = 'epr_ind_magnetic_field'
768
769 INTEGER :: handle, idir, idir2, idir3, iib, iiib, &
770 ispin, natom, nspins
771 LOGICAL :: gapw
772 REAL(dp) :: scale_fac
773 TYPE(cell_type), POINTER :: cell
774 TYPE(dft_control_type), POINTER :: dft_control
775 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
776 TYPE(pw_c1d_gs_type) :: pw_gspace_work
777 TYPE(pw_c1d_gs_type), ALLOCATABLE, DIMENSION(:, :) :: shift_pw_gspace
778 TYPE(pw_c1d_gs_type), DIMENSION(:), POINTER :: jrho1_g
779 TYPE(pw_env_type), POINTER :: pw_env
780 TYPE(pw_pool_p_type), DIMENSION(:), POINTER :: pw_pools
781 TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
782 TYPE(pw_r3d_rs_type) :: shift_pw_rspace
783 TYPE(pw_r3d_rs_type), DIMENSION(:), POINTER :: epr_rho_r
784 TYPE(realspace_grid_desc_type), POINTER :: auxbas_rs_desc
785
786 CALL timeset(routinen, handle)
787
788 NULLIFY (cell, dft_control, pw_env, auxbas_rs_desc, auxbas_pw_pool, &
789 pw_pools, particle_set, jrho1_g, epr_rho_r)
790
791 CALL get_qs_env(qs_env=qs_env, cell=cell, dft_control=dft_control, &
792 particle_set=particle_set)
793
794 gapw = dft_control%qs_control%gapw
795 natom = SIZE(particle_set, 1)
796 nspins = dft_control%nspins
797
798 CALL get_epr_env(epr_env=epr_env)
799
800 CALL get_current_env(current_env=current_env)
801
802 CALL get_qs_env(qs_env=qs_env, pw_env=pw_env)
803 CALL pw_env_get(pw_env, auxbas_rs_desc=auxbas_rs_desc, &
804 auxbas_pw_pool=auxbas_pw_pool, pw_pools=pw_pools)
805 !
806 ! Initialize
807 ! Allocate grids for the calculation of jrho and the shift
808 ALLOCATE (shift_pw_gspace(3, nspins))
809 DO ispin = 1, nspins
810 DO idir = 1, 3
811 CALL auxbas_pw_pool%create_pw(shift_pw_gspace(idir, ispin))
812 CALL pw_zero(shift_pw_gspace(idir, ispin))
813 END DO
814 END DO
815 CALL auxbas_pw_pool%create_pw(shift_pw_rspace)
816 CALL pw_zero(shift_pw_rspace)
817 CALL auxbas_pw_pool%create_pw(pw_gspace_work)
818 CALL pw_zero(pw_gspace_work)
819 !
820 CALL set_vecp(ib, iib, iiib)
821 !
822 DO ispin = 1, nspins
823 !
824 DO idir3 = 1, 3
825 ! set to zero for the calculation of the shift
826 CALL pw_zero(shift_pw_gspace(idir3, ispin))
827 END DO
828 DO idir = 1, 3
829 CALL qs_rho_get(current_env%jrho1_set(idir)%rho, rho_g=jrho1_g)
830 ! Field gradient
831 ! loop over the Gvec components: x,y,z
832 DO idir2 = 1, 3
833 IF (idir /= idir2) THEN
834 ! in reciprocal space multiply (G_idir2(i)/G(i)^2)J_(idir)(G(i))
835 CALL mult_g_ov_g2_grid(auxbas_pw_pool, jrho1_g(ispin), &
836 pw_gspace_work, idir2, 0.0_dp)
837 !
838 ! scale and add to the correct component of the shift column
839 CALL set_vecp_rev(idir, idir2, idir3)
840 scale_fac = fac_vecp(idir3, idir2, idir)
841 CALL pw_scale(pw_gspace_work, scale_fac)
842 CALL pw_axpy(pw_gspace_work, shift_pw_gspace(idir3, ispin))
843 END IF
844 END DO
845 !
846 END DO ! idir
847 END DO ! ispin
848
849 ! Store the total soft induced magnetic field (corrected for sic)
850 IF (dft_control%nspins == 2) THEN
851 DO idir = 1, 3
852 CALL qs_rho_get(epr_env%bind_set(idir, ib)%rho, rho_r=epr_rho_r)
853 CALL pw_transfer(shift_pw_gspace(idir, 2), epr_rho_r(1))
854 END DO
855 END IF
856 !
857 ! Dellocate grids for the calculation of jrho and the shift
858 CALL auxbas_pw_pool%give_back_pw(pw_gspace_work)
859 DO ispin = 1, dft_control%nspins
860 DO idir = 1, 3
861 CALL auxbas_pw_pool%give_back_pw(shift_pw_gspace(idir, ispin))
862 END DO
863 END DO
864 DEALLOCATE (shift_pw_gspace)
865 CALL auxbas_pw_pool%give_back_pw(shift_pw_rspace)
866 !
867 ! Finalize
868 CALL timestop(handle)
869 !
870 END SUBROUTINE epr_ind_magnetic_field
871
872END MODULE qs_linres_epr_ownutils
873
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...
objects that represent the structure of input sections and the data contained in an input 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_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
Collection of simple mathematical functions and subroutines.
Definition mathlib.F:15
subroutine, public diamat_all(a, eigval, dac)
Diagonalize the symmetric n by n matrix a using the LAPACK library. Only the upper triangle of matrix...
Definition mathlib.F:372
Interface to the message passing library MPI.
Define the data structure for the particle information.
computes preconditioners, and implements methods to apply them currently used in qs_ot
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 ...
different utils that are useful to manipulate splines on the regular grid of a pw
subroutine, public pw_spline_precond_release(preconditioner)
releases the preconditioner
subroutine, public pw_spline_precond_create(preconditioner, precond_kind, pool, pbc, transpose)
...
subroutine, public pw_spline_do_precond(preconditioner, in_v, out_v)
applies the preconditioner to the system of equations to find the coefficients of the spline
subroutine, public pw_spline_precond_set_kind(preconditioner, precond_kind, pbc, transpose)
switches the types of precoditioner to use
real(kind=dp) function, public eval_interp_spl3_pbc(vec, pw)
Evaluates the PBC interpolated Spline (pw) function on the generic input vector (vec)
logical function, public find_coeffs(values, coeffs, linop, preconditioner, pool, eps_r, eps_x, max_iter, sumtype)
solves iteratively (CG) a systmes of linear equations linOp(coeffs)=values (for example those needed ...
subroutine, public spl3_pbc(pw_in, pw_out)
...
Calculation of the energies concerning the core charge distribution.
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.
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.
subroutine, public epr_g_soo(epr_env, current_env, qs_env, ib)
Calculates g_soo (soft part only for now)
subroutine, public epr_g_so(epr_env, current_env, qs_env, ib)
Calculates g_so.
subroutine, public epr_g_zke(epr_env, qs_env)
Calculate zke part of the g tensor.
subroutine, public epr_ind_magnetic_field(epr_env, current_env, qs_env, ib)
...
subroutine, public epr_g_print(epr_env, qs_env)
Prints the g tensor.
given the response wavefunctions obtained by the application of the (rxp), p, and ((dk-dl)xp) operato...
subroutine, public mult_g_ov_g2_grid(pw_pool, rho_gspace, funcg_times_rho, idir, my_chi)
Given the current density on the PW grid in reciprcal space (obtained by FFT), calculate the integral...
Calculate the operators p rxp and D needed in the optimization of the different contribution of the f...
subroutine, public set_vecp(i1, i2, i3)
...
real(dp) function, public fac_vecp(a, b, c)
...
subroutine, public set_vecp_rev(i1, i2, i3)
...
Type definitiona for linear response calculations.
subroutine, public get_current_env(current_env, simple_done, simple_converged, full_done, nao, nstates, gauge, list_cubes, statetrueindex, gauge_name, basisfun_center, nbr_center, center_list, centers_set, psi1_p, psi1_rxp, psi1_d, p_psi0, rxp_psi0, jrho1_atom_set, jrho1_set, chi_tensor, chi_tensor_loc, gauge_atom_radius, rs_gauge, use_old_gauge_atom, chi_pbc, psi0_order)
...
subroutine, public get_epr_env(epr_env, g_total, g_so, g_soo, nablavks_set, nablavks_atom_set, bind_set, bind_atom_set)
...
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...
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
to create arrays of pools
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
stores information for the preconditioner used to calculate the coeffs of splines
Provides all information about a quickstep kind.
keeps the density in various representations, keeping track of which ones are valid.