38 use,
intrinsic :: iso_fortran_env
101 integer,
public,
parameter :: &
102 POISSON_DIRECT_SUM = -1, &
114 type(derivatives_t),
pointer,
public :: der
116 integer,
public :: kernel
117 type(cube_t),
public :: cube
118 type(mesh_cube_parallel_map_t),
public :: mesh_cube_map
119 type(poisson_mg_solver_t) :: mg
120 type(poisson_fft_t),
public :: fft_solver
121 real(real64),
public :: poisson_soft_coulomb_param
122 logical :: all_nodes_default
123 type(poisson_corr_t) :: corrector
124 type(poisson_isf_t) :: isf_solver
125 type(poisson_psolver_t) :: psolver_solver
126 type(poisson_no_t) :: no_solver
128 logical,
public :: is_dressed = .false.
129 type(photon_mode_t),
public :: photons
131 type(MPI_Comm) :: intercomm
132 type(mpi_grp_t) :: local_grp
137 integer,
parameter :: &
144 subroutine poisson_init(this, namespace, space, der, mc, stencil, qtot, label, solver, verbose, force_serial, force_cmplx)
145 type(poisson_t),
intent(inout) :: this
146 class(space_t),
intent(in) :: space
147 type(namespace_t),
intent(in) :: namespace
148 type(derivatives_t),
target,
intent(in) :: der
149 type(multicomm_t),
intent(in) :: mc
150 type(stencil_t),
intent(in) :: stencil
151 real(real64),
optional,
intent(in) :: qtot
152 character(len=*),
optional,
intent(in) :: label
153 integer,
optional,
intent(in) :: solver
154 logical,
optional,
intent(in) :: verbose
155 logical,
optional,
intent(in) :: force_serial
156 logical,
optional,
intent(in) :: force_cmplx
158 logical :: need_cube, isf_data_is_parallel
159 integer :: default_solver, default_kernel, box(space%dim), fft_type, fft_library
160 real(real64) :: fft_alpha
161 character(len=60) :: str
170 if (
present(label)) str = trim(label)
192 call parse_variable(namespace,
'DressedOrbitals', .false., this%is_dressed)
194 if (this%is_dressed)
then
195 assert(
present(qtot))
200 if(.not.
allocated(this%photons%pol_dipole))
then
203 if (this%photons%nmodes > 1)
then
208 this%all_nodes_default = .false.
264 if (space%dim == 3 .and. .not. space%is_periodic()) default_solver =
poisson_isf
275 if (space%dim > 3) default_solver =
poisson_no
277 if (der%mesh%use_curvilinear)
then
278 select case (space%dim)
280 default_solver = poisson_direct_sum
282 default_solver = poisson_direct_sum
288 if (this%is_dressed) default_solver = poisson_direct_sum
290 if (.not.
present(solver))
then
291 call parse_variable(namespace,
'PoissonSolver', default_solver, this%method)
297 select case (this%method)
298 case (poisson_direct_sum)
301 str =
"fast Fourier transform"
303 str =
"conjugate gradients"
305 str =
"conjugate gradients, corrected"
309 str =
"interpolating scaling functions"
311 str =
"interpolating scaling functions (from BigDFT)"
313 str =
"no Poisson solver - Hartree set to 0"
315 write(
message(1),
'(a,a,a)')
"The chosen Poisson solver is '", trim(str),
"'"
319 if (space%dim > 3 .and. this%method /=
poisson_no)
then
320 call messages_input_error(namespace,
'PoissonSolver',
'Currently no Poisson solver is available for Dimensions > 3')
357 select case (space%dim)
359 if (.not. space%is_periodic())
then
365 if (space%periodic_dim == 2)
then
367 else if (space%is_periodic())
then
368 default_kernel = space%periodic_dim
373 default_kernel = space%periodic_dim
376 call parse_variable(namespace,
'PoissonFFTKernel', default_kernel, this%kernel)
386 message(1) =
'PoissonFFTKernel=multipole_correction is not supported on GPUs'
387 message(2) =
'Using FFTW to compute the FFTs on the CPU'
394 if (.not.
present(solver))
then
395 if (space%is_periodic() .and. this%method == poisson_direct_sum)
then
396 message(1) =
'A periodic system may not use the direct_sum Poisson solver.'
401 message(1) =
'A periodic system may not use the cg_corrected Poisson solver.'
405 if (space%is_periodic() .and. this%method ==
poisson_cg)
then
406 message(1) =
'A periodic system may not use the cg Poisson solver.'
411 message(1) =
'A periodic system may not use the multigrid Poisson solver.'
415 select case (space%dim)
418 select case (space%periodic_dim)
420 if ((this%method /=
poisson_fft) .and. (this%method /= poisson_direct_sum))
then
421 message(1) =
'A finite 1D system may only use fft or direct_sum Poisson solvers.'
426 message(1) =
'A periodic 1D system may only use the fft Poisson solver.'
431 if (der%mesh%use_curvilinear .and. this%method /= poisson_direct_sum)
then
432 message(1) =
'If curvilinear coordinates are used in 1D, then the only working'
433 message(2) =
'Poisson solver is direct_sum.'
439 if ((this%method /=
poisson_fft) .and. (this%method /= poisson_direct_sum))
then
440 message(1) =
'A 2D system may only use fft or direct_sum solvers.'
444 if (der%mesh%use_curvilinear .and. (this%method /= poisson_direct_sum))
then
445 message(1) =
'If curvilinear coordinates are used in 2D, then the only working'
446 message(2) =
'Poisson solver is direct_sum.'
452 if (space%is_periodic() .and. this%method ==
poisson_isf)
then
453 call messages_write(
'The ISF solver can only be used for finite systems.')
457 if (space%is_periodic() .and. this%method ==
poisson_fft .and. &
458 this%kernel /= space%periodic_dim .and. this%kernel >= 0 .and. this%kernel <= 3)
then
459 write(
message(1),
'(a,i1,a)')
'The system is periodic in ', space%periodic_dim ,
' dimension(s),'
460 write(
message(2),
'(a,i1,a)')
'but Poisson solver is set for ', this%kernel,
' dimensions.'
465 write(
message(1),
'(a,i1,a)')
'PoissonFFTKernel = multipole_correction cannot be used for periodic systems.'
470 message(1) =
'If curvilinear coordinates are used, then the only working'
471 message(2) =
'Poisson solver are cg_corrected and multigrid.'
478 select type (box => der%mesh%box)
481 message(1) =
'When using the "minimum" box shape and the "cg_corrected"'
482 message(2) =
'Poisson solver, we have observed "sometimes" some non-'
483 message(3) =
'negligible error. You may want to check that the "fft" or "cg"'
484 message(4) =
'solver are providing, in your case, the same results.'
493#if !(defined HAVE_PSOLVER)
494 message(1) =
"The PSolver Poisson solver cannot be used since the code was not compiled with the PSolver library."
510 box(:) = der%mesh%idx%ll(:)
520 call parse_variable(namespace,
'PoissonSolverPSolverParallelData', .
true., isf_data_is_parallel)
548 write(
message(1),
'(a,f12.5,a)')
"Input: '", fft_alpha, &
549 "' is not a valid DoubleFFTParameter"
550 message(2) =
'1.0 <= DoubleFFTParameter <= 3.0'
554 if (space%dim /= 3 .and. fft_library ==
fftlib_pfft)
then
558 select case (space%dim)
561 select case (this%kernel)
565 box = der%mesh%idx%ll
569 select case (this%kernel)
572 box(1:2) = maxval(box)
576 box(:) = der%mesh%idx%ll(:)
580 select case (this%kernel)
586 box(2) = maxval(box(2:3))
587 box(3) = maxval(box(2:3))
589 box(:) = der%mesh%idx%ll(:)
600 call cube_init(this%cube, box, namespace, space, der%mesh%spacing, &
601 der%mesh%coord_system, fft_type = fft_type, &
602 need_partition=.not.der%mesh%parallel_in_domains)
604 if (this%cube%parallel_in_domains .and. this%method ==
poisson_fft)
then
609 if (this%is_dressed .and. .not. this%method == poisson_direct_sum)
then
610 write(
message(1),
'(a)')
'Dressed Orbital calculation currently only working with direct sum Poisson solver.'
629 select case (this%method)
657 if (this%cube%parallel_in_domains)
then
663 if (this%is_dressed)
then
666 this%is_dressed = .false.
676 complex(real64),
intent(inout) :: pot(:)
677 complex(real64),
intent(in) :: rho(:)
678 logical,
optional,
intent(in) :: all_nodes
681 real(real64),
allocatable :: aux1(:), aux2(:)
683 logical :: all_nodes_value
692 if (
present(kernel))
then
693 assert(.not. any(abs(kernel%qq(:))>1e-8_real64))
698 safe_allocate(aux1(1:der%mesh%np))
699 safe_allocate(aux2(1:der%mesh%np))
701 aux1(1:der%mesh%np) = real(rho(1:der%mesh%np))
702 aux2(1:der%mesh%np) = real(pot(1:der%mesh%np))
703 call dpoisson_solve(this, namespace, aux2, aux1, all_nodes=all_nodes_value, kernel=kernel)
704 pot(1:der%mesh%np) = aux2(1:der%mesh%np)
707 aux1(1:der%mesh%np) = aimag(rho(1:der%mesh%np))
708 aux2(1:der%mesh%np) = aimag(pot(1:der%mesh%np))
709 call dpoisson_solve(this, namespace, aux2, aux1, all_nodes=all_nodes_value, kernel=kernel)
710 pot(1:der%mesh%np) = pot(1:der%mesh%np) +
m_zi*aux2(1:der%mesh%np)
712 safe_deallocate_a(aux1)
713 safe_deallocate_a(aux2)
722 subroutine zpoisson_solve(this, namespace, pot, rho, all_nodes, kernel)
725 complex(real64),
contiguous,
intent(inout) :: pot(:)
726 complex(real64),
contiguous,
intent(in) :: rho(:)
727 logical,
optional,
intent(in) :: all_nodes
730 logical :: all_nodes_value
736 assert(ubound(pot, dim = 1) == this%der%mesh%np_part .or. ubound(pot, dim = 1) == this%der%mesh%np)
737 assert(ubound(rho, dim = 1) == this%der%mesh%np_part .or. ubound(rho, dim = 1) == this%der%mesh%np)
742 .and. .not. this%is_dressed)
then
748 call zpoisson_fft_solve(this%fft_solver, this%der%mesh, this%cube, pot, rho, this%mesh_cube_map, kernel=kernel)
767 type(
batch_t),
intent(inout) :: rhob
768 logical,
optional,
intent(in) :: all_nodes
775 assert(potb%nst_linear == rhob%nst_linear)
776 assert(potb%type() == rhob%type())
779 do ii = 1, potb%nst_linear
780 call dpoisson_solve(this, namespace, potb%dff_linear(:, ii), rhob%dff_linear(:, ii), all_nodes, kernel=kernel)
783 do ii = 1, potb%nst_linear
784 call zpoisson_solve(this, namespace, potb%zff_linear(:, ii), rhob%zff_linear(:, ii), all_nodes, kernel=kernel)
798 subroutine dpoisson_solve(this, namespace, pot, rho, all_nodes, kernel)
801 real(real64),
contiguous,
intent(inout) :: pot(:)
802 real(real64),
contiguous,
intent(in) :: rho(:)
806 logical,
optional,
intent(in) :: all_nodes
810 real(real64),
allocatable :: rho_corrected(:), vh_correction(:)
811 logical :: all_nodes_value
818 assert(ubound(pot, dim = 1) == der%mesh%np_part .or. ubound(pot, dim = 1) == der%mesh%np)
819 assert(ubound(rho, dim = 1) == der%mesh%np_part .or. ubound(rho, dim = 1) == der%mesh%np)
826 if (
present(kernel))
then
830 select case (this%method)
831 case (poisson_direct_sum)
832 if ((this%is_dressed .and. this%der%dim - 1 > 3) .or. this%der%dim > 3)
then
833 message(1) =
"Direct sum Poisson solver only available for 1, 2, or 3 dimensions."
839 call poisson_cg1(namespace, der, this%corrector, pot, rho)
842 safe_allocate(rho_corrected(1:der%mesh%np))
843 safe_allocate(vh_correction(1:der%mesh%np_part))
845 call correct_rho(this%corrector, der, rho, rho_corrected, vh_correction)
847 pot(1:der%mesh%np) = pot(1:der%mesh%np) - vh_correction(1:der%mesh%np)
848 call poisson_cg2(namespace, der, pot, rho_corrected)
849 pot(1:der%mesh%np) = pot(1:der%mesh%np) + vh_correction(1:der%mesh%np)
851 safe_deallocate_a(rho_corrected)
852 safe_deallocate_a(vh_correction)
859 call dpoisson_fft_solve(this%fft_solver, der%mesh, this%cube, pot, rho, this%mesh_cube_map, kernel=kernel)
861 safe_allocate(rho_corrected(1:der%mesh%np))
862 safe_allocate(vh_correction(1:der%mesh%np_part))
864 call correct_rho(this%corrector, der, rho, rho_corrected, vh_correction)
865 call dpoisson_fft_solve(this%fft_solver, der%mesh, this%cube, pot, rho_corrected, this%mesh_cube_map, &
866 average_to_zero = .
true., kernel=kernel)
868 pot(1:der%mesh%np) = pot(1:der%mesh%np) + vh_correction(1:der%mesh%np)
869 safe_deallocate_a(rho_corrected)
870 safe_deallocate_a(vh_correction)
874 call poisson_isf_solve(this%isf_solver, der%mesh, this%cube, pot, rho, all_nodes_value)
878 if (this%psolver_solver%datacode ==
"G")
then
900 subroutine poisson_init_sm(this, namespace, space, main, der, sm, method, force_cmplx)
903 class(
space_t),
intent(in) :: space
907 integer,
optional,
intent(in) :: method
908 logical,
optional,
intent(in) :: force_cmplx
910 integer :: default_solver, idir, iter, maxl
911 integer :: box(space%dim)
918 this%is_dressed = .false.
920 this%all_nodes_default = .false.
926 this%all_nodes_default = main%all_nodes_default
929 default_solver = poisson_direct_sum
930 this%method = default_solver
931 if (
present(method)) this%method = method
933 if (der%mesh%use_curvilinear)
then
939 select case (this%method)
940 case (poisson_direct_sum)
945 assert(.not. der%mesh%parallel_in_domains)
948 call cube_init(this%cube, box, namespace, space, sm%mesh%spacing, sm%mesh%coord_system, &
949 fft_type =
fft_none, need_partition=.not.der%mesh%parallel_in_domains)
951 call poisson_isf_init(this%isf_solver, namespace, der%mesh, this%cube,
mpi_world%comm, init_world = this%all_nodes_default)
955 assert(.not. der%mesh%parallel_in_domains)
956 if (this%all_nodes_default)
then
959 this%cube%mpi_grp = this%der%mesh%mpi_grp
963 call cube_init(this%cube, box, namespace, space, sm%mesh%spacing, sm%mesh%coord_system, &
964 fft_type =
fft_none, need_partition=.not.der%mesh%parallel_in_domains)
979 do idir = 1, space%dim
980 box(idir) = nint(
m_two * (box(idir) - 1)) + 1
983 call cube_init(this%cube, box, namespace, space, sm%mesh%spacing, sm%mesh%coord_system, &
984 fft_type =
fft_complex, need_partition=.not.der%mesh%parallel_in_domains)
986 call cube_init(this%cube, box, namespace, space, sm%mesh%spacing, sm%mesh%coord_system, &
987 fft_type =
fft_real, need_partition=.not.der%mesh%parallel_in_domains)
989 call poisson_fft_init(this%fft_solver, namespace, space, this%cube, this%kernel)
991 call parse_variable(namespace,
'PoissonSolverMaxMultipole', 4, maxl)
992 write(
message(1),
'(a,i2)')
'Info: Boundary conditions fixed up to L =', maxl
1010 subroutine poisson_test(this, space, mesh, latt, namespace, repetitions)
1012 class(
space_t),
intent(in) :: space
1013 class(
mesh_t),
intent(in) :: mesh
1016 integer,
intent(in) :: repetitions
1018 real(real64),
allocatable :: rho(:), vh(:), vh_exact(:), xx(:, :), xx_per(:)
1019 real(real64) :: alpha, beta, rr, delta, ralpha, hartree_nrg_num, &
1020 hartree_nrg_analyt, lcl_hartree_nrg
1021 real(real64) :: total_charge
1022 integer :: ip, ierr, iunit, nn, n_gaussians, itime, icell
1028 if (mesh%box%dim == 1)
then
1049 safe_allocate( rho(1:mesh%np))
1050 safe_allocate( vh(1:mesh%np))
1051 safe_allocate(vh_exact(1:mesh%np))
1052 safe_allocate(xx(1:space%dim, 1:n_gaussians))
1053 safe_allocate(xx_per(1:space%dim))
1059 alpha =
m_four*mesh%spacing(1)
1060 write(
message(1),
'(a,f14.6)')
"Info: The alpha value is ", alpha
1061 write(
message(2),
'(a)')
" Higher values of alpha lead to more physical densities and more reliable results."
1065 write(
message(1),
'(a)')
'Building the Gaussian distribution of charge...'
1071 if (space%dim == 3) xx(3, 1) =
m_two
1074 if (space%dim == 3) xx(3, 2) = -
m_one
1079 do nn = 1, n_gaussians
1081 call mesh_r(mesh, ip, rr, origin = xx(:, nn))
1082 rho(ip) = rho(ip) + (-1)**nn * beta*
exp(-(rr/alpha)**2)
1088 write(
message(1),
'(a,e23.16)')
'Total charge of the Gaussian distribution', total_charge
1091 write(
message(1),
'(a)')
'Computing exact potential.'
1097 do nn = 1, n_gaussians
1099 write(
message(1),
'(a,i2,a,i9,a)')
'Computing Gaussian ', nn,
' for ', latt_iter%n_cells,
' periodic copies.'
1102 do icell = 1, latt_iter%n_cells
1103 xx_per = xx(:, nn) + latt_iter%get(icell)
1106 call mesh_r(mesh, ip, rr, origin=xx_per)
1107 select case (space%dim)
1110 vh_exact(ip) = vh_exact(ip) + (-1)**nn *
loct_erf(rr/alpha)/rr
1112 vh_exact(ip) = vh_exact(ip) + (-1)**nn * (
m_two/
sqrt(
m_pi))/alpha
1115 ralpha = rr**2/(
m_two*alpha**2)
1116 if (ralpha < 100.0_real64)
then
1120 vh_exact(ip) = vh_exact(ip) + (-1)**nn * beta * (
m_pi)**(
m_three*
m_half) * alpha * &
1129 do itime = 1, repetitions
1134 iunit =
io_open(
"hartree_results", namespace, action=
'write')
1135 delta =
dmf_nrm2(mesh, vh-vh_exact)
1136 write(iunit,
'(a,e23.16)')
'Hartree test (abs.) = ', delta
1137 delta = delta/
dmf_nrm2(mesh, vh_exact)
1138 write(iunit,
'(a,e23.16)')
'Hartree test (rel.) = ', delta
1143 lcl_hartree_nrg = lcl_hartree_nrg + rho(ip) * vh(ip)
1145 lcl_hartree_nrg = lcl_hartree_nrg * mesh%spacing(1) * mesh%spacing(2) * mesh%spacing(3)/
m_two
1147 call mpi_reduce(lcl_hartree_nrg, hartree_nrg_num, 1, &
1148 mpi_double_precision, mpi_sum, 0, mpi_comm_world,
mpi_err)
1150 write(
message(1),
'(a)')
"MPI error in MPI_Reduce; subroutine poisson_test of file poisson.F90"
1154 hartree_nrg_num = lcl_hartree_nrg
1160 lcl_hartree_nrg = lcl_hartree_nrg + rho(ip) * vh_exact(ip)
1162 lcl_hartree_nrg = lcl_hartree_nrg * mesh%spacing(1) * mesh%spacing(2) * mesh%spacing(3) /
m_two
1164 call mpi_reduce(lcl_hartree_nrg, hartree_nrg_analyt, 1, &
1165 mpi_double_precision, mpi_sum, 0, mpi_comm_world,
mpi_err)
1167 write(
message(1),
'(a)')
"MPI error in MPI_Reduce; subroutine poisson_test of file poisson.F90"
1171 hartree_nrg_analyt = lcl_hartree_nrg
1177 write(iunit,
'(a,e23.16)')
'Hartree Energy (numerical) =', hartree_nrg_num,
'Hartree Energy (analytical) =',hartree_nrg_analyt
1196 safe_deallocate_a(rho)
1197 safe_deallocate_a(vh)
1198 safe_deallocate_a(vh_exact)
1199 safe_deallocate_a(xx)
1229 this%kernel /= poisson_fft_kernel_sph .and. this%kernel /= poisson_fft_kernel_corrected)
then
1240 solver = this%method
1247 type(multicomm_t),
intent(in) :: mc
1252 if (multicomm_have_slaves(mc))
then
1254 call mpi_grp_init(this%local_grp, mc%group_comm(p_strategy_states))
1256 this%root = (this%local_grp%rank == 0)
1258 this%intercomm = mc%slave_intercomm
1259 call mpi_comm_remote_size(this%intercomm, this%nslaves, mpi_err)
1272 type(multicomm_t),
intent(in) :: mc
1281 if (multicomm_have_slaves(mc))
then
1284 do islave = this%local_grp%rank, this%nslaves - 1, this%local_grp%size
1285 call mpi_send(m_one, 1, mpi_double_precision, islave,
cmd_finish, this%intercomm, mpi_err)
1299 type(namespace_t),
intent(in) :: namespace
1302 real(real64),
allocatable :: rho(:), pot(:)
1304 type(mpi_status) :: status
1305 integer :: bcast_root
1308 call profiling_in(
"SLAVE_WORK")
1310 safe_allocate(rho(1:this%der%mesh%np))
1311 safe_allocate(pot(1:this%der%mesh%np))
1314 do while(.not. done)
1316 call profiling_in(
"SLAVE_WAIT")
1317 call mpi_recv(rho(1), this%der%mesh%np, mpi_double_precision, mpi_any_source, mpi_any_tag, this%intercomm, status, mpi_err)
1318 call profiling_out(
"SLAVE_WAIT")
1321 select case (status%MPI_TAG)
1329 call profiling_in(
"SLAVE_BROADCAST")
1330 bcast_root = mpi_proc_null
1331 if (this%root) bcast_root = mpi_root
1332 call mpi_bcast(pot(1), this%der%mesh%np, mpi_double_precision, bcast_root, this%intercomm, mpi_err)
1333 call profiling_out(
"SLAVE_BROADCAST")
1339 safe_deallocate_a(pot)
1340 safe_deallocate_a(rho)
1342 call profiling_out(
"SLAVE_WORK")
1352 async = (this%nslaves > 0)
1360 type(namespace_t),
intent(in) :: namespace
1361 class(space_t),
intent(in) :: space
1362 type(fourier_space_op_t),
intent(inout) :: coulb
1363 real(real64),
intent(in) :: qq(:)
1364 real(real64),
intent(in) :: alpha, beta, mu
1365 real(real64),
optional,
intent(in) :: singul
1367 real(real64),
parameter :: vanishing_q = 1.0e-5_real64
1372 if (space%is_periodic())
then
1373 assert(ubound(qq, 1) >= space%periodic_dim)
1377 if (mu > m_epsilon)
then
1379 write(message(1),
'(a)')
"Poisson solver with range separation is only implemented with FFT."
1380 call messages_fatal(1, namespace=namespace)
1386 if (
allocated(coulb%qq))
then
1387 reinit = any(abs(coulb%qq(1:space%periodic_dim) - qq(1:space%periodic_dim)) > m_epsilon)
1389 reinit = reinit .or. (abs(coulb%mu-mu) > m_epsilon .and. mu > m_epsilon)
1390 reinit = reinit .or. (abs(coulb%alpha-alpha) > m_epsilon .and. alpha > m_epsilon)
1391 reinit = reinit .or. (abs(coulb%beta-beta) > m_epsilon .and. beta > m_epsilon)
1397 select case (this%method)
1402 call fourier_space_op_end(coulb)
1404 safe_allocate(coulb%qq(1:space%dim))
1405 coulb%qq(1:space%periodic_dim) = qq(1:space%periodic_dim)
1406 coulb%qq(space%periodic_dim+1:space%dim) = vanishing_q
1408 coulb%singularity = optional_default(singul, m_zero)
1412 call poisson_fft_get_kernel(namespace, space, this%cube, coulb, this%kernel, &
1413 this%poisson_soft_coulomb_param)
1415 call messages_not_implemented(
"poisson_build_kernel with other methods than FFT", namespace=namespace)
1433 real(real64),
intent(in) :: alpha, beta, mu
1435 select case (this%method)
1439 if(mu < m_epsilon)
then
1441 else if(alpha > m_epsilon .and. beta < m_epsilon)
then
1443 else if(alpha < m_epsilon .and. beta > m_epsilon)
then
1451#include "poisson_init_inc.F90"
1452#include "poisson_direct_inc.F90"
1453#include "poisson_direct_sm_inc.F90"
1457#include "poisson_inc.F90"
1459#include "complex.F90"
1460#include "poisson_inc.F90"
Prints out to iunit a message in the form: ["InputVariable" = value] where "InputVariable" is given b...
double exp(double __x) __attribute__((__nothrow__
pure logical function, public accel_is_enabled()
This module implements batches of mesh functions.
This module handles the calculation mode.
integer, parameter, public p_strategy_kpoints
parallelization in k-points
subroutine, public cube_init(cube, nn, namespace, space, spacing, coord_system, fft_type, fft_library, dont_optimize, nn_out, mpi_grp, need_partition, tp_enlarge, blocksize)
subroutine, public cube_end(cube)
subroutine, public cube_init_cube_map(cube, mesh)
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
Fast Fourier Transform module. This module provides a single interface that works with different FFT ...
integer, parameter, public fft_none
global constants
integer, public fft_default_lib
integer, parameter, public fftlib_accel
integer, parameter, public fft_real
integer, parameter, public fft_complex
integer, parameter, public fftlib_pfft
integer, parameter, public fftlib_fftw
real(real64), parameter, public m_two
real(real64), parameter, public r_small
real(real64), parameter, public m_zero
real(real64), parameter, public m_four
real(real64), parameter, public m_pi
some mathematical constants
complex(real64), parameter, public m_zi
real(real64), parameter, public m_half
real(real64), parameter, public m_one
real(real64), parameter, public m_three
This module implements the index, used for the mesh points.
subroutine, public dio_function_output(how, dir, fname, namespace, space, mesh, ff, unit, ierr, pos, atoms, grp, root)
Top-level IO routine for functions defined on the mesh.
integer(int64) function, public io_function_fill_how(where)
Use this function to quickly plot functions for debugging purposes: call dio_function_output(io_funct...
subroutine, public io_close(iunit, grp)
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
This module is intended to contain "only mathematical" functions and procedures.
subroutine, public mesh_cube_parallel_map_end(this)
subroutine, public mesh_cube_parallel_map_init(this, mesh, cube)
This module defines various routines, operating on mesh functions.
real(real64) function, public dmf_integrate(mesh, ff, mask, reduce)
Integrate a function on the mesh.
This module defines the meshes, which are used in Octopus.
subroutine, public mesh_double_box(space, mesh, alpha, db)
finds the dimension of a box doubled in the non-periodic dimensions
pure subroutine, public mesh_r(mesh, ip, rr, origin, coords)
return the distance to the origin for a given grid point
subroutine, public messages_print_with_emphasis(msg, iunit, namespace)
subroutine, public messages_not_implemented(feature, namespace)
character(len=512), private msg
subroutine, public messages_warning(no_lines, all_nodes, namespace)
subroutine, public messages_info(no_lines, iunit, verbose_limit, stress, all_nodes, namespace)
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
subroutine, public messages_input_error(namespace, var, details, row, column)
subroutine, public messages_experimental(name, namespace)
type(mpi_grp_t), public mpi_world
integer, public mpi_err
used to store return values of mpi calls
This module handles the communicators for the various parallelization strategies.
logical pure function, public multicomm_strategy_is_parallel(mc, level)
logical pure function, public multicomm_have_slaves(this)
Some general things and nomenclature:
subroutine, public photon_mode_compute_dipoles(this, mesh)
Computes the polarization dipole.
subroutine, public photon_mode_add_poisson_terms(this, mesh, rho, pot)
subroutine, public photon_mode_end(this)
subroutine, public photon_mode_set_n_electrons(this, qtot)
subroutine, public photon_mode_init(this, namespace, dim, photon_free)
real(real64), public threshold
subroutine, public poisson_cg2(namespace, der, pot, rho)
subroutine, public poisson_cg1(namespace, der, corrector, pot, rho)
subroutine, public poisson_cg_init(thr, itr)
subroutine, public poisson_cg_end
subroutine, public poisson_corrections_end(this)
subroutine, public poisson_corrections_init(this, namespace, space, ml, mesh)
subroutine, public correct_rho(this, der, rho, rho_corrected, vh_correction)
integer, parameter, public poisson_fft_kernel_nocut
integer, parameter, public poisson_fft_kernel_cyl
subroutine, public zpoisson_fft_solve(this, mesh, cube, pot, rho, mesh_cube_map, average_to_zero, kernel, sm)
subroutine, public poisson_fft_end(this)
subroutine, public poisson_fft_init(this, namespace, space, cube, kernel, soft_coulb_param, fullcube)
integer, parameter, public poisson_fft_kernel_pla
integer, parameter, public poisson_fft_kernel_none
integer, parameter, public poisson_fft_kernel_corrected
integer, parameter, public poisson_fft_kernel_sph
subroutine, public dpoisson_fft_solve(this, mesh, cube, pot, rho, mesh_cube_map, average_to_zero, kernel, sm)
subroutine, public poisson_isf_end(this)
subroutine, public poisson_isf_init(this, namespace, mesh, cube, all_nodes_comm, init_world)
subroutine, public poisson_isf_solve(this, mesh, cube, pot, rho, all_nodes, sm)
subroutine, public poisson_multigrid_solver(this, namespace, der, pot, rho)
A multigrid Poisson solver with corrections at the boundaries.
subroutine, public poisson_multigrid_end(this)
subroutine, public poisson_no_solve(this, mesh, pot, rho)
subroutine, public poisson_no_end(this)
subroutine, public zpoisson_solve_sm(this, namespace, sm, pot, rho, all_nodes)
Calculates the Poisson equation. Given the density returns the corresponding potential.
integer, parameter, public poisson_multigrid
subroutine poisson_kernel_init(this, namespace, space, mc, stencil)
integer, parameter, public poisson_psolver
subroutine, public dpoisson_solve_start(this, rho)
integer, parameter cmd_finish
subroutine, public zpoisson_solve_finish(this, pot)
subroutine poisson_solve_direct(this, namespace, pot, rho)
logical pure function, public poisson_solver_is_iterative(this)
integer, parameter, public poisson_fft
logical pure function, public poisson_is_multigrid(this)
subroutine, public poisson_solve_batch(this, namespace, potb, rhob, all_nodes, kernel)
subroutine, public zpoisson_solve(this, namespace, pot, rho, all_nodes, kernel)
subroutine, public poisson_async_init(this, mc)
subroutine, public dpoisson_solve_sm(this, namespace, sm, pot, rho, all_nodes)
Calculates the Poisson equation. Given the density returns the corresponding potential.
subroutine zpoisson_solve_real_and_imag_separately(this, namespace, pot, rho, all_nodes, kernel)
real(real64) function, public poisson_get_full_range_weight(this, alpha, beta, mu)
Most Poisson solvers do not implement Coulomb attenuated potentials, and can only be used for global ...
subroutine, public poisson_build_kernel(this, namespace, space, coulb, qq, alpha, beta, mu, singul)
subroutine, public poisson_init_sm(this, namespace, space, main, der, sm, method, force_cmplx)
subroutine, public poisson_slave_work(this, namespace)
integer, parameter cmd_poisson_solve
integer, parameter, public poisson_cg
logical pure function, public poisson_solver_has_free_bc(this)
subroutine, public dpoisson_solve_finish(this, pot)
subroutine, public poisson_init(this, namespace, space, der, mc, stencil, qtot, label, solver, verbose, force_serial, force_cmplx)
subroutine, public zpoisson_solve_start(this, rho)
subroutine, public poisson_async_end(this, mc)
integer, parameter, public poisson_cg_corrected
subroutine, public dpoisson_solve(this, namespace, pot, rho, all_nodes, kernel)
Calculates the Poisson equation. Given the density returns the corresponding potential.
integer pure function, public poisson_get_solver(this)
integer, parameter, public poisson_isf
integer, parameter, public poisson_null
subroutine, public poisson_test(this, space, mesh, latt, namespace, repetitions)
This routine checks the Hartree solver selected in the input file by calculating numerically and anal...
integer, parameter, public poisson_no
logical pure function, public poisson_is_async(this)
subroutine, public poisson_end(this)
subroutine, public poisson_psolver_global_solve(this, mesh, cube, pot, rho, sm)
subroutine, public poisson_psolver_parallel_solve(this, mesh, cube, pot, rho, mesh_cube_map)
subroutine, public poisson_psolver_end(this)
subroutine, public poisson_psolver_get_dims(this, cube)
subroutine, public poisson_psolver_init(this, namespace, space, cube, mu, qq, force_isolated)
subroutine, public profiling_out(label)
Increment out counter and sum up difference between entry and exit time.
subroutine, public profiling_in(label, exclude)
Increment in counter and save entry time.
This module defines stencils used in Octopus.
subroutine, public submesh_init_cube_map(sm, space)
subroutine, public submesh_get_cube_dim(sm, space, db)
finds the dimension of a box containing the submesh
type(type_t), public type_float
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
This module defines the unit system, used for input and output.
type(unit_t), public unit_one
some special units required for particular quantities
Class defining batches of mesh functions.
Class implementing a box that is a union of spheres. We do this in a specific class instead of using ...
class representing derivatives
The following class implements a lattice iterator. It allows one to loop over all cells that are with...
Describes mesh distribution to nodes.
A submesh is a type of mesh, used for the projectors in the pseudopotentials It contains points on a ...