49 use,
intrinsic :: iso_fortran_env
96 integer :: repetitions
97 integer :: min_blocksize
98 integer :: max_blocksize
102 real(real64) :: shift_aux
103 type(derivatives_t),
pointer :: der_aux => null()
104 type(preconditioner_t) :: prec_aux
112 type(namespace_t),
intent(in) :: namespace
114 type(test_parameters_t) :: param
183 call parse_variable(namespace,
'TestMode', option__testmode__hartree, test_mode)
200 call parse_variable(namespace,
'TestType', option__testtype__all, param%type)
201 if (param%type < 1 .or. param%type > 5)
then
202 message(1) =
"Invalid option for TestType."
219 call parse_variable(namespace,
'TestRepetitions', 1, param%repetitions)
232 call parse_variable(namespace,
'TestMinBlockSize', 1, param%min_blocksize)
245 call parse_variable(namespace,
'TestMaxBlockSize', 128, param%max_blocksize)
255 select case (test_mode)
256 case (option__testmode__hartree)
258 case (option__testmode__derivatives)
260 case (option__testmode__orthogonalization)
262 case (option__testmode__interpolation)
264 case (option__testmode__ion_interaction)
266 case (option__testmode__projector)
268 case (option__testmode__dft_u)
270 case (option__testmode__hamiltonian_apply)
272 case (option__testmode__density_calc)
274 case (option__testmode__exp_apply)
276 case (option__testmode__boundaries)
278 case (option__testmode__subspace_diag)
280 case (option__testmode__batch_ops)
282 case (option__testmode__clock)
284 case (option__testmode__linear_solver)
286 case (option__testmode__cgal)
288 case (option__testmode__dense_eigensolver)
290 case (option__testmode__grid_interpolation)
292 case (option__testmode__iihash)
294 case (option__testmode__sihash)
296 case (option__testmode__sphash)
298 case (option__testmode__mpiwrappers)
300 case (option__testmode__regridding)
302 case (option__testmode__helmholtz_decomposition)
304 case (option__testmode__vecpot_analytical)
306 case (option__testmode__current_density)
308 case (option__testmode__mixing_tests)
326 sys =>
electrons_t(namespace, generate_epot=.false.)
328 call poisson_test(sys%hm%psolver, sys%space, sys%gr, sys%ions%latt, namespace, param%repetitions)
329 safe_deallocate_p(sys)
346 sys =>
electrons_t(namespace, generate_epot=.false.)
349 call helmholtz%init(namespace, sys%gr, sys%mc, sys%space)
352 write(
message(1),
'(a)')
"Helmholtz decomposition: beginning Hertzian dipole test"
356 write(
message(1),
'(a)')
"Helmholtz decomposition: beginning Gaussian test"
358 call gaussian_test(helmholtz, sys%gr, sys%namespace, sys%space)
360 safe_deallocate_p(sys)
370 real(real64),
allocatable :: rho(:), x(:), center(:)
371 real(real64) :: rr, alpha, beta, res
374 real(real64),
parameter :: threshold = 1.e-7_real64
380 sys =>
electrons_t(namespace, generate_epot=.false.)
386 shift_aux = 0.25_real64
394 alpha =
m_four * sys%gr%spacing(1)
395 beta =
m_one / (alpha**sys%space%dim *
sqrt(
m_pi)**sys%space%dim)
397 safe_allocate(center(1:sys%space%dim))
400 safe_allocate(rho(1:sys%gr%np))
403 call mesh_r(sys%gr, ip, rr, origin = center(:))
404 rho(ip) = beta*
exp(-(rr/alpha)**2)
407 safe_allocate(x(1:sys%gr%np))
413 write(
message(1),
'(a,i6,a)')
"Info: CG converged with ", iter,
" iterations."
414 write(
message(2),
'(a,e14.6)')
"Info: The residue is ", res
415 write(
message(3),
'(a,e14.6)')
"Info: Norm solution CG ",
dmf_nrm2(sys%gr, x)
420 safe_deallocate_a(rho)
421 safe_deallocate_p(sys)
436 real(real64),
intent(in) :: x(:)
437 real(real64),
contiguous,
intent(out) :: Hx(:)
439 real(real64),
allocatable :: tmpx(:)
443 safe_allocate(tmpx(1:
mesh_aux%np_part))
448 safe_deallocate_a(tmpx)
463 complex(real64),
allocatable :: psi(:, :)
469 call messages_write(
'Info: Testing the nonlocal part of the pseudopotential with SOC')
474 sys =>
electrons_t(namespace, generate_epot=.false.)
483 call sys%st%group%psib(1, 1)%copy_to(epsib)
487 do itime = 1, param%repetitions
489 sys%hm%ep%natoms, 2, sys%st%group%psib(1, 1), epsib)
492 safe_allocate(psi(1:sys%gr%np, 1:sys%st%d%dim))
493 do itime = 1, epsib%nst
495 write(
message(1),
'(a,i1,3x, f12.6)')
"Norm state ", itime,
zmf_nrm2(sys%gr, 2, psi)
498 safe_deallocate_a(psi)
502 safe_deallocate_p(sys)
514 integer :: itime, ist
516 real(real64),
allocatable :: ddot(:,:,:), dweight(:,:)
517 complex(real64),
allocatable :: zdot(:,:,:), zweight(:,:)
530 sys =>
electrons_t(namespace, generate_epot=.false.)
535 if (sys%st%pack_states)
call sys%st%pack()
537 call sys%st%group%psib(1, 1)%copy_to(epsib2, copy_data = .
true.)
540 if (.not. sys%hm%phase%is_allocated())
then
541 call sys%st%group%psib(1, 1)%copy_to(epsib, copy_data = .
true.)
543 call sys%st%group%psib(1, 1)%copy_to(epsib)
544 call sys%hm%phase%apply_to(sys%gr, sys%gr%np, &
545 .false., epsib, src=sys%st%group%psib(1, 1))
546 epsib2%has_phase = .
true.
552 call dorbitalbasis_build(basis, sys%namespace, sys%ions, sys%gr, sys%st%d%kpt, sys%st%d%dim, &
553 sys%hm%phase%is_allocated(), .false., .false.)
554 safe_allocate(dweight(1:basis%orbsets(1)%norbs, 1:epsib%nst_linear))
555 safe_allocate(ddot(1:sys%st%d%dim, 1:basis%orbsets(1)%norbs, 1:epsib%nst))
557 call zorbitalbasis_build(basis, sys%namespace, sys%ions, sys%gr, sys%st%d%kpt, sys%st%d%dim, &
558 sys%hm%phase%is_allocated(), .false., .false.)
560 safe_allocate(zweight(1:basis%orbsets(1)%norbs, 1:epsib%nst_linear))
561 safe_allocate(zdot(1:sys%st%d%dim, 1:basis%orbsets(1)%norbs, 1:epsib%nst))
564 if (sys%hm%phase%is_allocated())
then
570 do itime = 1, param%repetitions
585 if (epsib%is_packed())
then
586 call epsib%do_unpack(force = .
true.)
589 do ist = 1, epsib%nst
591 write(
message(1),
'(a,i2,3x,e13.6)')
"Dotp state ", ist, ddot(1,1,ist)
593 write(
message(1),
'(a,i2,2(3x,e13.6))')
"Dotp state ", ist, zdot(1,1,ist)
601 safe_deallocate_a(dweight)
602 safe_deallocate_a(zweight)
603 safe_deallocate_a(ddot)
604 safe_deallocate_a(zdot)
610 safe_deallocate_p(sys)
622 integer :: itime, terms
641 call parse_variable(namespace,
'TestHamiltonianApply', option__testhamiltonianapply__term_all, terms)
642 if (terms == 0) terms = huge(1)
647 call messages_write(
'Info: Testing the application of the Hamiltonian')
652 sys =>
electrons_t(namespace, generate_epot=.false.)
659 if (sys%st%pack_states .and. sys%hm%apply_packed())
call sys%st%pack()
662 call v_ks_calc(sys%ks, sys%namespace, sys%space, sys%hm, sys%st, sys%ions, sys%ext_partners)
664 call boundaries_set(sys%gr%der%boundaries, sys%gr, sys%st%group%psib(1, 1))
666 call sys%st%group%psib(1, 1)%copy_to(hpsib)
668 if (sys%hm%apply_packed())
then
669 call sys%st%group%psib(1, 1)%do_pack()
670 call hpsib%do_pack(copy = .false.)
673 do itime = 1, param%repetitions
683 if (hpsib%is_packed())
then
684 call hpsib%do_unpack(force = .
true.)
689 call hpsib%end(copy = .false.)
691 safe_deallocate_p(sys)
714 sys =>
electrons_t(namespace, generate_epot=.false.)
719 if (sys%st%pack_states)
call sys%st%pack()
721 do itime = 1, param%repetitions
725 write(
message(1),
'(a,3x, f12.6)')
"Norm density ",
dmf_nrm2(sys%gr, sys%st%rho(:,1))
729 safe_deallocate_p(sys)
752 sys =>
electrons_t(namespace, generate_epot=.false.)
757 if (sys%st%pack_states)
call sys%st%pack()
759 do itime = 1, param%repetitions
760 call boundaries_set(sys%gr%der%boundaries, sys%gr, sys%st%group%psib(1, 1))
766 safe_deallocate_p(sys)
790 sys =>
electrons_t(namespace, generate_epot=.false.)
797 if (sys%st%pack_states .and. sys%hm%apply_packed())
call sys%st%pack()
800 call v_ks_calc(sys%ks, sys%namespace, sys%space, sys%hm, sys%st, sys%ions, sys%ext_partners)
804 if (sys%hm%apply_packed())
then
805 call sys%st%group%psib(1, 1)%do_pack()
808 do itime = 1, param%repetitions
809 call te%apply_batch(sys%namespace, sys%gr, sys%hm, sys%st%group%psib(1, 1), 1e-3_real64)
815 safe_deallocate_p(sys)
829 real(real64),
allocatable :: diff(:)
840 sys =>
electrons_t(namespace, generate_epot=.false.)
846 if (sys%st%pack_states .and. sys%hm%apply_packed())
call sys%st%pack()
849 call v_ks_calc(sys%ks, sys%namespace, sys%space, sys%hm, sys%st, sys%ions, sys%ext_partners)
851 call sdiag%init(sys%namespace, sys%st)
853 safe_allocate(diff(1:sys%st%nst))
855 do itime = 1, param%repetitions
857 call dsubspace_diag(sdiag, sys%namespace, sys%gr, sys%st, sys%hm, 1, sys%st%eigenval(:, 1), diff)
859 call zsubspace_diag(sdiag, sys%namespace, sys%gr, sys%st, sys%hm, 1, sys%st%eigenval(:, 1), diff)
863 safe_deallocate_a(diff)
868 safe_deallocate_p(sys)
880 integer :: itime, ops, ops_default, ist, jst, nst
882 real(real64),
allocatable :: tmp(:)
883 real(real64),
allocatable :: ddotv(:)
884 complex(real64),
allocatable :: zdotv(:)
885 real(real64),
allocatable :: ddot(:,:)
886 complex(real64),
allocatable :: zdot(:,:)
911 option__testbatchops__ops_axpy + &
912 option__testbatchops__ops_scal + &
913 option__testbatchops__ops_nrm2 + &
914 option__testbatchops__ops_dotp_matrix + &
915 option__testbatchops__ops_dotp_self + &
916 option__testbatchops__ops_dotp_vector
927 sys =>
electrons_t(namespace, generate_epot=.false.)
932 if (sys%st%pack_states)
call sys%st%pack()
934 if (
bitand(ops, option__testbatchops__ops_axpy) /= 0)
then
935 message(1) =
'Info: Testing axpy'
938 call sys%st%group%psib(1, 1)%copy_to(xx, copy_data = .
true.)
939 call sys%st%group%psib(1, 1)%copy_to(yy, copy_data = .
true.)
941 do itime = 1, param%repetitions
942 call batch_axpy(sys%gr%np, 0.1_real64, xx, yy)
950 if (
bitand(ops, option__testbatchops__ops_scal) /= 0)
then
951 message(1) =
'Info: Testing scal'
954 call sys%st%group%psib(1, 1)%copy_to(xx, copy_data = .
true.)
955 call sys%st%group%psib(1, 1)%copy_to(yy, copy_data = .
true.)
957 do itime = 1, param%repetitions
966 if (
bitand(ops, option__testbatchops__ops_nrm2) /= 0)
then
967 message(1) =
'Info: Testing nrm2'
970 call sys%st%group%psib(1, 1)%copy_to(xx, copy_data = .
true.)
971 call sys%st%group%psib(1, 1)%copy_to(yy, copy_data = .
true.)
973 safe_allocate(tmp(1:xx%nst))
975 do itime = 1, param%repetitions
979 write(
message(1),
'(a,i1,3x,e23.16)')
"Nrm2 norm state ", itime, tmp(itime)
983 safe_deallocate_a(tmp)
989 if (
bitand(ops, option__testbatchops__ops_dotp_matrix) /= 0)
then
991 message(1) =
'Info: Testing dotp_matrix'
994 call sys%st%group%psib(1, 1)%copy_to(xx, copy_data = .
true.)
995 call sys%st%group%psib(1, 1)%copy_to(yy, copy_data = .
true.)
997 nst = sys%st%group%psib(1, 1)%nst
1000 safe_allocate(ddot(1:nst, 1:nst))
1001 do itime = 1, param%repetitions
1007 write(
message(jst),
'(a,2i3,3x,e23.16)')
'Dotp_matrix states', ist, jst, ddot(ist,jst)
1011 safe_deallocate_a(ddot)
1013 safe_allocate(zdot(1:nst, 1:nst))
1014 do itime = 1, param%repetitions
1020 write(
message(jst),
'(a,2i3,3x,2(e23.16,1x))')
'Dotp_matrix states', ist, jst, zdot(ist,jst)
1024 safe_deallocate_a(zdot)
1031 if (
bitand(ops, option__testbatchops__ops_dotp_vector) /= 0)
then
1033 message(1) =
'Info: Testing dotp_vector'
1036 call sys%st%group%psib(1, 1)%copy_to(xx, copy_data = .
true.)
1037 call sys%st%group%psib(1, 1)%copy_to(yy, copy_data = .
true.)
1039 nst = sys%st%group%psib(1, 1)%nst
1042 safe_allocate(ddotv(1:nst))
1043 do itime = 1, param%repetitions
1048 write(
message(ist),
'(a,i3,3x,e23.16)')
'Dotp_vector state', ist, ddotv(ist)
1051 safe_deallocate_a(ddotv)
1053 safe_allocate(zdotv(1:nst))
1054 do itime = 1, param%repetitions
1059 write(
message(ist),
'(a,i3,3x,2(e23.16,1x))')
'Dotp_vector state', ist, zdotv(ist)
1062 safe_deallocate_a(zdotv)
1069 if (
bitand(ops, option__testbatchops__ops_dotp_self) /= 0)
then
1071 message(1) =
'Info: Testing dotp_self'
1074 call sys%st%group%psib(1, 1)%copy_to(xx, copy_data = .
true.)
1076 nst = sys%st%group%psib(1, 1)%nst
1079 safe_allocate(ddot(1:nst, 1:nst))
1080 do itime = 1, param%repetitions
1086 write(
message(jst),
'(a,2i3,3x,e23.16)')
'Dotp_self states', ist, jst, ddot(ist,jst)
1090 safe_deallocate_a(ddot)
1092 safe_allocate(zdot(1:nst, 1:nst))
1093 do itime = 1, param%repetitions
1099 write(
message(jst),
'(a,2i3,3x,2(e23.16,1x))')
'Dotp_self states', ist, jst, zdot(ist,jst)
1103 safe_deallocate_a(zdot)
1110 safe_deallocate_p(sys)
1124 sys =>
electrons_t(namespace, generate_epot=.false.)
1125 call sys%init_parallelization(
mpi_world)
1127 message(1) =
'Info: Testing the finite-differences derivatives.'
1131 if (param%type == option__testtype__all .or. param%type == option__testtype__real)
then
1132 call dderivatives_test(sys%gr%der, sys%namespace, param%repetitions, param%min_blocksize, param%max_blocksize)
1135 if (param%type == option__testtype__all .or. param%type == option__testtype__complex)
then
1136 call zderivatives_test(sys%gr%der, sys%namespace, param%repetitions, param%min_blocksize, param%max_blocksize)
1139 safe_deallocate_p(sys)
1158 sys =>
electrons_t(namespace, generate_epot=.false.)
1159 call sys%init_parallelization(
mpi_world)
1161 message(1) =
'Info: Testing orthogonalization.'
1165 if (param%type == option__testtype__all .or. param%type == option__testtype__real)
then
1166 message(1) =
'Info: Real wave-functions.'
1168 do itime = 1, param%repetitions
1173 if (param%type == option__testtype__all .or. param%type == option__testtype__complex)
then
1174 message(1) =
'Info: Complex wave-functions.'
1176 do itime = 1, param%repetitions
1181 safe_deallocate_p(sys)
1196 sys =>
electrons_t(namespace, generate_epot=.false.)
1197 call sys%init_parallelization(
mpi_world)
1199 if (param%type == option__testtype__all .or. param%type == option__testtype__real)
then
1208 if (param%type == option__testtype__all .or. param%type == option__testtype__complex)
then
1210 call messages_write(
'Info: Testing complex interpolation routines')
1218 safe_deallocate_p(sys)
1233 sys =>
electrons_t(namespace, generate_epot=.false.)
1234 call sys%init_parallelization(
mpi_world)
1236 call ion_interaction_test(sys%space, sys%ions%latt, sys%ions%atom, sys%ions%natoms, sys%ions%pos, &
1237 sys%gr%box%bounding_box_l, namespace, sys%mc)
1239 safe_deallocate_p(sys)
1248 type(
grid_t),
intent(in) :: gr
1249 class(
batch_t),
intent(inout) :: psib
1250 character(*),
optional,
intent(in) :: string
1253 complex(real64),
allocatable :: zpsi(:, :)
1254 real(real64),
allocatable :: dpsi(:, :)
1256 character(80) :: string_
1263 safe_allocate(dpsi(1:gr%np, 1:st%d%dim))
1265 safe_allocate(zpsi(1:gr%np, 1:st%d%dim))
1268 do itime = 1, psib%nst
1271 write(
message(1),
'(a,i2,3x,e23.16)')
"Norm state "//trim(string_)//
" ", itime,
dmf_nrm2(gr, st%d%dim, dpsi)
1274 write(
message(1),
'(a,i2,3x,e23.16)')
"Norm state "//trim(string_)//
" ", itime,
zmf_nrm2(gr, st%d%dim, zpsi)
1280 safe_deallocate_a(dpsi)
1282 safe_deallocate_a(zpsi)
1298 write(
message(1),
'(a)')
" Operation Counter Time Global step"
1313 call clock%set(
clock_t(time_step=
m_four, initial_iteration=1))
1317 write(
message(1),
'(a)')
" Clock comparisons:"
1320 other_clock =
clock_t(time_step=
m_one, initial_iteration=5)
1332 character(len=*),
intent(in) :: operation
1334 write(
message(1),
'(a17,x,i6,x,f10.1,x,i16)') operation, clock%counter(), clock%value(), clock%global_step()
1339 character(len=*),
intent(in) :: condition
1340 logical,
intent(in) :: result
1342 write(
message(1),
'(a10," = ",i1," (",l1,")")') condition, abs(transfer(result, 0)), result
1359 message(1) =
"cgal_polyhedron_point_inside"
1371 integer :: N, ii, jj, N_list(4), i_N
1372 real(real64),
allocatable :: matrix(:, :), eigenvectors(:, :), eigenvalues(:), test(:)
1373 real(real64),
allocatable :: differences(:)
1377 n_list = [15, 32, 100, 500]
1381 safe_allocate(matrix(1:n, 1:n))
1382 safe_allocate(eigenvectors(1:n, 1:n))
1383 safe_allocate(eigenvalues(1:n))
1384 safe_allocate(test(1:n))
1385 safe_allocate(differences(1:n))
1391 matrix(ii, jj) = ii * jj
1396 eigenvectors(1:n, 1:n) = matrix(1:n, 1:n)
1400 test(:) = matmul(matrix, eigenvectors(:, ii)) - eigenvalues(ii) * eigenvectors(:, ii)
1401 differences(ii) = sum(abs(test)) / sum(abs(eigenvectors(:, ii)))
1403 write(
message(1),
"(A, I3, A, E13.6)")
"Parallel solver - N: ", n, &
1404 ", average difference: ", sum(differences)/n
1408 eigenvectors(1:n, 1:n) = matrix(1:n, 1:n)
1412 test(:) = matmul(matrix, eigenvectors(:, ii)) - eigenvalues(ii) * eigenvectors(:, ii)
1413 differences(ii) = sum(abs(test)) / sum(abs(eigenvectors(:, ii)))
1415 write(
message(1),
"(A, I3, A, E13.6)")
"Serial solver - N: ", n, &
1416 ", average difference: ", sum(differences)/n
1419 safe_deallocate_a(matrix)
1420 safe_deallocate_a(eigenvectors)
1421 safe_deallocate_a(eigenvalues)
1422 safe_deallocate_a(test)
1423 safe_deallocate_a(differences)
1430 class(
batch_t),
intent(inout) :: psib
1433 real(real64),
allocatable :: dff(:)
1434 complex(real64),
allocatable :: zff(:)
1436 real(real64) :: da, db, dc
1437 complex(real64) :: za, zb, zc
1442 da =
m_one/mesh%box%bounding_box_l(1)
1448 za = da +
m_zi*0.01_real64
1449 zb = db*
exp(
m_zi*0.345_real64)
1450 zc = dc -
m_zi*50.0_real64
1452 safe_allocate(zff(1:mesh%np))
1453 do ist = 1, psib%nst_linear
1457 zff(ip) = zb*
exp(-za*sum(mesh%x(ip, :)**2)) + zc
1462 safe_deallocate_a(zff)
1464 safe_allocate(dff(1:mesh%np))
1465 do ist = 1, psib%nst_linear
1469 dff(ip) = db*
exp(-da*sum(mesh%x(ip, :)**2)) + dc
1474 safe_deallocate_a(dff)
1488 call sys%init_parallelization(
mpi_world)
1491 sys%gr%stencil, sys%mc, nlevels=3)
1497 safe_deallocate_p(sys)
1513 write(
message(1),*)
'hash[1] :', found,
value
1517 write(
message(1),*)
'hash[2] :', found,
value
1521 write(
message(1),*)
'hash[3] :', found,
value
1533 integer ::
value, sum
1542 write(
message(1),*)
'hash["one"]: ', found,
value
1546 write(
message(1),*)
'hash["two"]: ', found,
value
1550 write(
message(1),*)
'hash["three"]: ', found,
value
1557 do while (it%has_next())
1558 value = it%get_next()
1560 write(
message(1),
'(I3,A,I5)') counter,
': hash[...] = ',
value
1562 counter = counter + 1
1564 write(
message(1),*)
'counter = ', counter
1565 write(
message(2),*)
'sum = ', sum
1587 class(*),
pointer :: value
1589 integer :: count_clock, count_space
1591 safe_allocate(clock_2)
1605 write(
message(1),*)
'hash["one"]: ', found,
value%counter()
1608 write(
message(1),*)
'hash["one"]: ', found,
value%short_info()
1611 write(
message(1),*)
'wrong type. found = ', found
1618 write(
message(1),*)
'hash["two"]: ', found,
value%counter()
1621 write(
message(1),*)
'hash["two"]: ', found,
value%short_info()
1624 write(
message(1),*)
'wrong type. found = ',found
1628 safe_deallocate_a(clock_2)
1633 write(
message(1),*)
'hash["three"]: ', found,
value%counter()
1636 write(
message(1),*)
'hash["three"]: ', found,
value%short_info()
1639 write(
message(1),*)
'wrong type. found = ',found
1648 do while (it%has_next())
1649 value => it%get_next()
1652 count_clock = count_clock + 1
1654 count_space = count_space + 1
1658 write(
message(1), *)
'Count_clock = ', count_clock
1659 write(
message(2), *)
'Count_space = ', count_space
1672 real(real64),
allocatable :: ff_A(:), ff_A_reference(:), ff_B(:), ff_B_reference(:), diff_A(:), diff_B(:)
1673 real(real64) :: norm_ff, norm_diff
1682 call sysa%init_parallelization(
mpi_world)
1683 call sysb%init_parallelization(
mpi_world)
1686 safe_allocate(ff_a(1:sysa%gr%np))
1687 safe_allocate(ff_a_reference(1:sysa%gr%np))
1688 safe_allocate(diff_a(1:sysa%gr%np))
1689 safe_allocate(ff_b(1:sysb%gr%np))
1690 safe_allocate(ff_b_reference(1:sysb%gr%np))
1691 safe_allocate(diff_b(1:sysb%gr%np))
1693 do ip = 1, sysa%gr%np
1694 ff_a_reference(ip) =
values(sysa%gr%x(ip, :))
1696 do ip = 1, sysb%gr%np
1697 ff_b_reference(ip) =
values(sysb%gr%x(ip, :))
1701 regridding =>
regridding_t(sysb%gr, sysa%gr, sysa%space, sysa%namespace)
1702 call regridding%do_transfer(ff_b, ff_a_reference)
1703 safe_deallocate_p(regridding)
1706 do ip = 1, sysb%gr%np
1708 ff_b_reference(ip) =
m_zero
1711 diff_b(ip) = abs(ff_b_reference(ip) - ff_b(ip))
1714 norm_ff =
dmf_nrm2(sysb%gr, ff_b_reference)
1715 norm_diff =
dmf_nrm2(sysb%gr, diff_b)
1717 write(
message(1),
'(a, E14.6)')
"Forward: difference of reference to mapped function (rel.): ", &
1722 sysb%gr, ff_b_reference,
unit_one, ierr)
1726 sysa%gr, ff_a_reference,
unit_one, ierr)
1729 regridding =>
regridding_t(sysa%gr, sysb%gr, sysb%space, sysb%namespace)
1730 call regridding%do_transfer(ff_a, ff_b_reference)
1731 safe_deallocate_p(regridding)
1733 do ip = 1, sysa%gr%np
1735 ff_a_reference(ip) =
m_zero
1738 diff_a(ip) = abs(ff_a_reference(ip) - ff_a(ip))
1741 norm_ff =
dmf_nrm2(sysa%gr, ff_a_reference)
1742 norm_diff =
dmf_nrm2(sysa%gr, diff_a)
1744 write(
message(1),
'(a, E14.6)')
"Backward: difference of reference to mapped function (rel.): ", &
1749 sysa%gr, ff_a_reference,
unit_one, ierr)
1753 sysb%gr, ff_b_reference,
unit_one, ierr)
1755 safe_deallocate_a(ff_a)
1756 safe_deallocate_a(ff_a_reference)
1757 safe_deallocate_a(ff_b)
1758 safe_deallocate_a(ff_b_reference)
1759 safe_deallocate_a(diff_a)
1760 safe_deallocate_a(diff_b)
1761 safe_deallocate_p(sysa)
1762 safe_deallocate_p(sysb)
1768 real(real64) function values(xx)
1769 real(real64),
intent(in) :: xx(:)
1770 real(real64) :: xx0(1:size(xx, dim=1))
1771 real(real64),
parameter :: aa =
m_half
1772 real(real64),
parameter :: bb =
m_four
1776 values = bb *
exp(-aa*sum((xx-xx0)**2))
1786 type(namespace_t),
intent(in) :: namespace
1788 class(maxwell_t),
pointer :: maxwell_system
1790 real(real64),
allocatable :: magnetic_field(:,:)
1791 real(real64),
allocatable :: vector_potential_mag(:,:)
1792 real(real64),
allocatable :: vector_potential_analytical(:,:)
1793 real(real64),
allocatable :: delta(:,:)
1794 real(real64) :: exp_factor
1798 real(real64) :: sigma
1799 integer :: ip, j, ierr, nn
1800 integer(int64) :: out_how
1801 character(len=MAX_PATH_LEN) :: fname, fname2, fname3
1804 maxwell_system => maxwell_t(namespace)
1805 sigma = maxwell_system%gr%box%bounding_box_l(1)/10_real64
1806 call maxwell_system%init_parallelization(mpi_world)
1808 safe_allocate(magnetic_field(1:maxwell_system%gr%np_part, 1:3))
1809 safe_allocate(vector_potential_mag(1:maxwell_system%gr%np_part, 1:3))
1810 safe_allocate(vector_potential_analytical(1:maxwell_system%gr%np_part, 1:3))
1811 safe_allocate(delta(1:maxwell_system%gr%np, 1:3))
1824 call parse_variable(namespace,
'TestVectorPotentialType', option__testvectorpotentialtype__bounded, nn)
1827 case (option__testvectorpotentialtype__bounded)
1828 do ip = 1, maxwell_system%gr%np_part
1829 xx = maxwell_system%gr%x(ip, 1)
1830 yy = maxwell_system%gr%x(ip, 2)
1831 zz = maxwell_system%gr%x(ip, 3)
1832 exp_factor =
exp((-xx**2 - yy**2 - zz**2)*1/(2*sigma**2))
1833 magnetic_field(ip, 1) = exp_factor*yy*(1 - (-xx**2 + yy**2)/(3*sigma**2) - zz**2/(3*sigma**2))
1834 magnetic_field(ip, 2) = exp_factor * xx * (1 + (-xx**2 + yy**2)/(3*sigma**2) - zz**2/(3*sigma**2))
1835 magnetic_field(ip, 3) = exp_factor * 2 * xx * yy * zz * 1/(3*sigma**2)
1837 vector_potential_analytical(ip, 1) = m_third * xx * zz * exp_factor
1838 vector_potential_analytical(ip, 2) = - m_third * yy * zz * exp_factor
1839 vector_potential_analytical(ip, 3) = m_third * (-xx**2 + yy**2) * exp_factor
1841 case (option__testvectorpotentialtype__unbounded)
1842 do ip = 1, maxwell_system%gr%np_part
1843 magnetic_field(ip, 1) = maxwell_system%gr%x(ip, 2)
1844 magnetic_field(ip, 2) = maxwell_system%gr%x(ip, 1)
1845 magnetic_field(ip, 3) = m_zero
1847 vector_potential_analytical(ip, 1) = m_third * maxwell_system%gr%x(ip, 1) * maxwell_system%gr%x(ip, 3)
1848 vector_potential_analytical(ip, 2) = - m_third * maxwell_system%gr%x(ip, 2) * maxwell_system%gr%x(ip, 3)
1849 vector_potential_analytical(ip, 3) = - m_third * (maxwell_system%gr%x(ip, 1)**2 - maxwell_system%gr%x(ip, 2)**2)
1852 call maxwell_system%helmholtz%get_vector_potential(namespace, vector_potential_mag, magnetic_field)
1856 do ip = 1, maxwell_system%gr%np
1857 delta(ip,j) = vector_potential_analytical(ip, j) - vector_potential_mag(ip, j)
1862 write(message(j),*)
'j, norm2(delta)', j, norm2(delta(:,j))
1864 call messages_info(3)
1866 write(fname,
'(a)')
'deviation_from_analytical_formulation'
1867 call io_function_output_vector(out_how ,
'./' , trim(fname), namespace, maxwell_system%space, maxwell_system%gr, &
1868 delta, unit_one, ierr)
1869 write(fname2,
'(a)')
'vector_potential_analytical'
1870 call io_function_output_vector(out_how ,
'./' , trim(fname2), namespace, maxwell_system%space, maxwell_system%gr, &
1871 vector_potential_analytical, unit_one, ierr)
1872 write(fname3,
'(a)')
'vector_potential_mag'
1873 call io_function_output_vector(out_how ,
'./' , trim(fname3), namespace, maxwell_system%space, maxwell_system%gr, &
1874 vector_potential_mag, unit_one, ierr)
1876 safe_deallocate_a(magnetic_field)
1877 safe_deallocate_a(vector_potential_mag)
1878 safe_deallocate_a(vector_potential_analytical)
1879 safe_deallocate_a(delta)
1880 safe_deallocate_p(maxwell_system)
1886 type(multigrid_t),
intent(in) :: mgrid
1887 class(space_t),
intent(in) :: space
1889 real(real64),
allocatable :: guess0(:), res0(:), guess1(:)
1890 type(mesh_t),
pointer :: mesh0, mesh1
1891 real(real64) :: delta, xx(3,2), alpha, beta, rr
1892 integer :: nn, ip, ierr, order
1904 call parse_variable(global_namespace,
'InterpolationTestOrder', 1, order)
1906 message(1) =
'Info: Testing the grid interpolation.'
1908 call messages_info(2)
1910 mesh0 => mgrid%level(0)%mesh
1911 mesh1 => mgrid%level(1)%mesh
1913 safe_allocate(guess0(1:mesh0%np_part))
1914 safe_allocate(res0(1:mesh0%np))
1915 safe_allocate(guess1(1:mesh1%np_part))
1917 alpha = m_four*mesh0%spacing(1)
1918 beta = m_one / (alpha**space%dim *
sqrt(m_pi)**space%dim)
1933 call mesh_r(mesh0, ip, rr, origin = xx(:, nn))
1934 guess0(ip) = guess0(ip) + (-1)**nn * beta*
exp(-(rr/alpha)**2)
1938 call dio_function_output (io_function_fill_how(
'AxisX'),
".",
"interpolation_target", global_namespace, &
1939 space, mesh0, guess0, unit_one, ierr)
1940 call dio_function_output (io_function_fill_how(
'AxisZ'),
".",
"interpolation_target", global_namespace, &
1941 space, mesh0, guess0, unit_one, ierr)
1942 call dio_function_output (io_function_fill_how(
'PlaneZ'),
".",
"interpolation_target", global_namespace, &
1943 space, mesh0, guess0, unit_one, ierr)
1950 call dmultigrid_fine2coarse(mgrid%level(1)%tt, mgrid%level(0)%der, mesh1, guess0, guess1, injection)
1952 call dmultigrid_coarse2fine(mgrid%level(1)%tt, mgrid%level(1)%der, mesh0, guess1, res0, order = order)
1954 call dio_function_output (io_function_fill_how(
'AxisX'),
".",
"interpolation_result", global_namespace, &
1955 space, mesh0, res0, unit_one, ierr)
1956 call dio_function_output (io_function_fill_how(
'AxisZ'),
".",
"interpolation_result", global_namespace, &
1957 space, mesh0, res0, unit_one, ierr)
1958 call dio_function_output (io_function_fill_how(
'PlaneZ'),
".",
"interpolation_result", global_namespace, &
1959 space, mesh0, res0, unit_one, ierr)
1961 delta = dmf_nrm2(mesh0, guess0(1:mesh0%np)-res0)
1962 write(message(1),
'(a,e13.6)')
'Interpolation test (abs.) = ', delta
1968 call dmultigrid_fine2coarse(mgrid%level(1)%tt, mgrid%level(0)%der, mesh1, guess0, guess1, fullweight)
1970 call dmultigrid_coarse2fine(mgrid%level(1)%tt, mgrid%level(1)%der, mesh0, guess1, res0, order = order)
1972 call dio_function_output (io_function_fill_how(
'AxisX'),
".",
"restriction_result", global_namespace, &
1973 space, mesh0, res0, unit_one, ierr)
1974 call dio_function_output (io_function_fill_how(
'AxisZ'),
".",
"restriction_result", global_namespace, &
1975 space, mesh0, res0, unit_one, ierr)
1976 call dio_function_output (io_function_fill_how(
'PlaneZ'),
".",
"restriction_result", global_namespace, &
1977 space, mesh0, res0, unit_one, ierr)
1979 delta = dmf_nrm2(mesh0, guess0(1:mesh0%np)-res0)
1980 write(message(2),
'(a,e13.6)')
'Restriction test (abs.) = ', delta
1981 call messages_info(2)
1983 safe_deallocate_a(guess0)
1984 safe_deallocate_a(res0)
1985 safe_deallocate_a(guess1)
1993 type(namespace_t),
intent(in) :: namespace
1994 type(electrons_t),
pointer :: sys
1996 type(current_t) :: current
1997 character(len=MAX_PATH_LEN) :: fname
1998 integer :: ierr, ip, idir
1999 integer(int64) :: out_how
2000 real(real64),
allocatable :: current_para_ref(:,:), current_dia_ref(:,:), current_mag_ref(:,:), delta(:)
2001 real(real64) :: xx(3), rr, a0, mag_curr, sin_thet, sin_phi, cos_phi, vec_pot_slope
2002 complex(real64) :: alpha
2004 sys => electrons_t(namespace, generate_epot=.false.)
2005 call sys%init_parallelization(mpi_world)
2007 alpha = (0.0_real64, 0.5_real64)
2009 vec_pot_slope = 0.4_real64
2011 call states_elec_allocate_wfns(sys%st, sys%gr, wfs_type = type_cmplx)
2014 call current_init(current, namespace)
2016 call hamiltonian_elec_epot_generate(sys%hm, sys%namespace, sys%space, sys%gr, sys%ions, sys%ext_partners, sys%st)
2018 safe_allocate(sys%hm%hm_base%vector_potential(1:3, 1:sys%gr%np))
2020 sys%hm%hm_base%vector_potential = m_zero
2021 do ip = 1, sys%gr%np
2022 xx = sys%gr%x(ip, 1:3)
2023 sys%hm%hm_base%vector_potential(2, ip) = vec_pot_slope * xx(1) / p_c
2026 call states_elec_allocate_current(sys%st, sys%space, sys%gr)
2027 call density_calc(sys%st, sys%gr, sys%st%rho)
2029 call current_calculate(current, namespace, sys%gr, sys%hm, sys%space, sys%st)
2031 safe_allocate(current_para_ref(1:sys%gr%np,1:3))
2032 safe_allocate(current_dia_ref(1:sys%gr%np,1:3))
2033 safe_allocate(current_mag_ref(1:sys%gr%np,1:3))
2034 safe_allocate(delta(1:sys%gr%np))
2037 current_para_ref(:,:) = m_zero
2038 do ip = 1, sys%gr%np
2039 call mesh_r(sys%gr, ip, rr)
2040 xx = sys%gr%x(ip, 1:3)
2041 if (rr > r_small)
then
2043 psi_1s(rr, a0) *
dr_psi_2s(rr, a0) ) * imag(alpha) / (1 + abs(alpha)**2) * xx(1:3) / rr
2047 write(fname,
'(a)')
'current_para'
2048 out_how = io_function_fill_how(
"PlaneZ")
2049 call io_function_output_vector(out_how ,
'./' , trim(fname), namespace, sys%space, sys%gr, &
2050 sys%st%current_para(:,:,1), unit_one, ierr)
2052 write(fname,
'(a)')
'current_para-ref'
2053 out_how = io_function_fill_how(
"PlaneZ")
2054 call io_function_output_vector(out_how ,
'./' , trim(fname), namespace, sys%space, sys%gr, &
2055 current_para_ref(:,:), unit_one, ierr)
2059 delta(:) = current_para_ref(1:sys%gr%np, idir) - sys%st%current_para(1:sys%gr%np, idir, 1)
2060 write(message(idir),*)
'idir =',idir,
', norm2(delta paramagnetic)',norm2(delta)
2062 call messages_info(3)
2065 current_dia_ref(:,:) = m_zero
2066 do ip = 1, sys%gr%np
2067 call mesh_r(sys%gr, ip, rr)
2068 current_dia_ref(ip,1:3) = - sys%hm%hm_base%vector_potential(1:3,ip) *&
2072 write(fname,
'(a)')
'current_dia'
2073 out_how = io_function_fill_how(
"PlaneZ")
2074 call io_function_output_vector(out_how ,
'./' , trim(fname), namespace, sys%space, sys%gr, &
2075 sys%st%current_dia(:,:,1), unit_one, ierr)
2077 write(fname,
'(a)')
'current_dia-ref'
2078 out_how = io_function_fill_how(
"PlaneZ")
2079 call io_function_output_vector(out_how ,
'./' , trim(fname), namespace, sys%space, sys%gr, &
2080 current_dia_ref(:,:), unit_one, ierr)
2084 delta(:) = current_dia_ref(1:sys%gr%np, idir) - sys%st%current_dia(1:sys%gr%np, idir, 1)
2085 write(message(idir),*)
'idir =',idir,
', norm2(delta diamagnetic)',norm2(delta)
2087 call messages_info(3)
2090 call current_calculate_mag(sys%gr%der, sys%st)
2093 current_mag_ref(:,:) = m_zero
2094 do ip = 1, sys%gr%np
2095 call mesh_r(sys%gr, ip, rr)
2096 xx = sys%gr%x(ip, 1:3)
2097 if (norm2(xx(1:2)) > r_small .and. rr > r_small)
then
2098 sin_thet = norm2(xx(1:2)) / rr
2099 sin_phi = xx(2) / norm2(xx(1:2))
2100 cos_phi = xx(1) / norm2(xx(1:2))
2104 current_mag_ref(ip,1) = m_half * mag_curr * sin_thet * sin_phi / (1+abs(alpha)**2)
2105 current_mag_ref(ip,2) = -m_half * mag_curr * sin_thet * cos_phi / (1+abs(alpha)**2)
2109 write(fname,
'(a)')
'current_mag'
2110 out_how = io_function_fill_how(
"PlaneZ")
2111 call io_function_output_vector(out_how ,
'./' , trim(fname), namespace, sys%space, sys%gr, &
2112 sys%st%current_mag(:,:,1), unit_one, ierr)
2114 write(fname,
'(a)')
'current_mag-ref'
2115 out_how = io_function_fill_how(
"PlaneZ")
2116 call io_function_output_vector(out_how ,
'./' , trim(fname), namespace, sys%space, sys%gr, &
2117 current_mag_ref(:,:), unit_one, ierr)
2121 delta(:) = current_mag_ref(1:sys%gr%np, idir) - sys%st%current_mag(1:sys%gr%np, idir, 1)
2122 write(message(idir),*)
'idir =',idir,
', norm2(delta magnetization)',norm2(delta)
2124 call messages_info(3)
2126 safe_deallocate_a(current_para_ref)
2127 safe_deallocate_a(current_dia_ref)
2128 safe_deallocate_a(current_mag_ref)
2129 safe_deallocate_a(delta)
2130 safe_deallocate_p(sys)
2136 class(batch_t),
intent(inout) :: psib
2137 class(mesh_t),
intent(in) :: mesh
2138 type(namespace_t),
intent(in) :: namespace
2139 complex(real64),
intent(in) :: alpha
2140 real(real64),
intent(in) :: a0
2142 complex(real64),
allocatable :: zff(:)
2149 safe_allocate(zff(1:mesh%np))
2150 if (type_is_complex(psib%type()))
then
2152 call mesh_r(mesh, ip, rr)
2154 call batch_set_state(psib, 1, mesh%np, zff)
2156 safe_deallocate_a(zff)
2158 write(message(1),*)
"States should be complex for the linear combination of hydrogenic states to work"
2159 call messages_info(1, namespace=namespace)
2166 real(real64),
intent(in) :: a0, rr
2167 complex(real64),
intent(in) :: alpha
2173 real(real64) function psi_1s(rr, a0)
2174 real(real64),
intent(in) :: a0, rr
2180 real(real64) function psi_2s(rr, a0)
2181 real(real64),
intent(in) :: a0, rr
2183 psi_2s =
sqrt(m_two) * a0**(-m_three/m_two) * (m_one - rr/(m_two * a0)) *
exp(-rr/(m_two * a0)) &
2184 / (m_two *
sqrt(m_pi))
2187 real(real64) function dr_psi_1s(rr, a0)
2188 real(real64),
intent(in) :: a0, rr
2193 real(real64) function dr_psi_2s(rr, a0)
2194 real(real64),
intent(in) :: a0, rr
2197 a0**(-m_five/m_two) *
exp(-rr/(m_two * a0)) / (
sqrt(m_two) * m_two *
sqrt(m_pi))
batchified version of the BLAS axpy routine:
scale a batch by a constant or vector
There are several ways how to call batch_set_state and batch_get_state:
constant times a vector plus a vector
Copies a vector x, to a vector y.
scales a vector by a constant
Prints out to iunit a message in the form: ["InputVariable" = value] where "InputVariable" is given b...
double exp(double __x) __attribute__((__nothrow__
double sqrt(double __x) __attribute__((__nothrow__
This module implements batches of mesh functions.
This module implements common operations on batches of mesh functions.
subroutine, public batch_set_zero(this, np, async)
fill all mesh functions of the batch with zero
Module implementing boundary conditions in Octopus.
Module, implementing a factory for boxes.
This module handles the calculation mode.
integer, parameter, public p_strategy_kpoints
parallelization in k-points
integer, parameter, public p_strategy_domains
parallelization in domains
type(calc_mode_par_t), public calc_mode_par
Singleton instance of parallel calculation mode.
integer, parameter, public p_strategy_states
parallelization in states
subroutine, public cgal_polyhedron_init(cgal_poly, fname, verbose)
logical function, public cgal_polyhedron_point_inside(cgal_poly, xq, yq, zq)
subroutine, public cgal_polyhedron_end(cgal_poly)
This module implements a calculator for the density and defines related functions.
subroutine, public density_calc(st, gr, density, istin)
Computes the density from the orbitals in st.
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
subroutine, public dderivatives_test(this, namespace, repetitions, min_blocksize, max_blocksize)
unit test for derivatives
subroutine, public dderivatives_lapl(der, ff, op_ff, ghost_update, set_bc, factor)
apply the Laplacian to a mesh function
subroutine, public zderivatives_test(this, namespace, repetitions, min_blocksize, max_blocksize)
unit test for derivatives
integer, parameter, public spin_polarized
subroutine, public exponential_init(te, namespace, full_batch)
real(real64), parameter, public m_two
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_epsilon
real(real64), parameter, public m_half
real(real64), parameter, public m_one
This module implements the underlying real-space grid.
subroutine, public zhamiltonian_elec_apply_batch(hm, namespace, mesh, psib, hpsib, terms, set_bc)
subroutine, public hamiltonian_elec_epot_generate(this, namespace, space, gr, ions, ext_partners, st, time)
subroutine, public dhamiltonian_elec_apply_batch(hm, namespace, mesh, psib, hpsib, terms, set_bc)
The Helmholtz decomposition is intended to contain "only mathematical" functions and procedures to co...
Test suit for the Helmholtz decomposition module.
subroutine, public gaussian_test(helmholtz, sys_grid, namespace, space)
subroutine, public hertzian_dipole_test(helmholtz, sys_grid, namespace, space)
This module implements a simple hash table for non-negative integer keys and integer values.
subroutine, public iihash_end(h)
Free a hash table.
subroutine, public iihash_insert(h, key, val)
Insert a (key, val) pair into the hash table h.
integer function, public iihash_lookup(h, key, found)
Look up a value in the hash table h. If found is present, it indicates if key could be found in the t...
subroutine, public iihash_init(h)
Initialize a hash table h.
subroutine, public dio_function_output(how, dir, fname, namespace, space, mesh, ff, unit, ierr, pos, atoms, grp, root)
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 ion_interaction_test(space, latt, atom, natoms, pos, lsize, namespace, mc)
This module defines functions over batches of mesh functions.
subroutine, public dmesh_batch_dotp_matrix(mesh, aa, bb, dot, reduce)
Calculate the overlap matrix of two batches.
subroutine, public dmesh_batch_dotp_self(mesh, aa, dot, reduce)
calculate the overlap matrix of a batch with itself
subroutine, public mesh_batch_nrm2(mesh, aa, nrm2, reduce)
Calculate the norms (norm2, not the square!) of a batch of mesh functions.
subroutine, public zmesh_batch_dotp_vector(mesh, aa, bb, dot, reduce, cproduct)
calculate the vector of dot-products of mesh functions between two batches
subroutine, public zmesh_batch_dotp_matrix(mesh, aa, bb, dot, reduce)
Calculate the overlap matrix of two batches.
subroutine, public zmesh_batch_normalize(mesh, psib, norm)
Normalize a batch.
subroutine, public zmesh_batch_dotp_self(mesh, aa, dot, reduce)
calculate the overlap matrix of a batch with itself
subroutine, public dmesh_batch_normalize(mesh, psib, norm)
Normalize a batch.
subroutine, public dmesh_batch_dotp_vector(mesh, aa, bb, dot, reduce, cproduct)
calculate the vector of dot-products of mesh functions between two batches
This module defines various routines, operating on mesh functions.
class(mesh_t), pointer, public mesh_aux
Globally-scoped pointer to the mesh instance.
real(real64) function, public dmf_dotp_aux(f1, f2)
dot product between two vectors (mesh functions)
subroutine, public mesh_init_mesh_aux(mesh)
Initialise a pointer to the grid/mesh, that is globally exposed, such that low level mesh operations ...
subroutine, public zmesh_interpolation_test(mesh)
subroutine, public dmesh_interpolation_test(mesh)
This module defines the meshes, which are used in Octopus.
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)
character(len=512), private msg
subroutine, public messages_obsolete_variable(namespace, name, rep)
subroutine, public messages_info(no_lines, iunit, verbose_limit, stress, all_nodes, namespace)
subroutine, public messages_new_line()
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
This module implements unit tests for the mixing methods.
subroutine, public mix_tests_run()
type(mpi_grp_t), public mpi_world
subroutine, public test_mpiwrappers
This module handles the communicators for the various parallelization strategies.
subroutine, public multigrid_end(mgrid)
subroutine, public multigrid_init(mgrid, namespace, space, mesh, der, stencil, mc, nlevels)
type(namespace_t), public global_namespace
subroutine, public orbitalbasis_end(this)
subroutine, public zorbitalbasis_build(this, namespace, ions, mesh, kpt, ndim, skip_s_orb, use_all_orb, verbose)
This routine is an interface for constructing the orbital basis.
subroutine, public dorbitalbasis_build(this, namespace, ions, mesh, kpt, ndim, skip_s_orb, use_all_orb, verbose)
This routine is an interface for constructing the orbital basis.
subroutine, public orbitalbasis_init(this, namespace, periodic_dim)
subroutine, public dorbitalset_get_coeff_batch(os, ndim, psib, dot)
subroutine, public dorbitalset_add_to_batch(os, ndim, psib, weight)
subroutine, public zorbitalset_add_to_batch(os, ndim, psib, weight)
subroutine, public orbitalset_update_phase(os, dim, kpt, kpoints, spin_polarized, vec_pot, vec_pot_var, kpt_max)
Build the phase correction to the global phase in case the orbital crosses the border of the simulato...
subroutine, public zorbitalset_get_coeff_batch(os, ndim, psib, dot)
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...
subroutine, public preconditioner_end(this)
subroutine, public preconditioner_init(this, namespace, gr, mc, space)
subroutine, public zproject_psi_batch(mesh, bnd, pj, npj, dim, psib, ppsib)
To optimize the application of the non-local operator in parallel, the projectors are applied in step...
Implementation details for regridding.
This module implements a simple hash table for string valued keys and integer values using the C++ ST...
subroutine, public sihash_insert(h, key, val)
Insert a (key, val) pair into the hash table h.
subroutine, public sihash_init(h)
Initialize a hash table h with size entries. Since we use separate chaining, the number of entries in...
integer function, public sihash_lookup(h, key, found)
Look up a value in the hash table h. If found is present, it indicates if key could be found in the t...
subroutine, public sihash_end(h)
Free a hash table.
This module is intended to contain "only mathematical" functions and procedures.
This module implements a simple hash table for string valued keys and integer values using the C++ ST...
subroutine, public sphash_init(h)
Initialize a hash table h with size entries. Since we use separate chaining, the number of entries in...
subroutine, public sphash_insert(h, key, val, clone)
Insert a (key, val) pair into the hash table h. If clone=.true., the object will be copied.
subroutine, public sphash_end(h)
Free a hash table.
class(*) function, pointer, public sphash_lookup(h, key, found)
Look up a value in the hash table h. If found is present, it indicates if key could be found in the t...
pure logical function, public states_are_real(st)
subroutine, public zstates_elec_calc_orth_test(st, namespace, mesh, kpoints)
subroutine, public dstates_elec_calc_orth_test(st, namespace, mesh, kpoints)
This module handles spin dimensions of the states and the k-point distribution.
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 dsubspace_diag(this, namespace, mesh, st, hm, ik, eigenval, diff, nonortho)
Diagonalises the Hamiltonian in the subspace defined by the states.
subroutine, public zsubspace_diag(this, namespace, mesh, st, hm, ik, eigenval, diff, nonortho)
Diagonalises the Hamiltonian in the subspace defined by the states.
This module implements a unit-test like runmode for Octopus.
real(real64) function psi_2s(rr, a0)
subroutine test_helmholtz_decomposition(namespace)
subroutine test_hartree(param, namespace)
subroutine test_derivatives(param, namespace)
subroutine test_subspace_diagonalization(param, namespace)
subroutine, public test_run(namespace)
subroutine test_density_calc(param, namespace)
real(real64) function psi_1s(rr, a0)
subroutine test_current_density(namespace)
Here we test the different contributions to the total electronic current density.
subroutine test_batch_set_gaussian(psib, mesh)
subroutine test_regridding(namespace)
subroutine test_sphash(namespace)
subroutine test_hamiltonian(param, namespace)
subroutine test_dense_eigensolver()
subroutine test_interpolation(param, namespace)
subroutine multigrid_test_interpolation(mgrid, space)
subroutine test_ion_interaction(namespace)
subroutine test_boundaries(param, namespace)
subroutine test_orthogonalization(param, namespace)
real(real64) function dr_psi_2s(rr, a0)
subroutine test_batch_ops(param, namespace)
complex(real64) function lc_hydrogen_state(rr, alpha, a0)
subroutine test_projector(param, namespace)
subroutine test_dft_u(param, namespace)
subroutine test_prints_info_batch(st, gr, psib, string)
real(real64) function dr_psi_1s(rr, a0)
subroutine test_linear_solver(namespace)
subroutine test_grid_interpolation()
subroutine set_hydrogen_states(psib, mesh, namespace, alpha, a0)
subroutine test_exponential(param, namespace)
subroutine test_vecpot_analytical(namespace)
Here, analytical formulation for vector potential and B field are used. Ref: Sangita Sen and Erik I....
type(type_t), public type_cmplx
logical pure function, public type_is_complex(this)
This module defines the unit system, used for input and output.
type(unit_t), public unit_one
some special units required for particular quantities
subroutine, public v_ks_calc(ks, namespace, space, hm, st, ions, ext_partners, calc_eigenval, time, calc_energy, calc_current, force_semilocal)
Class defining batches of mesh functions.
class representing derivatives
Class describing the electron system.
Description of the grid, containing information on derivatives, stencil, and symmetries.
This class implements the iteration counter used by the multisystem algorithms. As any iteration coun...
Describes mesh distribution to nodes.
contains the information of the meshes and provides the transfer functions
The states_elec_t class contains all electronic wave functions.
batches of electronic states
subroutine write_clock(operation)
subroutine set_der_aux(der)
subroutine write_condition_result(condition, result)
real(real64) function values(xx)
subroutine laplacian_op(x, hx)
Computes Hx = (\Laplacian) x.