101    logical             :: bc_add_ab_region  = .false.
 
  102    logical             :: bc_zero           = .false.
 
  103    logical             :: bc_constant       = .false.
 
  104    logical             :: bc_mirror_pec     = .false.
 
  105    logical             :: bc_mirror_pmc     = .false.
 
  106    logical             :: bc_periodic       = .false.
 
  107    logical             :: bc_plane_waves    = .false.
 
  108    logical             :: bc_medium         = .false.
 
  109    type(exponential_t) :: te
 
  110    logical             :: plane_waves_in_box
 
  111    integer             :: tr_etrs_approx
 
  114  integer, 
public, 
parameter ::   &
 
  115    RS_TRANS_FORWARD  = 1,       &
 
  118  integer, 
parameter ::    &
 
  119    MXWLL_ETRS_FULL  = 0,  &
 
  126    type(grid_t),                 
intent(in)    :: gr
 
  127    type(namespace_t),            
intent(in)    :: namespace
 
  128    type(states_mxll_t),          
intent(inout) :: st
 
  129    type(hamiltonian_mxll_t),     
intent(inout) :: hm
 
  130    type(propagator_mxll_t),      
intent(inout) :: tr
 
  132    integer :: nlines, ncols, icol
 
  134    character(len=256) :: string
 
  135    logical :: plane_waves_set
 
  141    plane_waves_set = .false.
 
  172    if (
parse_block(namespace, 
'MaxwellBoundaryConditions', blk) == 0) 
then 
  177      if (nlines /= 1) 
then 
  182        call messages_input_error(namespace, 
'MaxwellBoundaryConditions', 
'should consist of three columns')
 
  191      select case (hm%bc%bc_type(icol))
 
  203        string = 
'PEC Mirror' 
  205        hm%bc_mirror_pec = .
true.
 
  207        string = 
'PMC Mirror' 
  208        tr%bc_mirror_pmc = .
true.
 
  209        hm%bc_mirror_pmc = .
true.
 
  212        tr%bc_periodic = .
true.
 
  213        hm%bc_periodic = .
true.
 
  215        string = 
'Plane waves' 
  216        plane_waves_set = .
true.
 
  217        tr%bc_plane_waves = .
true.
 
  219        hm%plane_waves = .
true.
 
  220        hm%bc_plane_waves = .
true.
 
  221        hm%bc_add_ab_region = .
true.
 
  223        string = 
'Medium boundary' 
  225        write(
message(1),
'(a)') 
'Unknown Maxwell boundary condition' 
  228      write(
message(1),
'(a,I1,a,a)') 
'Maxwell boundary condition in direction ', icol, 
': ', trim(string)
 
  230      if (plane_waves_set .and. .not. (
parse_is_defined(namespace, 
'MaxwellIncidentWaves'))) 
then 
  231        write(
message(1),
'(a)') 
'Input: Maxwell boundary condition option is set to "plane_waves".' 
  232        write(
message(2),
'(a)') 
'Input: User defined Maxwell plane waves have to be defined!' 
  239      safe_allocate(st%rs_state_const(1:st%dim))
 
  240      st%rs_state_const = 
m_z0 
  254    call parse_variable(namespace, 
'MaxwellTDETRSApprox', mxwll_etrs_full, tr%tr_etrs_approx)
 
  264    call parse_variable(namespace, 
'MaxwellPlaneWavesInBox', .false., tr%plane_waves_in_box)
 
  265    if (tr%plane_waves_in_box .and. .not. hm%bc%do_plane_waves) 
then 
  282  subroutine mxll_propagation_step(hm, namespace, gr, space, st, tr, rs_stateb, ff_rs_inhom_t1, ff_rs_inhom_t2, time, dt)
 
  284    type(namespace_t),          
intent(in)    :: namespace
 
  285    type(
grid_t),               
intent(inout) :: gr
 
  286    class(
space_t),             
intent(in)    :: space
 
  289    type(
batch_t),              
intent(inout) :: rs_stateb
 
  290    complex(real64), 
contiguous,          
intent(in)    :: ff_rs_inhom_t1(:,:)
 
  291    complex(real64), 
contiguous,          
intent(in)    :: ff_rs_inhom_t2(:,:)
 
  292    real(real64),               
intent(in)    :: time
 
  293    real(real64),               
intent(in)    :: dt
 
  295    integer            :: ii, ff_dim, idim, istate, inter_steps
 
  296    real(real64)       :: inter_dt, inter_time
 
  300    type(
batch_t) :: ff_rs_stateb, ff_rs_state_pmlb
 
  301    type(
batch_t) :: ff_rs_inhom_1b, ff_rs_inhom_2b, ff_rs_inhom_meanb
 
  302    complex(real64), 
allocatable :: rs_state(:, :)
 
  309    if (hm%ma_mx_coupling_apply) 
then 
  310      message(1) = 
"Maxwell-matter coupling not implemented yet" 
  313    safe_allocate(rs_state(gr%np, st%dim))
 
  315    if (tr%plane_waves_in_box) 
then 
  319      safe_deallocate_a(rs_state)
 
  325      if (hm%bc%bc_ab_type(idim) == option__maxwellabsorbingboundaries__cpml) 
then 
  331    if (pml_check .and. .not. hm%bc%pml%parameters_initialized) &
 
  338    inter_dt      = 
m_one / inter_steps * dt
 
  340    call zbatch_init(ff_rs_stateb, 1, 1, hm%dim, gr%np_part)
 
  341    if (st%pack_states) 
