41    real(real64), 
pointer :: system_charge(:) => null() 
 
   42    real(real64), 
pointer, 
public :: system_pos(:,:) => null() 
 
   43    real(real64), 
pointer :: system_vel(:,:) => null() 
 
   45    real(real64), 
allocatable, 
public :: partner_e_field(:,:)
 
   46    real(real64), 
allocatable, 
public :: partner_b_field(:,:)
 
   63    class(interaction_partner_t), 
target, 
intent(inout) :: partner
 
   64    class(lorentz_force_t),               
pointer       :: this
 
   70    this%label = 
"lorenz_force" 
   72    this%partner => partner
 
   79    this%intra_interaction = .false. 
 
   86  subroutine lorentz_force_init(this, dim, system_np, system_charge, system_pos, system_vel, namespace)
 
   87    class(lorentz_force_t),               
intent(inout) :: this
 
   88    integer,                              
intent(in)    :: dim
 
   89    integer,                              
intent(in)    :: system_np
 
   90    real(real64),                 
target, 
intent(in)    :: system_charge(:)
 
   91    real(real64),                 
target, 
intent(in)    :: system_pos(:,:)
 
   92    real(real64),                 
target, 
intent(in)    :: system_vel(:,:)
 
   93    type(namespace_t),                    
intent(in)    :: namespace
 
   97    message(1) = 
"Energies for Lorentz forces are not yet implemented, and currently set to 0." 
  101    this%system_np = system_np
 
  103    safe_allocate(this%force(dim, system_np))
 
  106    safe_allocate(this%partner_e_field(1:dim, 1:system_np))
 
  107    this%partner_e_field = 
m_zero 
  108    safe_allocate(this%partner_b_field(1:dim, 1:system_np))
 
  109    this%partner_b_field = 
m_zero 
  111    this%system_charge => system_charge
 
  112    this%system_pos => system_pos
 
  113    this%system_vel => system_vel
 
  120    class(lorentz_force_t),             
intent(inout) :: this
 
  127    assert(this%dim == 3)
 
  128    assert(.not. this%intra_interaction)
 
  130    do ip = 1, this%system_np
 
  131      this%force(1, ip) = this%partner_e_field(1, ip) + &
 
  132        this%system_vel(2, ip)*this%partner_b_field(3, ip) - this%system_vel(3, ip)*this%partner_b_field(2, ip)
 
  134      this%force(2, ip) = this%partner_e_field(2, ip) + &
 
  135        this%system_vel(3, ip)*this%partner_b_field(1, ip) - this%system_vel(1, ip)*this%partner_b_field(3, ip)
 
  137      this%force(3, ip) = this%partner_e_field(3, ip) + &
 
  138        this%system_vel(1, ip)*this%partner_b_field(2, ip) - this%system_vel(2, ip)*this%partner_b_field(1, ip)
 
  140      this%force(1:3, ip) = this%force(1:3, ip)*this%system_charge(ip)
 
  151    real(real64)   :: power
 
  158    do ip = 1, this%system_np
 
  159      power = power - dot_product(this%system_vel(1:3,ip), this%force(1:3,ip))
 
  179    nullify(this%system_charge)
 
  180    nullify(this%system_pos)
 
  181    nullify(this%system_vel)
 
  182    safe_deallocate_a(this%force)
 
  183    safe_deallocate_a(this%partner_e_field)
 
  184    safe_deallocate_a(this%partner_b_field)
 
real(real64), parameter, public m_zero
 
This module defines the abstract interaction_t class, and some auxiliary classes for interactions.
 
subroutine, public interaction_end(this)
 
This module defines classes and functions for interaction partners.
 
subroutine lorentz_force_calculate_energy(this)
 
class(lorentz_force_t) function, pointer lorentz_force_constructor(partner)
 
subroutine lorentz_force_finalize(this)
 
subroutine lorentz_force_init(this, dim, system_np, system_charge, system_pos, system_vel, namespace)
 
subroutine lorentz_force_calculate(this)
 
subroutine, public messages_warning(no_lines, all_nodes, namespace)
 
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
 
This module defines the quantity_t class and the IDs for quantities, which can be exposed by a system...
 
integer, parameter, public velocity
 
integer, parameter, public position
 
integer, parameter, public b_field
 
integer, parameter, public charge
 
integer, parameter, public e_field
 
Lorenz force between a systems of particles and an electromagnetic field.