34 use,
intrinsic :: iso_fortran_env
65 integer,
public,
parameter :: &
72 integer,
public :: exp_method
73 real(real64) :: lanczos_tol
74 real(real64) :: chebyshev_tol
75 integer,
public :: exp_order
77 logical,
public :: full_batch = .false.
86 type(namespace_t),
pointer :: namespace
87 class(mesh_t),
pointer :: mesh
89 procedure(operator_apply),
deferred :: apply
99 class(operator_t),
intent(in) :: this
100 class(batch_t),
intent(inout) :: psib
101 class(batch_t),
intent(inout) :: hpsib
107 class(hamiltonian_abst_t),
pointer :: hm
115 procedure hamiltonian_operator_constructor
125 class(hamiltonian_abst_t),
pointer :: hm
133 procedure SinvH_operator_constructor
142 logical,
optional,
intent(in) :: full_batch
201 select case (te%exp_method)
214 call parse_variable(namespace,
'TDChebyshevTol', 1e-10_real64, te%chebyshev_tol)
228 call parse_variable(namespace,
'TDLanczosTol', 1e-6_real64, te%lanczos_tol)
245 call parse_variable(namespace,
'TDExpOrder', default__tdexporder, te%exp_order)
249 message(1) =
"TDExpOrder is only relevant for TDExponentialMethod = taylor"
254 te%arnoldi_gs = option__arnoldiorthogonalization__cgs
255 if (te%exp_method == exp_lanczos)
then
270 call parse_variable(namespace,
'ArnoldiOrthogonalization', option__arnoldiorthogonalization__cgs, &
287 teo%exp_method = tei%exp_method
288 teo%lanczos_tol = tei%lanczos_tol
289 teo%exp_order = tei%exp_order
290 teo%arnoldi_gs = tei%arnoldi_gs
300 class(
mesh_t),
intent(in) :: mesh
302 integer,
intent(in) :: ist
303 integer,
intent(in) :: ik
304 complex(real64),
contiguous,
intent(inout) :: zpsi(:, :)
305 real(real64),
intent(in) :: deltat
306 logical,
optional,
intent(in) :: imag_time
309 complex(real64),
allocatable :: zpsi_inh(:, :)
315 if (hm%phase%is_allocated())
then
316 call hm%phase%apply_to_single(zpsi, mesh%np, hm%d%dim, ik, .false.)
322 safe_allocate(zpsi_inh(1:mesh%np_part, 1:hm%d%dim))
324 call wfs_elec_init(inh_psib, hm%d%dim, ist, ist, zpsi_inh, ik)
325 call te%apply_batch(namespace, mesh, hm, psib, deltat, &
326 imag_time=imag_time, inh_psib=inh_psib)
328 safe_deallocate_a(zpsi_inh)
330 call te%apply_batch(namespace, mesh, hm, psib, deltat, &
336 if (hm%phase%is_allocated())
then
337 call hm%phase%apply_to_single(zpsi, mesh%np, hm%d%dim, ik, .
true.)
361 subroutine exponential_apply_batch(te, namespace, mesh, hm, psib, deltat, psib2, deltat2, imag_time, inh_psib, op)
364 class(
mesh_t),
intent(in) :: mesh
366 class(
batch_t),
intent(inout) :: psib
367 real(real64),
intent(in) :: deltat
368 class(
batch_t),
optional,
intent(inout) :: psib2
369 real(real64),
optional,
intent(in) :: deltat2
370 logical,
optional,
intent(in) :: imag_time
371 class(
batch_t),
optional,
intent(inout) :: inh_psib
372 class(
operator_t),
target,
optional,
intent(in) :: op
374 complex(real64) :: deltat_, deltat2_
376 logical :: imag_time_
384 assert(
present(psib2) .eqv.
present(deltat2))
385 if (
present(inh_psib))
then
386 assert(inh_psib%nst == psib%nst)
389 if (
present(op))
then
399 deltat_ = -
m_zi*deltat
400 if (
present(deltat2)) deltat2_ =
m_zi*deltat2
402 deltat_ = cmplx(deltat,
m_zero, real64)
403 if (
present(deltat2)) deltat2_ = cmplx(deltat2,
m_zero, real64)
406 if (.not. op_%is_hermitian() .and. te%exp_method ==
exp_chebyshev)
then
407 write(
message(1),
'(a)')
'The Chebyshev expansion cannot be used for non-Hermitian operators.'
408 write(
message(2),
'(a)')
'Please use the Lanczos exponentiation scheme ("TDExponentialMethod = lanczos")'
409 write(
message(3),
'(a)')
'or the Taylor expansion ("TDExponentialMethod = taylor") method.'
413 select case (te%exp_method)
416 if (
present(deltat2))
then
422 if (
present(inh_psib))
then
423 if (
present(deltat2))
then
425 psib2, deltat2_, inh_psib)
433 if (
present(psib2))
then
436 call psib%copy_data_to(mesh%np, psib2)
438 psib2=psib2, deltat2=deltat2_)
439 if (
present(inh_psib))
then
441 psib2=psib2, deltat2=deltat2_)
445 if (
present(inh_psib))
then
451 if (
present(inh_psib))
then
452 write(
message(1),
'(a)')
'Chebyshev exponential ("TDExponentialMethod = chebyshev")'
453 write(
message(2),
'(a)')
'with inhomogeneous term is not implemented'
459 if (
present(psib2))
then
463 chebyshev_function =>
chebyshev_exp_t(hm%spectral_half_span, hm%spectral_middle_point, deltat)
464 if (
present(psib2))
then
465 chebyshev_function_dt2 =>
chebyshev_exp_t(hm%spectral_half_span, hm%spectral_middle_point, deltat2)
468 if (
present(psib2))
call psib%copy_data_to(mesh%np, psib2)
470 deallocate(chebyshev_function)
471 if (
present(psib2))
then
473 deallocate(chebyshev_function_dt2)
478 if (.not.
present(op))
then
479 safe_deallocate_p(op_)
487 subroutine exponential_taylor_series_batch(te, namespace, mesh, hm, psib, deltat, op, psib2, deltat2, inh_psib, phik_shift)
490 class(
mesh_t),
intent(in) :: mesh
492 class(
batch_t),
intent(inout) :: psib
493 complex(real64),
intent(in) :: deltat
495 class(
batch_t),
optional,
intent(inout) :: psib2
496 complex(real64),
optional,
intent(in) :: deltat2
497 class(
batch_t),
optional,
intent(inout) :: inh_psib
498 integer,
optional,
intent(in) :: phik_shift
500 complex(real64) :: zfact, zfact2
501 integer :: iter, denom, phik_shift_
502 logical :: zfact_is_real
503 class(
batch_t),
allocatable :: psi1b, hpsi1b
508 call psib%clone_to(psi1b)
509 call psib%clone_to(hpsi1b)
513 zfact_is_real = abs(deltat-real(deltat, real64)) <
m_epsilon
515 if (
present(psib2))
call psib%copy_data_to(mesh%np, psib2)
517 if (
present(inh_psib))
then
519 call batch_axpy(mesh%np, real(zfact, real64), inh_psib, psib)
521 if (
present(psib2))
then
522 zfact2 = zfact2*deltat2
523 call batch_axpy(mesh%np, real(zfact2, real64), inh_psib, psib2)
530 do iter = 1, te%exp_order
531 denom = iter+phik_shift_
532 if (
present(inh_psib)) denom = denom + 1
533 zfact = zfact*(-
m_zi*deltat)/denom
534 if (
present(deltat2)) zfact2 = zfact2*(-
m_zi*deltat2)/denom
535 zfact_is_real = .not. zfact_is_real
542 call op%apply(psi1b, hpsi1b)
544 if (
present(inh_psib))
then
545 call op%apply(inh_psib, hpsi1b)
547 call op%apply(psib, hpsi1b)
551 if (zfact_is_real)
then
552 call batch_axpy(mesh%np, real(zfact, real64), hpsi1b, psib)
553 if (
present(psib2))
call batch_axpy(mesh%np, real(zfact2, real64), hpsi1b, psib2)
556 if (
present(psib2))
call batch_axpy(mesh%np, zfact2, hpsi1b, psib2)
559 if (iter /= te%exp_order)
call hpsi1b%copy_data_to(mesh%np, psi1b)
565 safe_deallocate_a(psi1b)
566 safe_deallocate_a(hpsi1b)
578 class(
mesh_t),
intent(in) :: mesh
579 class(
batch_t),
intent(inout) :: psib
580 complex(real64),
intent(in) :: deltat
582 class(
batch_t),
optional,
intent(in) :: inh_psib
583 class(
batch_t),
optional,
intent(inout) :: psib2
584 complex(real64),
optional,
intent(in) :: deltat2
586 class(
batch_t),
allocatable :: tmpb, tmpb2
590 assert(
present(psib2) .eqv.
present(deltat2))
592 if (
present(inh_psib))
then
593 call inh_psib%clone_to(tmpb, copy_data=.
true.)
594 if (
present(psib2))
then
597 call inh_psib%clone_to(tmpb2, copy_data=.
true.)
599 psib2=tmpb2, deltat2=deltat2)
600 call batch_axpy(mesh%np, real(deltat, real64), tmpb, psib)
601 call batch_axpy(mesh%np, real(deltat2, real64), tmpb2, psib2)
603 safe_deallocate_a(tmpb2)
607 call batch_axpy(mesh%np, real(deltat, real64), tmpb, psib)
610 safe_deallocate_a(tmpb)
612 if (
present(psib2))
then
614 psib2=psib2, deltat2=deltat2)
640 class(
mesh_t),
intent(in) :: mesh
641 class(
batch_t),
intent(inout) :: psib
642 complex(real64),
intent(in) :: deltat
644 complex(real64) function fun(z)
646 complex(real64),
intent(in) :: z
650 class(
batch_t),
optional,
intent(inout) :: psib2
651 complex(real64),
optional,
intent(in) :: deltat2
653 integer :: iter, l, ii, ist, max_initialized
654 complex(real64),
allocatable :: hamilt(:,:,:), expo(:,:,:), expo2(:,:,:)
655 complex(real64),
allocatable :: hamilt_tmp(:,:,:), coef(:,:), coef2(:,:)
656 real(real64),
allocatable :: beta(:), res(:), res2(:), norm(:)
657 integer,
parameter :: max_order = 200
659 integer,
parameter :: order_initial = 16
660 integer :: order_alloc
662 logical :: have_dt2, converged, breakdown
667 if (te%exp_method /= exp_lanczos)
then
668 message(1) =
"The exponential method needs to be set to Lanzcos (TDExponentialMethod=lanczos)."
676 have_dt2 =
present(psib2)
677 assert(
present(psib2) .eqv.
present(deltat2))
679 assert(psib2%nst == psib%nst)
682 safe_allocate(beta(1:psib%nst))
683 safe_allocate(res(1:psib%nst))
684 safe_allocate(norm(1:psib%nst))
689 safe_allocate(vb(1:max_order))
690 call psib%clone_to(vb(1)%p)
694 call psib%copy_data_to(mesh%np, vb(1)%p, async=.
true.)
699 if (te%full_batch) beta = norm2(beta)
702 if (all(abs(beta) <= 1.0e-12_real64))
then
703 safe_deallocate_a(beta)
704 safe_deallocate_a(res)
705 safe_deallocate_a(norm)
707 safe_deallocate_a(vb)
715 order_alloc = order_initial
716 safe_allocate(hamilt(1:order_alloc+1, 1:order_alloc+1, 1:psib%nst))
717 safe_allocate( expo(1:order_alloc+1, 1:order_alloc+1, 1:psib%nst))
719 safe_allocate(expo2(1:order_alloc+1, 1:order_alloc+1, 1:psib%nst))
720 safe_allocate(res2(1:psib%nst))
725 do iter = 1, max_order-1
727 if (iter + 1 > order_alloc)
then
728 safe_allocate(hamilt_tmp(1:2*order_alloc+1, 1:2*order_alloc+1, 1:psib%nst))
730 hamilt_tmp(1:order_alloc+1, 1:order_alloc+1, :) = hamilt(:, :, :)
731 safe_deallocate_a(hamilt)
732 call move_alloc(hamilt_tmp, hamilt)
734 order_alloc = min(2*order_alloc, max_order)
735 safe_deallocate_a(expo)
736 safe_allocate(expo(1:order_alloc+1, 1:order_alloc+1, 1:psib%nst))
738 safe_deallocate_a(expo2)
739 safe_allocate(expo2(1:order_alloc+1, 1:order_alloc+1, 1:psib%nst))
743 call psib%clone_to(vb(iter + 1)%p)
744 max_initialized = iter + 1
747 call op%apply(vb(iter)%p, vb(iter+1)%p)
750 if (op%is_hermitian())
then
752 hamilt(1:max(iter-2, 1), iter, 1:psib%nst) =
m_zero
755 hamilt(iter-1, iter, 1:psib%nst) = hamilt(iter, iter-1, 1:psib%nst)
757 call batch_axpy(mesh%np, -hamilt(iter-1, iter, 1:psib%nst), vb(iter-1)%p, vb(iter+1)%p, a_full = .false.)
766 hamilt(iter, 1:iter-2, 1:psib%nst) =
m_zero
780 normalize = .false., overlap = hamilt(l:iter, iter, 1:psib%nst), norm = hamilt(iter + 1, iter, 1:psib%nst), &
781 gs_scheme = te%arnoldi_gs, full_batch = te%full_batch)
785 breakdown = all(abs(hamilt(iter + 1, iter, :)) < 1.0e4_real64*
m_epsilon)
797 if (iter > 3 .or. breakdown)
then
798 if (op%is_hermitian())
then
803 -
m_zi*deltat2, expo2(:,1,ii))
804 res2(ii) = abs(hamilt(iter + 1, iter, ii) * abs(expo2(iter, 1, ii)))
808 res(ii) = abs(hamilt(iter + 1, iter, ii) * abs(expo(iter, 1, ii)))
815 -
m_zi*deltat2, expo2(:,1,ii))
816 res2(ii) = abs(hamilt(iter + 1, iter, ii) * abs(expo2(iter, 1, ii)))
820 res(ii) = abs(hamilt(iter + 1, iter, ii) * abs(expo(iter, 1, ii)))
832 if (abs(hamilt(iter + 1, iter, ist)) >= 1.0e4_real64 *
m_epsilon)
then
833 norm(ist) =
m_one / abs(hamilt(iter + 1, iter, ist))
838 call batch_scal(mesh%np, norm, vb(iter+1)%p, a_full = .false.)
844 converged = all(res < te%lanczos_tol)
845 if (converged .and. have_dt2) converged = all(res2 < te%lanczos_tol)
851 if (iter == max_order)
then
852 write(
message(1),
'(a,i5,a,es9.2)')
'Lanczos exponential expansion did not converge after ', iter, &
853 ' iterations. Residual: ', maxval(res)
858 write(
message(1),
'(a,i5)')
'Debug: Lanczos exponential iterations: ', iter
866 safe_allocate(coef(1:iter-1, 1:psib%nst))
868 coef(1:iter-1, ii) = beta(ii)*expo(2:iter, 1, ii)
871 safe_allocate(coef2(1:iter-1, 1:psib%nst))
873 coef2(1:iter-1, ii) = beta(ii)*expo2(2:iter, 1, ii)
875 call batch_gemv(mesh%np, vb(2:iter), coef, expo(1,1,1:psib%nst), psib, &
876 coef2, expo2(1,1,1:psib%nst), psib2)
877 safe_deallocate_a(coef2)
879 call batch_gemv(mesh%np, vb(2:iter), coef, expo(1,1,1:psib%nst), psib)
881 safe_deallocate_a(coef)
883 do ii = 1, max_initialized
887 safe_deallocate_a(vb)
888 safe_deallocate_a(hamilt)
889 safe_deallocate_a(hamilt_tmp)
890 safe_deallocate_a(expo)
891 safe_deallocate_a(expo2)
892 safe_deallocate_a(beta)
893 safe_deallocate_a(res)
894 safe_deallocate_a(res2)
895 safe_deallocate_a(norm)
920 class(
mesh_t),
intent(in) :: mesh
922 class(
batch_t),
intent(inout) :: psib
926 integer :: j, order_needed
927 complex(real64) :: coefficient
928 complex(real64),
allocatable :: coefficients(:)
929 real(real64) :: error
930 class(
batch_t),
allocatable,
target :: psi0, psi1, psi2
931 class(
batch_t),
pointer :: psi_n, psi_n1, psi_n2
932 integer,
parameter :: max_order = 200
937 call psib%clone_to(psi0)
938 call psib%clone_to(psi1)
939 call psib%clone_to(psi2)
940 call psib%copy_data_to(mesh%np, psi0)
942 order_needed = max_order
944 error = chebyshev_function%get_error(j)
945 if (error >
m_zero .and. error < te%chebyshev_tol)
then
951 call chebyshev_function%get_coefficients(j, coefficients)
954 call batch_scal(mesh%np, coefficients(0), psib)
957 call op%apply(psi0, psi1)
958 call batch_axpy(mesh%np, -hm%spectral_middle_point, psi0, psi1)
961 call batch_axpy(mesh%np, coefficients(1), psi1, psib)
968 do j = 2, order_needed
970 call op%apply(psi_n1, psi_n)
971 call batch_axpy(mesh%np, -hm%spectral_middle_point, psi_n1, psi_n)
976 call batch_axpy(mesh%np, coefficients(j), psi_n, psib)
979 if (mod(j, 3) == 2)
then
983 else if (mod(j, 3) == 1)
then
994 if (order_needed == max_order)
then
995 write(
message(1),
'(a,i5,a,es9.2)')
'Chebyshev exponential expansion did not converge after ', j, &
996 ' iterations. Coefficient: ', coefficient
999 write(
message(1),
'(a,i5)')
'Debug: Chebyshev exponential iterations: ', j
1006 safe_deallocate_a(psi0)
1007 safe_deallocate_a(psi1)
1008 safe_deallocate_a(psi2)
1010 safe_deallocate_a(coefficients)
1024 type(
grid_t),
intent(inout) :: gr
1027 real(real64),
intent(in) :: deltat
1028 integer,
optional,
intent(inout) :: order
1030 integer :: ik, ib, i
1031 real(real64) :: zfact
1043 do i = 1, te%exp_order
1044 zfact = zfact * deltat / i
1052 do ik = st%d%kpt%start, st%d%kpt%end
1053 do ib = st%group%block_start, st%group%block_end
1054 call batch_scal2v(gr%np, -
m_zi, hst1%group%psib(ib, ik), st1%group%psib(ib, ik), conjugate_xx = .false.)
1055 call batch_axpy(gr%np, zfact, st1%group%psib(ib, ik), st%group%psib(ib, ik))
1073 do ik = st%d%kpt%start, st%d%kpt%end
1074 do ib = st%group%block_start, st%group%block_end
1075 call batch_axpy(gr%np, deltat, st1%group%psib(ib, ik), st%group%psib(ib, ik))
1080 do i = 1, te%exp_order
1081 zfact = zfact * deltat / (i+1)
1089 do ik = st%d%kpt%start, st%d%kpt%end
1090 do ib = st%group%block_start, st%group%block_end
1091 call batch_scal2v(gr%np, -
m_zi, hst1%group%psib(ib, ik), st1%group%psib(ib, ik), conjugate_xx = .false.)
1092 call batch_axpy(gr%np, deltat * zfact, st1%group%psib(ib, ik), st%group%psib(ib, ik))
1103 if (
present(order)) order = te%exp_order*st%nik*st%nst
1111 class(
mesh_t),
intent(in) :: mesh
1113 class(
batch_t),
intent(inout) :: psib
1114 real(real64),
intent(in) :: deltat
1115 integer,
intent(in) :: k
1116 class(
operator_t),
target,
optional,
intent(in) :: op
1119 complex(real64) :: deltat_
1126 if (
present(op))
then
1132 if (.not. op_%is_hermitian() .and. te%exp_method ==
exp_chebyshev)
then
1133 write(
message(1),
'(a)')
'The Chebyshev expansion for the exponential will only converge if the imaginary'
1134 write(
message(2),
'(a)')
'eigenvalues are small enough compared to the span of the real eigenvalues,'
1135 write(
message(3),
'(a)')
'i.e., for ratios smaller than about 1e-3.'
1136 write(
message(4),
'(a)')
'The Lanczos method ("TDExponentialMethod = lanczos") is guaranteed to'
1137 write(
message(5),
'(a)')
'always converge in this case.'
1141 deltat_ = cmplx(deltat,
m_zero, real64)
1143 select case (te%exp_method)
1150 else if (k == 2)
then
1153 write(
message(1),
'(a)')
'Lanczos expansion not implemented for phi_k, k > 2'
1160 else if (k == 2)
then
1163 write(
message(1),
'(a)')
'Chebyshev expansion not implemented for phi_k, k > 2'
1167 deallocate(chebyshev_function)
1170 if (.not.
present(op))
then
1171 safe_deallocate_p(op_)
1178 type(
namespace_t),
target,
intent(in) :: namespace
1179 class(
mesh_t),
target,
intent(in) :: mesh
1186 call this%init(namespace, mesh, hm)
1193 type(
namespace_t),
target,
intent(in) :: namespace
1194 class(
mesh_t),
target,
intent(in) :: mesh
1200 this%namespace => namespace
1208 class(
batch_t),
intent(inout) :: psib
1209 class(
batch_t),
intent(inout) :: hpsib
1213 call this%hm%zapply(this%namespace, this%mesh, psib, hpsib)
1234 type(
namespace_t),
target,
intent(in) :: namespace
1235 class(
mesh_t),
target,
intent(in) :: mesh
1242 call this%init(namespace, mesh, hm)
1250 type(
namespace_t),
target,
intent(in) :: namespace
1251 class(
mesh_t),
target,
intent(in) :: mesh
1257 this%namespace => namespace
1267 class(
batch_t),
intent(inout) :: psib
1268 class(
batch_t),
intent(inout) :: hpsib
1276 select type (hm => this%hm)
1281 call this%hm%zapply(this%namespace, this%mesh, psib, hpsib)
1284 message(1) =
"SinvH_operator_apply requires wfs_elec_t batches."
1288 message(1) =
"SinvH_operator_apply requires wfs_elec_t batches."
batchified version of the BLAS axpy routine:
batchified linear combination:
batchified scale with optional conjugation:
scale a batch by a constant or vector
subroutine, public accel_finish()
This module implements batches of mesh functions.
This module implements common operations on batches of mesh functions.
This module contains interfaces for BLAS routines You should not use these routines directly....
logical function hamiltonian_operator_is_hermitian(this)
logical function operator_is_hermitian(this)
subroutine, public exponential_copy(teo, tei)
subroutine, public exponential_apply_all(te, namespace, gr, hm, st, deltat, order)
Note that this routine not only computes the exponential, but also an extra term if there is a inhomo...
subroutine exponential_lanczos_batch(te, namespace, mesh, psib, deltat, op, inh_psib, psib2, deltat2)
Lanczos/Arnoldi procedure for the exponential of an operator.
subroutine sinvh_operator_init(this, namespace, mesh, hm)
type(hamiltonian_operator_t) function, pointer hamiltonian_operator_constructor(namespace, mesh, hm)
subroutine exponential_cheby_batch(te, namespace, mesh, hm, psib, chebyshev_function, op)
Calculates the exponential of the Hamiltonian through an expansion in Chebyshev polynomials.
type(sinvh_operator_t) function, pointer sinvh_operator_constructor(namespace, mesh, hm)
subroutine exponential_apply_phi_batch(te, namespace, mesh, hm, psib, deltat, k, op)
subroutine exponential_apply_batch(te, namespace, mesh, hm, psib, deltat, psib2, deltat2, imag_time, inh_psib, op)
This routine performs the operation:
subroutine hamiltonian_operator_init(this, namespace, mesh, hm)
subroutine, public exponential_lanczos_function_batch(te, namespace, mesh, psib, deltat, fun, op, psib2, deltat2)
Compute fun(H) psib, i.e. the application of a function of the Hamiltonian to a batch.
logical function sinvh_operator_is_hermitian(this)
subroutine exponential_taylor_series_batch(te, namespace, mesh, hm, psib, deltat, op, psib2, deltat2, inh_psib, phik_shift)
subroutine, public exponential_init(te, namespace, full_batch)
integer, parameter, public exp_taylor
integer, parameter, public exp_chebyshev
subroutine exponential_apply_single(te, namespace, mesh, hm, zpsi, ist, ik, deltat, imag_time)
Wrapper to batchified routine for applying exponential to an array.
subroutine sinvh_operator_apply(this, psib, hpsib)
Apply A = S^{-1} H, the operator propagated for ultrasoft/PAW.
subroutine hamiltonian_operator_apply(this, psib, hpsib)
real(real64), parameter, public m_two
real(real64), parameter, public m_huge
real(real64), parameter, public m_zero
complex(real64), parameter, public m_z0
complex(real64), parameter, public m_zi
real(real64), parameter, public m_epsilon
complex(real64), parameter, public m_z1
real(real64), parameter, public m_one
This module implements the underlying real-space grid.
This module defines an abstract class for Hamiltonians.
subroutine, public zhamiltonian_elec_apply_all(hm, namespace, gr, st, hst)
subroutine, public zhamiltonian_elec_apply_sinvh_batch(hm, namespace, mesh, psib, hspsib, terms, set_bc, set_phase)
Apply the operator A = S^{-1} H to a batch (for ultrasoft/PAW).
pure logical function, public hamiltonian_elec_inh_term(hm)
subroutine, public lalg_hessenberg_function_first_column(n, h, fun, factor, col, factor2, col2)
First column of fun(factor*H) for a diagonalizable complex upper Hessenberg matrix H.
subroutine, public lalg_tridiagonal_function_first_column(n, t, fun, factor, col, factor2, col2)
First column of fun(factor*T) for a real symmetric tridiagonal matrix T.
This module is intended to contain "only mathematical" functions and procedures.
complex(real64) pure function, public phi2(z)
Compute phi2(z) = (phi1(z)-1)/z = (exp(z) - z - 1)/z^2.
complex(real64) pure function, public exponential(z)
Wrapper for exponential.
complex(real64) pure function, public phi1(z)
Compute phi1(z) = (exp(z)-1)/z.
This module defines functions over batches of mesh functions.
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_orthogonalization(mesh, nst, psib, phib, normalize, overlap, norm, gs_scheme, full_batch)
Orthonormalizes states of phib to the orbitals of nst batches of psi.
This module defines various routines, operating on mesh functions.
This module defines the meshes, which are used in Octopus.
subroutine, public messages_warning(no_lines, 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_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
logical function, public parse_is_defined(namespace, name)
/* To use the profiling module, call profiling_in and profiling_out with the label of the region as a...
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.
subroutine, public states_elec_end(st)
finalize the states_elec_t object
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
type(type_t), parameter, public type_cmplx
Class defining batches of mesh functions.
Class to encapsulate the operator A = S^{-1} H inside the exponential.
Description of the grid, containing information on derivatives, stencil, and symmetries.
The abstract Hamiltonian class defines a skeleton for specific implementations.
Describes mesh distribution to nodes.
The states_elec_t class contains all electronic wave functions.
batches of electronic states