call ff_rs_stateb%do_pack(copy=.false.)
 
  344      call ff_rs_stateb%copy_to(ff_rs_state_pmlb)
 
  348    if ((hm%ma_mx_coupling_apply .or. hm%current_density_ext_flag .or. hm%current_density_from_medium) .and. &
 
  350      call ff_rs_stateb%copy_to(ff_rs_inhom_1b)
 
  351      call ff_rs_stateb%copy_to(ff_rs_inhom_2b)
 
  352      call ff_rs_stateb%copy_to(ff_rs_inhom_meanb)
 
  354      do istate = 1, hm%dim
 
  355        call batch_set_state(ff_rs_inhom_meanb, istate, gr%np, ff_rs_inhom_t1(:, istate))
 
  356        call batch_set_state(ff_rs_inhom_2b, istate, gr%np, ff_rs_inhom_t2(:, istate))
 
  362      call ff_rs_inhom_meanb%copy_data_to(gr%np, ff_rs_inhom_1b)
 
  363      call ff_rs_inhom_meanb%copy_data_to(gr%np, ff_rs_inhom_2b)
 
  366      hm%cpml_hamiltonian = .false.
 
  367      call tr%te%apply_batch(namespace, gr, hm, ff_rs_inhom_2b, inter_dt)
 
  371      call ff_rs_inhom_meanb%copy_data_to(gr%np, ff_rs_inhom_2b)
 
  373      call tr%te%apply_batch(namespace, gr, hm, ff_rs_inhom_2b, inter_dt*
m_half)
 
  376      call ff_rs_inhom_meanb%copy_data_to(gr%np, ff_rs_inhom_2b)
 
  378      call tr%te%apply_batch(namespace, gr, hm, ff_rs_inhom_2b, -inter_dt*
m_half)
 
  381      call ff_rs_inhom_2b%end()
 
  382      call ff_rs_inhom_meanb%end()
 
  385    do ii = 1, inter_steps
 
  388      inter_time = time + inter_dt * (ii-1)
 
  399      hm%cpml_hamiltonian = pml_check
 
  400      call tr%te%apply_batch(namespace, gr, hm, ff_rs_stateb, dt)
 
  401      hm%cpml_hamiltonian = .false.
 
  408      if ((hm%ma_mx_coupling_apply) .or. hm%current_density_ext_flag .or. hm%current_density_from_medium) 
then 
  409        if (tr%tr_etrs_approx == mxwll_etrs_full) 
then 
  410          call ff_rs_stateb%copy_to(ff_rs_inhom_1b)
 
  411          call ff_rs_stateb%copy_to(ff_rs_inhom_2b)
 
  412          call ff_rs_stateb%copy_to(ff_rs_inhom_meanb)
 
  415          do istate = 1, hm%dim
 
  416            call batch_set_state(ff_rs_inhom_meanb, istate, gr%np, ff_rs_inhom_t2(:, istate))
 
  417            call batch_set_state(ff_rs_inhom_1b, istate, gr%np, ff_rs_inhom_t1(:, istate))
 
  421          call ff_rs_inhom_1b%copy_data_to(gr%np, ff_rs_inhom_2b)
 
  422          call batch_axpy(gr%np, ii / real(inter_steps, real64) , ff_rs_inhom_meanb, ff_rs_inhom_2b)
 
  423          call batch_axpy(gr%np, (ii-1) / real(inter_steps, real64) , ff_rs_inhom_meanb, ff_rs_inhom_1b)
 
  425          hm%cpml_hamiltonian = .false.
 
  426          call tr%te%apply_batch(namespace, gr, hm, ff_rs_inhom_1b, inter_dt)
 
  431          do istate = 1, hm%dim
 
  432            call batch_set_state(ff_rs_inhom_1b, istate, gr%np, ff_rs_inhom_t1(:, istate))
 
  433            call batch_set_state(ff_rs_inhom_2b, istate, gr%np, ff_rs_inhom_t2(:, istate))
 
  437          call ff_rs_inhom_1b%copy_data_to(gr%np, ff_rs_inhom_2b)
 
  439          call tr%te%apply_batch(namespace, gr, hm, ff_rs_inhom_1b, inter_dt/
m_two)
 
  440          call tr%te%apply_batch(namespace, gr, hm, ff_rs_inhom_2b, -inter_dt/
m_two)
 
  446          call ff_rs_inhom_1b%end()
 
  447          call ff_rs_inhom_2b%end()
 
  448          call ff_rs_inhom_meanb%end()
 
  462      if (tr%bc_constant) 
then 
  465        if (st%rs_state_const_external) 
then 
  487      if (any(hm%bc%bc_ab_type == option__maxwellabsorbingboundaries__mask)) 
then 
  493      if (tr%bc_plane_waves) 
then 
  502    if (tr%tr_etrs_approx == option__maxwelltdetrsapprox__const_steps) 
then 
  503      call ff_rs_inhom_1b%end()
 
  506    call ff_rs_stateb%end()
 
  509      call ff_rs_state_pmlb%end()
 
  512    safe_deallocate_a(rs_state)
 
  522    type(namespace_t),          
intent(in)    :: namespace
 
  523    type(
grid_t),               
intent(inout) :: gr
 
  524    class(
space_t),             
intent(in)    :: space
 
  527    real(real64),               
intent(in)    :: time
 
  528    real(real64),               
intent(in)    :: dt
 
  529    integer,                    
intent(in)    :: counter
 
  535    call st%rs_stateb%copy_to(rs_state_tmpb)
 
  543    if (any(hm%bc%bc_ab_type == option__maxwellabsorbingboundaries__cpml)) 
then 
  554    if (counter == 0) 
then 
  556      call batch_xpay(gr%np, st%rs_stateb, dt, rs_state_tmpb)
 
  563    call st%rs_stateb%copy_data_to(gr%np, st%rs_state_prevb)
 
  565    call rs_state_tmpb%copy_data_to(gr%np, st%rs_stateb)
 
  568    if (any(hm%bc%bc_ab_type == option__maxwellabsorbingboundaries__cpml)) 
then 
  572    call rs_state_tmpb%end()
 
  593    type(namespace_t),          
intent(in)    :: namespace
 
  594    type(
grid_t),               
intent(inout) :: gr
 
  595    class(
space_t),             
intent(in)    :: space
 
  598    real(real64),               
intent(in)    :: time
 
  599    real(real64),               
intent(in)    :: dt
 
  605    call st%rs_stateb%copy_to(rs_state_tmpb)
 
  614    if (any(hm%bc%bc_ab_type == option__maxwellabsorbingboundaries__cpml)) 
then 
  620    call hm%zapply(namespace, gr, st%rs_stateb, rs_state_tmpb)
 
  623    if (hm%current_density_ext_flag .or. hm%current_density_from_medium) 
then 
  625      call mxll_set_batch(st%inhomogeneousb, st%rs_current_density_t1, gr%np, st%dim)
 
  630    call tr%te%apply_phi_batch(namespace, gr, hm, rs_state_tmpb, dt, 1)
 
  632    call batch_axpy(gr%np, dt, rs_state_tmpb, st%rs_stateb)
 
  634    call rs_state_tmpb%end()
 
  637    if (any(hm%bc%bc_ab_type == option__maxwellabsorbingboundaries__cpml)) 
then 
  666    type(namespace_t),          
intent(in)    :: namespace
 
  667    type(
grid_t),               
intent(inout) :: gr
 
  668    class(
space_t),             
intent(in)    :: space
 
  671    real(real64),               
intent(in)    :: time
 
  672    real(real64),               
intent(in)    :: dt
 
  678    call st%rs_stateb%copy_to(rs_state_tmpb)
 
  687    if (any(hm%bc%bc_ab_type == option__maxwellabsorbingboundaries__cpml)) 
then 
  693    call hm%zapply(namespace, gr, st%rs_stateb, rs_state_tmpb)
 
  696    if (hm%current_density_ext_flag .or. hm%current_density_from_medium) 
then 
  698      call mxll_set_batch(st%inhomogeneousb, st%rs_current_density_t1, gr%np, st%dim)
 
  702      call mxll_set_batch(st%inhomogeneousb, st%rs_current_density_t2, gr%np, st%dim)
 
  707    call tr%te%apply_phi_batch(namespace, gr, hm, rs_state_tmpb, dt, 1)
 
  709    call batch_axpy(gr%np, dt, rs_state_tmpb, st%rs_stateb)
 
  710    if (hm%current_density_ext_flag .or. hm%current_density_from_medium) 
then 
  713      call mxll_set_batch(st%inhomogeneousb, st%rs_current_density_t1, gr%np, st%dim)
 
  717      call mxll_set_batch(st%inhomogeneousb, st%rs_current_density_t2, gr%np, st%dim)
 
  722      call tr%te%apply_phi_batch(namespace, gr, hm, rs_state_tmpb, dt, 2)
 
  724      call batch_axpy(gr%np, dt, rs_state_tmpb, st%rs_stateb)
 
  728    if (any(hm%bc%bc_ab_type == option__maxwellabsorbingboundaries__cpml)) 
then 
  732    call rs_state_tmpb%end()
 
  740    type(
grid_t),             
intent(in)    :: gr
 
  743    integer :: ip, ip_in, il, idim
 
  747    assert(
allocated(st%ep) .and. 
allocated(st%mu))
 
  751    if (hm%calc_medium_box) 
then 
  752      do il = 1, 
size(hm%medium_boxes)
 
  753        assert(.not. hm%medium_boxes(il)%has_mapping)
 
  754        do ip = 1, hm%medium_boxes(il)%points_number
 
  755          if (abs(hm%medium_boxes(il)%c(ip)) <= 
m_epsilon) cycle
 
  756          st%ep(ip) = hm%medium_boxes(il)%ep(ip)
 
  757          st%mu(ip) = hm%medium_boxes(il)%mu(ip)
 
  764        do ip_in = 1, hm%bc%medium(idim)%points_number
 
  765          ip = hm%bc%medium(idim)%points_map(ip_in)
 
  766          st%ep(ip) = hm%bc%medium(idim)%ep(ip_in)
 
  767          st%mu(ip) = hm%bc%medium(idim)%mu(ip_in)
 
  780    type(
grid_t),             
intent(in)         :: gr
 
  782    type(
batch_t),            
intent(inout)      :: rs_stateb
 
  783    type(
batch_t),            
intent(inout)      :: ff_rs_stateb
 
  784    integer,                  
intent(in)         :: sign
 
  786    complex(real64), 
allocatable :: rs_state(:,:)
 
  787    complex(real64), 
allocatable :: rs_state_tmp(:,:)
 
  797    safe_allocate(rs_state(1:gr%np, 1:st%dim))
 
  800      if (sign == rs_trans_forward) 
then 
  809        safe_allocate(rs_state_tmp(1:gr%np, 1:st%dim))
 
  813          rs_state(1:np, ii) = 
m_half * (rs_state(1:np, ii) + conjg(rs_state_tmp(1:np, ii)))
 
  816        safe_deallocate_a(rs_state_tmp)
 
  819      if (sign == rs_trans_forward) 
then 
  820        call rs_stateb%copy_data_to(gr%np, ff_rs_stateb)
 
  822        call ff_rs_stateb%copy_data_to(gr%np, rs_stateb)
 
  825    safe_deallocate_a(rs_state)
 
  836    class(
mesh_t),            
intent(in)    :: mesh
 
  837    complex(real64),          
intent(inout) :: rs_charge_density(:)
 
  838    complex(real64),          
intent(inout) :: rs_current_density(:,:)
 
  839    complex(real64),          
intent(inout) :: ff_density(:,:)
 
  840    integer,                  
intent(in)    :: sign
 
  844    assert(
size(rs_charge_density) == mesh%np .or. 
size(rs_charge_density) == mesh%np_part)
 
  845    assert(
size(rs_current_density, dim=1) == 
size(rs_charge_density))
 
  846    assert(
size(rs_current_density, dim=2) == 3)
 
  853      if (sign == rs_trans_forward) 
then 
  855          rs_current_density, ff_density)
 
  858          rs_charge_density, rs_current_density)
 
  861      if (sign == rs_trans_forward) 
