In physics, interactions are in general symmetric. However, the magnitude with which it affects the interaction partners can be very different.
Also, the way the interactions have to be implemented can differ depending on the ‘‘direction’’ of the interaction.
type,extends(interaction_surrogate_t),abstract::interaction_t! General information about the interaction
type(iteration_counter_t)::iteration!< Iteration counter storing the iteration at which the interaction was last updated.
character(len=:),allocatable::label!< label of an interaction, used for debug and restart
logical::intra_interaction!< Is this an interaction of a system with itself?
integer::timing!< parameter to determine if the interaction should use the couplings
!! at the exact requested iteration or if retardation is allowed
FLOAT::energy!< Energy associated with the interaction.
! The interaction requires access to some quantities from a system to be evaluated.
integer,allocatable::system_quantities(:)!< Identifiers of the quantities needed from the system
! Information regarding the partner
class(interaction_partner_t),pointer::partner=>NULL()integer,allocatable::couplings_from_partner(:)!< Identifiers of the quantities needed from the partner
logical::partner_couplings_up_to_date=.false.!< Have the partner couplings been updated yet?
contains
procedure(interaction_calculate),deferred::calculateprocedure(interaction_calculate_energy),deferred::calculate_energyprocedure::update=>interaction_update!< @copydoc interaction_oct_m::interaction_update
procedure::update_partner_couplings=>interaction_update_partner_couplings!< @copydoc interaction_oct_m::interaction_update_partner_couplings
procedure::restart_read=>interaction_restart_read!< @copydoc interaction_oct_m::interaction_restart_read
procedure::restart_write=>interaction_restart_write!< @copydoc interaction_oct_m::interaction_restart_write
end type interaction_t
This is the minimal data structure for interactions, which only contains information relating to partner A, who owns the interacion.
In particular, the interaction has a list of quantities, which partner A needs to expose, so that the interaction can be calculated.
The IDs for the exposed quantities are defined in the section Exposed Quantities.
Furthermore, this abstract type already contains the clock for the interaction, and defines the interfaces for the deferred update()
and calculate() routines.
Abstract children
force_interaction_t
The next level of specialization of interaction, are all interactions which create a force on the partner. Here we only add the actual force vector, acting on the partner system.
Definition of force_interaction_t
type,extends(interaction_t),abstract::force_interaction_tinteger::dim=0!< spatial dimensions
integer::system_np=0!< number of particles in the system that the forces are acting on
FLOAT,allocatable,public::force(:,:)end type force_interaction_t
potential_interaction_t
The next level of specialization of interaction, are all interactions which create a potential for the partner.
Definition of potential_interaction_t
type,extends(interaction_t),abstract::potential_interaction_t! Although the potential should be a rank 1 object in the generic case,
! we make it of rank 2 to be able to treat spin and spinor cases for electrons
FLOAT,allocatable,public::potential(:,:)end type potential_interaction_t
density_interaction_t
The next level of specialization of interaction, are all interactions which create a potential for the partner.
Definition of density_interaction_t
type,extends(interaction_t),abstract::density_interaction_tFLOAT,allocatable,public::density(:,:)end type density_interaction_t
Specific classes:
Specific interaction classes extend the abstract ones. The most important element they add to the abstract classes is the information about the quantities, required to calculate the interaction. In case of the system. owning the interaction (system A), it is sufficient to keep pointers to the data, stored in the system itself. Thr reason is that the interaction is always updated by the propagator of the system A. For the partner system (system B), however, the interaction keeps a copy of the exposed quantities. This allows the partner system to continue the propagation beyond the time for which the quantities are requested, which might happen if the two systems are using different time steps.
Ghost interaction
Definition of ghost_interaction_t
type,extends(interaction_t)::ghost_interaction_tcontains
procedure::calculate=>ghost_interaction_calculateprocedure::calculate_energy=>ghost_interaction_calculate_energyfinal::ghost_interaction_finalizeend type ghost_interaction_t
Gravity
Definition of gravity_t
type,extends(force_interaction_t)::gravity_tprivate
FLOAT,pointer::system_mass(:)=>NULL()!< pointer to array storing the masses of the particles
FLOAT,pointer::system_pos(:,:)=>NULL()!< pointer to array storing the positions of the particles
integer,public::partner_np=0!< number of particles in the partner system
FLOAT,allocatable,public::partner_mass(:)!< array storing a copy of the masses of the partner particles
FLOAT,allocatable,public::partner_pos(:,:)!< array storing a copy of the positions of the partner particles
contains
procedure::init=>gravity_initprocedure::calculate=>gravity_calculateprocedure::calculate_energy=>gravity_calculate_energyfinal::gravity_finalizeend type gravity_t
Coulomb force
Definition of coulomb_force_t
type,extends(force_interaction_t)::coulomb_force_tprivate
FLOAT,pointer::system_charge(:)=>NULL()!< pointer to array storing the charges of the particles
FLOAT,pointer::system_pos(:,:)=>NULL()!< pointer to array storing the positions of the particles
integer,public::partner_np=0!< number of particles in the partner system
FLOAT,allocatable,public::partner_charge(:)!< array storing a copy of the masses of the partner particles
FLOAT,allocatable,public::partner_pos(:,:)!< array storing a copy of the positions of the partner particles
contains
procedure::init=>coulomb_force_initprocedure::calculate=>coulomb_force_calculateprocedure::calculate_energy=>coulomb_force_calculate_energyfinal::coulomb_force_finalizeend type coulomb_force_t
Lorentz force
Definition of lorentz_force_t
type,extends(force_interaction_t)::lorentz_force_tprivate
FLOAT,pointer::system_charge(:)=>NULL()!< pointer to array storing the charges of the particles
FLOAT,pointer,public::system_pos(:,:)=>NULL()!< pointer to array storing the positions of the particles
FLOAT,pointer::system_vel(:,:)=>NULL()!< pointer to array storing the velocities of the particles
FLOAT,allocatable,public::partner_e_field(:,:)!< E field generated by partner at the positions of the system particles
FLOAT,allocatable,public::partner_b_field(:,:)!< B field generated by partner at the positions of the system particles
contains
procedure::init=>lorentz_force_initprocedure::calculate=>lorentz_force_calculateprocedure::calculate_energy=>lorentz_force_calculate_energyfinal::lorentz_force_finalizeend type lorentz_force_t
Interaction factory
Instances of interaction_t or derived types are, like systems, generated using a factory.
Currently, the following interaction types are defined: