Octopus
density.F90
Go to the documentation of this file.
1!! Copyright (C) 2002-2010 M. Marques, A. Castro, A. Rubio, G. Bertsch, X. Andrade
2!!
3!! This program is free software; you can redistribute it and/or modify
4!! it under the terms of the GNU General Public License as published by
5!! the Free Software Foundation; either version 2, or (at your option)
6!! any later version.
7!!
8!! This program is distributed in the hope that it will be useful,
9!! but WITHOUT ANY WARRANTY; without even the implied warranty of
10!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11!! GNU General Public License for more details.
12!!
13!! You should have received a copy of the GNU General Public License
14!! along with this program; if not, write to the Free Software
15!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16!! 02110-1301, USA.
17!!
18
19#include "global.h"
20
26!
27module density_oct_m
28 use accel_oct_m
30 use batch_oct_m
32 use blas_oct_m
33 use iso_c_binding
34 use comm_oct_m
35 use debug_oct_m
38 use epot_oct_m
39 use global_oct_m
40 use grid_oct_m
41 use, intrinsic :: iso_fortran_env
44 use math_oct_m
45 use mesh_oct_m
48 use mpi_oct_m
52 use parser_oct_m
53 use phase_oct_m
57 use ps_oct_m, only: proj_uspp
58 use smear_oct_m
59 use space_oct_m
63 use types_oct_m
65
66 implicit none
67
68 private
69
70 public :: &
83
86 private
87 real(real64), contiguous, pointer :: density(:, :)
88 ! !! dimensions (1:np, 1:d%nspin)
89 type(states_elec_t), pointer :: st => null()
90 type(grid_t), pointer :: gr => null()
91 type(epot_t), pointer :: ep => null()
92 type(nonlocal_pseudopotential_t), pointer :: vnl => null()
93 type(phase_t), pointer :: phase => null()
94 type(accel_mem_t) :: buff_density
95 integer(int64) :: pnp
96 logical :: packed
97 end type density_calc_t
98
99contains
100
105 !
106 subroutine density_calc_init(this, st, gr, density, ep, vnl, phase)
107 type(density_calc_t), intent(out) :: this
108 type(states_elec_t), target, intent(in) :: st
109 type(grid_t), target, intent(in) :: gr
110 real(real64), contiguous, target, intent(out) :: density(:, :)
111 type(epot_t), optional, target, intent(in) :: ep
112 type(nonlocal_pseudopotential_t), optional, target, intent(inout) :: vnl
113 type(phase_t), optional, target, intent(in) :: phase
114
115 integer :: ip, ispin
116 logical :: correct_size
117
118 push_sub(density_calc_init)
119
120 this%st => st
121 this%gr => gr
122 nullify(this%ep)
123 nullify(this%vnl)
124 nullify(this%phase)
125
126 if (st%requires_generalized_overlap) then
127 if (.not. present(ep) .or. .not. present(vnl)) then
128 call messages_not_implemented("density calculation with ultrasoft/PAW augmentation density")
129 end if
130 this%ep => ep
131 this%vnl => vnl
132 if (present(phase)) this%phase => phase
133 ! PAW: reset the one-center accumulators
134 if (allocated(this%vnl%onsite_density_matrix)) this%vnl%onsite_density_matrix = m_zero
135 if (allocated(this%vnl%onsite_current_matrix)) this%vnl%onsite_current_matrix = m_zero
136 end if
137
138 this%density => density
139 !$omp parallel private(ip)
140 do ispin = 1, st%d%nspin
141 !$omp do
142 do ip = 1, gr%np
143 this%density(ip, ispin) = m_zero
144 end do
145 !$omp end do nowait
146 end do
147 !$omp end parallel
148
149 this%packed = .false.
150
151 correct_size = ubound(this%density, dim = 1) == this%gr%np .or. &
152 ubound(this%density, dim = 1) == this%gr%np_part
153 assert(correct_size)
154
155 pop_sub(density_calc_init)
156 end subroutine density_calc_init
158 ! ---------------------------------------------------
160 !
161 subroutine density_calc_pack(this, async)
162 type(density_calc_t), intent(inout) :: this
163 logical, optional, intent(in) :: async
167 this%packed = .true.
168 this%pnp = accel_padded_size(this%gr%np)
169 call accel_create_buffer(this%buff_density, accel_mem_read_write, type_float, this%pnp*this%st%d%nspin)
170
171 ! set to zero
172 call accel_set_buffer_to_zero(this%buff_density, type_float, this%pnp*this%st%d%nspin, async=async)
173
174 pop_sub(density_calc_pack)
175 end subroutine density_calc_pack
176
177 ! ---------------------------------------------------
181 !
182 subroutine density_calc_state(this, psib, istin)
183 type(density_calc_t), intent(inout) :: this
184 type(wfs_elec_t), intent(in) :: psib
185 integer, intent(in) :: istin
186
187 integer :: ist, ip, ispin, istin_, bsize, gsize
188 complex(real64) :: term, psi1, psi2
189 real(real64), allocatable :: weight(:)
190 type(accel_mem_t) :: buff_weight
191 type(accel_kernel_t), pointer :: kernel
192
193 push_sub(density_calc_state)
194 call profiling_in("CALC_STATE_DENSITY")
195
196 ispin = this%st%d%get_spin_index(psib%ik)
197
198 istin_= 0
199
200 safe_allocate(weight(1:psib%nst))
201 do ist = 1, psib%nst
202 weight(ist) = this%st%kweights(psib%ik)*this%st%occ(psib%ist(ist), psib%ik)
203 if (psib%ist(ist) == istin) istin_ = ist
204 end do
205
206 assert(istin_ > 0)
207
208 if (abs(weight(istin_)) <= m_epsilon) then
209 call profiling_out("CALC_STATE_DENSITY")
210 pop_sub(density_calc_state)
211 return
212 end if
213
214 !fix ist for the remaining code
215 ist = istin_
216
217
218 select case (psib%status())
219 case (batch_not_packed)
220 select case (this%st%d%ispin)
222 if (states_are_real(this%st)) then
223 !$omp parallel do simd schedule(static)
224 do ip = 1, this%gr%np
225 this%density(ip, ispin) = this%density(ip, ispin) + weight(ist)*psib%dff(ip, 1, ist)**2
226 end do
227 else
228 !$omp parallel do schedule(static)
229 do ip = 1, this%gr%np
230 this%density(ip, ispin) = this%density(ip, ispin) + weight(ist)* &
231 real(conjg(psib%zff(ip, 1, ist))*psib%zff(ip, 1, ist), real64)
232 end do
233 end if
234 case (spinors)
235 !$omp parallel do schedule(static) private(psi1, psi2, term)
236 do ip = 1, this%gr%np
237 psi1 = psib%zff(ip, 1, ist)
238 psi2 = psib%zff(ip, 2, ist)
239 this%density(ip, 1) = this%density(ip, 1) + weight(ist)*real(conjg(psi1)*psi1, real64)
240 this%density(ip, 2) = this%density(ip, 2) + weight(ist)*real(conjg(psi2)*psi2, real64)
241 term = weight(ist)*psi1*conjg(psi2)
242 this%density(ip, 3) = this%density(ip, 3) + real(term, real64)
243 this%density(ip, 4) = this%density(ip, 4) + aimag(term)
244 end do
245 end select
246
247 case (batch_packed)
248
249 select case (this%st%d%ispin)
251 if (states_are_real(this%st)) then
252 !$omp parallel do schedule(static)
253 do ip = 1, this%gr%np
254 this%density(ip, ispin) = this%density(ip, ispin) + weight(ist)*psib%dff_pack(ist, ip)**2
255 end do
256 else
257
258 !$omp parallel do schedule(static)
259 do ip = 1, this%gr%np
260 this%density(ip, ispin) = this%density(ip, ispin) + weight(ist)* &
261 real(conjg(psib%zff_pack(ist, ip))*psib%zff_pack(ist, ip), real64)
262 end do
263 end if
264 case (spinors)
265 assert(mod(psib%nst_linear, 2) == 0)
266 !$omp parallel do schedule(static) private(psi1, psi2, term)
267 do ip = 1, this%gr%np
268 psi1 = psib%zff_pack(2*ist - 1, ip)
269 psi2 = psib%zff_pack(2*ist, ip)
270 term = weight(ist)*psi1*conjg(psi2)
271
272 this%density(ip, 1) = this%density(ip, 1) + weight(ist)*real(conjg(psi1)*psi1, real64)
273 this%density(ip, 2) = this%density(ip, 2) + weight(ist)*real(conjg(psi2)*psi2, real64)
274 this%density(ip, 3) = this%density(ip, 3) + real(term, real64)
275 this%density(ip, 4) = this%density(ip, 4) + aimag(term)
276 end do
277 end select
278
280 if (.not. this%packed) call density_calc_pack(this, async=.true.)
281
282 call accel_create_buffer(buff_weight, accel_mem_read_only, type_float, psib%nst)
283 call accel_write_buffer(buff_weight, psib%nst, weight, async=.true.)
284
285 select case (this%st%d%ispin)
287 if (states_are_real(this%st)) then
288 kernel => kernel_density_real
289 else
290 kernel => kernel_density_complex
291 end if
292
293 call accel_set_kernel_arg(kernel, 0, psib%nst)
294 call accel_set_kernel_arg(kernel, 1, this%gr%np)
295 call accel_set_kernel_arg(kernel, 2, int(this%pnp*(ispin - 1), int32))
296 call accel_set_kernel_arg(kernel, 3, buff_weight)
297 call accel_set_kernel_arg(kernel, 4, psib%ff_device)
298 call accel_set_kernel_arg(kernel, 5, int(log2(psib%pack_size(1)), int32))
299 call accel_set_kernel_arg(kernel, 6, this%buff_density)
300
301 case (spinors)
302 kernel => kernel_density_spinors
303
304 call accel_set_kernel_arg(kernel, 0, psib%nst)
305 call accel_set_kernel_arg(kernel, 1, this%gr%np)
306 call accel_set_kernel_arg(kernel, 2, int(this%pnp, int32))
307 call accel_set_kernel_arg(kernel, 3, buff_weight)
308 call accel_set_kernel_arg(kernel, 4, psib%ff_device)
309 call accel_set_kernel_arg(kernel, 5, int(log2(psib%pack_size(1)), int32))
310 call accel_set_kernel_arg(kernel, 6, this%buff_density)
311 end select
312
313 ! Compute the grid
314 bsize = accel_kernel_block_size(kernel)
315 call accel_grid_size(this%gr%np, bsize, gsize)
316
317 call accel_kernel_run(kernel, (/gsize/), (/bsize/))
318
319 call accel_finish()
320 call accel_free_buffer(buff_weight)
321 end select
322
323 if (this%st%requires_generalized_overlap) then
324 call density_calc_accumulate_aug(this, psib, ispin, weight)
325 end if
326
327 safe_deallocate_a(weight)
328
329 call profiling_out("CALC_STATE_DENSITY")
330
331 pop_sub(density_calc_state)
332 end subroutine density_calc_state
333
334 ! ---------------------------------------------------
336 !
337 subroutine density_calc_accumulate(this, psib, async)
338 type(density_calc_t), intent(inout) :: this
339 type(wfs_elec_t), intent(in) :: psib
340 logical, optional, intent(in) :: async
341
342 integer :: ist, ip, ispin, bsize, gsize
343 complex(real64) :: term, psi1, psi2
344 real(real64), allocatable :: weight(:)
345 type(accel_mem_t) :: buff_weight
346 type(accel_kernel_t), pointer :: kernel
347
349 call profiling_in("CALC_DENSITY")
350
351 ispin = this%st%d%get_spin_index(psib%ik)
352
353 safe_allocate(weight(1:psib%nst))
354 do ist = 1, psib%nst
355 weight(ist) = this%st%kweights(psib%ik)*this%st%occ(psib%ist(ist), psib%ik)
356 end do
357
358 select case (psib%status())
359 case (batch_not_packed)
360 select case (this%st%d%ispin)
362 if (states_are_real(this%st)) then
363 do ist = 1, psib%nst
364 if (abs(weight(ist)) <= m_epsilon) cycle
365 !$omp parallel do simd schedule(static)
366 do ip = 1, this%gr%np
367 this%density(ip, ispin) = this%density(ip, ispin) + weight(ist)*psib%dff(ip, 1, ist)**2
368 end do
369 end do
370 else
371 do ist = 1, psib%nst
372 if (abs(weight(ist)) <= m_epsilon) cycle
373 !$omp parallel do schedule(static)
374 do ip = 1, this%gr%np
375 this%density(ip, ispin) = this%density(ip, ispin) + weight(ist)* &
376 real(conjg(psib%zff(ip, 1, ist))*psib%zff(ip, 1, ist), real64)
377 end do
378 end do
379 end if
380 case (spinors)
381 do ist = 1, psib%nst
382 if (abs(weight(ist)) <= m_epsilon) cycle
383 !$omp parallel do schedule(static) private(psi1, psi2, term)
384 do ip = 1, this%gr%np
385 psi1 = psib%zff(ip, 1, ist)
386 psi2 = psib%zff(ip, 2, ist)
387 this%density(ip, 1) = this%density(ip, 1) + weight(ist)*real(conjg(psi1)*psi1, real64)
388 this%density(ip, 2) = this%density(ip, 2) + weight(ist)*real(conjg(psi2)*psi2, real64)
389 term = weight(ist)*psi1*conjg(psi2)
390 this%density(ip, 3) = this%density(ip, 3) + real(term, real64)
391 this%density(ip, 4) = this%density(ip, 4) + aimag(term)
392 end do
393 end do
394 end select
395
396 case (batch_packed)
397
398 select case (this%st%d%ispin)
400 if (states_are_real(this%st)) then
401 !$omp parallel do schedule(static) private(ist)
402 do ip = 1, this%gr%np
403 do ist = 1, psib%nst
404 this%density(ip, ispin) = this%density(ip, ispin) + weight(ist)*psib%dff_pack(ist, ip)**2
405 end do
406 end do
407 else
408 !$omp parallel do schedule(static) private(ist)
409 do ip = 1, this%gr%np
410 do ist = 1, psib%nst
411 this%density(ip, ispin) = this%density(ip, ispin) + weight(ist)* &
412 real(conjg(psib%zff_pack(ist, ip))*psib%zff_pack(ist, ip), real64)
413 end do
414 end do
415 end if
416 case (spinors)
417 assert(mod(psib%nst_linear, 2) == 0)
418 !$omp parallel do schedule(static) private(ist, psi1, psi2, term)
419 do ip = 1, this%gr%np
420 do ist = 1, psib%nst
421 psi1 = psib%zff_pack(2*ist - 1, ip)
422 psi2 = psib%zff_pack(2*ist, ip)
423 term = weight(ist)*psi1*conjg(psi2)
424
425 this%density(ip, 1) = this%density(ip, 1) + weight(ist)*real(conjg(psi1)*psi1, real64)
426 this%density(ip, 2) = this%density(ip, 2) + weight(ist)*real(conjg(psi2)*psi2, real64)
427 this%density(ip, 3) = this%density(ip, 3) + real(term, real64)
428 this%density(ip, 4) = this%density(ip, 4) + aimag(term)
429 end do
430 end do
431 end select
432
434 if (.not. this%packed) call density_calc_pack(this)
435
436 call accel_create_buffer(buff_weight, accel_mem_read_only, type_float, psib%nst)
437 call accel_write_buffer(buff_weight, psib%nst, weight, async=.true.)
438
439 select case (this%st%d%ispin)
441 if (states_are_real(this%st)) then
442 kernel => kernel_density_real
443 else
444 kernel => kernel_density_complex
445 end if
446
447 call accel_set_kernel_arg(kernel, 0, psib%nst)
448 call accel_set_kernel_arg(kernel, 1, this%gr%np)
449 call accel_set_kernel_arg(kernel, 2, int(this%pnp, int32)*(ispin - 1))
450 call accel_set_kernel_arg(kernel, 3, buff_weight)
451 call accel_set_kernel_arg(kernel, 4, psib%ff_device)
452 call accel_set_kernel_arg(kernel, 5, int(log2(psib%pack_size(1)), int32))
453 call accel_set_kernel_arg(kernel, 6, this%buff_density)
454
455 case (spinors)
456 kernel => kernel_density_spinors
457
458 call accel_set_kernel_arg(kernel, 0, psib%nst)
459 call accel_set_kernel_arg(kernel, 1, this%gr%np)
460 call accel_set_kernel_arg(kernel, 2, int(this%pnp, int32))
461 call accel_set_kernel_arg(kernel, 3, buff_weight)
462 call accel_set_kernel_arg(kernel, 4, psib%ff_device)
463 call accel_set_kernel_arg(kernel, 5, int(log2(psib%pack_size(1)), int32))
464 call accel_set_kernel_arg(kernel, 6, this%buff_density)
465 end select
466
467 ! Compute the grid
468 bsize = accel_kernel_block_size(kernel)
469 call accel_grid_size(this%gr%np, bsize, gsize)
470
471 call accel_kernel_run(kernel, (/gsize/), (/bsize/))
472
473 call accel_free_buffer(buff_weight)
474
475 if(.not. optional_default(async, .false.)) call accel_finish()
476
477 end select
478
479 ! Ultrasoft/PAW augmentation density: n(r) += sum_ij Q_ij(r) <psi|beta_i><beta_j|psi>.
480 ! This must be done on the batch path used by the SCF (density_calc), not only in
481 ! density_calc_state, otherwise the augmentation charge is silently dropped.
482 if (this%st%requires_generalized_overlap) then
483 call density_calc_accumulate_aug(this, psib, ispin, weight)
484 end if
485
486 safe_deallocate_a(weight)
487
488
489 if (this%st%d%ispin /= spinors) then
490 if (states_are_real(this%st)) then
491 ! 1 add (1), 2 mult (1)
492 call profiling_count_operations(psib%nst*this%gr%np*(1 + 2))
493 else
494 ! 1 add (2), 1 complex mult (6), 1 real-complex mult (2)
495 call profiling_count_operations(psib%nst*this%gr%np*(2 + 6 + 2))
496 end if
497 else
498 ! 4 add (2), 3 complex mult (6), 3 real-complex mult (2)
499 call profiling_count_operations(psib%nst*this%gr%np*(4*2 + 3*6 + 3*2))
500 end if
501
502 call profiling_out("CALC_DENSITY")
503
505 end subroutine density_calc_accumulate
506
507 ! ---------------------------------------------------
509 subroutine density_calc_accumulate_aug(this, psib, ispin, weight)
510 type(density_calc_t), intent(inout) :: this
511 type(wfs_elec_t), intent(in) :: psib
512 integer, intent(in) :: ispin
513 real(real64), intent(in) :: weight(:)
514
515 integer :: imat, iatom, is, ip, np
516 integer :: ncomp, icomp, comp_map(4)
517 real(real64), allocatable :: beta_density(:, :, :, :)
518 real(real64), allocatable :: beta_current(:, :, :, :)
519 complex(real64), allocatable :: beta_density_cmplx(:, :, :, :, :)
520 real(real64), allocatable :: acc(:, :), wcol(:, :)
521 type(projector_matrix_t), pointer :: pmat
522 type(projector_t), pointer :: proj
523 type(wfs_elec_t) :: phased_psib
524 logical :: do_phase
525
526 push_sub_with_profile(density_calc_accumulate_aug)
527
528 assert(associated(this%ep))
529 assert(associated(this%vnl))
530 assert(.not. this%gr%use_curvilinear)
531 assert(this%vnl%apply_projector_matrices)
532
533 if (psib%status() == batch_device_packed) then
534 call messages_not_implemented("USPP augmentation density for accelerator batches")
535 end if
536
537 ! The projections <beta|psi> that build the augmentation density matrix must
538 ! include the Bloch phase exp(ik.r) at k /= 0, exactly as in the Hamiltonian and
539 ! overlap apply.
540 do_phase = .false.
541 if (associated(this%phase)) do_phase = this%phase%is_allocated()
542
543 ! The projector density matrix is stored spin-resolved in beta_density: for spinors the four
544 ! real slabs of the 2x2 spin matrix (uu, dd, Re ud, Im ud), for collinear one channel per
545 ! spin, the batch filling the channel of its own spin index. comp_map translates the
546 ! components scattered below to the density columns (identity for spinors; the batch
547 ! single channel for collinear).
548 if (this%st%d%ispin == spinors) then
549 ncomp = 4
550 comp_map(1:4) = [1, 2, 3, 4]
551 else
552 ncomp = 1
553 comp_map(1) = ispin
554 end if
555
556 if (this%st%d%ispin == spinors .and. this%ep%reltype == spin_orbit) then
557 if (do_phase .and. .not. psib%has_phase) then
558 call psib%copy_to(phased_psib)
559 call this%phase%apply_to(this%gr, this%gr%np, .false., phased_psib, src = psib)
560 phased_psib%has_phase = .true.
561 call nonlocal_pseudopotential_density_matrix_spinor_cmplx(this%vnl, this%gr, this%st%d, .false., phased_psib, &
562 weight, beta_density_cmplx)
563 call phased_psib%end()
564 else
565 call nonlocal_pseudopotential_density_matrix_spinor_cmplx(this%vnl, this%gr, this%st%d, .false., psib, &
566 weight, beta_density_cmplx)
567 end if
568 safe_allocate(beta_density(1:this%vnl%max_nprojs, 1:this%vnl%max_nprojs, 1:this%vnl%nprojector_matrices, 1:4))
569 beta_density = m_zero
570 call nonlocal_pseudopotential_soc_density_to_real(this%vnl, this%ep, beta_density_cmplx, beta_density, &
571 beta_current = beta_current)
572 safe_deallocate_a(beta_density_cmplx)
573 else if (this%st%d%ispin == spinors) then
574 ! Noncollinear: build the 2x2 spin-density matrix in projector space (4 real slabs).
575 ! Spinors are always complex.
576 if (do_phase .and. .not. psib%has_phase) then
577 call psib%copy_to(phased_psib)
578 call this%phase%apply_to(this%gr, this%gr%np, .false., phased_psib, src = psib)
579 phased_psib%has_phase = .true.
580 call nonlocal_pseudopotential_density_matrix_spinor(this%vnl, this%gr, this%st%d, .false., phased_psib, &
581 weight, beta_density, beta_current = beta_current)
582 call phased_psib%end()
583 else
584 call nonlocal_pseudopotential_density_matrix_spinor(this%vnl, this%gr, this%st%d, .false., psib, &
585 weight, beta_density, beta_current = beta_current)
586 end if
587 else if (states_are_real(this%st)) then
588 call dnonlocal_pseudopotential_density_matrix(this%vnl, this%gr, this%st%d, .false., psib, weight, beta_density)
589 else if (do_phase .and. .not. psib%has_phase) then
590 call psib%copy_to(phased_psib)
591 call this%phase%apply_to(this%gr, this%gr%np, .false., phased_psib, src = psib)
592 phased_psib%has_phase = .true.
593 call znonlocal_pseudopotential_density_matrix(this%vnl, this%gr, this%st%d, .false., phased_psib, weight, &
594 beta_density, beta_current = beta_current)
595 call phased_psib%end()
596 else
597 ! Either no phase is needed, or the batch already carries the phase (e.g. the fused
598 ! density/exp-apply path in a velocity-gauge / k-point propagation passes an already-phased
599 ! batch). In both cases the projector overlaps are evaluated directly on psib.
600 call znonlocal_pseudopotential_density_matrix(this%vnl, this%gr, this%st%d, .false., psib, weight, &
601 beta_density, beta_current = beta_current)
602 end if
603
604 ! PAW: accumulate the one-center density matrix rho_ij for the on-site corrections
605 if (allocated(this%vnl%onsite_density_matrix)) then
606 assert(size(this%vnl%onsite_density_matrix, 4) == size(beta_density, 4))
607 this%vnl%onsite_density_matrix = this%vnl%onsite_density_matrix + beta_density
608 end if
609 ! PAW: accumulate the one-center current matrix A_ij = Im[rho_ij]
610 if (allocated(this%vnl%onsite_current_matrix) .and. allocated(beta_current)) then
611 assert(size(this%vnl%onsite_current_matrix, 4) == size(beta_current, 4))
612 this%vnl%onsite_current_matrix = this%vnl%onsite_current_matrix + beta_current
613 end if
614
615 do imat = 1, this%vnl%nprojector_matrices
616 pmat => this%vnl%projector_matrices(imat)
617 iatom = this%vnl%projector_to_atom(imat)
618 proj => this%ep%proj(iatom)
619
620 assert(projector_has_augmentation(proj))
621 assert(allocated(proj%aug%qflm))
622 assert(proj%aug%qfunc_nbeta > 0)
623 assert(proj%aug%qfunc_lmax >= 0)
624
625 np = pmat%npoints
626
627 ! The Gaunt sums reduce to scalar weights per combined Q Y_LM column
628 ! (density(:, comp_map(c)) += sum_ij Q_ij(r) rho_ij^{c}), and the grid work
629 ! to one matrix-vector product acc = aug_qflm . wcol per spin component.
630 ! comp_map is a contiguous range by construction (identity for spinors, the
631 ! batch spin channel for collinear).
632 safe_allocate(wcol(1:proj%aug%qflm_ncombo, 1:ncomp))
633 wcol = m_zero
634 call projector_aug_pair_to_columns(proj, pmat, ncomp, &
635 beta_density(:, :, imat, comp_map(1):comp_map(ncomp)), wcol)
636
637 if (np > 0) then
638 safe_allocate(acc(1:np, 1:ncomp))
639 do icomp = 1, ncomp
640 call blas_gemv('N', np, proj%aug%qflm_ncombo, m_one, proj%aug%qflm(1, 1), np, &
641 wcol(1, icomp), 1, m_zero, acc(1, icomp), 1)
642 end do
643
644 ! Scatter the accumulated augmentation density onto the mesh
645 do icomp = 1, ncomp
646 do is = 1, np
647 ip = pmat%map(is)
648 this%density(ip, comp_map(icomp)) = this%density(ip, comp_map(icomp)) + acc(is, icomp)
649 end do
650 end do
651 safe_deallocate_a(acc)
652 end if
653
654 safe_deallocate_a(wcol)
655 end do
656
657 safe_deallocate_a(beta_density)
658 safe_deallocate_a(beta_current)
659
660 pop_sub_with_profile(density_calc_accumulate_aug)
661 end subroutine density_calc_accumulate_aug
662
663 ! ---------------------------------------------------
669 !
670 subroutine density_calc_end(this, allreduce, symmetrize, buff_density)
671 type(density_calc_t), intent(inout) :: this
672 logical, optional, intent(in) :: allreduce
673 logical, optional, intent(in) :: symmetrize
674 type(accel_mem_t), optional, intent(inout) :: buff_density
675
676 integer :: ispin, ip
677 real(real64), allocatable :: tmpdensity(:)
678 logical :: was_packed
679
680 logical:: allreduce_local, symmetrize_local
681
682 push_sub(density_calc_end)
683
684 call profiling_in("CALC_DENSITY_END")
685
686 allreduce_local = (this%st%parallel_in_states .or. this%st%d%kpt%parallel) .and. optional_default(allreduce, .true.)
687 symmetrize_local = this%st%symmetrize_density .and. optional_default(symmetrize, .true.)
688
689 was_packed = this%packed ! Save before modifying
690 if (this%packed) then
691 this%packed = .false.
692
693 safe_allocate(tmpdensity(1:this%gr%np))
694
695 ! the density is in device memory
696 do ispin = 1, this%st%d%nspin
697 call accel_read_buffer(this%buff_density, int(this%gr%np, int64), tmpdensity, offset = (ispin - 1)*this%pnp)
698
699 !$omp parallel do simd
700 do ip = 1, this%gr%np
701 this%density(ip, ispin) = this%density(ip, ispin) + tmpdensity(ip)
702 end do
703 end do
704
705 safe_deallocate_a(tmpdensity)
706
707 ! If buff_density is not needed, free the GPU buffer now
708 if (.not. present(buff_density)) then
709 call accel_free_buffer(this%buff_density)
710 end if
711 end if
712
713 ! reduce over states and k-points
714 if (allreduce_local) then
715 call profiling_in("DENSITY_REDUCE")
716 call comm_allreduce(this%st%st_kpt_mpi_grp, this%density, dim = (/this%gr%np, this%st%d%nspin/))
717 call profiling_out("DENSITY_REDUCE")
718 end if
719
720 if (associated(this%vnl)) then
721 if (allocated(this%vnl%onsite_density_matrix) .and. allreduce_local) then
722 call comm_allreduce(this%st%st_kpt_mpi_grp, this%vnl%onsite_density_matrix)
723 end if
724 if (allocated(this%vnl%onsite_current_matrix) .and. allreduce_local) then
725 call comm_allreduce(this%st%st_kpt_mpi_grp, this%vnl%onsite_current_matrix)
726 end if
727 end if
728
729 if (symmetrize_local) then
730 do ispin = 1, this%st%d%nspin
731 call dgrid_symmetrize_scalar_field(this%gr, this%density(:, ispin))
732 end do
733 ! PAW: symmetrize the one-center density matrix
734 if (associated(this%vnl)) then
736 end if
737 end if
738
739 if (present(buff_density) .and. was_packed) then
740 if (allreduce_local .or. symmetrize_local) then
741 do ispin = 1, this%st%d%nspin
742 call accel_write_buffer(this%buff_density, int(this%gr%np, int64), &
743 this%density(1:this%gr%np, ispin), &
744 offset=int((ispin - 1)*this%pnp, int64))
745 end do
746 end if
747
748 ! Free any previously stored buffer before overwriting
749 if (buff_density%allocated) call accel_free_buffer(buff_density)
750
751 call accel_move_buffer(this%buff_density, buff_density)
752 end if
753
754 call profiling_out("CALC_DENSITY_END")
755
756 pop_sub(density_calc_end)
757 end subroutine density_calc_end
758
759
760 ! ---------------------------------------------------------
765 !
766 subroutine density_calc(st, gr, density, istin, ep, vnl, phase)
767 type(states_elec_t), intent(inout) :: st
768 type(grid_t), intent(in) :: gr
769 real(real64), contiguous, intent(out) :: density(:, :)
770 integer, optional, intent(in) :: istin
771 type(epot_t), optional, target, intent(in) :: ep
772 type(nonlocal_pseudopotential_t), optional, target, intent(inout) :: vnl
773 type(phase_t), optional, target, intent(in) :: phase
774
775 integer :: ik, ib
776 type(density_calc_t) :: dens_calc
777
778 push_sub(density_calc)
779
780 assert(ubound(density, dim = 1) == gr%np .or. ubound(density, dim = 1) == gr%np_part)
781
782 if (st%requires_generalized_overlap .and. present(istin)) then
783 call messages_not_implemented("state-resolved density with ultrasoft/PAW augmentation density")
784 end if
785
786 call density_calc_init(dens_calc, st, gr, density, ep, vnl, phase)
787
788 if (.not. present(istin)) then
789 ! ordinary density accumulate
790 do ik = st%d%kpt%start, st%d%kpt%end
791 do ib = st%group%block_start, st%group%block_end
792 call density_calc_accumulate(dens_calc, st%group%psib(ib, ik), async=.true.)
793 end do
794 end do
795 call accel_finish()
796 else
797 ! state-resolved density
798 do ik = st%d%kpt%start, st%d%kpt%end
799 do ib = st%group%block_start, st%group%block_end
800 if (st%group%psib(ib, ik)%ist(1) <= istin .and. st%group%psib(ib, ik)%ist(st%group%psib(ib, ik)%nst) >= istin) then
801 call density_calc_state(dens_calc, st%group%psib(ib, ik), istin)
802 end if
803 end do
804 end do
805 end if
806
807 call density_calc_end(dens_calc, allreduce = .not. present(istin), buff_density = st%buff_density)
808
809 pop_sub(density_calc)
810 end subroutine density_calc
811
812 ! ---------------------------------------------------------
814 subroutine states_elec_freeze_orbitals(st, namespace, space, gr, mc, kpoints, n, family_is_mgga)
815 type(states_elec_t), intent(inout) :: st
816 type(namespace_t), intent(in) :: namespace
817 class(space_t), intent(in) :: space
818 type(grid_t), intent(in) :: gr
819 type(multicomm_t), intent(in) :: mc
820 type(kpoints_t), intent(in) :: kpoints
821 integer, intent(in) :: n
822 logical, intent(in) :: family_is_mgga
823
824 integer :: ist, ik, ib, nblock
825 integer :: nodeto, nodefr
826 type(states_elec_t) :: staux
827 complex(real64), allocatable :: psi(:, :, :), rec_buffer(:,:)
828 type(wfs_elec_t) :: psib
829 type(density_calc_t) :: dens_calc
830
832
833 if (st%requires_generalized_overlap) then
834 call messages_not_implemented("frozen-orbital density with ultrasoft/PAW augmentation density")
835 end if
836
837 if (n >= st%nst) then
838 write(message(1),'(a)') 'Attempting to freeze a number of orbitals which is larger or equal to'
839 write(message(2),'(a)') 'the total number. The program has to stop.'
840 call messages_fatal(2, namespace=namespace)
841 end if
842
843 assert(states_are_complex(st))
844
845 if (.not. allocated(st%frozen_rho)) then
846 safe_allocate(st%frozen_rho(1:gr%np, 1:st%d%nspin))
847 end if
848
849 call density_calc_init(dens_calc, st, gr, st%frozen_rho)
850
851 do ik = st%d%kpt%start, st%d%kpt%end
852 if (n < st%st_start) cycle
853
854 do ib = st%group%block_start, st%group%block_end
855 !We can use the full batch
856 if (states_elec_block_max(st, ib) <= n) then
857
858 call density_calc_accumulate(dens_calc, st%group%psib(ib, ik))
859 if (states_elec_block_max(st, ib) == n) exit
860
861 else !Here we only use a part of this batch
862
863 nblock = n - states_elec_block_min(st, ib) + 1
864
865 safe_allocate(psi(1:gr%np, 1:st%d%dim, 1:nblock))
866
867 do ist = 1, nblock
868 call states_elec_get_state(st, gr, states_elec_block_min(st, ib) + ist - 1, ik, psi(:, :, ist))
869 end do
870
871 call wfs_elec_init(psib, st%d%dim, states_elec_block_min(st, ib), n, psi, ik)
872 call density_calc_accumulate(dens_calc, psib)
873 call psib%end()
874 safe_deallocate_a(psi)
875
876 exit
877
878 end if
879
880 end do
881 end do
882
883 call density_calc_end(dens_calc)
884
885 if (family_is_mgga) then
886 if (.not. allocated(st%frozen_tau)) then
887 safe_allocate(st%frozen_tau(1:gr%np, 1:st%d%nspin))
888 end if
889 if (.not. allocated(st%frozen_gdens)) then
890 safe_allocate(st%frozen_gdens(1:gr%np, 1:space%dim, 1:st%d%nspin))
891 end if
892 if (.not. allocated(st%frozen_ldens)) then
893 safe_allocate(st%frozen_ldens(1:gr%np, 1:st%d%nspin))
894 end if
895
896 call states_elec_calc_quantities(gr, st, kpoints, .true., kinetic_energy_density = st%frozen_tau, &
897 density_gradient = st%frozen_gdens, density_laplacian = st%frozen_ldens, st_end = n)
898 end if
899
900
901 call states_elec_copy(staux, st)
902
903 call states_elec_freeze_redistribute_states(st, namespace, gr, mc, n)
904
905 safe_allocate(psi(1:gr%np, 1:st%d%dim, 1))
906 safe_allocate(rec_buffer(1:gr%np, 1:st%d%dim))
907
908 do ik = st%d%kpt%start, st%d%kpt%end
909 ! loop over all frozen states
910 do ist = 1, st%nst
911 ! new distribution: frozen states
912 nodeto = st%node(ist)
913 ! old distribution: full states
914 nodefr = staux%node(ist+n)
915
916 if (st%mpi_grp%rank == nodeto .and. st%mpi_grp%rank == nodefr) then
917 ! do a simple copy on the same rank, also for serial version
918 call states_elec_get_state(staux, gr, ist+n, ik, psi(:, :, 1))
919 call states_elec_set_state(st, gr, ist, ik, psi(:, :, 1))
920 else
921 ! we can use blocking send/recv calls here because we always have different ranks
922 if (st%mpi_grp%rank == nodefr) then
923 call states_elec_get_state(staux, gr, ist+n, ik, psi(:, :, 1))
924 call st%mpi_grp%send(psi(1, 1, 1), gr%np*st%d%dim, mpi_double_complex, nodeto, ist)
925 end if
926 if (st%mpi_grp%rank == nodeto) then
927 call st%mpi_grp%recv(rec_buffer(1, 1), gr%np*st%d%dim, mpi_double_complex, nodefr, ist)
928 call states_elec_set_state(st, gr, ist, ik, rec_buffer(:, :))
929 end if
930 end if
931 end do
932 end do
933
934 safe_deallocate_a(psi)
935 safe_deallocate_a(rec_buffer)
936
937 do ik = 1, st%nik
938 do ist = 1, st%nst
939 st%occ(ist, ik) = staux%occ(n+ist, ik)
940 st%eigenval(ist, ik) = staux%eigenval(n+ist, ik)
941 end do
942 end do
943
944 call states_elec_end(staux)
946 end subroutine states_elec_freeze_orbitals
947
948 ! ---------------------------------------------------------
949 subroutine states_elec_freeze_redistribute_states(st, namespace, mesh, mc, nn)
950 type(states_elec_t), intent(inout) :: st
951 type(namespace_t), intent(in) :: namespace
952 class(mesh_t), intent(in) :: mesh
953 type(multicomm_t), intent(in) :: mc
954 integer, intent(in) :: nn
955
957
958 st%nst = st%nst - nn
959
961 call states_elec_distribute_nodes(st, namespace, mc)
962 call states_elec_allocate_wfns(st, mesh, type_cmplx, packed=.true.)
963
964 safe_deallocate_a(st%eigenval)
965 safe_allocate(st%eigenval(1:st%nst, 1:st%nik))
966 st%eigenval = huge(st%eigenval)
967
968 safe_deallocate_a(st%occ)
969 safe_allocate(st%occ (1:st%nst, 1:st%nik))
970 st%occ = m_zero
971
972
975
976 ! ---------------------------------------------------------
977 subroutine states_elec_freeze_adjust_qtot(st)
978 type(states_elec_t), intent(inout) :: st
979
980 integer :: ik, ist
981
983
984 ! Change the smearing method by fixing the occupations to
985 ! that of the ground-state such that the unfrozen states inherit
986 ! those values.
987 st%smear%method = smear_fixed_occ
988
989 ! Set total charge
990 st%qtot = m_zero
991 do ik = st%d%kpt%start, st%d%kpt%end
992 do ist = st%st_start, st%st_end
993 st%qtot = st%qtot + st%occ(ist, ik) * st%kweights(ik)
994 end do
995 end do
996
997 if (st%parallel_in_states .or. st%d%kpt%parallel) then
998 call comm_allreduce(st%st_kpt_mpi_grp, st%qtot)
999 end if
1000
1001
1003 end subroutine states_elec_freeze_adjust_qtot
1004
1005
1006 ! ---------------------------------------------------------
1015 !
1016 subroutine states_elec_total_density(st, mesh, total_rho)
1017 type(states_elec_t), intent(in) :: st
1018 class(mesh_t), intent(in) :: mesh
1019 real(real64), contiguous, intent(out) :: total_rho(:,:)
1020
1021 integer :: is
1022
1024
1025 call lalg_copy(mesh%np, st%d%nspin, st%rho, total_rho)
1026
1027 if (allocated(st%rho_core)) then
1028 do is = 1, st%d%spin_channels
1029 call lalg_axpy(mesh%np, m_one/st%d%spin_channels, st%rho_core, total_rho(:, is))
1030 end do
1031 end if
1032
1033 ! Add, if it exists, the frozen density from the inner orbitals.
1034 if (allocated(st%frozen_rho)) then
1035 call lalg_axpy(mesh%np, st%d%nspin, m_one, st%frozen_rho, total_rho)
1036 end if
1037
1039 end subroutine states_elec_total_density
1040
1041 ! ---------------------------------------------------------
1044 subroutine states_elec_sync_buff_density(st, mesh)
1045 type(states_elec_t), intent(inout) :: st
1046 class(mesh_t), intent(in) :: mesh
1047
1048 integer :: is
1049 integer(int64) :: pnp
1050
1052
1053 if (accel_is_enabled() .and. st%buff_density%allocated) then
1054 pnp = accel_padded_size(mesh%np)
1055 do is = 1, st%d%nspin
1056 call accel_write_buffer(st%buff_density, int(mesh%np, int64), st%rho(1:mesh%np, is), &
1057 offset = (is - 1)*pnp)
1058 end do
1059 end if
1060
1062 end subroutine states_elec_sync_buff_density
1063
1064#include "undef.F90"
1065#include "real.F90"
1066#include "density_inc.F90"
1067
1068#include "undef.F90"
1069#include "complex.F90"
1070#include "density_inc.F90"
1071
1072end module density_oct_m
1073
1074
1075!! Local Variables:
1076!! mode: f90
1077!! coding: utf-8
1078!! End:
--------------— gemv ---------------— SGEMV performs one of the matrix-vector operations
Definition: blas.F90:410
constant times a vector plus a vector
Definition: lalg_basic.F90:171
Copies a vector x, to a vector y.
Definition: lalg_basic.F90:197
type(accel_kernel_t), target, save, public kernel_density_real
Definition: accel.F90:249
integer function, public accel_kernel_block_size(kernel)
Definition: accel.F90:1194
subroutine, public accel_free_buffer(this, async)
Definition: accel.F90:967
subroutine, public accel_finish()
Definition: accel.F90:1104
subroutine, public accel_move_buffer(buffer_from, buffer_to)
Move the buffer memory from the first buffer to the second.
Definition: accel.F90:1010
type(accel_kernel_t), target, save, public kernel_density_spinors
Definition: accel.F90:251
integer, parameter, public accel_mem_read_write
Definition: accel.F90:162
pure logical function, public accel_is_enabled()
Definition: accel.F90:391
type(accel_kernel_t), target, save, public kernel_density_complex
Definition: accel.F90:250
integer, parameter, public accel_mem_read_only
Definition: accel.F90:162
This module implements batches of mesh functions.
Definition: batch.F90:112
integer, parameter, public batch_not_packed
functions are stored in CPU memory, unpacked order
Definition: batch.F90:293
integer, parameter, public batch_device_packed
functions are stored in device memory in packed order
Definition: batch.F90:293
integer, parameter, public batch_packed
functions are stored in CPU memory, in transposed (packed) order
Definition: batch.F90:293
This module implements common operations on batches of mesh functions.
Definition: batch_ops.F90:95
This module contains interfaces for BLAS routines You should not use these routines directly....
Definition: blas.F90:97
This module implements a calculator for the density and defines related functions.
Definition: density.F90:99
subroutine density_calc_state(this, psib, istin)
Calculate contribution to the density from state istin.
Definition: density.F90:255
subroutine, public density_calc_accumulate(this, psib, async)
Accumulate weighted orbital densities for a batch psib.
Definition: density.F90:410
subroutine, public states_elec_freeze_adjust_qtot(st)
Definition: density.F90:1050
subroutine, public states_elec_freeze_redistribute_states(st, namespace, mesh, mc, nn)
Definition: density.F90:1022
subroutine density_calc_accumulate_aug(this, psib, ispin, weight)
Accumulate the real-space USPP augmentation density for one wavefunction batch.
Definition: density.F90:582
subroutine, public density_calc(st, gr, density, istin, ep, vnl, phase)
Computes the density from the orbitals in st.
Definition: density.F90:839
subroutine density_calc_pack(this, async)
prepare the density calculator for GPU use
Definition: density.F90:234
subroutine, public states_elec_sync_buff_density(st, mesh)
Synchronize the GPU density buffer with the host density strho.
Definition: density.F90:1117
subroutine, public ddensity_accumulate_grad(space, mesh, st, psib, grad_psib, grad_rho)
Accumulate within a batch.
Definition: density.F90:1207
subroutine, public zdensity_accumulate_grad(space, mesh, st, psib, grad_psib, grad_rho)
Accumulate within a batch.
Definition: density.F90:1397
subroutine, public states_elec_total_density(st, mesh, total_rho)
This routine calculates the total electronic density.
Definition: density.F90:1089
subroutine, public density_calc_end(this, allreduce, symmetrize, buff_density)
Finalize the density calculation.
Definition: density.F90:743
subroutine, public states_elec_freeze_orbitals(st, namespace, space, gr, mc, kpoints, n, family_is_mgga)
Calculate partial density for frozen orbitals.
Definition: density.F90:887
subroutine, public density_calc_init(this, st, gr, density, ep, vnl, phase)
initialize the density calculator
Definition: density.F90:179
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
integer, parameter, public unpolarized
Parameters...
integer, parameter, public spinors
integer, parameter, public spin_polarized
integer, parameter, public spin_orbit
Definition: epot.F90:152
real(real64), parameter, public m_zero
Definition: global.F90:173
real(real64), parameter, public m_epsilon
Definition: global.F90:189
real(real64), parameter, public m_one
Definition: global.F90:174
This module implements the underlying real-space grid.
Definition: grid.F90:96
subroutine, public dgrid_symmetrize_scalar_field(gr, field, suppress_warning)
Definition: grid.F90:659
This module is intended to contain "only mathematical" functions and procedures.
Definition: math.F90:94
This module defines various routines, operating on mesh functions.
This module defines the meshes, which are used in Octopus.
Definition: mesh.F90:97
subroutine, public messages_not_implemented(feature, namespace)
Definition: messages.F90:1048
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
Definition: messages.F90:138
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
Definition: messages.F90:386
This module handles the communicators for the various parallelization strategies.
Definition: multicomm.F90:124
subroutine, public dnonlocal_pseudopotential_density_matrix(this, mesh, std, spiral_bnd, psib, weight, beta_density, weight2, beta_density2, beta_current)
Accumulate occupation-weighted beta-projector density matrices for USPP density.
subroutine, public nonlocal_pseudopotential_soc_density_to_real(this, epot, rho_cmplx, beta_density, beta_current)
Rotate the complex-Y_lm projector density matrix to the real-Y_lm basis (SOC USPP).
subroutine, public znonlocal_pseudopotential_density_matrix(this, mesh, std, spiral_bnd, psib, weight, beta_density, weight2, beta_density2, beta_current)
Accumulate occupation-weighted beta-projector density matrices for USPP density.
subroutine, public nonlocal_pseudopotential_density_matrix_spinor(this, mesh, std, spiral_bnd, psib, weight, beta_density, beta_current)
Noncollinear (spinor) projector density matrix for the ultrasoft augmentation.
subroutine, public nonlocal_pseudopotential_symmetrize_onsite(this)
Symmetrize the PAW one-center density matrix rho_ij over the crystal symmetries.
subroutine, public nonlocal_pseudopotential_density_matrix_spinor_cmplx(this, mesh, std, spiral_bnd, psib, weight, beta_density)
Full COMPLEX spinor projector density matrix (fully-relativistic ultrasoft).
/* To use the profiling module, call profiling_in and profiling_out with the label of the region as a...
Definition: profiling.F90:122
subroutine, public profiling_out(label)
Increment out counter and sum up difference between entry and exit time.
Definition: profiling.F90:672
subroutine, public profiling_in(label, exclude)
Increment in counter and save entry time.
Definition: profiling.F90:604
subroutine, public projector_aug_pair_to_columns(proj, pmat, ncomp, pairw, wcol)
Apply the Gaunt coupling between projection pairs and the combined augmentation columns: wcol(col,...
Definition: projector.F90:740
logical elemental function, public projector_has_augmentation(p)
Whether the projector carries an augmentation contribution (charge augmentation Q_ij and a generalize...
Definition: projector.F90:213
Definition: ps.F90:93
integer, parameter, public proj_uspp
Definition: ps.F90:151
integer, parameter, public smear_fixed_occ
Definition: smear.F90:153
pure logical function, public states_are_complex(st)
pure logical function, public states_are_real(st)
This module handles spin dimensions of the states and the k-point distribution.
integer pure function, public states_elec_block_max(st, ib)
return index of last state in block ib
subroutine, public states_elec_distribute_nodes(st, namespace, mc)
Distribute states over the processes for states parallelization.
subroutine, public states_elec_calc_quantities(gr, st, kpoints, nlcc, kinetic_energy_density, paramagnetic_current, density_gradient, density_laplacian, gi_kinetic_energy_density, st_end)
calculated selected quantities
subroutine, public states_elec_end(st)
finalize the states_elec_t object
subroutine, public states_elec_deallocate_wfns(st)
Deallocates the KS wavefunctions defined within a states_elec_t structure.
subroutine, public states_elec_allocate_wfns(st, mesh, wfs_type, skip, packed)
Allocates the KS wavefunctions defined within a states_elec_t structure.
subroutine, public states_elec_copy(stout, stin, exclude_wfns, exclude_eigenval, special, dest_type, copy_data)
make a (selective) copy of a states_elec_t object
integer pure function, public states_elec_block_min(st, ib)
return index of first state in block ib
type(type_t), parameter, public type_cmplx
Definition: types.F90:114
type(type_t), parameter, public type_float
Definition: types.F90:113
The calculator object.
Definition: density.F90:157
Description of the grid, containing information on derivatives, stencil, and symmetries.
Definition: grid.F90:148
Describes mesh distribution to nodes.
Definition: mesh.F90:165
Stores all communicators and groups.
Definition: multicomm.F90:185
A container for the phase.
Definition: phase.F90:158
A set of projectors defined on a submesh.
The projector data type is intended to hold the local and non-local parts of the pseudopotentials....
Definition: projector.F90:168
The states_elec_t class contains all electronic wave functions.
batches of electronic states
Definition: wfs_elec.F90:120
int true(void)