then 
  862        ff_density(1:mesh%np, 1:3) = rs_current_density(1:mesh%np, 1:3)
 
  864        rs_current_density(1:mesh%np, 1:3) = ff_density(1:mesh%np, 1:3)
 
  876    class(
mesh_t),            
intent(in)    :: mesh
 
  877    complex(real64),          
intent(in)    :: rs_charge_density(:)
 
  878    complex(real64),          
intent(in)    :: rs_current_density(:,:)
 
  879    complex(real64),          
intent(inout) :: rs_density_6x6(:,:)
 
  883    assert(
size(rs_current_density, dim=2) == 3)
 
  884    assert(
size(rs_density_6x6, dim=2) == 6)
 
  888      rs_density_6x6(1:mesh%np, ii) = rs_current_density(1:mesh%np, ii)
 
  889      rs_density_6x6(1:mesh%np, ii+3) = rs_current_density(1:mesh%np, ii)
 
  896    class(
mesh_t),            
intent(in)    :: mesh
 
  897    complex(real64),          
intent(in)    :: rs_density_6x6(:,:)
 
  898    complex(real64),          
intent(inout) :: rs_charge_density(:)
 
  899    complex(real64),          
intent(inout) :: rs_current_density(:,:)
 
  903    assert(
size(rs_current_density, dim=2) == 3)
 
  904    assert(
size(rs_density_6x6, dim=2) == 6)
 
  908      rs_current_density(1:mesh%np, ii) = 
m_half * &
 
  909        real(rs_density_6x6(1:mesh%np, ii) + rs_density_6x6(1:mesh%np, ii+3), real64)
 
  916    type(
grid_t),                  
intent(in)    :: gr_mxll
 
  919    type(
grid_t),                  
intent(in)    :: gr_elec
 
  922    complex(real64),               
intent(inout) :: rs_state_matter(:,:)
 
  924    complex(real64), 
allocatable :: tmp_pot_mx_gr(:,:), tmp_grad_mx_gr(:,:)
 
  926    safe_allocate(tmp_pot_mx_gr(1:gr_mxll%np_part,1))
 
  927    safe_allocate(tmp_grad_mx_gr(1:gr_mxll%np,1:gr_mxll%box%dim))
 
  932    tmp_pot_mx_gr(:,:) = 
m_zero 
  933    tmp_grad_mx_gr(:,:) = 
m_zero 
  934    call zderivatives_grad(gr_mxll%der, tmp_pot_mx_gr(:,1), tmp_grad_mx_gr(:,:), set_bc = .false.)
 
  935    tmp_grad_mx_gr = - tmp_grad_mx_gr
 
  937    rs_state_matter = 
m_z0 
  938    call build_rs_state(real(tmp_grad_mx_gr(1:gr_mxll%np,:)), aimag(tmp_grad_mx_gr(1:gr_mxll%np,:)), st_mxll%rs_sign, &
 
  939      rs_state_matter(1:gr_mxll%np,:), gr_mxll, st_mxll%ep(1:gr_mxll%np), st_mxll%mu(1:gr_mxll%np), &
 
  942    safe_deallocate_a(tmp_pot_mx_gr)
 
  943    safe_deallocate_a(tmp_grad_mx_gr)
 
  950    poisson_solver, helmholtz, time, field, transverse_field, vector_potential)
 
  951    type(namespace_t),               
intent(in)    :: namespace
 
  952    integer,                         
intent(in)    :: trans_calc_method
 
  953    type(
grid_t),                    
intent(in)    :: gr_mxll
 
  959    type(
poisson_t),                 
intent(in)    :: poisson_solver
 
  961    real(real64),                    
intent(in)    :: time
 
  962    complex(real64),                 
intent(inout) :: field(:,:)
 
  963    complex(real64),                 
intent(inout) :: transverse_field(:,:)
 
  967    complex(real64), 
allocatable :: rs_state_plane_waves(:, :)
 
  971    transverse_field = 
m_z0 
  976    if (hm_mxll%ma_mx_coupling) 
then 
  981      if (tr_mxll%bc_plane_waves .and. hm_mxll%plane_waves_apply) 
then 
  982        safe_allocate(rs_state_plane_waves(1:gr_mxll%np, 1:st_mxll%dim))
 
  983        call mxll_get_batch(st_mxll%rs_state_plane_wavesb, rs_state_plane_waves, gr_mxll%np, st_mxll%dim)
 
  987      if (tr_mxll%bc_plane_waves .and. hm_mxll%plane_waves_apply) 
then 
  988        transverse_field(1:np,:) = field(1:np,:) - rs_state_plane_waves(1:np,:)
 
  990        transverse_field(1:np,:) = field(1:np,:)
 
  993      call helmholtz%get_trans_field(namespace, transverse_field, total_field=field)
 
  995      if (tr_mxll%bc_plane_waves .and. hm_mxll%plane_waves_apply) 
then 
  996        transverse_field(1:np,:) = transverse_field(1:np,:) + rs_state_plane_waves(1:np,:)
 
  997        safe_deallocate_a(rs_state_plane_waves)
 
 1002      transverse_field(1:np,:) = field
 
 1013    type(namespace_t),          
