26 use,
intrinsic :: iso_fortran_env
44 integer,
parameter :: COS2 = 1
57 logical,
public :: grid_based_partner = .
true.
58 complex(real64),
allocatable :: rs_current(:, :)
61 integer,
public :: partner_np = 0
62 real(real64),
allocatable,
public :: partner_charge(:)
63 real(real64),
allocatable,
public :: partner_pos(:,:)
64 real(real64),
allocatable,
public :: partner_vel(:,:)
67 real(real64) :: reg_width
68 real(real64),
allocatable :: reg(:)
70 type(space_t),
pointer :: system_space => null()
71 type(lattice_vectors_t),
pointer :: system_latt => null()
94 class(current_to_mxll_field_t),
intent(inout) :: this
95 type(grid_t),
target,
intent(in) :: gr
96 integer,
intent(in) :: ndim
101 safe_allocate(this%rs_current(1:gr%np, 1:ndim))
108 class(interaction_partner_t),
target,
intent(inout) :: partner
109 class(current_to_mxll_field_t),
pointer :: this
115 this%label =
"current_to_mxll_field"
116 this%partner => partner
122 this%couplings_from_partner = [
"current"]
137 call parse_variable(partner%namespace,
'RegularizationFunction', cos2, this%reg_type)
152 call parse_variable(partner%namespace,
'RegularizationFunctionWidth', 2.0_real64, &
155 this%intra_interaction = .false.
168 this%system_space => space
169 this%system_latt => latt
181 nullify(this%system_space)
182 nullify(this%system_latt)
183 safe_deallocate_a(this%rs_current)
192 integer :: part_ind, i_dim, ip
194 real(real64) :: norm, time
198 if(this%grid_based_partner)
then
199 call this%regridding%do_transfer(this%system_field, this%partner_field)
201 this%system_field =
m_zero
202 do part_ind = 1, this%partner_np
203 call submesh_init(submesh, this%system_space, this%system_gr, &
204 this%system_latt, this%partner_pos(:,part_ind), this%reg_width)
206 safe_allocate(this%reg(1:submesh%np))
207 if (this%reg_type == cos2)
then
208 do ip = 1, submesh%np
209 this%reg(ip) =
cos( (
m_pi/
m_two) * (submesh%r(ip)/this%reg_width) )**2
215 do i_dim = 1, this%system_space%dim
217 this%partner_charge(part_ind)*this%partner_vel(i_dim,part_ind)/norm)
219 safe_deallocate_a(this%reg)
227 assert(this%interpolation_initialized)
228 associate(coupling => this%partner%quantities%get(this%couplings_from_partner(1)))
229 time = coupling%iteration%value()
231 call this%interpolation%add_time(time, this%rs_current)
double cos(double __x) __attribute__((__nothrow__
subroutine current_to_mxll_field_init_space_latt(this, space, latt)
subroutine current_to_mxll_field_finalize(this)
class(current_to_mxll_field_t) function, pointer current_to_mxll_field_constructor(partner)
subroutine current_to_mxll_field_do_mapping(this)
subroutine current_to_mxll_field_init(this, gr, ndim)
subroutine current_to_mxll_field_calculate_energy(this)
This module implements the field transfer.
subroutine, public field_transfer_init(this, gr, ndim)
the system field is allocated and initialized to 0
real(real64), parameter, public m_two
real(real64), parameter, public m_zero
real(real64), parameter, public m_pi
some mathematical constants
This module implements the underlying real-space grid.
This module defines classes and functions for interaction partners.
This module defines the meshes, which are used in Octopus.
subroutine, public messages_input_error(namespace, var, details, row, column)
Implementation details for regridding.
subroutine, public build_rs_current_state(current_state, mesh, rs_current_state, ep_field, np)
real(real64) function, public dsm_integrate(mesh, sm, ff, reduce)
subroutine, public submesh_end(this)
subroutine, public submesh_init(this, space, mesh, latt, center, rc)
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
Class to transfer a current to a Maxwell field.
class defining the field_transfer interaction
A submesh is a type of mesh, used for the projectors in the pseudopotentials It contains points on a ...