41    real(real64), 
pointer :: system_charge(:) => null() 
 
   42    real(real64), 
pointer :: system_pos(:,:)  => null()  
 
   44    integer, 
public :: partner_np = 0
 
   45    real(real64), 
allocatable, 
public :: partner_charge(:)
 
   46    real(real64), 
allocatable, 
public :: partner_pos(:,:)
 
   63    class(interaction_partner_t), 
target, 
intent(inout) :: partner
 
   64    class(coulomb_force_t),               
pointer       :: this
 
   70    this%label = 
"coulomb_force" 
   72    this%partner => partner
 
   85    class(coulomb_force_t),             
intent(inout) :: this
 
   86    integer,                            
intent(in)    :: dim
 
   87    integer,                            
intent(in)    :: system_np
 
   88    real(real64),               
target, 
intent(in)    :: system_charge(:)
 
   89    real(real64),               
target, 
intent(in)    :: system_pos(:,:)
 
   94    this%system_np = system_np
 
   95    safe_allocate(this%force(1:dim, 1:system_np))
 
   98    this%system_charge => system_charge
 
   99    this%system_pos => system_pos
 
  106    class(coulomb_force_t),             
intent(inout) :: this
 
  109    real(real64), 
parameter :: COULCONST = 
m_one  
  110    real(real64) :: dist3
 
  114    assert(
allocated(this%partner_charge))
 
  115    assert(
allocated(this%partner_pos))
 
  117    do ip = 1, this%system_np
 
  118      do jp = 1, this%partner_np
 
  119        if (this%intra_interaction .and. ip == jp ) cycle
 
  121        dist3 = sum((this%partner_pos(1:this%dim, jp) - this%system_pos(1:this%dim, ip))**2)**(
m_three/
m_two)
 
  123        this%force(1:this%dim, ip) = -(this%partner_pos(1:this%dim, jp) - this%system_pos(1:this%dim, ip)) &
 
  124          / (dist3 + 
m_epsilon) * (coulconst * this%system_charge(ip) * this%partner_charge(jp))
 
  133    class(coulomb_force_t),             
intent(inout) :: this
 
  136    real(real64), 
parameter :: coulconst = 
m_one  
  141    assert(
allocated(this%partner_charge))
 
  142    assert(
allocated(this%partner_pos))
 
  145    do ip = 1, this%system_np
 
  146      do jp = 1, this%partner_np
 
  147        if (this%intra_interaction .and. ip == jp ) cycle
 
  149        dist = 
sqrt(sum((this%partner_pos(1:this%dim, jp) - this%system_pos(1:this%dim, ip))**2))
 
  151        this%energy = this%energy + 
m_half  / (dist + 
m_epsilon) * (coulconst * this%system_charge(ip) * this%partner_charge(jp))
 
  166    nullify(this%system_charge)
 
  167    nullify(this%system_pos)
 
  168    safe_deallocate_a(this%partner_pos)
 
  169    safe_deallocate_a(this%partner_charge)
 
  170    safe_deallocate_a(this%force)
 
double sqrt(double __x) __attribute__((__nothrow__
 
subroutine coulomb_force_calculate_energy(this)
 
subroutine coulomb_force_calculate(this)
 
subroutine coulomb_force_finalize(this)
 
subroutine coulomb_force_init(this, dim, system_np, system_charge, system_pos)
 
class(coulomb_force_t) function, pointer coulomb_force_constructor(partner)
 
real(real64), parameter, public m_two
 
real(real64), parameter, public m_zero
 
real(real64), parameter, public m_epsilon
 
real(real64), parameter, public m_half
 
real(real64), parameter, public m_one
 
real(real64), parameter, public m_three
 
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.
 
This module defines the quantity_t class and the IDs for quantities, which can be exposed by a system...
 
integer, parameter, public position
 
integer, parameter, public charge
 
Coulomb interaction between two systems of particles.