intent(in)    :: namespace
 
 1014    type(
poisson_t),            
intent(in)    :: poisson_solver
 
 1015    type(
grid_t),               
intent(in)    :: gr
 
 1017    complex(real64),            
intent(in)    :: field(:,:)
 
 1021    real(real64), 
allocatable :: dtmp(:,:)
 
 1023    safe_allocate(dtmp(1:gr%np_part,1:3))
 
 1035    safe_deallocate_a(dtmp)
 
 1045    integer :: ip, ip_in, point_info, idim, dim
 
 1046    real(real64)   :: bounds(2, mesh%box%dim), xx(mesh%box%dim)
 
 1047    real(real64)   :: ddv(mesh%box%dim), tmp(mesh%box%dim), width(mesh%box%dim)
 
 1048    real(real64), 
allocatable :: mask(:)
 
 1055    if (hm%bc_zero .or. hm%bc_constant .or. hm%bc_plane_waves) 
then 
 1056      bounds(1,1:dim) = (mesh%idx%nr(2,1:dim) - 2 * mesh%idx%enlarge(1:dim)) * mesh%spacing(1:dim)
 
 1057      bounds(2,1:dim) = (mesh%idx%nr(2,1:dim) -     mesh%idx%enlarge(1:dim)) * mesh%spacing(1:dim)
 
 1062      xx(1:dim) = mesh%x(ip,1:dim)
 
 1063      if ((abs(xx(1)) <= bounds(2,1)) .and. (abs(xx(2)) <= bounds(2,2)) .and. (abs(xx(3)) <= bounds(2,3))) 
then 
 1064        if ((abs(xx(1)) > bounds(1,1)) .or. (abs(xx(2)) > bounds(1,2)) .or. (abs(xx(3)) > bounds(1,3))) 
then 
 1072      if (point_info == 1) 
then 
 1076    bc%der_bndry_mask_points_number = ip_in
 
 1077    safe_allocate(bc%der_bndry_mask(1:ip_in))
 
 1078    safe_allocate(bc%der_bndry_mask_points_map(1:ip_in))
 
 1082      xx(1:dim) = mesh%x(ip,1:dim)
 
 1083      if ((abs(xx(1)) <= bounds(2,1)) .and. (abs(xx(2)) <= bounds(2,2)) .and. (abs(xx(3)) <= bounds(2,3))) 
then 
 1084        if ((abs(xx(1)) > bounds(1,1)) .or. (abs(xx(2)) > bounds(1,2)) .or. (abs(xx(3)) > bounds(1,3))) 
then 
 1092      if (point_info == 1) 
then 
 1094        bc%der_bndry_mask_points_map(ip_in) = ip
 
 1098    safe_allocate(mask(1:mesh%np))
 
 1100    width(:) = bounds(2,:) - bounds(1,:)
 
 1106      ddv(1:dim) = abs(mesh%x(ip,1:dim)) - bounds(1,1:dim)
 
 1107      do idim = 1, mesh%box%dim
 
 1108        if (ddv(idim) >= 
m_zero) 
then 
 1109          if (ddv(idim)  <=  width(idim)) 
then 
 1115        mask(ip) = mask(ip) * tmp(idim)
 
 1119    do idim = 1, mesh%box%dim
 
 1120      do ip_in = 1, bc%der_bndry_mask_points_number
 
 1121        ip = bc%der_bndry_mask_points_map(ip_in)
 
 1122        bc%der_bndry_mask(ip_in) = mask(ip)
 
 1126    safe_deallocate_a(mask)
 
 1134  subroutine energy_mxll_calc(gr, st, hm, energy_mxll, rs_field, rs_field_plane_waves)
 
 1135    type(
grid_t),             
intent(in)  :: gr
 
 1139    complex(real64),          
intent(in)  :: rs_field(:,:)
 
 1140    complex(real64), 
optional,          
intent(in)  :: rs_field_plane_waves(:,:)
 
 1142    real(real64), 
allocatable :: energy_density(:), e_energy_density(:), b_energy_density(:), energy_density_plane_waves(:)
 
 1148    safe_allocate(energy_density(1:gr%np))
 
 1149    safe_allocate(e_energy_density(1:gr%np))
 
 1150    safe_allocate(b_energy_density(1:gr%np))
 
 1151    if (
present(rs_field_plane_waves) .and. hm%plane_waves) 
then 
 1152      safe_allocate(energy_density_plane_waves(1:gr%np))
 
 1156      b_energy_density, hm%plane_waves, rs_field_plane_waves, energy_density_plane_waves)
 
 1157    energy_mxll%energy    = 
dmf_integrate(gr, energy_density, mask=st%inner_points_mask)
 
 1158    energy_mxll%e_energy  = 
dmf_integrate(gr, e_energy_density, mask=st%inner_points_mask)
 
 1159    energy_mxll%b_energy  = 
dmf_integrate(gr, b_energy_density, mask=st%inner_points_mask)
 
 1160    if (
present(rs_field_plane_waves) .and. hm%plane_waves) 
then 
 1161      energy_mxll%energy_plane_waves = 
dmf_integrate(gr, energy_density_plane_waves, mask=st%inner_points_mask)
 
 1163      energy_mxll%energy_plane_waves = 
m_zero 
 1166    energy_mxll%boundaries = 
dmf_integrate(gr, energy_density, mask=st%boundary_points_mask)
 
 1168    safe_deallocate_a(energy_density)
 
 1169    safe_deallocate_a(e_energy_density)
 
 1170    safe_deallocate_a(b_energy_density)
 
 1171    if (
present(rs_field_plane_waves) .and. hm%plane_waves) 
then 
 1172      safe_deallocate_a(energy_density_plane_waves)
 
 1182    type(
grid_t),             
intent(in)    :: gr
 
 1186    type(
batch_t),            
intent(in)    :: rs_fieldb
 
 1187    type(
batch_t),            
intent(in)    :: rs_field_plane_wavesb
 
 1189    type(
batch_t) :: e_fieldb, b_fieldb, e_field_innerb, b_field_innerb, rs_field_plane_waves_innerb
 
 1190    real(real64) :: tmp(1:st%dim)
 
 1191    complex(real64) :: ztmp(1:st%dim)
 
 1198    if (st%pack_states) 
then 
 1199      call e_fieldb%do_pack(copy=.false.)
 
 1201    call e_fieldb%copy_to(b_fieldb)
 
 1202    call e_fieldb%copy_to(e_field_innerb)
 
 1203    call e_fieldb%copy_to(b_field_innerb)
 
 1211      call batch_copy_with_map(st%inner_points_number, st%buff_inner_points_map, e_fieldb, e_field_innerb)
 
 1212      call batch_copy_with_map(st%inner_points_number, st%buff_inner_points_map, b_fieldb, b_field_innerb)
 
 1214      call batch_copy_with_map(st%inner_points_number, st%inner_points_map, e_fieldb, e_field_innerb)
 
 1215      call batch_copy_with_map(st%inner_points_number, st%inner_points_map, b_fieldb, b_field_innerb)
 
 1218    energy_mxll%e_energy = sum(tmp)
 
 1220    energy_mxll%b_energy = sum(tmp)
 
 1221    energy_mxll%energy = energy_mxll%e_energy + energy_mxll%b_energy
 
 1224    energy_mxll%boundaries = sum(tmp)
 
 1226    energy_mxll%boundaries = energy_mxll%boundaries + sum(tmp)
 
 1227    energy_mxll%boundaries = energy_mxll%boundaries - energy_mxll%energy
 
 1229    if (hm%plane_waves) 
