(git:f2099e5)
Loading...
Searching...
No Matches
fde_methods.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
10 USE cp_files, ONLY: close_file,&
15 USE kinds, ONLY: dp
16 USE message_passing, ONLY: mp_comm_type,&
18 USE pw_env_types, ONLY: pw_env_get,&
21 USE pw_methods, ONLY: pw_axpy,&
22 pw_copy,&
28 USE pw_types, ONLY: pw_c1d_gs_type,&
33 USE qs_ks_types, ONLY: get_ks_env,&
35 USE qs_rho_types, ONLY: qs_rho_get,&
37 USE xc, ONLY: xc_vxc_pw_create
38#include "./base/base_uses.f90"
39
40 IMPLICIT NONE
41 PRIVATE
42
43 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'fde_methods'
44
45 PUBLIC :: &
48 fde_spawn, &
49 fde_v_es, &
53
54CONTAINS
55
56! **************************************************************************************************
57!> \brief Build the electrostatic potential of a QS calculation
58!> \param qs_env ...
59!> \param v_es ...
60! **************************************************************************************************
61 SUBROUTINE fde_v_es(qs_env, v_es)
62 TYPE(qs_environment_type), POINTER :: qs_env
63 TYPE(pw_r3d_rs_type), INTENT(OUT) :: v_es
64
65 REAL(kind=dp) :: e_es
66 TYPE(pw_c1d_gs_type) :: rho_tot_g, v_es_g
67 TYPE(pw_env_type), POINTER :: pw_env
68 TYPE(pw_poisson_type), POINTER :: poisson_env
69 TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
70 TYPE(qs_rho_type), POINTER :: rho
71
72 NULLIFY (pw_env, poisson_env, auxbas_pw_pool, rho)
73 CALL get_qs_env(qs_env, pw_env=pw_env, rho=rho)
74 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool, poisson_env=poisson_env)
75
76 CALL auxbas_pw_pool%create_pw(rho_tot_g)
77 CALL pw_zero(rho_tot_g)
78 CALL calc_rho_tot_gspace(rho_tot_g, qs_env, rho)
79
80 CALL auxbas_pw_pool%create_pw(v_es_g)
81 CALL pw_poisson_solve(poisson_env, rho_tot_g, e_es, v_es_g)
82
83 CALL auxbas_pw_pool%create_pw(v_es)
84 CALL pw_transfer(v_es_g, v_es)
85
86 CALL auxbas_pw_pool%give_back_pw(rho_tot_g)
87 CALL auxbas_pw_pool%give_back_pw(v_es_g)
88
89 END SUBROUTINE fde_v_es
90
91! **************************************************************************************************
92!> \brief Copy the electron density from a QS calculation into a new grid
93!> \param qs_env ...
94!> \param rho ...
95! **************************************************************************************************
96 SUBROUTINE fde_get_env_density(qs_env, rho)
97 TYPE(qs_environment_type), POINTER :: qs_env
98 TYPE(pw_r3d_rs_type), INTENT(OUT) :: rho
99
100 INTEGER :: ispin, nspins
101 TYPE(dft_control_type), POINTER :: dft_control
102 TYPE(pw_env_type), POINTER :: pw_env
103 TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
104 TYPE(pw_r3d_rs_type), DIMENSION(:), POINTER :: rho_r
105 TYPE(qs_rho_type), POINTER :: rho_qs
106
107 NULLIFY (dft_control, pw_env, auxbas_pw_pool, rho_r, rho_qs)
108 CALL get_qs_env(qs_env, dft_control=dft_control, pw_env=pw_env, rho=rho_qs)
109 nspins = dft_control%nspins
110
111 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
112 CALL auxbas_pw_pool%create_pw(rho)
113 CALL pw_zero(rho)
114
115 CALL qs_rho_get(rho_qs, rho_r=rho_r)
116 DO ispin = 1, nspins
117 CALL pw_axpy(rho_r(ispin), rho, 1.0_dp)
118 END DO
119
120 END SUBROUTINE fde_get_env_density
121
122! **************************************************************************************************
123!> \brief Evaluate an XC+KEDF potential and energy for a density
124!> \param ks_env ...
125!> \param pw_env ...
126!> \param xc_section ...
127!> \param rho ...
128!> \param v_xc ...
129!> \param e_xc ...
130! **************************************************************************************************
131 SUBROUTINE fde_vxc_on_grid(ks_env, pw_env, xc_section, rho, v_xc, e_xc)
132 TYPE(qs_ks_env_type), POINTER :: ks_env
133 TYPE(pw_env_type), POINTER :: pw_env
134 TYPE(section_vals_type), POINTER :: xc_section
135 TYPE(pw_r3d_rs_type), INTENT(IN) :: rho
136 TYPE(pw_r3d_rs_type), INTENT(OUT) :: v_xc
137 REAL(kind=dp), INTENT(OUT) :: e_xc
138
139 REAL(kind=dp), DIMENSION(3, 3) :: virial_xc
140 TYPE(pw_c1d_gs_type) :: rho_g_single
141 TYPE(pw_c1d_gs_type), DIMENSION(:), POINTER :: rho_g
142 TYPE(pw_pool_type), POINTER :: auxbas_pw_pool, xc_pw_pool
143 TYPE(pw_r3d_rs_type), DIMENSION(:), POINTER :: rho_r, tau, vxc_rho, vxc_tau
144 TYPE(pw_r3d_rs_type), POINTER :: weights
145
146 NULLIFY (auxbas_pw_pool, xc_pw_pool, rho_r, rho_g, tau, vxc_rho, vxc_tau, weights)
147 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool, xc_pw_pool=xc_pw_pool)
148 CALL get_ks_env(ks_env, xcint_weights=weights)
149
150 ALLOCATE (rho_r(1), rho_g(1))
151 rho_r(1) = rho
152 CALL auxbas_pw_pool%create_pw(rho_g_single)
153 CALL pw_transfer(rho, rho_g_single)
154 rho_g(1) = rho_g_single
155
156 CALL xc_vxc_pw_create(vxc_rho=vxc_rho, &
157 vxc_tau=vxc_tau, &
158 exc=e_xc, &
159 rho_r=rho_r, &
160 rho_g=rho_g, &
161 tau=tau, &
162 xc_section=xc_section, &
163 weights=weights, &
164 pw_pool=xc_pw_pool, &
165 compute_virial=.false., &
166 virial_xc=virial_xc)
167
168 CALL auxbas_pw_pool%create_pw(v_xc)
169 CALL pw_copy(vxc_rho(1), v_xc)
170
171 CALL xc_pw_pool%give_back_pw(vxc_rho(1))
172 DEALLOCATE (vxc_rho)
173 IF (ASSOCIATED(vxc_tau)) THEN
174 CALL xc_pw_pool%give_back_pw(vxc_tau(1))
175 DEALLOCATE (vxc_tau)
176 END IF
177 CALL auxbas_pw_pool%give_back_pw(rho_g_single)
178 DEALLOCATE (rho_r, rho_g)
179
180 END SUBROUTINE fde_vxc_on_grid
181
182! **************************************************************************************************
183!> \brief Build the embedding potential and evaluate nonadditive terms of a QS calculation.
184!> \param qs_env ...
185!> \param rho ...
186!> \param v_emb ...
187!> \param e_xc_na ...
188!> \param e_kin_na ...
189! **************************************************************************************************
190 SUBROUTINE fde_build_v_emb(qs_env, rho, v_emb, e_xc_na, e_kin_na)
191 TYPE(qs_environment_type), POINTER :: qs_env
192 TYPE(pw_r3d_rs_type), INTENT(IN) :: rho
193 TYPE(pw_r3d_rs_type), INTENT(OUT) :: v_emb
194 REAL(kind=dp), INTENT(OUT) :: e_xc_na, e_kin_na
195
196 REAL(kind=dp) :: exc_a, exc_ab, exc_b
197 TYPE(dft_control_type), POINTER :: dft_control
198 TYPE(pw_env_type), POINTER :: pw_env
199 TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
200 TYPE(pw_r3d_rs_type) :: rho_ab, rho_b_r, v_a, v_ab, v_tmp
201 TYPE(qs_ks_env_type), POINTER :: ks_env
202 TYPE(section_vals_type), POINTER :: input, kg_xc_section, xc_section
203
204 NULLIFY (dft_control, pw_env, auxbas_pw_pool, ks_env, input, xc_section, kg_xc_section)
205 CALL get_qs_env(qs_env, dft_control=dft_control, pw_env=pw_env, ks_env=ks_env, input=input)
206 cpassert(dft_control%nspins == 1)
207 cpassert(.NOT. dft_control%qs_control%gapw)
208
209 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
210
211 CALL fde_get_env_density(qs_env, rho_b_r)
212 CALL auxbas_pw_pool%create_pw(rho_ab)
213 CALL pw_copy(rho_b_r, rho_ab)
214 CALL pw_axpy(rho, rho_ab, 1.0_dp)
215
216 xc_section => section_vals_get_subs_vals(input, "DFT%XC")
217 kg_xc_section => section_vals_get_subs_vals(input, "DFT%KG_METHOD%XC")
218
219 CALL fde_v_es(qs_env, v_emb)
220
221 CALL fde_vxc_on_grid(ks_env, pw_env, xc_section, rho_ab, v_ab, exc_ab)
222 CALL fde_vxc_on_grid(ks_env, pw_env, xc_section, rho, v_a, exc_a)
223 CALL fde_vxc_on_grid(ks_env, pw_env, xc_section, rho_b_r, v_tmp, exc_b) ! energy only
224 CALL auxbas_pw_pool%give_back_pw(v_tmp)
225 CALL pw_axpy(v_ab, v_emb, 1.0_dp)
226 CALL pw_axpy(v_a, v_emb, -1.0_dp)
227 CALL auxbas_pw_pool%give_back_pw(v_ab)
228 CALL auxbas_pw_pool%give_back_pw(v_a)
229 e_xc_na = exc_ab - exc_a - exc_b
230
231 CALL fde_vxc_on_grid(ks_env, pw_env, kg_xc_section, rho_ab, v_ab, exc_ab)
232 CALL fde_vxc_on_grid(ks_env, pw_env, kg_xc_section, rho, v_a, exc_a)
233 CALL fde_vxc_on_grid(ks_env, pw_env, kg_xc_section, rho_b_r, v_tmp, exc_b) ! energy only
234 CALL auxbas_pw_pool%give_back_pw(v_tmp)
235 CALL pw_axpy(v_ab, v_emb, 1.0_dp)
236 CALL pw_axpy(v_a, v_emb, -1.0_dp)
237 CALL auxbas_pw_pool%give_back_pw(v_ab)
238 CALL auxbas_pw_pool%give_back_pw(v_a)
239 e_kin_na = exc_ab - exc_a - exc_b
240
241 CALL auxbas_pw_pool%give_back_pw(rho_ab)
242 CALL auxbas_pw_pool%give_back_pw(rho_b_r)
243
244 END SUBROUTINE fde_build_v_emb
245
246! **************************************************************************************************
247!> \brief Spawns the subsystem solver. Only the source rank launches the process; the other ranks
248!> wait for it on the broadcasts below
249!> \param fde_control ...
250!> \param input_file ...
251!> \param para_env ...
252! **************************************************************************************************
253 SUBROUTINE fde_spawn(fde_control, input_file, para_env)
254 TYPE(fde_control_type), POINTER :: fde_control
255 CHARACTER(len=*), INTENT(IN) :: input_file
256 TYPE(mp_para_env_type), INTENT(IN) :: para_env
257
258 CHARACTER(len=:), ALLOCATABLE :: command
259 INTEGER :: cmdstat, exitstat
260
261 IF (len_trim(fde_control%workdir) > 0) THEN
262 command = "cd "//trim(fde_control%workdir)//" && "// &
263 trim(fde_control%command)//" "//trim(input_file)
264 ELSE
265 command = trim(fde_control%command)//" "//trim(input_file)
266 END IF
267
268 exitstat = 0
269 cmdstat = 0
270 IF (para_env%is_source()) THEN
271 CALL execute_command_line(command, wait=.true., exitstat=exitstat, cmdstat=cmdstat)
272 END IF
273
274 CALL para_env%bcast(cmdstat)
275 CALL para_env%bcast(exitstat)
276
277 IF (cmdstat /= 0) THEN
278 cpabort("FDE: failed to launch command: "//command)
279 END IF
280 IF (exitstat /= 0) THEN
281 cpabort("FDE: command returned a non-zero exit status: "//trim(cp_to_string(exitstat)))
282 END IF
283
284 END SUBROUTINE fde_spawn
285
286! **************************************************************************************************
287!> \brief Write grid points to disk in the Molcas format, optionally with weights and values.
288!> write_value=.TRUE.: x y z weight value
289!> write_value=.FALSE.: x y z
290!> \param pw ...
291!> \param filename ...
292!> \param write_value ...
293! **************************************************************************************************
294 SUBROUTINE fde_write_pw(pw, filename, write_value)
295 TYPE(pw_r3d_rs_type), INTENT(IN) :: pw
296 CHARACTER(len=*), INTENT(IN) :: filename
297 LOGICAL, INTENT(IN) :: write_value
298
299 CHARACTER(len=*), PARAMETER :: routinen = 'fde_write_pw'
300
301 INTEGER :: dest, handle, i1, i2, i3, ip, l1, l2, &
302 l3, mepos, num_pe, source, tag, u1, &
303 u2, u3, unit_nr
304 REAL(kind=dp) :: dvol, x, y, z
305 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: buf
306 TYPE(mp_comm_type) :: group
307
308 CALL timeset(routinen, handle)
309
310 l1 = pw%pw_grid%bounds(1, 1)
311 u1 = pw%pw_grid%bounds(2, 1)
312 l2 = pw%pw_grid%bounds(1, 2)
313 u2 = pw%pw_grid%bounds(2, 2)
314 l3 = pw%pw_grid%bounds(1, 3)
315 u3 = pw%pw_grid%bounds(2, 3)
316 dvol = pw%pw_grid%dvol
317
318 group = pw%pw_grid%para%group
319 mepos = pw%pw_grid%para%group%mepos
320 num_pe = pw%pw_grid%para%group%num_pe
321 tag = 1
322 dest = 0
323
324 unit_nr = -1
325 IF (mepos == dest) THEN
326 CALL open_file(file_name=trim(filename), file_status="REPLACE", file_form="FORMATTED", &
327 file_action="WRITE", unit_number=unit_nr)
328 WRITE (unit_nr, '(I10)') pw%pw_grid%ngpts
329 END IF
330
331 ALLOCATE (buf(l3:u3))
332
333 DO i1 = l1, u1
334 DO i2 = l2, u2
335 IF (pw%pw_grid%para%mode /= pw_mode_local) THEN
336 source = dest
337 DO ip = 0, num_pe - 1
338 IF (pw%pw_grid%para%bo(1, 1, ip, 1) <= i1 - l1 + 1 &
339 .AND. pw%pw_grid%para%bo(2, 1, ip, 1) >= i1 - l1 + 1 &
340 .AND. pw%pw_grid%para%bo(1, 2, ip, 1) <= i2 - l2 + 1 &
341 .AND. pw%pw_grid%para%bo(2, 2, ip, 1) >= i2 - l2 + 1) THEN
342 source = ip
343 END IF
344 END DO
345 ELSE
346 source = dest
347 END IF
348
349 IF (source == dest) THEN
350 IF (mepos == source) buf(:) = pw%array(i1, i2, :)
351 ELSE
352 IF (mepos == source) THEN
353 buf(:) = pw%array(i1, i2, :)
354 CALL group%send(buf, dest, tag)
355 END IF
356 IF (mepos == dest) CALL group%recv(buf, source, tag)
357 END IF
358
359 IF (mepos == dest) THEN
360 DO i3 = l3, u3
361 x = pw%pw_grid%dh(1, 1)*(i1 - l1) &
362 + pw%pw_grid%dh(2, 1)*(i2 - l2) &
363 + pw%pw_grid%dh(3, 1)*(i3 - l3)
364 y = pw%pw_grid%dh(1, 2)*(i1 - l1) &
365 + pw%pw_grid%dh(2, 2)*(i2 - l2) &
366 + pw%pw_grid%dh(3, 2)*(i3 - l3)
367 z = pw%pw_grid%dh(1, 3)*(i1 - l1) &
368 + pw%pw_grid%dh(2, 3)*(i2 - l2) &
369 + pw%pw_grid%dh(3, 3)*(i3 - l3)
370 IF (write_value) THEN
371 WRITE (unit_nr, '(3F16.8,2ES20.10E3)') x, y, z, dvol, buf(i3)
372 ELSE
373 WRITE (unit_nr, '(3F16.8)') x, y, z
374 END IF
375 END DO
376 END IF
377
378 CALL group%sync()
379 END DO
380 END DO
381
382 DEALLOCATE (buf)
383
384 IF (mepos == dest) CALL close_file(unit_number=unit_nr)
385
386 CALL timestop(handle)
387
388 END SUBROUTINE fde_write_pw
389
390! **************************************************************************************************
391!> \brief Read the density in x y z weight value format
392!> \param pw ...
393!> \param filename ...
394! **************************************************************************************************
395 SUBROUTINE fde_read_pw(pw, filename)
396 TYPE(pw_r3d_rs_type), INTENT(INOUT) :: pw
397 CHARACTER(len=*), INTENT(IN) :: filename
398
399 CHARACTER(len=*), PARAMETER :: routinen = 'fde_read_pw'
400
401 INTEGER :: dest, handle, i1, i2, i3, ip, l1, l2, &
402 l3, mepos, npoints, num_pe, source, &
403 tag, u1, u2, u3, unit_nr
404 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: buf
405 TYPE(mp_comm_type) :: group
406
407 CALL timeset(routinen, handle)
408
409 l1 = pw%pw_grid%bounds(1, 1)
410 u1 = pw%pw_grid%bounds(2, 1)
411 l2 = pw%pw_grid%bounds(1, 2)
412 u2 = pw%pw_grid%bounds(2, 2)
413 l3 = pw%pw_grid%bounds(1, 3)
414 u3 = pw%pw_grid%bounds(2, 3)
415
416 group = pw%pw_grid%para%group
417 mepos = pw%pw_grid%para%group%mepos
418 num_pe = pw%pw_grid%para%group%num_pe
419 tag = 1
420 dest = 0
421
422 unit_nr = -1
423 IF (mepos == dest) THEN
424 CALL open_file(file_name=trim(filename), file_status="OLD", file_form="FORMATTED", &
425 file_action="READ", unit_number=unit_nr)
426 READ (unit_nr, *) npoints
427 IF (npoints /= pw%pw_grid%ngpts) THEN
428 cpabort("Number of grid points in file does not match the pw grid")
429 END IF
430 END IF
431
432 ALLOCATE (buf(l3:u3))
433
434 DO i1 = l1, u1
435 DO i2 = l2, u2
436 IF (pw%pw_grid%para%mode /= pw_mode_local) THEN
437 source = dest
438 DO ip = 0, num_pe - 1
439 IF (pw%pw_grid%para%bo(1, 1, ip, 1) <= i1 - l1 + 1 &
440 .AND. pw%pw_grid%para%bo(2, 1, ip, 1) >= i1 - l1 + 1 &
441 .AND. pw%pw_grid%para%bo(1, 2, ip, 1) <= i2 - l2 + 1 &
442 .AND. pw%pw_grid%para%bo(2, 2, ip, 1) >= i2 - l2 + 1) THEN
443 source = ip
444 END IF
445 END DO
446 ELSE
447 source = dest
448 END IF
449
450 IF (mepos == dest) THEN
451 DO i3 = l3, u3
452 READ (unit_nr, *) buf(i3)
453 END DO
454 END IF
455
456 IF (source == dest) THEN
457 IF (mepos == source) pw%array(i1, i2, :) = buf(:)
458 ELSE
459 IF (mepos == dest) CALL group%send(buf, source, tag)
460 IF (mepos == source) THEN
461 CALL group%recv(buf, dest, tag)
462 pw%array(i1, i2, :) = buf(:)
463 END IF
464 END IF
465
466 CALL group%sync()
467 END DO
468 END DO
469
470 DEALLOCATE (buf)
471
472 IF (mepos == dest) CALL close_file(unit_number=unit_nr)
473
474 CALL timestop(handle)
475
476 END SUBROUTINE fde_read_pw
477
478! **************************************************************************************************
479!> \brief Read scalar results returned by the subsystem solver, one value per line, in this order:
480!> E_sub : embedded subsystem total energy
481!> E_emb : embedding energy
482!> E_nuc : nuclear repulsion energy
483!> n_e : number of active-subsystem electrons
484!> n_a : number of nuclei of subsystem A
485!> Followed by n_a lines of
486!> Z_I x_I y_I z_I (charge and coordinates in the CP2K frame)
487!> \param filename ...
488!> \param para_env ...
489!> \param e_sub ...
490!> \param e_emb ...
491!> \param e_nuc ...
492!> \param n_e ...
493!> \param n_a ...
494!> \param z_a ...
495!> \param r_a ...
496! **************************************************************************************************
497 SUBROUTINE fde_read_results(filename, para_env, e_sub, e_emb, e_nuc, n_e, n_a, z_a, r_a)
498 CHARACTER(len=*), INTENT(IN) :: filename
499 TYPE(mp_para_env_type), INTENT(IN) :: para_env
500 REAL(kind=dp), INTENT(OUT) :: e_sub, e_emb, e_nuc, n_e
501 INTEGER, INTENT(OUT) :: n_a
502 REAL(kind=dp), ALLOCATABLE, DIMENSION(:), &
503 INTENT(OUT) :: z_a
504 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :), &
505 INTENT(OUT) :: r_a
506
507 INTEGER :: iatom, unit_nr
508 REAL(kind=dp), DIMENSION(4) :: vals
509
510 vals = 0.0_dp
511 n_a = 0
512 IF (para_env%is_source()) THEN
513 CALL open_file(file_name=trim(filename), file_status="OLD", file_form="FORMATTED", &
514 file_action="READ", unit_number=unit_nr)
515 READ (unit_nr, *) vals(1)
516 READ (unit_nr, *) vals(2)
517 READ (unit_nr, *) vals(3)
518 READ (unit_nr, *) vals(4)
519 READ (unit_nr, *) n_a
520 END IF
521 CALL para_env%bcast(vals)
522 CALL para_env%bcast(n_a)
523
524 ALLOCATE (z_a(n_a), r_a(3, n_a))
525 z_a = 0.0_dp
526 r_a = 0.0_dp
527 IF (para_env%is_source()) THEN
528 DO iatom = 1, n_a
529 READ (unit_nr, *) z_a(iatom), r_a(1, iatom), r_a(2, iatom), r_a(3, iatom)
530 END DO
531 CALL close_file(unit_number=unit_nr)
532 END IF
533 CALL para_env%bcast(z_a)
534 CALL para_env%bcast(r_a)
535
536 e_sub = vals(1)
537 e_emb = vals(2)
538 e_nuc = vals(3)
539 n_e = vals(4)
540
541 END SUBROUTINE fde_read_results
542
543END MODULE fde_methods
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
Utility routines to open and close files. Tracking of preconnections.
Definition cp_files.F:16
subroutine, public open_file(file_name, file_status, file_form, file_action, file_position, file_pad, unit_number, debug, skip_get_unit_number, file_access)
Opens the requested file using a free unit number.
Definition cp_files.F:323
subroutine, public close_file(unit_number, file_status, keep_preconnection)
Close an open file given by its logical unit number. Optionally, keep the file and unit preconnected.
Definition cp_files.F:123
various routines to log and control the output. The idea is that decisions about where to log should ...
subroutine, public fde_read_results(filename, para_env, e_sub, e_emb, e_nuc, n_e, n_a, z_a, r_a)
Read scalar results returned by the subsystem solver, one value per line, in this order: E_sub : embe...
subroutine, public fde_read_pw(pw, filename)
Read the density in x y z weight value format.
subroutine, public fde_write_pw(pw, filename, write_value)
Write grid points to disk in the Molcas format, optionally with weights and values....
subroutine, public fde_build_v_emb(qs_env, rho, v_emb, e_xc_na, e_kin_na)
Build the embedding potential and evaluate nonadditive terms of a QS calculation.
subroutine, public fde_v_es(qs_env, v_es)
Build the electrostatic potential of a QS calculation.
Definition fde_methods.F:62
subroutine, public fde_spawn(fde_control, input_file, para_env)
Spawns the subsystem solver. Only the source rank launches the process; the other ranks wait for it o...
subroutine, public fde_get_env_density(qs_env, rho)
Copy the electron density from a QS calculation into a new grid.
Definition fde_methods.F:97
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
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Interface to the message passing library MPI.
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
integer, parameter, public pw_mode_local
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, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
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)
...
subroutine, public get_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, exc_accint, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, rho, rho_xc, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, task_list, task_list_soft, kpoints, do_kpoints, atomic_kind_set, qs_kind_set, cell, cell_ref, use_ref_cell, particle_set, energy, force, local_particles, local_molecules, molecule_kind_set, molecule_set, subsys, cp_subsys, virial, results, atprop, nkind, natom, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env, nelectron_total, nelectron_spin)
...
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...
Exchange and Correlation functional calculations.
Definition xc.F:17
subroutine, public xc_vxc_pw_create(vxc_rho, vxc_tau, exc, rho_r, rho_g, tau, xc_section, weights, pw_pool, compute_virial, virial_xc, exc_r)
Exchange and Correlation functional calculations.
Definition xc.F:483
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 ...
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.