48 use,
intrinsic :: iso_fortran_env
146 type(space_t),
private :: space
147 type(states_elec_dim_t) :: d
148 type(hamiltonian_elec_base_t) :: hm_base
149 type(phase_t) :: phase
150 type(energy_t),
allocatable :: energy
151 type(absorbing_boundaries_t) :: abs_boundaries
152 type(ks_potential_t) :: ks_pot
153 real(real64),
allocatable :: vberry(:,:)
155 type(derivatives_t),
pointer,
private :: der
157 type(nonlocal_pseudopotential_t) :: vnl
158 type(nonlocal_pseudopotential_t) :: aug_overlap
159 type(nonlocal_pseudopotential_t) :: aug_inverse_overlap
161 type(ions_t),
pointer :: ions
162 logical,
private :: owns_ions = .false.
163 logical,
private :: is_copy_snapshot = .false.
164 real(real64) :: exx_coef
166 class(poisson_t),
allocatable :: psolver
169 logical :: self_induced_magnetic
170 real(real64),
allocatable :: a_ind(:, :)
171 real(real64),
allocatable :: b_ind(:, :)
173 integer :: theory_level
174 type(xc_t),
pointer :: xc
175 type(xc_photons_t),
pointer :: xc_photons
177 class(epot_t),
allocatable :: ep
178 class(pcm_t),
allocatable :: pcm
181 logical,
private :: adjoint
184 real(real64),
private :: mass
187 logical,
private :: inh_term
188 class(states_elec_t),
allocatable :: inh_st
192 type(oct_exchange_t) :: oct_exchange
194 class(scissor_t),
allocatable :: scissor
196 real(real64) :: current_time
197 logical,
private :: is_applied_packed
200 class(lda_u_t),
allocatable :: lda_u
201 integer :: lda_u_level
203 logical,
public :: time_zero
205 class(exchange_operator_t),
allocatable,
public :: exxop
207 type(kpoints_t),
pointer,
public :: kpoints => null()
209 type(partner_list_t) :: external_potentials
210 real(real64),
allocatable,
public :: v_ext_pot(:)
211 real(real64),
allocatable,
public :: v_static(:)
213 type(ion_electron_local_potential_t) :: v_ie_loc
216 type(magnetic_constrain_t) :: magnetic_constrain
236 integer,
public,
parameter :: &
244 subroutine hamiltonian_elec_init(hm, namespace, space, gr, ions, ext_partners, st, theory_level, xc, &
245 mc, kpoints, need_exchange, xc_photons)
248 class(
space_t),
intent(in) :: space
249 type(
grid_t),
target,
intent(inout) :: gr
250 type(
ions_t),
target,
intent(inout) :: ions
253 integer,
intent(in) :: theory_level
254 type(
xc_t),
target,
intent(in) :: xc
257 logical,
optional,
intent(in) :: need_exchange
258 type(
xc_photons_t),
optional,
target,
intent(in) :: xc_photons
261 logical :: need_exchange_
262 real(real64) :: rashba_coupling
267 safe_allocate(hm%lda_u)
268 safe_allocate(hm%exxop)
269 safe_allocate(hm%psolver)
270 safe_allocate(hm%scissor)
271 safe_allocate(hm%inh_st)
273 safe_allocate(hm%pcm)
274 safe_allocate(hm%lda_u%basis)
279 hm%theory_level = theory_level
282 hm%kpoints => kpoints
308 if (space%dim /= 2)
then
309 write(
message(1),
'(a)')
'Rashba spin-orbit coupling can only be used for two-dimensional systems.'
315 call hm%hm_base%init(hm%d%nspin, hm%mass, rashba_coupling)
317 call hm%aug_overlap%init()
318 call hm%aug_inverse_overlap%init()
319 call mpi_grp_copy(hm%vnl%paw_onsite_grp, st%st_kpt_mpi_grp)
321 assert(
associated(gr%der%lapl))
322 hm%hm_base%kinetic => gr%der%lapl
324 safe_allocate(hm%energy)
329 hm%owns_ions = .false.
330 hm%is_copy_snapshot = .false.
333 if(
present(xc_photons))
then
334 hm%xc_photons => xc_photons
336 hm%xc_photons => null()
345 call poisson_init(hm%psolver, namespace, space, gr%der, mc, gr%stencil, st%qtot)
348 call epot_init(hm%ep, namespace, gr, hm%ions, hm%psolver, hm%d%ispin, hm%xc%family, hm%kpoints, &
349 xc_id=[hm%xc%functional(
func_x, 1)%id, hm%xc%functional(
func_c, 1)%id])
350 hm%xc%usexcnhat = hm%ep%usexcnhat
351 st%requires_generalized_overlap = hm%ep%requires_generalized_overlap
356 if (hm%ep%requires_generalized_overlap)
then
357 if (gr%use_curvilinear)
then
379 call parse_variable(namespace,
'USPPSaveMemory', .false., hm%vnl%uspp_save_memory)
380 hm%aug_overlap%uspp_save_memory = hm%vnl%uspp_save_memory
381 hm%aug_inverse_overlap%uspp_save_memory = hm%vnl%uspp_save_memory
383 call kick_init(hm%kick, namespace, space, hm%kpoints, hm%d%ispin)
385 hm%zora =>
zora_t(namespace, hm%der, hm%d, hm%ep, hm%mass)
388 call hm%v_ie_loc%init(gr, hm%psolver, hm%ions, namespace, hm%ep%dgrid, hm%ep%atoms_dist_plane)
390 call hm%nlcc%init(gr, hm%ions, hm%ep%dgrid, hm%ep%atoms_dist_plane)
391 safe_allocate(st%rho_core(1:gr%np))
424 call parse_variable(namespace,
'CalculateSelfInducedMagneticField', .false., hm%self_induced_magnetic)
425 if (hm%self_induced_magnetic)
then
426 safe_allocate(hm%a_ind(1:gr%np_part, 1:space%dim))
427 safe_allocate(hm%b_ind(1:gr%np_part, 1:space%dim))
435 hm%inh_term = .false.
440 call hm%phase%init(gr, hm%d%kpt, hm%kpoints, st%d, space)
460 call lda_u_init(hm%lda_u, namespace, space, hm%lda_u_level, gr, ions, st, mc, hm%kpoints)
469 if(hm%lda_u_level /=
dft_u_none .and. hm%phase%is_allocated())
then
484 call parse_variable(namespace,
'HamiltonianApplyPacked', .
true., hm%is_applied_packed)
486 if (hm%theory_level ==
hartree_fock .and. st%parallel_in_states)
then
491 .and. st%parallel_in_states)
then
510 if (hm%xc%compute_exchange(hm%theory_level) .or. need_exchange_)
then
515 else if (
bitand(hm%xc%family, xc_family_oep) /= 0 .or. hm%theory_level ==
rdmft)
then
517 hm%kpoints, hm%xc%cam)
518 if (hm%theory_level ==
rdmft) hm%exxop%useACE = .false.
527 if (gr%use_curvilinear)
then
529 hm%is_applied_packed = .false.
530 call messages_write(
'Cannot use GPUs as curvilinear coordinates are used.')
533 call messages_write(
'Cannot use GPUs as curvilinear coordinates are used.', new_line = .
true.)
534 call messages_write(
'Calculation will not be continued. To force execution, set AllowCPUonly = yes.')
564 if (
associated(hm%xc_photons))
then
565 if (hm%xc_photons%wants_to_renormalize_mass())
then
567 call hm%set_mass(namespace, hm%xc_photons%get_renormalized_mass())
571 if (hm%xc%compute_exchange(hm%theory_level) .or. need_exchange_)
call hm%exxop%write_info(namespace)
581 class(*),
pointer :: potential
586 safe_allocate(hm%v_ext_pot(1:gr%np))
587 hm%v_ext_pot(1:gr%np) =
m_zero
589 call iter%start(hm%external_potentials)
590 do while (iter%has_next())
591 potential => iter%get_next()
592 select type (potential)
595 call potential%allocate_memory(gr)
596 call potential%calculate(namespace, gr, hm%psolver)
599 select case (potential%type)
605 message(1) =
"Cannot use static magnetic field with real wavefunctions"
609 if (.not.
allocated(hm%ep%b_field))
then
610 safe_allocate(hm%ep%b_field(1:3))
611 hm%ep%b_field(1:3) =
m_zero
613 hm%ep%b_field(1:3) = hm%ep%b_field(1:3) + potential%b_field(1:3)
615 if (.not.
allocated(hm%ep%a_static))
then
616 safe_allocate(hm%ep%a_static(1:gr%np, 1:space%dim))
617 hm%ep%a_static(1:gr%np, 1:space%dim) =
m_zero
619 call lalg_axpy(gr%np, space%dim,
m_one, potential%a_static, hm%ep%a_static)
622 if (.not.
allocated(hm%ep%e_field))
then
623 safe_allocate(hm%ep%e_field(1:space%dim))
624 hm%ep%e_field(1:space%dim) =
m_zero
626 hm%ep%e_field(1:space%dim) = hm%ep%e_field(1:space%dim) + potential%e_field(1:space%dim)
629 if (space%periodic_dim < space%dim)
then
630 if (.not.
allocated(hm%v_static))
then
631 safe_allocate(hm%v_static(1:gr%np))
632 hm%v_static(1:gr%np) =
m_zero
634 if (.not.
allocated(hm%ep%v_ext))
then
635 safe_allocate(hm%ep%v_ext(1:gr%np_part))
636 hm%ep%v_ext(1:gr%np_part) =
m_zero
642 if (hm%kpoints%use_symmetries)
then
646 message(1) =
"The StaticElectricField breaks (at least) one of the symmetries used to reduce the k-points."
647 message(2) =
"Set SymmetryBreakDir equal to StaticElectricField."
654 call potential%deallocate_memory()
667 class(*),
pointer :: potential
671 call iter%start(hm%external_potentials)
672 do while (iter%has_next())
673 potential => iter%get_next()
674 select type (potential)
678 message(1) =
"Applying StaticElectricField in a periodic direction is only accurate for large supercells."
679 message(2) =
"Single-point Berry phase is not appropriate when k-point sampling is needed."
695 logical :: external_potentials_present
696 logical :: kick_present
700 if (
allocated(hm%ep%e_field) .and. space%is_periodic() .and. .not.
list_has_gauge_field(ext_partners))
then
703 if (any(abs(hm%ep%e_field(1:space%periodic_dim)) >
m_epsilon))
then
704 safe_allocate(hm%vberry(1:gr%np, 1:hm%d%nspin))
715 call pcm_init(hm%pcm, namespace, space, ions, gr, st%qtot, st%val_charge, external_potentials_present, kick_present)
716 if (hm%pcm%run_pcm)
then
739 if (hm%is_copy_snapshot)
then
742 if (
allocated(hm%lda_u))
then
743 safe_deallocate_a(hm%lda_u%basis)
745 safe_deallocate_a(hm%lda_u)
746 safe_deallocate_a(hm%exxop)
747 safe_deallocate_a(hm%psolver)
748 safe_deallocate_a(hm%scissor)
749 safe_deallocate_a(hm%inh_st)
750 safe_deallocate_a(hm%ep)
751 safe_deallocate_a(hm%pcm)
756 call hm%hm_base%end()
758 call hm%aug_overlap%end()
759 call hm%aug_inverse_overlap%end()
764 safe_deallocate_a(hm%vberry)
765 safe_deallocate_a(hm%a_ind)
766 safe_deallocate_a(hm%b_ind)
767 safe_deallocate_a(hm%v_ext_pot)
769 safe_deallocate_p(hm%zora)
777 if (hm%owns_ions .and.
associated(hm%ions))
then
780 if (
allocated(hm%ions%species))
then
781 safe_deallocate_a(hm%ions%species)
784 safe_deallocate_p(hm%ions)
785 hm%owns_ions = .false.
788 hm%owns_ions = .false.
800 safe_deallocate_a(hm%energy)
802 if (hm%pcm%run_pcm)
call pcm_end(hm%pcm)
804 call hm%v_ie_loc%end()
807 call iter%start(hm%external_potentials)
808 do while (iter%has_next())
809 potential => iter%get_next()
810 safe_deallocate_p(potential)
812 call hm%external_potentials%empty()
813 safe_deallocate_a(hm%v_static)
819 hm%is_copy_snapshot = .false.
821 if (
allocated(hm%lda_u))
then
822 safe_deallocate_a(hm%lda_u%basis)
824 safe_deallocate_a(hm%lda_u)
825 safe_deallocate_a(hm%exxop)
826 safe_deallocate_a(hm%psolver)
827 safe_deallocate_a(hm%scissor)
828 safe_deallocate_a(hm%inh_st)
829 safe_deallocate_a(hm%ep)
830 safe_deallocate_a(hm%pcm)
847 if (hm%owns_ions .and.
associated(hm%ions))
then
848 if (
allocated(hm%ions%species))
then
849 safe_deallocate_a(hm%ions%species)
852 safe_deallocate_p(hm%ions)
853 hm%owns_ions = .false.
856 hm%owns_ions = .false.
859 if (
associated(hm%zora))
then
860 safe_deallocate_p(hm%zora)
863 call iter%start(hm%external_potentials)
864 do while (iter%has_next())
865 potential => iter%get_next()
866 safe_deallocate_p(potential)
868 call hm%external_potentials%empty()
870 call hm%hm_base%end()
874 call hm%aug_overlap%end()
875 call hm%aug_inverse_overlap%end()
878 hm%is_copy_snapshot = .false.
894 type(
ions_t),
pointer :: ions_out
895 type(
zora_t),
pointer :: zora_out
899 class(*),
pointer :: ptr
901 logical :: runtime_initialized
906 runtime_initialized =
associated(hm_in%kpoints)
908 call iter%start(hm_in%external_potentials)
909 do while (iter%has_next())
910 ptr => iter%get_next()
913 call external_potentials_in%add(ptr)
915 call external_potentials_out%add(ext_pot)
920 call hm_in%external_potentials%empty()
923 hm_out%is_copy_snapshot = .
true.
934 if (
accel_is_enabled() .and. runtime_initialized .and.
associated(hm_out%der))
then
943 call hm_out%external_potentials%empty()
944 call iter%start(external_potentials_out)
945 do while (iter%has_next())
946 ptr => iter%get_next()
949 call hm_out%external_potentials%add(ptr)
954 call iter%start(external_potentials_in)
955 do while (iter%has_next())
956 ptr => iter%get_next()
959 call hm_in%external_potentials%add(ptr)
964 call external_potentials_out%empty()
965 call external_potentials_in%empty()
967 if (runtime_initialized)
then
971 if (
allocated(hm_in%energy))
then
972 if (.not.
allocated(hm_out%energy)) safe_allocate(hm_out%energy)
975 safe_deallocate_a(hm_out%energy)
982 if (
associated(hm_in%ions))
then
983 safe_allocate(ions_out)
984 ions_out = hm_in%ions
985 hm_out%ions => ions_out
986 hm_out%owns_ions = .
true.
987 call hm_out%v_ie_loc%bind(hm_out%psolver, hm_out%ions)
988 call hm_out%nlcc%bind(hm_out%ions)
991 hm_out%owns_ions = .false.
992 nullify(hm_out%v_ie_loc%atoms_dist)
993 nullify(hm_out%v_ie_loc%atom)
994 nullify(hm_out%v_ie_loc%pos)
995 nullify(hm_out%nlcc%atoms_dist)
996 nullify(hm_out%nlcc%atom)
997 nullify(hm_out%nlcc%pos)
1000 if (hm_out%lda_u_level /=
dft_u_none .and.
associated(hm_out%ions))
then
1007 if (
associated(hm_in%zora))
then
1008 allocate(zora_out, source=hm_in%zora)
1009 hm_out%zora => zora_out
1011 nullify(hm_out%zora)
1023 logical :: runtime_initialized
1027 runtime_initialized =
associated(hm_in%kpoints)
1028 if (.not. runtime_initialized)
then
1037 if (
associated(hm_in%xc))
then
1038 if (hm_in%xc%compute_exchange(hm_in%theory_level))
then
1051 if (hm_in%pcm%run_pcm)
then
1075 integer,
intent(in) :: terms
1096 real(real64),
intent(in) :: delta(:)
1097 real(real64),
intent(in) :: emin
1100 real(real64) :: emax
1108 hm%spectral_middle_point = (emax + emin) /
m_two
1109 hm%spectral_half_span = (emax - emin) /
m_two
1132 hm%inh_term = .
true.
1144 if (hm%inh_term)
then
1146 hm%inh_term = .false.
1158 if (.not. hm%adjoint)
then
1161 hm%abs_boundaries%mf = -hm%abs_boundaries%mf
1175 if (hm%adjoint)
then
1176 hm%adjoint = .false.
1178 hm%abs_boundaries%mf = -hm%abs_boundaries%mf
1190 class(
mesh_t),
intent(in) :: mesh
1192 class(
space_t),
intent(in) :: space
1194 real(real64),
optional,
intent(in) :: time
1196 integer :: ispin, ip, idir, iatom, ilaser
1197 real(real64) :: aa(space%dim), time_
1198 real(real64),
allocatable :: vp(:,:)
1201 real(real64) :: am(space%dim)
1206 this%current_time =
m_zero
1207 if (
present(time)) this%current_time = time
1212 call this%hm_base%clear(mesh%np)
1219 if (
present(time) .or. this%time_zero)
then
1222 if(
associated(lasers))
then
1223 do ilaser = 1, lasers%no_lasers
1224 select case (
laser_kind(lasers%lasers(ilaser)))
1226 do ispin = 1, this%d%spin_channels
1228 this%hm_base%potential(:, ispin), time_)
1234 safe_allocate(vp(1:mesh%np, 1:space%dim))
1235 vp(1:mesh%np, 1:space%dim) =
m_zero
1239 do idir = 1, space%dim
1240 this%hm_base%vector_potential(idir, ip) = this%hm_base%vector_potential(idir, ip) + vp(ip, idir)/
p_c
1244 call laser_field(lasers%lasers(ilaser), this%hm_base%uniform_magnetic_field(1:space%dim), time_)
1245 safe_deallocate_a(vp)
1250 call laser_field(lasers%lasers(ilaser), aa, time_)
1251 this%hm_base%uniform_vector_potential(1:space%dim) = this%hm_base%uniform_vector_potential(1:space%dim) - aa/
p_c
1256 assert(
allocated(this%hm_base%uniform_vector_potential))
1258 this%hm_base%uniform_vector_potential(1:space%dim) = this%hm_base%uniform_vector_potential(1:space%dim) - am/
p_c
1264 if (
associated(gfield))
then
1267 this%hm_base%uniform_vector_potential(1:space%dim) = this%hm_base%uniform_vector_potential(1:space%dim) - aa/
p_c
1271 if (
allocated(this%ep%e_field) .and.
associated(gfield))
then
1272 this%hm_base%uniform_vector_potential(1:space%periodic_dim) = &
1273 this%hm_base%uniform_vector_potential(1:space%periodic_dim) - time_*this%ep%e_field(1:space%periodic_dim)
1277 if (
associated(this%xc_photons))
then
1278 if(this%xc_photons%lpfmf .and.
allocated(this%xc_photons%mf_vector_potential))
then
1281 this%hm_base%uniform_vector_potential(1:space%dim) = &
1282 this%hm_base%uniform_vector_potential(1:space%dim) - this%xc_photons%mf_vector_potential(1:space%dim)/
p_c
1289 if (
allocated(this%ep%a_static))
then
1294 do idir = 1, space%dim
1295 this%hm_base%vector_potential(idir, ip) = this%hm_base%vector_potential(idir, ip) + this%ep%a_static(ip, idir)
1304 call this%hm_base%accel_copy_pot(mesh)
1307 if (
allocated(this%ep%b_field))
then
1310 this%hm_base%uniform_magnetic_field(idir) = this%hm_base%uniform_magnetic_field(idir) + this%ep%b_field(idir)
1315 call this%hm_base%update_magnetic_terms(mesh, this%ep%gyromagnetic_ratio, this%d%ispin)
1320 if (this%mxll%test_equad)
then
1339 if ((.not. this%kpoints%gamma_only()) .or.
allocated(this%hm_base%uniform_vector_potential))
then
1343 do iatom = 1, this%ep%natoms
1344 call projector_init_phases(this%ep%proj(iatom), space%dim, this%d, this%der%boundaries, this%kpoints, &
1345 vec_pot = this%hm_base%uniform_vector_potential, vec_pot_var = this%hm_base%vector_potential)
1351 if (
allocated(this%hm_base%uniform_vector_potential))
then
1353 call this%phase%update(mesh, this%d%kpt, this%kpoints, this%d, space, this%hm_base%uniform_vector_potential)
1358 vec_pot = this%hm_base%uniform_vector_potential, vec_pot_var = this%hm_base%vector_potential)
1363 if (this%ep%requires_generalized_overlap)
then
1368 if (this%aug_inverse_overlap%ovlp_inv%use_global_coupling)
then
1369 if (.not. this%aug_inverse_overlap%ovlp_inv%coupling_built .or. this%phase%is_allocated())
then
1370 call this%aug_inverse_overlap%ovlp_inv%build(this%aug_inverse_overlap%projector_matrices, &
1371 this%aug_inverse_overlap%projector_phases, mesh, this%d%kpt%start, this%d%kpt%end)
1391 class(
mesh_t),
intent(in) :: mesh
1392 logical,
optional,
intent(in) :: accumulate
1394 integer :: ispin, ip
1395 real(real64),
allocatable :: vscreen(:,:)
1402 do ispin = 1, this%d%nspin
1405 this%hm_base%potential(ip, ispin) =
m_zero
1410 this%hm_base%Impotential =
m_zero
1415 do ispin = 1, this%d%nspin
1416 if (ispin <= 2)
then
1420 this%hm_base%potential(ip, ispin) = this%hm_base%potential(ip, ispin) + this%ep%vpsl(ip) + this%v_ext_pot(ip)
1424 if (this%pcm%run_pcm)
then
1425 if (this%pcm%solute)
then
1428 this%hm_base%potential(ip, ispin) = this%hm_base%potential(ip, ispin) + &
1429 this%pcm%v_e_rs(ip) + this%pcm%v_n_rs(ip)
1433 if (this%pcm%localf)
then
1436 this%hm_base%potential(ip, ispin) = this%hm_base%potential(ip, ispin) + &
1437 this%pcm%v_ext_rs(ip)
1447 this%hm_base%Impotential(ip, ispin) = this%hm_base%Impotential(ip, ispin) + this%abs_boundaries%mf(ip)
1462 call this%zora%update(this%der, this%hm_base%potential)
1466 do ispin = 1, this%d%nspin
1468 if (
allocated(this%hm_base%zeeman_pot))
then
1471 this%hm_base%potential(ip, ispin) = this%hm_base%potential(ip, ispin) + this%hm_base%zeeman_pot(ip, ispin)
1477 if (this%mxll%test_equad)
then
1480 this%hm_base%potential(ip, ispin) = this%hm_base%potential(ip, ispin) + this%mxll%e_quadrupole_pot(ip)
1489 call this%ks_pot%add_vhxc(this%hm_base%potential)
1491 call this%hm_base%accel_copy_pot(mesh)
1495 if (this%ep%requires_generalized_overlap)
then
1497 if (this%ep%has_paw .and. .not. this%xc%usexcnhat)
then
1498 safe_allocate(vscreen(1:mesh%np, 1:this%d%nspin))
1499 call lalg_copy(mesh%np, this%d%nspin, this%hm_base%potential, vscreen)
1500 call lalg_axpy(mesh%np, this%d%nspin, -
m_one, this%ks_pot%vxc, vscreen)
1506 if (this%ep%has_paw .and. this%vnl%nprojector_matrices > 0)
then
1507 if (.not.
allocated(this%aug_overlap%onsite_density_matrix))
then
1508 message(1) =
"Internal error: the PAW one-center density matrix is not allocated,"
1509 message(2) =
"the one-center contributions to the Hamiltonian cannot be computed."
1512 if (
allocated(vscreen))
then
1514 onsite_density_matrix = this%aug_overlap%onsite_density_matrix)
1517 onsite_density_matrix = this%aug_overlap%onsite_density_matrix)
1522 safe_deallocate_a(vscreen)
1536 class(
mesh_t),
intent(in) :: mesh
1537 real(real64),
allocatable,
intent(inout) :: nhat(:,:)
1543 safe_deallocate_a(nhat)
1544 if (this%ep%has_paw .and. .not. this%xc%usexcnhat)
then
1545 assert(this%d%ispin /=
spinors)
1546 safe_allocate(nhat(1:mesh%np_part, 1:this%d%spin_channels))
1548 if (
allocated(this%aug_overlap%onsite_density_matrix))
then
1549 do is = 1, this%d%spin_channels
1551 this%aug_overlap%onsite_density_matrix(:, :, :, is), nhat(:, is))
1565 type(
grid_t),
intent(in) :: gr
1566 type(
ions_t),
target,
intent(inout) :: ions
1569 real(real64),
optional,
intent(in) :: time
1572 integer :: xc_spin_col
1577 call epot_generate(this%ep, namespace, gr, this%ions, this%d, st%st_kpt_mpi_grp)
1578 st%requires_generalized_overlap = this%ep%requires_generalized_overlap
1581 if (this%ep%has_paw .and.
associated(this%xc))
then
1583 xc_spin_col = merge(1, 2, this%d%ispin ==
unpolarized)
1584 xfp => this%xc%functional(:, xc_spin_col)
1592 if (
allocated(this%ep%e_field) .and. space%periodic_dim < space%dim)
then
1598 this%v_ie_loc%atoms_dist => ions%atoms_dist
1599 this%v_ie_loc%atom => ions%atom
1600 call this%v_ie_loc%calculate()
1603 call lalg_axpy(gr%np,
m_one, this%v_ie_loc%potential(:,1), this%ep%vpsl)
1607 if (this%ep%nlcc)
then
1608 call this%nlcc%end()
1609 call this%nlcc%init(gr, ions, this%ep%dgrid, this%ep%atoms_dist_plane)
1610 call this%nlcc%calculate()
1611 call lalg_copy(gr%np, this%nlcc%density(:,1), st%rho_core)
1614 call this%vnl%build(space, gr, this%ep, this%d%ispin)
1615 if (this%ep%requires_generalized_overlap)
then
1616 call this%aug_overlap%build(space, gr, this%ep, this%d%ispin, overlap_operator = .
true.)
1617 call this%aug_inverse_overlap%build(space, gr, this%ep, this%d%ispin, inverse_overlap_operator = .
true.)
1618 if (
allocated(this%aug_overlap%onsite_current_matrix))
then
1628 if (this%ep%has_paw)
then
1632 call this%aug_overlap%end()
1633 call this%aug_inverse_overlap%end()
1639 if (this%ep%non_local .and. .not. this%vnl%apply_projector_matrices)
then
1641 call messages_write(
'Relativistic pseudopotentials have not been fully implemented for GPUs.')
1644 call messages_write(
'Relativistic pseudopotentials have not been fully implemented for GPUs.',&
1646 call messages_write(
'Calculation will not be continued. To force execution, set AllowCPUonly = yes.')
1653 if (this%pcm%run_pcm)
then
1656 if (this%pcm%solute)
then
1663 if (this%pcm%localf .and.
allocated(this%v_static))
then
1664 call pcm_calc_pot_rs(this%pcm, gr, this%psolver, v_ext = this%ep%v_ext(1:gr%np_part))
1669 call lda_u_update_basis(this%lda_u, space, gr, ions, st, this%psolver, namespace, this%kpoints, &
1670 this%phase%is_allocated(), this%aug_overlap)
1680 time = this%current_time
1688 apply = this%is_applied_packed
1696 type(namespace_t),
intent(in) :: namespace
1697 class(space_t),
intent(in) :: space
1698 type(lattice_vectors_t),
intent(in) :: latt
1699 class(species_t),
intent(in) :: species
1700 real(real64),
intent(in) :: pos(1:space%dim)
1701 integer,
intent(in) :: ia
1702 class(mesh_t),
intent(in) :: mesh
1703 complex(real64),
contiguous,
intent(in) :: psi(:,:)
1704 complex(real64),
contiguous,
intent(out) :: vpsi(:,:)
1707 real(real64),
allocatable :: vlocal(:)
1710 safe_allocate(vlocal(1:mesh%np_part))
1712 call epot_local_potential(hm%ep, namespace, space, latt, mesh, species, pos, ia, vlocal)
1715 do idim = 1, hm%d%dim
1718 vpsi(ip, idim) = vlocal(ip) * psi(ip, idim)
1723 safe_deallocate_a(vlocal)
1734 class(space_t),
intent(in) :: space
1735 class(mesh_t),
intent(in) :: mesh
1736 type(partner_list_t),
intent(in) :: ext_partners
1737 real(real64),
intent(in) :: time(1:2)
1738 real(real64),
intent(in) :: mu(1:2)
1740 integer :: ispin, ip, idir, iatom, ilaser, itime
1741 real(real64) :: aa(space%dim), bb(space%dim), time_
1742 real(real64),
allocatable :: vp(:,:)
1743 real(real64),
allocatable :: velectric(:)
1744 type(lasers_t),
pointer :: lasers
1745 type(gauge_field_t),
pointer :: gfield
1748 call profiling_in(
"HAMILTONIAN_ELEC_UPDATE_EXT_POT")
1750 this%current_time = m_zero
1751 this%current_time = time(1)
1754 call this%hm_base%clear(mesh%np)
1757 call this%hm_base%allocate_field(mesh, field_potential, &
1758 complex_potential = this%abs_boundaries%abtype == imaginary_absorbing)
1763 lasers => list_get_lasers(ext_partners)
1764 if(
associated(lasers))
then
1765 do ilaser = 1, lasers%no_lasers
1766 select case (laser_kind(lasers%lasers(ilaser)))
1767 case (e_field_scalar_potential, e_field_electric)
1768 safe_allocate(velectric(1:mesh%np))
1769 do ispin = 1, this%d%spin_channels
1771 call laser_potential(lasers%lasers(ilaser), mesh, velectric, time_)
1774 this%hm_base%potential(ip, ispin) = this%hm_base%potential(ip, ispin) + mu(itime) * velectric(ip)
1777 safe_deallocate_a(velectric)
1778 case (e_field_magnetic)
1779 call this%hm_base%allocate_field(mesh, field_vector_potential + field_uniform_magnetic_field, .false.)
1781 safe_allocate(vp(1:mesh%np, 1:space%dim))
1782 vp(1:mesh%np, 1:space%dim) = m_zero
1783 call laser_vector_potential(lasers%lasers(ilaser), mesh, vp, time_)
1784 do idir = 1, space%dim
1787 this%hm_base%vector_potential(idir, ip) = this%hm_base%vector_potential(idir, ip) &
1788 + mu(itime) * vp(ip, idir)/p_c
1793 call laser_field(lasers%lasers(ilaser), bb(1:space%dim), time_)
1794 this%hm_base%uniform_magnetic_field = this%hm_base%uniform_magnetic_field &
1796 safe_deallocate_a(vp)
1797 case (e_field_vector_potential)
1798 call this%hm_base%allocate_field(mesh, field_uniform_vector_potential, .false.)
1801 call laser_field(lasers%lasers(ilaser), aa, time_)
1802 this%hm_base%uniform_vector_potential(1:space%dim) = this%hm_base%uniform_vector_potential(1:space%dim) &
1803 - mu(itime) * aa/p_c
1809 gfield => list_get_gauge_field(ext_partners)
1810 if (
associated(gfield))
then
1811 call this%hm_base%allocate_field(mesh, field_uniform_vector_potential, .false.)
1812 call gauge_field_get_vec_pot(gfield, aa)
1813 this%hm_base%uniform_vector_potential(1:space%dim) = this%hm_base%uniform_vector_potential(1:space%dim) - aa/p_c
1820 if (
allocated(this%ep%e_field) .and.
associated(gfield))
then
1821 this%hm_base%uniform_vector_potential(1:space%periodic_dim) = &
1822 this%hm_base%uniform_vector_potential(1:space%periodic_dim) - time_*this%ep%e_field(1:space%periodic_dim)
1828 if (
allocated(this%ep%a_static))
then
1829 call this%hm_base%allocate_field(mesh, field_vector_potential, .false.)
1833 do idir = 1, space%dim
1834 this%hm_base%vector_potential(idir, ip) = this%hm_base%vector_potential(idir, ip) + this%ep%a_static(ip, idir)
1840 call this%hm_base%accel_copy_pot(mesh)
1843 if (
allocated(this%ep%b_field))
then
1844 call this%hm_base%allocate_field(mesh, field_uniform_magnetic_field, .false.)
1846 this%hm_base%uniform_magnetic_field(idir) = this%hm_base%uniform_magnetic_field(idir) + this%ep%b_field(idir)
1850 call this%hm_base%update_magnetic_terms(mesh, this%ep%gyromagnetic_ratio, this%d%ispin)
1856 call profiling_out(
"HAMILTONIAN_ELEC_UPDATE_EXT_POT")
1865 if ((.not. this%kpoints%gamma_only()) .or.
allocated(this%hm_base%uniform_vector_potential))
then
1867 call profiling_in(
'UPDATE_PHASES')
1869 do iatom = 1, this%ep%natoms
1870 call projector_init_phases(this%ep%proj(iatom), space%dim, this%d, this%der%boundaries, this%kpoints, &
1871 vec_pot = this%hm_base%uniform_vector_potential, vec_pot_var = this%hm_base%vector_potential)
1874 call profiling_out(
'UPDATE_PHASES')
1877 if (
allocated(this%hm_base%uniform_vector_potential))
then
1878 call this%phase%update(mesh, this%d%kpt, this%kpoints, this%d, space, this%hm_base%uniform_vector_potential)
1882 if (this%ep%requires_generalized_overlap)
then
1886 if (this%aug_inverse_overlap%ovlp_inv%use_global_coupling)
then
1887 if (.not. this%aug_inverse_overlap%ovlp_inv%coupling_built .or. this%phase%is_allocated())
then
1888 call this%aug_inverse_overlap%ovlp_inv%build(this%aug_inverse_overlap%projector_matrices, &
1889 this%aug_inverse_overlap%projector_phases, mesh, this%d%kpt%start, this%d%kpt%end)
1907 type(nonlocal_pseudopotential_t),
intent(inout) :: nlpp
1908 logical,
optional,
intent(in) :: async
1910 integer :: ik, imat, nmat, max_npoints, offset, iphase, nphase, ip, iatom
1914 if (this%phase%is_allocated() .and.
allocated(nlpp%projector_matrices))
then
1916 max_npoints = nlpp%max_npoints
1917 nmat = nlpp%nprojector_matrices
1920 if (this%der%boundaries%spiralBC) nphase = 3
1922 if (.not.
allocated(nlpp%projector_phases))
then
1923 safe_allocate(nlpp%projector_phases(1:max_npoints, 1:nphase, nmat, this%d%kpt%start:this%d%kpt%end))
1924 if (accel_is_enabled())
then
1925 call accel_create_buffer(nlpp%buff_projector_phases, accel_mem_read_only, &
1926 type_cmplx, nlpp%total_points*nphase*this%d%kpt%nlocal())
1929 nlpp%nphase = nphase
1934 do ik = this%d%kpt%start, this%d%kpt%end
1935 do imat = 1, nlpp%nprojector_matrices
1936 iatom = nlpp%projector_to_atom(imat)
1937 do iphase = 1, nphase
1939 do ip = 1, nlpp%projector_matrices(imat)%npoints
1940 nlpp%projector_phases(ip, iphase, imat, ik) = this%ep%proj(iatom)%phase(ip, iphase, ik)
1943 if (accel_is_enabled() .and. nlpp%projector_matrices(imat)%npoints > 0)
then
1944 call accel_write_buffer(nlpp%buff_projector_phases, &
1945 nlpp%projector_matrices(imat)%npoints, nlpp%projector_phases(1:, iphase, imat, ik), &
1946 offset = offset, async=optional_default(async, .false.))
1948 offset = offset + nlpp%projector_matrices(imat)%npoints
1960 logical,
intent(in) :: states_are_real
1964 if (hm%self_induced_magnetic)
then
1965 if (.not. states_are_real)
then
1968 message(1) =
'No current density for real states since it is identically zero.'
1969 call messages_warning(1)
1978 type(namespace_t),
intent(in) :: namespace
1979 type(grid_t),
intent(in) :: gr
1980 type(states_elec_t),
intent(inout) :: st
1981 type(states_elec_t),
intent(inout) :: hst
1983 integer :: ik, ib, ist
1984 complex(real64),
allocatable :: psi(:, :)
1985 complex(real64),
allocatable :: psiall(:, :, :, :)
1989 do ik = st%d%kpt%start, st%d%kpt%end
1990 do ib = st%group%block_start, st%group%block_end
1995 if (oct_exchange_enabled(hm%oct_exchange))
then
1997 safe_allocate(psiall(gr%np_part, 1:hst%d%dim, st%st_start:st%st_end, st%d%kpt%start:st%d%kpt%end))
1999 call states_elec_get_state(st, gr, psiall)
2001 call oct_exchange_prepare(hm%oct_exchange, gr, psiall, hm%xc, hm%psolver, namespace)
2003 safe_deallocate_a(psiall)
2005 safe_allocate(psi(gr%np_part, 1:hst%d%dim))
2009 call states_elec_get_state(hst, gr, ist, ik, psi)
2010 call oct_exchange_operator(hm%oct_exchange, namespace, gr, psi, ist, ik)
2011 call states_elec_set_state(hst, gr, ist, ik, psi)
2015 safe_deallocate_a(psi)
2037 type(namespace_t),
intent(in) :: namespace
2038 real(real64),
intent(in) :: mass
2042 if (parse_is_defined(namespace,
'ParticleMass'))
then
2043 message(1) =
'Attempting to redefine a non-unit electron mass'
2044 call messages_fatal(1)
2055 class(mesh_t),
intent(in) :: mesh
2056 real(real64),
contiguous,
intent(out) :: diag(:,:)
2057 integer,
intent(in) :: ik
2059 integer :: idim, ip, ispin
2061 real(real64),
allocatable :: ldiag(:)
2065 safe_allocate(ldiag(1:mesh%np))
2069 call derivatives_lapl_diag(hm%der, ldiag)
2072 do idim = 1, hm%d%dim
2075 diag(ip, idim) = -m_half/hm%mass*ldiag(ip)
2080 select case (hm%d%ispin)
2082 case (unpolarized, spin_polarized)
2083 ispin = hm%d%get_spin_index(ik)
2086 diag(ip, 1) = diag(ip, 1) + hm%ep%vpsl(ip)
2092 diag(ip, 1) = diag(ip, 1) + hm%ep%vpsl(ip)
2093 diag(ip, 2) = diag(ip, 2) + hm%ep%vpsl(ip)
2098 call hm%ks_pot%add_vhxc(diag)
2107#include "hamiltonian_elec_inc.F90"
2110#include "complex.F90"
2111#include "hamiltonian_elec_inc.F90"
subroutine build_external_potentials()
subroutine external_potentials_checks()
subroutine build_interactions()
constant times a vector plus a vector
Copies a vector x, to a vector y.
integer, parameter, public imaginary_absorbing
subroutine, public absorbing_boundaries_end(this)
subroutine, public absorbing_boundaries_init(this, namespace, space, gr)
pure logical function, public accel_allow_cpu_only()
subroutine, public accel_finish()
pure logical function, public accel_is_enabled()
This module implements batches of mesh functions.
This module implements common operations on batches of mesh functions.
Module implementing boundary conditions in Octopus.
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
real(real64) function, public derivatives_lapl_get_max_eigenvalue(this)
Get maximum eigenvalue of discrete Laplacian. For the star and star_general stencils,...
integer, parameter, public unpolarized
Parameters...
integer, parameter, public spinors
subroutine, public energy_copy(ein, eout)
subroutine, public epot_generate(ep, namespace, mesh, ions, st_d, kpt_st_grp)
subroutine, public epot_bind_poisson_solver(ep, psolver)
Bind the Poisson solver if the potential manages a density. The Poisson solver pointer is aliased whe...
logical function, public epot_have_external_potentials(ep)
integer, parameter, public scalar_relativistic_zora
subroutine, public epot_end(ep)
integer, parameter, public fully_relativistic_zora
subroutine, public epot_set_shared_paw_xc(ep, functl)
Point every PAW one-center engine at the shared xc functional.
subroutine, public epot_init(ep, namespace, gr, ions, psolver, ispin, xc_family, kpoints, xc_id)
subroutine, public exchange_operator_init(this, namespace, space, st, der, mc, stencil, kpoints, cam)
subroutine, public exchange_operator_end(this)
logical function, public list_has_gauge_field(partners)
type(gauge_field_t) function, pointer, public list_get_gauge_field(partners)
logical function, public list_has_lasers(partners)
type(lasers_t) function, pointer, public list_get_lasers(partners)
integer, parameter, public external_pot_from_file
potential, defined in a file
subroutine, public load_external_potentials(external_potentials, namespace)
integer, parameter, public external_pot_charge_density
user-defined function for charge density
integer, parameter, public external_pot_usdef
user-defined function for local potential
integer, parameter, public external_pot_static_efield
Static electric field.
integer, parameter, public external_pot_static_bfield
Static magnetic field.
subroutine, public external_potential_clone(pot_out, pot_in)
Deep-clone an external potential instance.
subroutine, public gauge_field_get_vec_pot(this, vec_pot)
real(real64), parameter, public m_two
real(real64), parameter, public m_zero
integer, parameter, public rdmft
integer, parameter, public hartree_fock
integer, parameter, public independent_particles
Theory level.
integer, parameter, public generalized_kohn_sham_dft
integer, parameter, public kohn_sham_dft
real(real64), parameter, public m_epsilon
real(real64), parameter, public p_c
Electron gyromagnetic ratio, see Phys. Rev. Lett. 130, 071801 (2023)
real(real64), parameter, public m_one
This module implements the underlying real-space grid.
This module defines an abstract class for Hamiltonians.
integer, parameter, public field_uniform_magnetic_field
integer, parameter, public field_uniform_vector_potential
integer, parameter, public field_vector_potential
integer, parameter, public term_mgga
subroutine, public hamiltonian_elec_base_accel_rebuild(this, mesh)
Rebuild accelerator buffers after an intrinsic copy.
integer, parameter, public field_potential
subroutine, public zhamiltonian_elec_apply_overlap_single(hm, namespace, mesh, psi, spsi, ist, ik, set_bc, set_phase, inverse)
Apply the overlap S (or its inverse) to a single state (wrapper around the batch routine).
subroutine, public dhamiltonian_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).
subroutine, public hamiltonian_elec_xc_nhat(this, mesh, nhat)
PAW with the Bloechl compensation scheme (usexcnhat = false): the compensation charge n^hat_s(r) = su...
subroutine, public zhamiltonian_elec_apply_overlap_batch(hm, namespace, mesh, psib, spsib, set_bc, inverse, set_phase)
Apply the generalized ultrasoft overlap operator S (or its inverse) to a batch.
pure logical function, public hamiltonian_elec_apply_packed(this)
subroutine, public hamiltonian_elec_set_inh(hm, st)
subroutine, public zvmask(mesh, hm, st)
subroutine, public dhamiltonian_elec_apply_batch(hm, namespace, mesh, psib, hpsib, terms, set_bc, set_phase, spsib)
subroutine, public hamiltonian_elec_adjoint(hm)
subroutine, public hamiltonian_elec_end(hm)
subroutine, public zhamiltonian_elec_apply_single(hm, namespace, mesh, psi, hpsi, ist, ik, terms, set_bc, set_phase)
pure logical function hamiltonian_elec_needs_mgga_term(hm, terms)
logical function, public hamiltonian_elec_has_kick(hm)
integer, parameter, public length
subroutine hamiltonian_elec_build_projector_phases(this, nlpp, async)
Build the projector phases for a given nonlocal-pseudopotential set.
logical function hamiltonian_elec_hermitian(hm)
subroutine, public dhamiltonian_elec_apply_single(hm, namespace, mesh, psi, hpsi, ist, ik, terms, set_bc, set_phase)
subroutine, public hamiltonian_elec_epot_generate(this, namespace, space, gr, ions, ext_partners, st, time)
real(real64) function, public hamiltonian_elec_get_time(this)
subroutine, public zhamiltonian_elec_apply_batch(hm, namespace, mesh, psib, hpsib, terms, set_bc, set_phase, spsib)
subroutine, public hamiltonian_elec_copy(hm_out, hm_in)
Deep-copy a hamiltonian_elec_t snapshot.
subroutine, public zhamiltonian_elec_apply_sinvh_single(hm, namespace, mesh, psi, hspsi, ist, ik, terms, set_bc, set_phase)
Apply A = S^{-1} H to a single state (wrapper around the batch routine).
subroutine, public dhamiltonian_elec_apply_sinvh_single(hm, namespace, mesh, psi, hspsi, ist, ik, terms, set_bc, set_phase)
Apply A = S^{-1} H to a single state (wrapper around the batch routine).
subroutine, public dhamiltonian_elec_apply_overlap_batch(hm, namespace, mesh, psib, spsib, set_bc, inverse, set_phase)
Apply the generalized ultrasoft overlap operator S (or its inverse) to a batch.
subroutine, public dvmask(mesh, hm, st)
logical function, public hamiltonian_elec_needs_current(hm, states_are_real)
subroutine, public hamiltonian_elec_remove_inh(hm)
subroutine, public dhamiltonian_elec_apply_overlap_single(hm, namespace, mesh, psi, spsi, ist, ik, set_bc, set_phase, inverse)
Apply the overlap S (or its inverse) to a single state (wrapper around the batch routine).
subroutine, public zhamiltonian_elec_apply_atom(hm, namespace, space, latt, species, pos, ia, mesh, psi, vpsi)
subroutine hamiltonian_elec_release_copy_owned(hm)
Release owned pointer targets created by hamiltonian_elec_copy.
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).
subroutine, public hamiltonian_elec_diagonal(hm, mesh, diag, ik)
subroutine, public hamiltonian_elec_update_pot(this, mesh, accumulate)
Update the KS potential of the electronic Hamiltonian.
integer, parameter, public velocity
subroutine hamiltonian_elec_update(this, mesh, namespace, space, ext_partners, time)
(re-)build the Hamiltonian for the next application:
subroutine hamiltonian_elec_copy_guard_supported(hm_in)
Hard-fail guard matrix for unsupported hamiltonian snapshots.
subroutine hamiltonian_elec_span(hm, delta, emin, namespace)
subroutine, public hamiltonian_elec_init(hm, namespace, space, gr, ions, ext_partners, st, theory_level, xc, mc, kpoints, need_exchange, xc_photons)
subroutine dhamiltonian_elec_apply(hm, namespace, mesh, psib, hpsib, terms, set_bc)
pure logical function, public hamiltonian_elec_inh_term(hm)
subroutine hamiltonian_elec_set_mass(this, namespace, mass)
set the effective electron mass, checking whether it was previously redefined.
subroutine, public hamiltonian_elec_update_with_ext_pot(this, mesh, space, ext_partners, time, mu)
This is an extension of "hamiltonian_elec_update_pot" to be used by the CFM4 propagator....
subroutine, public hamiltonian_elec_not_adjoint(hm)
subroutine, public zhamiltonian_elec_external(this, mesh, psib, vpsib)
subroutine zhamiltonian_elec_apply(hm, namespace, mesh, psib, hpsib, terms, set_bc)
This module defines classes and functions for interaction partners.
subroutine, public kick_copy(kick_out, kick_in)
integer, parameter, public kick_magnon_mode
subroutine, public kick_end(kick)
subroutine, public kick_init(kick, namespace, space, kpoints, nspin)
pure integer function, public kick_get_type(kick)
A module to handle KS potential, without the external potential.
subroutine, public ks_potential_accel_rebuild(this)
Rebuild accelerator buffers after an intrinsic copy.
subroutine, public laser_vector_potential(laser, mesh, aa, time)
subroutine, public lasers_nondipole_laser_field_step(this, field, time)
Retrieves the NDSFA vector_potential correction. The nondipole field is obtained for consecutive time...
logical function, public lasers_with_nondipole_field(lasers)
Check if a nondipole SFA correction should be computed for the given laser.
integer, parameter, public e_field_electric
integer, parameter, public e_field_vector_potential
subroutine, public laser_potential(laser, mesh, pot, time)
integer, parameter, public e_field_scalar_potential
integer pure elemental function, public laser_kind(laser)
subroutine, public laser_field(laser, field, time)
Retrieves the value of either the electric or the magnetic field. If the laser is given by a scalar p...
integer, parameter, public e_field_magnetic
integer, parameter, public dft_u_none
subroutine, public lda_u_init(this, namespace, space, level, gr, ions, st, mc, kpoints)
subroutine, public lda_u_accel_rebuild(this, kpt)
Rebuild DFT+U accelerator buffers after intrinsic assignment.
subroutine, public lda_u_rebind_after_copy(this, ions)
Rebind non-owning pointers after intrinsic assignment of lda_u_t.
subroutine, public lda_u_build_phase_correction(this, space, std, boundaries, namespace, kpoints, vec_pot, vec_pot_var)
Build the phase correction to the global phase for all orbitals.
subroutine, public lda_u_end(this)
subroutine, public lda_u_update_basis(this, space, gr, ions, st, psolver, namespace, kpoints, has_phase, aug_overlap)
This module implements fully polymorphic linked lists, and some specializations thereof.
This modules implements the routines for doing constrain DFT for noncollinear magnetism.
subroutine, public magnetic_constrain_copy(this_out, this_in)
Deep-copy magnetic constrain data.
subroutine, public magnetic_constrain_end(this)
Releases memory of the magnetic constrain.
subroutine, public magnetic_constrain_init(this, namespace, mesh, std, natoms, min_dist)
Initilializes the magnetic_constrain_t object.
This module is intended to contain "only mathematical" functions and procedures.
This module defines various routines, operating on mesh functions.
This module defines the meshes, which are used in Octopus.
subroutine, public messages_not_implemented(feature, namespace)
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_experimental(name, namespace)
subroutine mpi_grp_copy(mpi_grp_out, mpi_grp_in)
MPI_THREAD_FUNNELED allows for calls to MPI from an OMP region if the thread is the team master.
This module handles the communicators for the various parallelization strategies.
subroutine, public mxll_coupling_init(this, d, gr, namespace, mass)
Parse variables and initialize Maxwell coupling.
subroutine, public set_electric_quadrupole_pot(this, mesh)
Computes the electric quadrupole potential where .
subroutine, public mxll_coupling_end(this)
Finalize and deallocate Maxwell coupling arrays.
subroutine, public mxll_coupling_calc(this, hm_base, mesh, d, space)
Add the Maxwell coupling to the electronic Hamiltonian.
subroutine, public mxll_coupling_copy(this_out, this_in, der_target)
Deep-copy Maxwell-electron coupling data and rebind derivatives.
subroutine, public nonlocal_pseudopotential_aug_density(this, mesh, epot, force_aug_weight, aug_density)
Accumulate the ultrasoft augmentation density n_aug(r) = sum_ij rho_ij Q_ij(r-R) (summed over all ult...
subroutine, public nonlocal_pseudopotential_accel_rebuild(this, space, mesh)
Rebuild accelerator buffers after an intrinsic copy.
subroutine, public nonlocal_pseudopotential_share_projector_data(this, donor)
Alias the heavy per-point projector data of a donor instance.
subroutine, public nonlocal_pseudopotential_rebind_projectors(this, epot)
Rebind projector matrix pointers (map, position) to a target epot.
subroutine, public nonlocal_pseudopotential_detach_copy(this, donor)
Detach the projector data of an instance obtained by intrinsic assignment.
subroutine, public nonlocal_pseudopotential_update_dij(this, mesh, epot, veff, add_bare, onsite_density_matrix)
Screen the ultrasoft nonlocal coupling matrix D_ij with the local potential.
subroutine, public nonlocal_pseudopotential_build_paw_symm(this, epot, space, gr, ions)
Build the crystal-symmetry data used to symmetrize the PAW one-center density matrix.
logical function, public oct_exchange_enabled(this)
subroutine, public oct_exchange_remove(this)
this module contains the low-level part of the output system
Some general things and nomenclature:
logical function, public parse_is_defined(namespace, name)
All-electron reconstruction of mesh fields from the PAW one-center terms.
subroutine, public paw_ae_build_current_basis(this, epot, dim)
Tabulate the one-center all-electron current basis on each projector sphere.
subroutine, public pcm_calc_pot_rs(pcm, mesh, psolver, ions, v_h, v_ext, kick, time_present, kick_time)
subroutine, public pcm_end(pcm)
subroutine, public pcm_init(pcm, namespace, space, ions, grid, qtot, val_charge, external_potentials_present, kick_present)
Initializes the PCM calculation: reads the VdW molecular cavity and generates the PCM response matrix...
subroutine, public phase_accel_rebuild(phase, mesh, kpt)
Rebuild phase accelerator buffers after an intrinsic copy.
subroutine, public poisson_init(this, namespace, space, der, mc, stencil, qtot, label, solver, verbose, force_serial, force_cmplx, fft_library, fft_batch_size, single_precision)
subroutine, public poisson_end(this)
/* 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 projector_init_phases(this, dim, std, bnd, kpoints, vec_pot, vec_pot_var)
subroutine, public scissor_end(this)
subroutine, public states_set_complex(st)
pure logical function, public states_are_real(st)
This module handles spin dimensions of the states and the k-point distribution.
subroutine, public states_elec_dim_copy(dout, din)
subroutine, public states_elec_dim_end(dim)
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
This module provides routines for communicating states when using states parallelization.
integer pure function, public symmetries_identity_index(this)
integer pure function, public symmetries_number(this)
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
This module defines the unit system, used for input and output.
type(unit_system_t), public units_inp
the units systems for reading and writing
type(xc_cam_t), parameter, public cam_exact_exchange
Use only Hartree Fock exact exchange.
logical pure function, public xc_functional_needs_shared_paw_handle(functl)
Whether a functional has an external parameter recomputed from the density each SCF step the PAW one-...
integer, parameter, public xc_oep_x_slater
Slater approximation to the exact exchange.
integer, parameter, public func_c
integer, parameter, public func_x
logical pure function, public family_is_mgga_with_exc(xcs)
Is the xc function part of the mGGA family with an energy functional.
logical pure function, public family_is_hybrid(xcs)
Returns true if the functional is an hybrid functional.
This module implements the "photon-free" electron-photon exchange-correlation functional.
This module implements the ZORA terms for the Hamoiltonian.
Extension of space that contains the knowledge of the spin dimension.
Description of the grid, containing information on derivatives, stencil, and symmetries.
The abstract Hamiltonian class defines a skeleton for specific implementations.
abstract class for general interaction partners
iterator for the list of partners
Describes mesh distribution to nodes.
Stores all communicators and groups.
The states_elec_t class contains all electronic wave functions.
This class described the 'photon-exchange' electron-photon xc functionals, based on QEDFT.
This class is responsible for calculating and applying the ZORA.