then 
 1230      call rs_field_plane_wavesb%copy_to(rs_field_plane_waves_innerb)
 
 1234          rs_field_plane_wavesb, rs_field_plane_waves_innerb)
 
 1237          rs_field_plane_wavesb, rs_field_plane_waves_innerb)
 
 1240      energy_mxll%energy_plane_waves = sum(real(tmp, real64) )
 
 1241      call rs_field_plane_waves_innerb%end()
 
 1243      energy_mxll%energy_plane_waves = 
m_zero 
 1248    call e_field_innerb%end()
 
 1249    call b_field_innerb%end()
 
 1258    type(namespace_t),          
intent(in)    :: namespace
 
 1259    type(
grid_t),               
intent(in)    :: gr
 
 1263    real(real64),               
intent(in)    :: time
 
 1264    real(real64),               
intent(in)    :: dt
 
 1265    real(real64),               
intent(in)    :: time_delay
 
 1266    complex(real64),            
intent(inout) :: rs_state(:,:)
 
 1268    integer            :: ip, ip_in, idim
 
 1269    logical            :: mask_check
 
 1274    mask_check = .false.
 
 1277      if (hm%bc%bc_ab_type(idim) == option__maxwellabsorbingboundaries__mask) 
then 
 1282    if (mask_check) 
then 
 1283      if (tr%bc_plane_waves .and. hm%plane_waves_apply) 
then 
 1285        call mxll_get_batch(st%rs_state_plane_wavesb, st%rs_state_plane_waves, gr%np, st%dim)
 
 1286        rs_state = rs_state - st%rs_state_plane_waves
 
 1288        rs_state = rs_state + st%rs_state_plane_waves
 
 1289      else if (tr%bc_constant .and. hm%spatial_constant_apply) 
then 
 1292        do ip_in=1, hm%bc%constant_points_number
 
 1293          ip = hm%bc%constant_points_map(ip_in)
 
 1294          rs_state(ip,:) = rs_state(ip,:) - st%rs_state_const(:)
 
 1297        do ip_in=1, hm%bc%constant_points_number
 
 1298          ip = hm%bc%constant_points_map(ip_in)
 
 1299          rs_state(ip,:) = rs_state(ip,:) + st%rs_state_const(:)
 
 1314    complex(real64),          
intent(inout) :: rs_state(:,:)
 
 1316    integer :: ip, ip_in, idim
 
 1323      if (hm%bc%bc_ab_type(idim) == option__maxwellabsorbingboundaries__mask) 
then 
 1324        do ip_in = 1, hm%bc%mask_points_number(idim)
 
 1325          ip = hm%bc%mask_points_map(ip_in,idim)
 
 1326          rs_state(ip,:) = rs_state(ip,:) * hm%bc%mask(ip_in,idim)
 
 1339    type(
grid_t),               
intent(in)    :: gr
 
 1342    type(
batch_t),              
intent(in)    :: ff_rs_stateb
 
 1343    type(
batch_t),              
intent(inout) :: ff_rs_state_pmlb
 
 1346    complex(real64), 
allocatable :: rs_state_constant(:,:)
 
 1347    type(
batch_t) :: rs_state_constantb
 
 1353    if (tr%bc_plane_waves .and. hm%plane_waves_apply) 
then 
 1355        ff_rs_state_pmlb, rs_trans_forward)
 
 1357    else if (tr%bc_constant .and. hm%spatial_constant_apply) 
then 
 1362      safe_allocate(rs_state_constant(1:gr%np,1:3))
 
 1364        rs_state_constant(1:gr%np, ii) = st%rs_state_const(ii)
 
 1366      call ff_rs_stateb%copy_to(rs_state_constantb)
 
 1367      call mxll_set_batch(rs_state_constantb, rs_state_constant, gr%np, 3)
 
 1370        ff_rs_state_pmlb, rs_trans_forward)
 
 1373      call rs_state_constantb%end()
 
 1375      safe_deallocate_a(rs_state_constant)
 
 1378      call ff_rs_stateb%copy_data_to(gr%np, ff_rs_state_pmlb)
 
 1389    type(namespace_t),          
intent(in)    :: namespace
 
 1390    type(
grid_t),               
intent(in)    :: gr
 
 1393    real(real64),               
intent(in)    :: time
 
 1394    real(real64),               
intent(in)    :: dt
 
 1395    real(real64),               
intent(in)    :: time_delay
 
 1396    type(
batch_t),              
intent(inout) :: ff_rs_state_pmlb
 
 1397    type(
batch_t),              
intent(inout) :: ff_rs_stateb
 
 1399    integer            :: ii, ff_dim
 
 1400    complex(real64), 
allocatable :: rs_state_constant(:,:), ff_rs_state_constant(:,:)
 
 1401    type(
batch_t) :: ff_rs_state_plane_wavesb, ff_rs_constantb, rs_state_constantb
 
 1407    if (tr%bc_plane_waves .and. hm%plane_waves_apply) 
then 
 1408      hm%cpml_hamiltonian = .
true.
 
 1409      call tr%te%apply_batch(namespace, gr, hm, ff_rs_state_pmlb, dt)
 
 1410      hm%cpml_hamiltonian = .false.
 
 1413      call ff_rs_stateb%copy_to(ff_rs_state_plane_wavesb)
 
 1419          ff_rs_state_pmlb, ff_rs_state_plane_wavesb, ff_rs_stateb)
 
 1421        call batch_add_with_map(hm%bc%plane_wave%points_number, hm%bc%plane_wave%points_map, &
 
 1422          ff_rs_state_pmlb, ff_rs_state_plane_wavesb, ff_rs_stateb)
 
 1425      call ff_rs_state_plane_wavesb%end()
 
 1427    else if (tr%bc_constant .and. hm%spatial_constant_apply) 
then 
 1428      hm%cpml_hamiltonian = .
true.
 
 1429      call tr%te%apply_batch(namespace, gr, hm, ff_rs_state_pmlb, dt)
 
 1430      hm%cpml_hamiltonian = .false.
 
 1432      call ff_rs_stateb%copy_to(ff_rs_constantb)
 
 1433      ff_dim = ff_rs_stateb%nst_linear
 
 1434      safe_allocate(rs_state_constant(1:gr%np, 1:st%dim))
 
 1438        rs_state_constant(1:gr%np, ii) = st%rs_state_const(ii)
 
 1440      call ff_rs_stateb%copy_to(rs_state_constantb)
 
 1441      call mxll_set_batch(rs_state_constantb, rs_state_constant, gr%np, st%dim)
 
 1446        call batch_add_with_map(hm%bc%constant_points_number, hm%bc%buff_constant_points_map, &
 
 1447          ff_rs_state_pmlb, ff_rs_constantb, ff_rs_stateb)
 
 1450          ff_rs_state_pmlb, ff_rs_constantb, ff_rs_stateb)
 
 1453      call ff_rs_constantb%end()
 
 1454      call rs_state_constantb%end()
 
 1456      safe_deallocate_a(rs_state_constant)
 
 1457      safe_deallocate_a(ff_rs_state_constant)
 
 1468    type(
grid_t),             
intent(in)    :: gr
 
 1469    type(
batch_t),            
intent(inout) :: ff_rs_state_pmlb
 
 1486    type(
grid_t),             
intent(in)    :: gr
 
 1487    type(
batch_t),            
intent(inout) :: ff_rs_state_pmlb
 
 1489    integer :: ip, ip_in, np_part, rs_sign
 
 1490    complex(real64) :: pml_a, pml_b, pml_g, grad
 
 1491    integer :: pml_dir, field_dir, ifield, idir
 
 1492    integer, 
