Encapsulate implementation of mxll-matter coupling in new module
The goal is to move out stuff from hamiltonian_elec.
The result would look like this:
in hamiltonian_elec.F90
:
! in hamiltonian_elec_t
if (this%mxll_coupling_mode)
call init_mxll_coupling(this%hm_base, mesh, d)
endif
! in the new module
module some-maxwell-module
contains
subroutine init_mxll_coupling(hm_base, mesh, d, maxwell, center_of_mass)
! Declarations here
...
select case(mxll_coupling_mode)
case (LENGTH_GAUGE_DIPOLE)
do ispin = 1, this%d%spin_channels
do ip = 1, mesh%np
! The -1 sign is missing here. Check epot.F90 for the explanation.
hm_base%potential(ip, ispin) = hm_base%potential(ip, ispin) + &
sum(maxwell%field_dip(1:space%dim) * (mesh%x(ip, 1:space%dim) - center_of_mass))
end do
end do
case (VELOCITY_GAUGE_DIPOLE)
call hm_base%allocate_field(mesh, FIELD_UNIFORM_VECTOR_POTENTIAL, .false.)
hm_base%uniform_vector_potential(1:space%dim) = hm_base%uniform_vector_potential(1:space%dim) + field_mxll_dip(1:space%dim)
case (FULL_MINIMAL_COUPLING)
call hm_base%allocate_field(mesh, FIELD_VECTOR_POTENTIAL, .false.)
do idir = 1, mesh%box%dim
hm_base%vector_potential(idir, :) = hm_base%vector_potential(idir, :) + maxwell%field(:, idir)
case (...)
...
end do
end select
end subroutine
end module
Suggested by @AlexBuccheri in MR !2141 (merged)
Implemented in MR !2179 (merged)
Edited by Franco Bonafé