71 subroutine td_etrs(ks, namespace, space, hm, ext_partners, gr, st, tr, time, dt, &
73 type(v_ks_t),
intent(inout) :: ks
74 type(namespace_t),
intent(in) :: namespace
75 type(electron_space_t),
intent(in) :: space
76 type(hamiltonian_elec_t),
intent(inout) :: hm
77 type(partner_list_t),
intent(in) :: ext_partners
78 type(grid_t),
intent(in) :: gr
79 type(states_elec_t),
intent(inout) :: st
80 type(propagator_base_t),
intent(inout) :: tr
81 real(real64),
intent(in) :: time
82 real(real64),
intent(in) :: dt
83 type(ion_dynamics_t),
intent(inout) :: ions_dyn
84 type(ions_t),
intent(inout) :: ions
86 type(xc_copied_potentials_t) :: vhxc_t1, vhxc_t2
87 type(gauge_field_t),
pointer :: gfield
93 call hm%ks_pot%store_potentials(vhxc_t1)
97 call v_ks_calc(ks, namespace, space, hm, st, ions, ext_partners, &
98 calc_current = .false., calc_energy = .false., calc_eigenval = .false.)
100 call hm%ks_pot%store_potentials(vhxc_t2)
101 call hm%ks_pot%restore_potentials(vhxc_t1)
102 call hm%update(gr, namespace, space, ext_partners, time = time - dt)
114 ext_partners, time, dt)
117 if(
associated(gfield))
then
121 call hm%ks_pot%restore_potentials(vhxc_t2)
133 subroutine td_etrs_sc(ks, namespace, space, hm, ext_partners, gr, st, tr, time, dt, &
134 ions_dyn, ions, sctol, scsteps)
135 type(v_ks_t),
intent(inout) :: ks
136 type(namespace_t),
intent(in) :: namespace
137 type(electron_space_t),
intent(in) :: space
138 type(hamiltonian_elec_t),
intent(inout) :: hm
139 type(partner_list_t),
intent(in) :: ext_partners
140 type(grid_t),
intent(in) :: gr
141 type(states_elec_t),
intent(inout) :: st
142 type(propagator_base_t),
intent(inout) :: tr
143 real(real64),
intent(in) :: time
144 real(real64),
intent(in) :: dt
145 type(ion_dynamics_t),
intent(inout) :: ions_dyn
146 type(ions_t),
intent(inout) :: ions
147 real(real64),
intent(in) :: sctol
148 integer,
optional,
intent(out) :: scsteps
151 integer :: ik, ib, iter
152 class(wfs_elec_t),
allocatable :: psi2(:, :)
154 integer,
parameter :: niter = 10
155 type(gauge_field_t),
pointer :: gfield
156 type(xc_copied_potentials_t) :: vhxc_t1, vhxc_t2
162 call hm%ks_pot%store_potentials(vhxc_t1)
171 call v_ks_calc(ks, namespace, space, hm, st, ions, ext_partners, &
172 calc_current = .false., calc_energy = .false., calc_eigenval = .false.)
175 call hm%ks_pot%store_potentials(vhxc_t2)
176 call hm%ks_pot%restore_potentials(vhxc_t1)
184 ext_partners, time, dt)
187 if(
associated(gfield))
then
191 call hm%ks_pot%restore_potentials(vhxc_t2)
195 safe_allocate_type_array(
wfs_elec_t, psi2, (st%group%block_start:st%group%block_end, st%d%kpt%start:st%d%kpt%end))
198 do ik = st%d%kpt%start, st%d%kpt%end
199 do ib = st%group%block_start, st%group%block_end
200 call st%group%psib(ib, ik)%copy_to(psi2(ib, ik), copy_data=.
true.)
206 call hm%ks_pot%store_potentials(vhxc_t2)
210 call v_ks_calc(ks, namespace, space, hm, st, ions, ext_partners, &
211 time = time, calc_current = .false., calc_energy = .false., calc_eigenval = .false.)
215 diff = hm%ks_pot%check_convergence(vhxc_t2, gr, st%rho, st%qtot)
223 if (diff <= sctol)
exit
225 if (iter /= niter)
then
227 do ik = st%d%kpt%start, st%d%kpt%end
228 do ib = st%group%block_start, st%group%block_end
229 call psi2(ib, ik)%copy_data_to(gr%np, st%group%psib(ib, ik))
244 if (
present(scsteps)) scsteps = iter
246 do ik = st%d%kpt%start, st%d%kpt%end
247 do ib = st%group%block_start, st%group%block_end
248 call psi2(ib, ik)%end()
252 safe_deallocate_a(psi2)
259 subroutine td_aetrs(namespace, space, hm, gr, st, tr, time, dt, ions_dyn, ions, ext_partners)
263 type(
grid_t),
intent(in) :: gr
266 real(real64),
intent(in) :: time
267 real(real64),
intent(in) :: dt
269 type(
ions_t),
intent(inout) :: ions
284 ions, ext_partners, time, dt)
288 if(
associated(gfield))
then
303 subroutine td_caetrs(ks, namespace, space, hm, ext_partners, gr, st, tr, time, dt, &
305 type(
v_ks_t),
intent(inout) :: ks
310 type(
grid_t),
intent(in) :: gr
313 real(real64),
intent(in) :: time
314 real(real64),
intent(in) :: dt
316 type(
ions_t),
intent(inout) :: ions
318 integer :: ik, ispin, ip, ist, ib
320 complex(real64) :: phase
322 integer(int64) :: pnp, wgsize, dim2, dim3
330 call hm%ks_pot%get_interpolated_potentials(tr%vks_old, 2, storage=vold)
332 call hm%ks_pot%restore_potentials(vold)
336 call v_ks_calc_start(ks, namespace, space, hm, st, ions, ions%latt, ext_partners, &
337 time = time - dt, calc_energy = .false., calc_current = .false.)
342 call v_ks_calc_finish(ks, hm, namespace, space, ions%latt, st, ext_partners)
344 call hm%ks_pot%set_interpolated_potentials(tr%vks_old, 1)
346 call hm%ks_pot%perform_interpolation(tr%vks_old, (/time - dt, time -
m_two*dt, time -
m_three*dt/), time)
349 call hm%ks_pot%mix_potentials(vold, dt)
353 if (family_is_mgga_with_exc(hm%xc))
then
358 call vold%copy_vhxc_to_buffer(int(gr%np, int64), st%d%nspin, pnp, phase_buff)
366 ions, ext_partners, time, dt)
369 if(
associated(gfield))
then
378 do ik = st%d%kpt%start, st%d%kpt%end
379 ispin = st%d%get_spin_index(ik)
381 do ib = st%group%block_start, st%group%block_end
382 if (hm%apply_packed())
then
383 call st%group%psib(ib, ik)%do_pack()
388 select case (st%group%psib(ib, ik)%status())
391 vv = vold%vhxc(ip, ispin)
392 phase = cmplx(
cos(vv), -
sin(vv), real64)
393 do ist = 1, st%group%psib(ib, ik)%nst_linear
394 st%group%psib(ib, ik)%zff_linear(ip, ist) = st%group%psib(ib, ik)%zff_linear(ip, ist)*phase
399 vv = vold%vhxc(ip, ispin)
400 phase = cmplx(
cos(vv), -
sin(vv), real64)
401 do ist = 1, st%group%psib(ib, ik)%nst_linear
402 st%group%psib(ib, ik)%zff_pack(ist, ip) = st%group%psib(ib, ik)%zff_pack(ist, ip)*phase
416 (/st%group%psib(ib, ik)%pack_size(1), wgsize, 1_int64/))
421 call hm%phase%set_phase_corr(gr, st%group%psib(ib, ik))
423 call tr%te%apply_batch(namespace, gr, hm, st%group%psib(ib, ik),
m_half*dt, &
424 inh_psib = hm%inh_st%group%psib(ib, ik))
426 call tr%te%apply_batch(namespace, gr, hm, st%group%psib(ib, ik),
m_half*dt)
428 call hm%phase%unset_phase_corr(gr, st%group%psib(ib, ik))
432 if (hm%apply_packed())
then
433 call st%group%psib(ib, ik)%do_unpack()
double sin(double __x) __attribute__((__nothrow__
double cos(double __x) __attribute__((__nothrow__
integer pure function, public accel_max_size_per_dim(dim)
subroutine, public accel_release_buffer(this)
type(accel_kernel_t), target, save, public kernel_phase
pure logical function, public accel_is_enabled()
integer, parameter, public accel_mem_read_only
integer pure function, public accel_max_workgroup_size()
This module implements batches of mesh functions.
integer, parameter, public batch_not_packed
functions are stored in CPU memory, unpacked order
integer, parameter, public batch_device_packed
functions are stored in device memory in packed order
integer, parameter, public batch_packed
functions are stored in CPU memory, in transposed (packed) order
This module implements a calculator for the density and defines related functions.
subroutine, public density_calc_end(this, allreduce, symmetrize)
Finalize the density calculation.
subroutine, public density_calc_accumulate(this, psib, async)
Accumulate weighted orbital densities for a batch psib.
subroutine, public density_calc_init(this, st, gr, density)
initialize the density calculator
type(gauge_field_t) function, pointer, public list_get_gauge_field(partners)
real(real64), parameter, public m_two
real(real64), parameter, public m_half
real(real64), parameter, public m_three
This module implements the underlying real-space grid.
pure logical function, public hamiltonian_elec_inh_term(hm)
This module defines classes and functions for interaction partners.
A module to handle KS potential, without the external potential.
integer, parameter, public independent_particles
subroutine, public lda_u_write_u(this, iunit, namespace)
subroutine, public lda_u_write_v(this, iunit, namespace)
integer, parameter, public dft_u_none
subroutine, public lda_u_update_occ_matrices(this, namespace, mesh, st, hm_base, phase, energy)
This module is intended to contain "only mathematical" functions and procedures.
This module defines various routines, operating on mesh functions.
subroutine, public messages_not_implemented(feature, namespace)
subroutine, public messages_new_line()
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
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 propagation_ops_elec_move_ions(wo, gr, hm, st, namespace, space, ions_dyn, ions, ext_partners, time, dt, save_pos)
subroutine, public propagation_ops_elec_propagate_gauge_field(wo, gfield, dt, time, save_gf)
subroutine, public propagation_ops_elec_update_hamiltonian(namespace, space, st, mesh, hm, ext_partners, time)
subroutine, public propagation_ops_elec_exp_apply(te, namespace, st, mesh, hm, dt)
subroutine, public propagation_ops_elec_interpolate_get(hm, mesh, vks_old)
subroutine, public propagation_ops_elec_fuse_density_exp_apply(te, namespace, st, gr, hm, dt, dt2, vmagnus)
subroutine, public td_caetrs(ks, namespace, space, hm, ext_partners, gr, st, tr, time, dt, ions_dyn, ions)
Propagator with approximate enforced time-reversal symmetry.
subroutine, public td_etrs_sc(ks, namespace, space, hm, ext_partners, gr, st, tr, time, dt, ions_dyn, ions, sctol, scsteps)
Propagator with enforced time-reversal symmetry and self-consistency.
subroutine, public td_etrs(ks, namespace, space, hm, ext_partners, gr, st, tr, time, dt, ions_dyn, ions)
Propagator with enforced time-reversal symmetry.
subroutine, public td_aetrs(namespace, space, hm, gr, st, tr, time, dt, ions_dyn, ions, ext_partners)
Propagator with approximate enforced time-reversal symmetry.
This module handles spin dimensions of the states and the k-point distribution.
type(type_t), public type_float
subroutine, public v_ks_calc_finish(ks, hm, namespace, space, latt, st, ext_partners, force_semilocal)
subroutine, public v_ks_calc_start(ks, namespace, space, hm, st, ions, latt, ext_partners, time, calc_energy, calc_current, force_semilocal)
This routine starts the calculation of the Kohn-Sham potential. The routine v_ks_calc_finish must be ...
subroutine, public v_ks_calc(ks, namespace, space, hm, st, ions, ext_partners, calc_eigenval, time, calc_energy, calc_current, force_semilocal)
Extension of space that contains the knowledge of the spin dimension.
Description of the grid, containing information on derivatives, stencil, and symmetries.
The states_elec_t class contains all electronic wave functions.
batches of electronic states