| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(periodic_zero_mode_plan_type), | intent(in) | :: | plan | |||
| type(periodic_zero_mode_state_type), | intent(in) | :: | state | |||
| real(kind=dp), | intent(in) | :: | z | |||
| integer(kind=i32), | intent(in) | :: | trace | |||
| real(kind=dp), | intent(out) | :: | potential | |||
| real(kind=dp), | intent(out) | :: | field |
subroutine eval_periodic_zero_mode(plan, state, z, trace, potential, field) type(periodic_zero_mode_plan_type), intent(in) :: plan type(periodic_zero_mode_state_type), intent(in) :: state real(dp), intent(in) :: z integer(i32), intent(in) :: trace real(dp), intent(out) :: potential, field real(dp) :: cumulative_charge, sheet_correction, primitive, gauge_primitive integer(i32) :: interval, breakpoint, gauge_interval if (trace < zero_mode_trace_minus .or. trace > zero_mode_trace_plus) then error stop 'invalid periodic zero-mode trace.' end if call locate_interval(plan%break_z, z, interval, breakpoint) cumulative_charge = evaluate_polynomial(state%cumulative_charge_coeff(:, interval), z) if (breakpoint > 0_i32) then sheet_correction = 0.5_dp*real(1_i32 - trace, dp)*state%sheet_charge(breakpoint) cumulative_charge = cumulative_charge - sheet_correction end if field = state%e_bottom + cumulative_charge/(eps0*plan%area_xy) primitive = charge_primitive(plan, state, z, interval) call locate_interval(plan%break_z, state%z_gauge, gauge_interval, breakpoint) gauge_primitive = charge_primitive(plan, state, state%z_gauge, gauge_interval) potential = state%phi_gauge - state%e_bottom*(z - state%z_gauge) - & (primitive - gauge_primitive)/(eps0*plan%area_xy) end subroutine eval_periodic_zero_mode