parameter :: field_dirs(3, 2) = reshape([2, 3, 1, 3, 1, 2], [3, 2])
 
 1493    logical :: with_medium
 
 1494    type(
batch_t) :: gradb(gr%der%dim)
 
 1502    assert(hm%dim == 3 .or. hm%dim == 6)
 
 1504    np_part = gr%np_part
 
 1505    rs_sign = hm%rs_sign
 
 1509    with_medium = hm%dim == 6
 
 1511    do pml_dir = 1, hm%st%dim
 
 1512      select case (gradb(pml_dir)%status())
 
 1514        do ip_in=1, hm%bc%pml%points_number
 
 1515          ip       = hm%bc%pml%points_map(ip_in)
 
 1516          pml_a = hm%bc%pml%a(ip_in,pml_dir)
 
 1517          pml_b = hm%bc%pml%b(ip_in,pml_dir)
 
 1519            field_dir = field_dirs(pml_dir, ifield)
 
 1520            grad = gradb(pml_dir)%zff_linear(ip, field_dir)
 
 1521            pml_g = hm%bc%pml%conv_plus(ip_in, pml_dir, field_dir)
 
 1522            hm%bc%pml%conv_plus(ip_in, pml_dir, field_dir) = pml_a * grad + pml_b * pml_g
 
 1523            if (with_medium) 
then 
 1524              grad = gradb(pml_dir)%zff_linear(ip, field_dir+3)
 
 1525              pml_g = hm%bc%pml%conv_minus(ip_in, pml_dir, field_dir)
 
 1526              hm%bc%pml%conv_minus(ip_in, pml_dir, field_dir) = pml_a * grad + pml_b * pml_g
 
 1531        do ip_in=1, hm%bc%pml%points_number
 
 1532          ip       = hm%bc%pml%points_map(ip_in)
 
 1533          pml_a = hm%bc%pml%a(ip_in,pml_dir)
 
 1534          pml_b = hm%bc%pml%b(ip_in,pml_dir)
 
 1536            field_dir = field_dirs(pml_dir, ifield)
 
 1537            grad = gradb(pml_dir)%zff_pack(field_dir, ip)
 
 1538            pml_g = hm%bc%pml%conv_plus(ip_in, pml_dir, field_dir)
 
 1539            hm%bc%pml%conv_plus(ip_in, pml_dir, field_dir) = pml_a * grad + pml_b * pml_g
 
 1540            if (with_medium) 
then 
 1541              grad = gradb(pml_dir)%zff_pack(field_dir+3, ip)
 
 1542              pml_g = hm%bc%pml%conv_minus(ip_in, pml_dir, field_dir)
 
 1543              hm%bc%pml%conv_minus(ip_in, pml_dir, field_dir) = pml_a * grad + pml_b * pml_g
 
 1550        if (with_medium) 
then 
 1570    do idir = 1, gr%der%dim
 
 1571      call gradb(idir)%end()
 
 1586    type(namespace_t),        
intent(in)    :: namespace
 
 1590    integer              :: il, nlines, idim, ncols, ierr
 
 1591    real(real64)         :: e_field(st%dim), b_field(st%dim)
 
 1592    character(len=1024)  :: mxf_expression
 
 1615    if (
parse_block(namespace, 
'UserDefinedConstantSpatialMaxwellField', blk) == 0) 
then 
 1616      st%rs_state_const_external = .
true.
 
 1618      safe_allocate(st%rs_state_const_td_function(1:nlines))
 
 1619      safe_allocate(st%rs_state_const_amp(1:st%dim, 1:nlines))
 
 1626        if (ncols  /= 7) 
then 
 1627          message(1) = 
'Each line in the UserDefinedConstantSpatialMaxwellField block must have' 
 1638        call build_rs_vector(e_field, b_field, st%rs_sign, st%rs_state_const_amp(:,il))
 
 1639        call tdf_read(st%rs_state_const_td_function(il), namespace, trim(mxf_expression), ierr)
 
 1653    call parse_variable(namespace, 
'PropagateSpatialMaxwellField', .
true., hm%spatial_constant_propagate)
 
 1662    logical,                  
intent(in)    :: constant_calc
 
 1664    type(
grid_t),             
intent(in)    :: gr
 
 1666    real(real64),             
intent(in)    :: time
 
 1667    real(real64),             
intent(in)    :: dt
 
 1668    real(real64),             
intent(in)    :: delay
 
 1669    complex(real64),          
intent(inout) :: rs_state(:,:)
 
 1670    logical,        
optional, 
intent(in)    :: set_initial_state
 
 1672    integer :: ip, ic, icn
 
 1673    real(real64)   :: tf_old, tf_new
 
 1674    logical :: set_initial_state_
 
 1680    set_initial_state_ = .false.
 
 1681    if (
present(set_initial_state)) set_initial_state_ = set_initial_state
 
 1683    if (hm%spatial_constant_apply) 
then 
 1684      if (constant_calc) 
then 
 1685        icn = 
size(st%rs_state_const_td_function(:))
 
 1686        st%rs_state_const(:) = 
m_z0 
 1688          tf_old = 
tdf(st%rs_state_const_td_function(ic), time-delay-dt)
 
 1689          tf_new = 
tdf(st%rs_state_const_td_function(ic), time-delay)
 
 1691            if (set_initial_state_ .or. (.not. hm%spatial_constant_propagate)) 
then 
 1692              rs_state(ip,:) = st%rs_state_const_amp(:,ic) * tf_new
 
 1694              rs_state(ip,:) = rs_state(ip,:) + st%rs_state_const_amp(:,ic) * (tf_new - tf_old)
 
 1697          st%rs_state_const(:) = st%rs_state_const(:) + st%rs_state_const_amp(:, ic)
 
 1699        st%rs_state_const(:) = st%rs_state_const(:) * tf_new
 
 1710    logical,                   
intent(in)    :: constant_calc
 
 1714    complex(real64),           
intent(inout) :: rs_state(:,:)
 
 1716    integer :: ip_in, ip
 
 1721    if (hm%spatial_constant_apply) 
then 
 1722      if (constant_calc) 
then 
 1723        do ip_in = 1, bc%constant_points_number
 
 1724          ip = bc%constant_points_map(ip_in)
 
 1725          rs_state(ip,:) = st%rs_state_const(:)
 
 1726          bc%constant_rs_state(ip_in,:) = st%rs_state_const(:)
 
 1740    complex(real64),     
intent(inout) :: rs_state(:,:)
 
 1742    integer                    :: ip, ip_in, idim
 
 1743    real(real64)               :: e_field(st%dim), b_field(st%dim)
 
 1749        do ip_in = 1, bc%mirror_points_number(idim)
 
 1750          ip = bc%mirror_points_map(ip_in, idim)
 
 1753          call build_rs_vector(e_field(:), b_field(:), st%rs_sign, rs_state(ip,:), st%ep(ip), st%mu(ip))
 
 1765    complex(real64),     
intent(inout) :: rs_state(:,:)
 
 1767    integer                    :: ip, ip_in, idim
 
 1774        do ip_in = 1, bc%mirror_points_number(idim)
 
 1775          ip = bc%mirror_points_map(ip_in,idim)
 
 1790    class(
mesh_t),            
intent(in)    :: mesh
 
 1791    real(real64),             
intent(in)    :: time
 
 1792    real(real64),             
intent(in)    :: time_delay
 
 1793    complex(real64),          
