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 real(real64) :: inv_factorial
503 logical :: zfact_is_real
504 class(
batch_t),
allocatable :: psi1b, hpsi1b
509 call psib%clone_to(psi1b)
510 call psib%clone_to(hpsi1b)
514 zfact_is_real = abs(deltat-real(deltat, real64)) <
m_epsilon
516 if (
present(psib2))
call psib%copy_data_to(mesh%np, psib2)
518 if (
present(inh_psib))
then
520 call batch_axpy(mesh%np, real(zfact, real64), inh_psib, psib)
522 if (
present(psib2))
then
523 zfact2 = zfact2*deltat2
524 call batch_axpy(mesh%np, real(zfact2, real64), inh_psib, psib2)
531 if (phik_shift_ > 0)
then
533 zfact = zfact*inv_factorial
534 zfact2 = zfact2*inv_factorial
536 call psib%copy_data_to(mesh%np, psi1b)
538 if (
present(psib2))
call batch_scal(mesh%np, inv_factorial, psib2)
541 do iter = 1, te%exp_order
542 denom = iter+phik_shift_
543 if (
present(inh_psib)) denom = denom + 1
544 zfact = zfact*(-
m_zi*deltat)/denom
545 if (
present(deltat2)) zfact2 = zfact2*(-
m_zi*deltat2)/denom
546 zfact_is_real = .not. zfact_is_real
552 if (iter /= 1 .or. phik_shift_ > 0)
then
553 call op%apply(psi1b, hpsi1b)
555 if (
present(inh_psib))
then
556 call op%apply(inh_psib, hpsi1b)
558 call op%apply(psib, hpsi1b)
562 if (zfact_is_real)
then
563 call batch_axpy(mesh%np, real(zfact, real64), hpsi1b, psib)
564 if (
present(psib2))
call batch_axpy(mesh%np, real(zfact2, real64), hpsi1b, psib2)
567 if (
present(psib2))
call batch_axpy(mesh%np, zfact2, hpsi1b, psib2)
570 if (iter /= te%exp_order)
call hpsi1b%copy_data_to(mesh%np, psi1b)
576 safe_deallocate_a(psi1b)
577 safe_deallocate_a(hpsi1b)
589 class(
mesh_t),
intent(in) :: mesh
590 class(
batch_t),
intent(inout) :: psib
591 complex(real64),
intent(in) :: deltat
593 class(
batch_t),
optional,
intent(in) :: inh_psib
594 class(
batch_t),
optional,
intent(inout) :: psib2
595 complex(real64),
optional,
intent(in) :: deltat2
597 class(
batch_t),
allocatable :: tmpb, tmpb2
601 assert(
present(psib2) .eqv.
present(deltat2))
603 if (
present(inh_psib))
then
604 call inh_psib%clone_to(tmpb, copy_data=.
true.)
605 if (
present(psib2))
then
608 call inh_psib%clone_to(tmpb2, copy_data=.
true.)
610 psib2=tmpb2, deltat2=deltat2)
611 call batch_axpy(mesh%np, real(deltat, real64), tmpb, psib)
612 call batch_axpy(mesh%np, real(deltat2, real64), tmpb2, psib2)
614 safe_deallocate_a(tmpb2)
618 call batch_axpy(mesh%np, real(deltat, real64), tmpb, psib)
621 safe_deallocate_a(tmpb)
623 if (
present(psib2))
then
625 psib2=psib2, deltat2=deltat2)
651 class(
mesh_t),
intent(in) :: mesh
652 class(
batch_t),
intent(inout) :: psib
653 complex(real64),
intent(in) :: deltat
655 complex(real64) function fun(z)
657 complex(real64),
intent(in) :: z
661 class(
batch_t),
optional,
intent(inout) :: psib2
662 complex(real64),
optional,
intent(in) :: deltat2
664 integer :: iter, l, ii, ist, max_initialized
665 complex(real64),
allocatable :: hamilt(:,:,:), expo(:,:,:), expo2(:,:,:)
666 complex(real64),
allocatable :: hamilt_tmp(:,:,:), coef(:,:), coef2(:,:)
667 real(real64),
allocatable :: beta(:), res(:), res2(:), norm(:)
668 integer,
parameter :: max_order = 200
670 integer,
parameter :: order_initial = 16
671 integer :: order_alloc
673 logical :: have_dt2, converged, breakdown
678 if (te%exp_method /= exp_lanczos)
then
679 message(1) =
"The exponential method needs to be set to Lanzcos (TDExponentialMethod=lanczos)."
687 have_dt2 =
present(psib2)
688 assert(
present(psib2) .eqv.
present(deltat2))
690 assert(psib2%nst == psib%nst)
693 safe_allocate(beta(1:psib%nst))
694 safe_allocate(res(1:psib%nst))
695 safe_allocate(norm(1:psib%nst))
700 safe_allocate(vb(1:max_order))
701 call psib%clone_to(vb(1)%p)
705 call psib%copy_data_to(mesh%np, vb(1)%p, async=.
true.)
710 if (te%full_batch) beta = norm2(beta)
713 if (all(abs(beta) <= 1.0e-12_real64))
then
714 safe_deallocate_a(beta)
715 safe_deallocate_a(res)
716 safe_deallocate_a(norm)
718 safe_deallocate_a(vb)
726 order_alloc = order_initial
727 safe_allocate(hamilt(1:order_alloc+1, 1:order_alloc+1, 1:psib%nst))
728 safe_allocate( expo(1:order_alloc+1, 1:order_alloc+1, 1:psib%nst))
730 safe_allocate(expo2(1:order_alloc+1, 1:order_alloc+1, 1:psib%nst))
731 safe_allocate(res2(1:psib%nst))
736 do iter = 1, max_order-1
738 if (iter + 1 > order_alloc)
then
739 safe_allocate(hamilt_tmp(1:2*order_alloc+1, 1:2*order_alloc+1, 1:psib%nst))
741 hamilt_tmp(1:order_alloc+1, 1:order_alloc+1, :) = hamilt(:, :, :)
742 safe_deallocate_a(hamilt)
743 call move_alloc(hamilt_tmp, hamilt)
745 order_alloc = min(2*order_alloc, max_order)
746 safe_deallocate_a(expo)
747 safe_allocate(expo(1:order_alloc+1, 1:order_alloc+1, 1:psib%nst))
749 safe_deallocate_a(expo2)
750 safe_allocate(expo2(1:order_alloc+1, 1:order_alloc+1, 1:psib%nst))
754 call psib%clone_to(vb(iter + 1)%p)
755 max_initialized = iter + 1
758 call op%apply(vb(iter)%p, vb(iter+1)%p)
761 if (op%is_hermitian())
then
763 hamilt(1:max(iter-2, 1), iter, 1:psib%nst) =
m_zero
766 hamilt(iter-1, iter, 1:psib%nst) = hamilt(iter, iter-1, 1:psib%nst)
768 call batch_axpy(mesh%np, -hamilt(iter-1, iter, 1:psib%nst), vb(iter-1)%p, vb(iter+1)%p, a_full = .false.)
777 hamilt(iter, 1:iter-2, 1:psib%nst) =
m_zero
791 normalize = .false., overlap = hamilt(l:iter, iter, 1:psib%nst), norm = hamilt(iter + 1, iter, 1:psib%nst), &
792 gs_scheme = te%arnoldi_gs, full_batch = te%full_batch)
796 breakdown = all(abs(hamilt(iter + 1, iter, :)) < 1.0e4_real64*
m_epsilon)
808 if (iter > 3 .or. breakdown)
then
809 if (op%is_hermitian())
then
814 -
m_zi*deltat2, expo2(:,1,ii))
815 res2(ii) = abs(hamilt(iter + 1, iter, ii) * abs(expo2(iter, 1, ii)))
819 res(ii) = abs(hamilt(iter + 1, iter, ii) * abs(expo(iter, 1, ii)))
826 -
m_zi*deltat2, expo2(:,1,ii))
827 res2(ii) = abs(hamilt(iter + 1, iter, ii) * abs(expo2(iter, 1, ii)))
831 res(ii) = abs(hamilt(iter + 1, iter, ii) * abs(expo(iter, 1, ii)))
843 if (abs(hamilt(iter + 1, iter, ist)) >= 1.0e4_real64 *
m_epsilon)
then
844 norm(ist) =
m_one / abs(hamilt(iter + 1, iter, ist))
849 call batch_scal(mesh%np, norm, vb(iter+1)%p, a_full = .false.)
855 converged = all(res < te%lanczos_tol)
856 if (converged .and. have_dt2) converged = all(res2 < te%lanczos_tol)
862 if (iter == max_order)
then
863 write(
message(1),
'(a,i5,a,es9.2)')
'Lanczos exponential expansion did not converge after ', iter, &
864 ' iterations. Residual: ', maxval(res)
869 write(
message(1),
'(a,i5)')
'Debug: Lanczos exponential iterations: ', iter
877 safe_allocate(coef(1:iter-1, 1:psib%nst))
879 coef(1:iter-1, ii) = beta(ii)*expo(2:iter, 1, ii)
882 safe_allocate(coef2(1:iter-1, 1:psib%nst))
884 coef2(1:iter-1, ii) = beta(ii)*expo2(2:iter, 1, ii)
886 call batch_gemv(mesh%np, vb(2:iter), coef, expo(1,1,1:psib%nst), psib, &
887 coef2, expo2(1,1,1:psib%nst), psib2)
888 safe_deallocate_a(coef2)
890 call batch_gemv(mesh%np, vb(2:iter), coef, expo(1,1,1:psib%nst), psib)
892 safe_deallocate_a(coef)
894 do ii = 1, max_initialized
898 safe_deallocate_a(vb)
899 safe_deallocate_a(hamilt)
900 safe_deallocate_a(hamilt_tmp)
901 safe_deallocate_a(expo)
902 safe_deallocate_a(expo2)
903 safe_deallocate_a(beta)
904 safe_deallocate_a(res)
905 safe_deallocate_a(res2)
906 safe_deallocate_a(norm)
931 class(
mesh_t),
intent(in) :: mesh
933 class(
batch_t),
intent(inout) :: psib
937 integer :: j, order_needed
938 complex(real64) :: coefficient
939 complex(real64),
allocatable :: coefficients(:)
940 real(real64) :: error
941 class(
batch_t),
allocatable,
target :: psi0, psi1, psi2
942 class(
batch_t),
pointer :: psi_n, psi_n1, psi_n2
943 integer,
parameter :: max_order = 200
948 call psib%clone_to(psi0)
949 call psib%clone_to(psi1)
950 call psib%clone_to(psi2)
951 call psib%copy_data_to(mesh%np, psi0)
953 order_needed = max_order
955 error = chebyshev_function%get_error(j)
956 if (error >
m_zero .and. error < te%chebyshev_tol)
then
962 call chebyshev_function%get_coefficients(j, coefficients)
965 call batch_scal(mesh%np, coefficients(0), psib)
968 call op%apply(psi0, psi1)
969 call batch_axpy(mesh%np, -hm%spectral_middle_point, psi0, psi1)
972 call batch_axpy(mesh%np, coefficients(1), psi1, psib)
979 do j = 2, order_needed
981 call op%apply(psi_n1, psi_n)
982 call batch_axpy(mesh%np, -hm%spectral_middle_point, psi_n1, psi_n)
987 call batch_axpy(mesh%np, coefficients(j), psi_n, psib)
990 if (mod(j, 3) == 2)
then
994 else if (mod(j, 3) == 1)
then
1005 if (order_needed == max_order)
then
1006 write(
message(1),
'(a,i5,a,es9.2)')
'Chebyshev exponential expansion did not converge after ', j, &
1007 ' iterations. Coefficient: ', coefficient
1010 write(
message(1),
'(a,i5)')
'Debug: Chebyshev exponential iterations: ', j
1017 safe_deallocate_a(psi0)
1018 safe_deallocate_a(psi1)
1019 safe_deallocate_a(psi2)
1021 safe_deallocate_a(coefficients)
1035 type(
grid_t),
intent(inout) :: gr
1038 real(real64),
intent(in) :: deltat
1039 integer,
optional,
intent(inout) :: order
1041 integer :: ik, ib, i
1042 real(real64) :: zfact
1054 do i = 1, te%exp_order
1055 zfact = zfact * deltat / i
1063 do ik = st%d%kpt%start, st%d%kpt%end
1064 do ib = st%group%block_start, st%group%block_end
1065 call batch_scal2v(gr%np, -
m_zi, hst1%group%psib(ib, ik), st1%group%psib(ib, ik), conjugate_xx = .false.)
1066 call batch_axpy(gr%np, zfact, st1%group%psib(ib, ik), st%group%psib(ib, ik))
1084 do ik = st%d%kpt%start, st%d%kpt%end
1085 do ib = st%group%block_start, st%group%block_end
1086 call batch_axpy(gr%np, deltat, st1%group%psib(ib, ik), st%group%psib(ib, ik))
1091 do i = 1, te%exp_order
1092 zfact = zfact * deltat / (i+1)
1100 do ik = st%d%kpt%start, st%d%kpt%end
1101 do ib = st%group%block_start, st%group%block_end
1102 call batch_scal2v(gr%np, -
m_zi, hst1%group%psib(ib, ik), st1%group%psib(ib, ik), conjugate_xx = .false.)
1103 call batch_axpy(gr%np, deltat * zfact, st1%group%psib(ib, ik), st%group%psib(ib, ik))
1114 if (
present(order)) order = te%exp_order*st%nik*st%nst
1122 class(
mesh_t),
intent(in) :: mesh
1124 class(
batch_t),
intent(inout) :: psib
1125 real(real64),
intent(in) :: deltat
1126 integer,
intent(in) :: k
1127 class(
operator_t),
target,
optional,
intent(in) :: op
1130 complex(real64) :: deltat_
1137 if (
present(op))
then
1143 if (.not. op_%is_hermitian() .and. te%exp_method ==
exp_chebyshev)
then
1144 write(
message(1),
'(a)')
'The Chebyshev expansion for the exponential will only converge if the imaginary'
1145 write(
message(2),
'(a)')
'eigenvalues are small enough compared to the span of the real eigenvalues,'
1146 write(
message(3),
'(a)')
'i.e., for ratios smaller than about 1e-3.'
1147 write(
message(4),
'(a)')
'The Lanczos method ("TDExponentialMethod = lanczos") is guaranteed to'
1148 write(
message(5),
'(a)')
'always converge in this case.'
1152 deltat_ = cmplx(deltat,
m_zero, real64)
1154 select case (te%exp_method)
1161 else if (k == 2)
then
1164 write(
message(1),
'(a)')
'Lanczos expansion not implemented for phi_k, k > 2'
1171 else if (k == 2)
then
1174 write(
message(1),
'(a)')
'Chebyshev expansion not implemented for phi_k, k > 2'
1178 deallocate(chebyshev_function)
1181 if (.not.
present(op))
then
1182 safe_deallocate_p(op_)
1189 type(
namespace_t),
target,
intent(in) :: namespace
1190 class(
mesh_t),
target,
intent(in) :: mesh
1197 call this%init(namespace, mesh, hm)
1204 type(
namespace_t),
target,
intent(in) :: namespace
1205 class(
mesh_t),
target,
intent(in) :: mesh
1211 this%namespace => namespace
1219 class(
batch_t),
intent(inout) :: psib
1220 class(
batch_t),
intent(inout) :: hpsib
1224 call this%hm%zapply(this%namespace, this%mesh, psib, hpsib)
1245 type(
namespace_t),
target,
intent(in) :: namespace
1246 class(
mesh_t),
target,
intent(in) :: mesh
1253 call this%init(namespace, mesh, hm)
1261 type(
namespace_t),
target,
intent(in) :: namespace
1262 class(
mesh_t),
target,
intent(in) :: mesh
1268 this%namespace => namespace
1278 class(
batch_t),
intent(inout) :: psib
1279 class(
batch_t),
intent(inout) :: hpsib
1287 select type (hm => this%hm)
1292 call this%hm%zapply(this%namespace, this%mesh, psib, hpsib)
1295 message(1) =
"SinvH_operator_apply requires wfs_elec_t batches."
1299 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.
recursive integer function, public factorial(n)
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