intent(inout) :: rs_state(:,:)
 
 1795    integer                    :: ip, ip_in, wn
 
 1796    real(real64)               :: x_prop(mesh%box%dim), rr, vv(mesh%box%dim), k_vector(mesh%box%dim)
 
 1797    real(real64)               :: k_vector_abs, nn
 
 1798    complex(real64)            :: e0(mesh%box%dim)
 
 1800    complex(real64)            :: rs_state_add(mesh%box%dim)
 
 1801    complex(real64)            :: mx_func
 
 1807    if (hm%plane_waves_apply) 
then 
 1808      do wn = 1, hm%bc%plane_wave%number
 
 1809        k_vector(:) = hm%bc%plane_wave%k_vector(1:mesh%box%dim, wn)
 
 1810        k_vector_abs = norm2(k_vector(1:mesh%box%dim))
 
 1811        vv(:) = hm%bc%plane_wave%v_vector(1:mesh%box%dim, wn)
 
 1812        e0(:) = hm%bc%plane_wave%e_field(1:mesh%box%dim, wn)
 
 1813        do ip_in = 1, hm%bc%plane_wave%points_number
 
 1814          ip = hm%bc%plane_wave%points_map(ip_in)
 
 1815          if (wn == 1) rs_state(ip,:) = 
m_z0 
 1817          x_prop(1:mesh%box%dim) = mesh%x(ip,1:mesh%box%dim) - vv(1:mesh%box%dim) * (time - time_delay)
 
 1818          rr = norm2(x_prop(1:mesh%box%dim))
 
 1819          if (hm%bc%plane_wave%modus(wn) == option__maxwellincidentwaves__plane_wave_mx_function) 
then 
 1821            mx_func = 
mxf(hm%bc%plane_wave%mx_function(wn), x_prop(1:mesh%box%dim))
 
 1822            e_field(1:mesh%box%dim) = real(e0(1:mesh%box%dim) * mx_func, real64)
 
 1826          rs_state(ip, :) =  rs_state(ip, :) + rs_state_add(:)
 
 1830      do ip_in = 1, hm%bc%plane_wave%points_number
 
 1831        ip             = hm%bc%plane_wave%points_map(ip_in)
 
 1832        rs_state(ip,:) = 
m_z0 
 1845    type(namespace_t),        
intent(in)    :: namespace
 
 1847    type(
grid_t),             
intent(in)    :: gr
 
 1848    real(real64),             
intent(in)    :: time
 
 1849    real(real64),             
intent(in)    :: dt
 
 1850    real(real64),             
intent(in)    :: time_delay
 
 1860    call zbatch_init(ff_rs_stateb, 1, 1, hm%dim, gr%np_part)
 
 1861    if (st%pack_states) 
call ff_rs_stateb%do_pack(copy=.false.)
 
 1867    hm%cpml_hamiltonian = .false.
 
 1868    call tr%te%apply_batch(namespace, gr, hm, ff_rs_stateb, dt)
 
 1871    call mxll_get_batch(st%rs_state_plane_wavesb, st%rs_state_plane_waves, gr%np, st%dim)
 
 1873    call mxll_set_batch(st%rs_state_plane_wavesb, st%rs_state_plane_waves, gr%np, st%dim)
 
 1874    call ff_rs_stateb%end()
 
 1883    real(real64),              
intent(in)    :: time
 
 1884    class(
space_t),            
intent(in)    :: space
 
 1885    class(
mesh_t),             
intent(in)    :: mesh
 
 1888    complex(real64),           
intent(inout) :: rs_state(:,:)
 
 1890    real(real64)         :: e_field_total(mesh%np,st%dim), b_field_total(mesh%np,st%dim)
 
 1891    complex(real64)      :: rs_state_add(mesh%np,st%dim)
 
 1901      rs_state_add(1:mesh%np,:), mesh, st%ep, st%mu)
 
 1902    rs_state(1:mesh%np,:) = rs_state(1:mesh%np,:) + rs_state_add(1:mesh%np,:)
 
 1914    type(
grid_t),            
intent(in)    :: gr
 
 1915    type(namespace_t),       
intent(in)    :: namespace
 
 1916    real(real64),            
intent(in)    :: time
 
 1917    real(real64),            
intent(in)    :: dt
 
 1918    type(
batch_t),           
intent(inout) :: rs_stateb
 
 1920    complex(real64), 
allocatable :: rs_state(:, :)
 
 1924    safe_allocate(rs_state(gr%np, st%dim))
 
 1926    if (tr%bc_constant) 
then 
 1929      if (st%rs_state_const_external) 
then 
 1950    if (any(hm%bc%bc_ab_type == option__maxwellabsorbingboundaries__mask)) 
then 
 1957    if (tr%bc_plane_waves) 
then 
 1964    safe_deallocate_a(rs_state)
 
batchified version of the BLAS axpy routine:
 
scale a batch by a constant or vector
 
There are several ways how to call batch_set_state and batch_get_state:
 
double sin(double __x) __attribute__((__nothrow__
 
double sqrt(double __x) __attribute__((__nothrow__
 
subroutine, public accel_kernel_start_call(this, file_name, kernel_name, flags)
 
subroutine, public accel_finish()
 
pure logical function, public accel_is_enabled()
 
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
 
subroutine, public zbatch_init(this, dim, st_start, st_end, np, special, packed)
initialize a TYPE_CMPLX valued batch to given size without providing external memory
 
subroutine, public dbatch_init(this, dim, st_start, st_end, np, special, packed)
initialize a TYPE_FLOAT valued batch to given size without providing external memory
 
integer, parameter, public batch_packed
functions are stored in CPU memory, in transposed (packed) order
 
This module implements common operations on batches of mesh functions.
 
subroutine, public batch_split_complex(np, xx, yy, zz)
extract the real and imaginary parts of a complex batch
 
subroutine, public batch_set_zero(this, np, async)
fill all mesh functions of the batch with zero
 
This module implements a calculator for the density and defines related functions.
 
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
 
subroutine, public dderivatives_curl(der, ff, op_ff, ghost_update, set_bc)
apply the curl operator to a vector of mesh functions
 
subroutine, public zderivatives_batch_grad(der, ffb, opffb, ghost_update, set_bc, to_cartesian, metric, factor)
apply the gradient to a batch of mesh functions
 
subroutine, public zderivatives_grad(der, ff, op_ff, ghost_update, set_bc, to_cartesian)
apply the gradient to a mesh function
 
subroutine, public energy_density_calc(mesh, st, rs_field, energy_dens, e_energy_dens, b_energy_dens, plane_waves_check, rs_field_plane_waves, energy_dens_plane_waves)
 
subroutine, public exponential_init(te, namespace, full_batch)
 
subroutine, public external_waves_eval(external_waves, time, mesh, type_of_field, out_field_total, der)
Calculation of external waves from parsed formula.
 
subroutine, public external_waves_init(external_waves, namespace)
Here, plane wave is evaluated from analytical formulae on grid.
 
Fast Fourier Transform module. This module provides a single interface that works with different FFT ...
 
real(real64), parameter, public m_two
 
real(real64), parameter, public m_zero
 
real(real64), parameter, public m_four
 
real(real64), parameter, public m_pi
some mathematical constants
 
real(real64), parameter, public m_fourth
 
real(real64), parameter, public p_mu
 
real(real64), parameter, public p_ep
 
complex(real64), parameter, public m_z0
 
complex(real64), parameter, public m_zi
 
real(real64), parameter, public m_epsilon
 
real(real64), parameter, public m_half
 
real(real64), parameter, public p_c
Electron gyromagnetic ratio, see Phys. Rev. Lett. 130, 071801 (2023)
 
real(real64), parameter, public m_one
 
real(real64), parameter, public m_three
 
This module implements the underlying real-space grid.
 
subroutine, public hamiltonian_mxll_apply_simple(hm, namespace, mesh, psib, hpsib, terms, set_bc)
 
subroutine, public mxll_update_pml_simple(hm, rs_stateb)
 
integer, parameter, public faraday_ampere_medium
 
subroutine, public hamiltonian_mxll_update(this, time)
Maxwell Hamiltonian update (here only the time is updated, can maybe be added to another routine)
 
subroutine, public mxll_copy_pml_simple(hm, rs_stateb)
 
The Helmholtz decomposition is intended to contain "only mathematical" functions and procedures to co...
 
This module implements the index, used for the mesh points.
 
This module is intended to contain "only mathematical" functions and procedures.
 
pure real(real64) function, dimension(1:3), public dcross_product(a, b)
 
integer, parameter, public mxll_bc_mirror_pmc
 
integer, parameter, public mxll_bc_periodic
 
integer, parameter, public mxll_bc_mirror_pec
 
integer, parameter, public mxll_bc_plane_waves
 
integer, parameter, public mxll_bc_medium
 
subroutine, public bc_mxll_generate_pml_parameters(bc, space, gr, c_factor, dt)
 
integer, parameter, public mxll_bc_constant
 
integer, parameter, public mxll_bc_zero
 
This module defines functions over batches of mesh functions.
 
subroutine, public zmesh_batch_dotp_vector(mesh, aa, bb, dot, reduce, cproduct)
calculate the vector of dot-products of mesh functions between two batches
 
subroutine, public dmesh_batch_dotp_vector(mesh, aa, bb, dot, reduce, cproduct)
calculate the vector of dot-products of mesh functions between two batches
 
This module defines various routines, operating on mesh functions.
 
real(real64) function, public dmf_integrate(mesh, ff, mask, reduce)
Integrate a function on the mesh.
 
This module defines the meshes, which are used in Octopus.
 
subroutine, public messages_print_with_emphasis(msg, iunit, namespace)
 
character(len=512), private msg
 
subroutine, public messages_info(no_lines, iunit, verbose_limit, stress, 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)
 
this module contains the output system
 
Some general things and nomenclature:
 
logical function, public parse_is_defined(namespace, name)
 
integer function, public parse_block(namespace, name, blk, check_varinfo_)
 
subroutine, public dpoisson_solve(this, namespace, pot, rho, all_nodes, kernel)
Calculates the Poisson equation. Given the density returns the corresponding potential.
 
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 mirror_pec_boundaries_calculation(bc, st, rs_state)
 
subroutine td_function_mxll_init(st, namespace, hm)
 
subroutine, public mxll_propagate_expgauss2(hm, namespace, gr, space, st, tr, time, dt)
Exponential propagation scheme with Gauss collocation points, s=2.
 
subroutine, public energy_mxll_calc_batch(gr, st, hm, energy_mxll, rs_fieldb, rs_field_plane_wavesb)
 
subroutine, public calculate_matter_longitudinal_field(gr_mxll, st_mxll, hm_mxll, gr_elec, st_elec, hm_elec, rs_state_matter)
 
subroutine plane_waves_propagation(hm, tr, namespace, st, gr, time, dt, time_delay)
 
subroutine derivatives_boundary_mask(bc, mesh, hm)
 
subroutine cpml_conv_function_update(hm, gr, ff_rs_state_pmlb)
 
subroutine transform_rs_state_batch(hm, gr, st, rs_stateb, ff_rs_stateb, sign)
 
subroutine, public mxll_propagate_leapfrog(hm, namespace, gr, space, st, tr, time, dt, counter)
 
subroutine, public mxll_propagate_expgauss1(hm, namespace, gr, space, st, tr, time, dt)
Exponential propagation scheme with Gauss collocation points, s=1.
 
subroutine, public constant_boundaries_calculation(constant_calc, bc, hm, st, rs_state)
 
subroutine, public mask_absorbing_boundaries(namespace, gr, hm, st, tr, time, dt, time_delay, rs_state)
 
subroutine, public calculate_vector_potential(namespace, poisson_solver, gr, st, field, vector_potential)
 
subroutine pml_propagation_stage_2_batch(hm, namespace, gr, st, tr, time, dt, time_delay, ff_rs_state_pmlb, ff_rs_stateb)
 
subroutine, public mxll_propagation_step(hm, namespace, gr, space, st, tr, rs_stateb, ff_rs_inhom_t1, ff_rs_inhom_t2, time, dt)
 
subroutine, public plane_waves_boundaries_calculation(hm, st, mesh, time, time_delay, rs_state)
 
subroutine, public get_vector_pot_and_transverse_field(namespace, trans_calc_method, gr_mxll, hm_mxll, st_mxll, tr_mxll, hm, st, poisson_solver, helmholtz, time, field, transverse_field, vector_potential)
 
subroutine, public spatial_constant_calculation(constant_calc, st, gr, hm, time, dt, delay, rs_state, set_initial_state)
 
subroutine, public set_medium_rs_state(st, gr, hm)
 
subroutine cpml_conv_function_update_via_riemann_silberstein(hm, gr, ff_rs_state_pmlb)
 
subroutine maxwell_mask(hm, rs_state)
 
integer, parameter mxwll_etrs_const
 
subroutine, public transform_rs_densities(hm, mesh, rs_charge_density, rs_current_density, ff_density, sign)
 
subroutine, public plane_waves_in_box_calculation(bc, time, space, mesh, der, st, rs_state)
 
subroutine, public energy_mxll_calc(gr, st, hm, energy_mxll, rs_field, rs_field_plane_waves)
 
integer, parameter, public rs_trans_backward
 
subroutine, public mirror_pmc_boundaries_calculation(bc, st, rs_state)
 
subroutine, public mxll_apply_boundaries(tr, st, hm, gr, namespace, time, dt, rs_stateb)
 
subroutine pml_propagation_stage_1_batch(hm, gr, st, tr, ff_rs_stateb, ff_rs_state_pmlb)
 
subroutine, public propagator_mxll_init(gr, namespace, st, hm, tr)
 
subroutine transform_rs_densities_to_6x6_rs_densities_backward(mesh, rs_density_6x6, rs_charge_density, rs_current_density)
 
subroutine transform_rs_densities_to_6x6_rs_densities_forward(mesh, rs_charge_density, rs_current_density, rs_density_6x6)
 
This module defines the quantity_t class and the IDs for quantities, which can be exposed by a system...
 
integer, parameter, public b_field
 
integer, parameter, public vector_potential
 
integer, parameter, public e_field
 
subroutine, public mxll_set_batch(rs_stateb, rs_state, np, dim, offset)
 
subroutine, public get_electric_field_vector(rs_state_vector, electric_field_vector, ep_element)
 
subroutine, public build_rs_vector(e_vector, b_vector, rs_sign, rs_vector, ep_element, mu_element)
 
subroutine, public mxll_get_batch(rs_stateb, rs_state, np, dim, offset)
 
subroutine, public build_rs_state(e_field, b_field, rs_sign, rs_state, mesh, ep_field, mu_field, np)
 
subroutine, public get_magnetic_field_state(rs_state, mesh, rs_sign, magnetic_field, mu_field, np)
 
subroutine, public get_magnetic_field_vector(rs_state_vector, rs_sign, magnetic_field_vector, mu_element)
 
subroutine, public tdf_read(f, namespace, function_name, ierr)
This function initializes "f" from the TDFunctions block.
 
Class defining batches of mesh functions.
 
class representing derivatives
 
Description of the grid, containing information on derivatives, stencil, and symmetries.
 
Describes mesh distribution to nodes.
 
The states_elec_t class contains all electronic wave functions.