classes_dlc_visitor.f90 Source File

This File Depends On

sourcefile~~classes_dlc_visitor.f90~~EfferentGraph sourcefile~classes_dlc_visitor.f90 classes_dlc_visitor.f90 sourcefile~procedures_dipolar_interactions_micro.f90 procedures_dipolar_interactions_micro.f90 sourcefile~procedures_dipolar_interactions_micro.f90->sourcefile~classes_dlc_visitor.f90 sourcefile~classes_dlc_structures.f90 classes_dlc_structures.f90 sourcefile~procedures_dipolar_interactions_micro.f90->sourcefile~classes_dlc_structures.f90 sourcefile~classes_structure_visitor.f90 classes_structure_visitor.f90 sourcefile~classes_structure_visitor.f90->sourcefile~classes_dlc_visitor.f90 sourcefile~types_particle_wrapper.f90 types_particle_wrapper.f90 sourcefile~types_particle_wrapper.f90->sourcefile~classes_dlc_visitor.f90 sourcefile~types_particle_wrapper.f90->sourcefile~classes_structure_visitor.f90 sourcefile~types_particle_wrapper.f90->sourcefile~classes_dlc_structures.f90 sourcefile~classes_structure_factor.f90 classes_structure_factor.f90 sourcefile~types_particle_wrapper.f90->sourcefile~classes_structure_factor.f90 sourcefile~classes_reciprocal_lattice.f90 classes_reciprocal_lattice.f90 sourcefile~classes_reciprocal_lattice.f90->sourcefile~classes_dlc_visitor.f90 sourcefile~classes_dlc_weight.f90 classes_dlc_weight.f90 sourcefile~classes_reciprocal_lattice.f90->sourcefile~classes_dlc_weight.f90 sourcefile~classes_reciprocal_lattice.f90->sourcefile~classes_dlc_structures.f90 sourcefile~classes_dlc_weight.f90->sourcefile~classes_dlc_visitor.f90 sourcefile~classes_dlc_structures.f90->sourcefile~classes_dlc_visitor.f90 sourcefile~data_constants.f90 data_constants.f90 sourcefile~data_constants.f90->sourcefile~classes_dlc_visitor.f90 sourcefile~data_constants.f90->sourcefile~procedures_dipolar_interactions_micro.f90 sourcefile~data_constants.f90->sourcefile~types_particle_wrapper.f90 sourcefile~data_constants.f90->sourcefile~classes_reciprocal_lattice.f90 sourcefile~data_constants.f90->sourcefile~classes_dlc_weight.f90 sourcefile~data_constants.f90->sourcefile~classes_dlc_structures.f90 sourcefile~classes_periodic_box.f90 classes_periodic_box.f90 sourcefile~data_constants.f90->sourcefile~classes_periodic_box.f90 sourcefile~procedures_checks.f90 procedures_checks.f90 sourcefile~data_constants.f90->sourcefile~procedures_checks.f90 sourcefile~classes_component_coordinates.f90 classes_component_coordinates.f90 sourcefile~data_constants.f90->sourcefile~classes_component_coordinates.f90 sourcefile~classes_component_dipole_moments.f90 classes_component_dipole_moments.f90 sourcefile~data_constants.f90->sourcefile~classes_component_dipole_moments.f90 sourcefile~classes_coordinates.f90 classes_coordinates.f90 sourcefile~data_constants.f90->sourcefile~classes_coordinates.f90 sourcefile~procedures_coordinates_micro.f90 procedures_coordinates_micro.f90 sourcefile~data_constants.f90->sourcefile~procedures_coordinates_micro.f90 sourcefile~classes_periodic_box.f90->sourcefile~classes_dlc_visitor.f90 sourcefile~classes_periodic_box.f90->sourcefile~classes_reciprocal_lattice.f90 sourcefile~classes_periodic_box.f90->sourcefile~classes_dlc_weight.f90 sourcefile~classes_periodic_box.f90->sourcefile~classes_dlc_structures.f90 sourcefile~classes_periodic_box.f90->sourcefile~classes_component_coordinates.f90 sourcefile~procedures_checks.f90->sourcefile~classes_reciprocal_lattice.f90 sourcefile~procedures_checks.f90->sourcefile~classes_periodic_box.f90 sourcefile~classes_permittivity.f90 classes_permittivity.f90 sourcefile~procedures_checks.f90->sourcefile~classes_permittivity.f90 sourcefile~procedures_checks.f90->sourcefile~classes_component_coordinates.f90 sourcefile~procedures_checks.f90->sourcefile~classes_component_dipole_moments.f90 sourcefile~classes_component_chemical_potential.f90 classes_component_chemical_potential.f90 sourcefile~procedures_checks.f90->sourcefile~classes_component_chemical_potential.f90 sourcefile~procedures_checks.f90->sourcefile~procedures_coordinates_micro.f90 sourcefile~procedures_errors.f90 procedures_errors.f90 sourcefile~procedures_errors.f90->sourcefile~classes_reciprocal_lattice.f90 sourcefile~procedures_errors.f90->sourcefile~classes_periodic_box.f90 sourcefile~procedures_errors.f90->sourcefile~procedures_checks.f90 sourcefile~procedures_errors.f90->sourcefile~classes_component_coordinates.f90 sourcefile~classes_num_particles.f90 classes_num_particles.f90 sourcefile~procedures_errors.f90->sourcefile~classes_num_particles.f90 sourcefile~procedures_errors.f90->sourcefile~procedures_coordinates_micro.f90 sourcefile~types_potential_domain.f90 types_potential_domain.f90 sourcefile~types_potential_domain.f90->sourcefile~procedures_checks.f90 sourcefile~classes_number_to_string.f90 classes_number_to_string.f90 sourcefile~classes_number_to_string.f90->sourcefile~procedures_checks.f90 sourcefile~types_potential_domain_selector.f90 types_potential_domain_selector.f90 sourcefile~types_potential_domain_selector.f90->sourcefile~procedures_checks.f90 sourcefile~data_strings.f90 data_strings.f90 sourcefile~data_strings.f90->sourcefile~classes_number_to_string.f90 sourcefile~data_strings.f90->sourcefile~procedures_coordinates_micro.f90 sourcefile~classes_permittivity.f90->sourcefile~classes_dlc_weight.f90 sourcefile~classes_structure_factor.f90->sourcefile~classes_dlc_structures.f90 sourcefile~types_component_wrapper.f90 types_component_wrapper.f90 sourcefile~types_component_wrapper.f90->sourcefile~classes_dlc_structures.f90 sourcefile~classes_component_coordinates.f90->sourcefile~types_component_wrapper.f90 sourcefile~classes_component_coordinates.f90->sourcefile~classes_component_dipole_moments.f90 sourcefile~classes_component_dipole_moments.f90->sourcefile~types_component_wrapper.f90 sourcefile~classes_num_particles.f90->sourcefile~types_component_wrapper.f90 sourcefile~classes_num_particles.f90->sourcefile~classes_component_coordinates.f90 sourcefile~classes_component_chemical_potential.f90->sourcefile~types_component_wrapper.f90 sourcefile~classes_coordinates.f90->sourcefile~classes_component_coordinates.f90 sourcefile~classes_coordinates.f90->sourcefile~classes_component_dipole_moments.f90 sourcefile~procedures_coordinates_micro.f90->sourcefile~classes_component_coordinates.f90
Help

Files Dependent On This One

sourcefile~~classes_dlc_visitor.f90~~AfferentGraph sourcefile~classes_dlc_visitor.f90 classes_dlc_visitor.f90 sourcefile~procedures_dlc_visitor_factory.f90 procedures_dlc_visitor_factory.f90 sourcefile~classes_dlc_visitor.f90->sourcefile~procedures_dlc_visitor_factory.f90 sourcefile~types_dipolar_interactions_dynamic_wrapper.f90 types_dipolar_interactions_dynamic_wrapper.f90 sourcefile~classes_dlc_visitor.f90->sourcefile~types_dipolar_interactions_dynamic_wrapper.f90 sourcefile~classes_box_particle_exchange.f90 classes_box_particle_exchange.f90 sourcefile~types_dipolar_interactions_dynamic_wrapper.f90->sourcefile~classes_box_particle_exchange.f90 sourcefile~procedures_dipolar_interactions_facades_factory.f90 procedures_dipolar_interactions_facades_factory.f90 sourcefile~types_dipolar_interactions_dynamic_wrapper.f90->sourcefile~procedures_dipolar_interactions_facades_factory.f90 sourcefile~classes_boxes_particles_swap.f90 classes_boxes_particles_swap.f90 sourcefile~types_dipolar_interactions_dynamic_wrapper.f90->sourcefile~classes_boxes_particles_swap.f90 sourcefile~procedures_exchange_visitors.f90 procedures_exchange_visitors.f90 sourcefile~types_dipolar_interactions_dynamic_wrapper.f90->sourcefile~procedures_exchange_visitors.f90 sourcefile~classes_box_particles_swap.f90 classes_box_particles_swap.f90 sourcefile~types_dipolar_interactions_dynamic_wrapper.f90->sourcefile~classes_box_particles_swap.f90 sourcefile~classes_particle_insertion_method.f90 classes_particle_insertion_method.f90 sourcefile~types_dipolar_interactions_dynamic_wrapper.f90->sourcefile~classes_particle_insertion_method.f90 sourcefile~types_physical_model_wrapper.f90 types_physical_model_wrapper.f90 sourcefile~types_dipolar_interactions_dynamic_wrapper.f90->sourcefile~types_physical_model_wrapper.f90 sourcefile~procedures_dipolar_interactions_factory.f90 procedures_dipolar_interactions_factory.f90 sourcefile~types_dipolar_interactions_dynamic_wrapper.f90->sourcefile~procedures_dipolar_interactions_factory.f90 sourcefile~procedures_dipolar_interactions_visitor.f90 procedures_dipolar_interactions_visitor.f90 sourcefile~types_dipolar_interactions_dynamic_wrapper.f90->sourcefile~procedures_dipolar_interactions_visitor.f90 sourcefile~classes_dipolar_interactions_facade.f90 classes_dipolar_interactions_facade.f90 sourcefile~types_dipolar_interactions_dynamic_wrapper.f90->sourcefile~classes_dipolar_interactions_facade.f90 sourcefile~classes_box_particle_move.f90 classes_box_particle_move.f90 sourcefile~types_dipolar_interactions_dynamic_wrapper.f90->sourcefile~classes_box_particle_move.f90 sourcefile~procedures_transmutation_visitors.f90 procedures_transmutation_visitors.f90 sourcefile~types_dipolar_interactions_dynamic_wrapper.f90->sourcefile~procedures_transmutation_visitors.f90 sourcefile~classes_boxes_particle_teleportation.f90 classes_boxes_particle_teleportation.f90 sourcefile~types_dipolar_interactions_dynamic_wrapper.f90->sourcefile~classes_boxes_particle_teleportation.f90 sourcefile~procedures_box_particle_exchange_factory.f90 procedures_box_particle_exchange_factory.f90 sourcefile~classes_box_particle_exchange.f90->sourcefile~procedures_box_particle_exchange_factory.f90 sourcefile~procedures_physical_model_factory.f90 procedures_physical_model_factory.f90 sourcefile~procedures_dipolar_interactions_facades_factory.f90->sourcefile~procedures_physical_model_factory.f90 sourcefile~procedures_boxes_particles_swap_factory.f90 procedures_boxes_particles_swap_factory.f90 sourcefile~classes_boxes_particles_swap.f90->sourcefile~procedures_boxes_particles_swap_factory.f90 sourcefile~procedures_exchange_visitors.f90->sourcefile~classes_box_particle_exchange.f90 sourcefile~procedures_exchange_visitors.f90->sourcefile~classes_boxes_particle_teleportation.f90 sourcefile~procedures_box_particles_swap_factory.f90 procedures_box_particles_swap_factory.f90 sourcefile~classes_box_particles_swap.f90->sourcefile~procedures_box_particles_swap_factory.f90 sourcefile~types_markov_chain_explorer_wrapper.f90 types_markov_chain_explorer_wrapper.f90 sourcefile~classes_particle_insertion_method.f90->sourcefile~types_markov_chain_explorer_wrapper.f90 sourcefile~procedures_particle_insertion_method_factory.f90 procedures_particle_insertion_method_factory.f90 sourcefile~classes_particle_insertion_method.f90->sourcefile~procedures_particle_insertion_method_factory.f90 sourcefile~procedures_exploration_inquirers.f90 procedures_exploration_inquirers.f90 sourcefile~classes_particle_insertion_method.f90->sourcefile~procedures_exploration_inquirers.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~procedures_box_particle_exchange_factory.f90 sourcefile~procedures_generating_algorithms_factory.f90 procedures_generating_algorithms_factory.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~procedures_generating_algorithms_factory.f90 sourcefile~plmc_generate.f90 plmc_generate.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~plmc_generate.f90 sourcefile~procedures_markov_chain_generator_factory.f90 procedures_markov_chain_generator_factory.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~procedures_markov_chain_generator_factory.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~procedures_physical_model_factory.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~procedures_boxes_particles_swap_factory.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~procedures_box_particles_swap_factory.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~procedures_particle_insertion_method_factory.f90 sourcefile~procedures_markov_chain_explorer_factory.f90 procedures_markov_chain_explorer_factory.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~procedures_markov_chain_explorer_factory.f90 sourcefile~plmc_explore.f90 plmc_explore.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~plmc_explore.f90 sourcefile~procedures_plmc_resetter.f90 procedures_plmc_resetter.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~procedures_plmc_resetter.f90 sourcefile~procedures_plmc_visitor.f90 procedures_plmc_visitor.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~procedures_plmc_visitor.f90 sourcefile~procedures_boxes_volume_exchange_factory.f90 procedures_boxes_volume_exchange_factory.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~procedures_boxes_volume_exchange_factory.f90 sourcefile~procedures_maximum_boxes_compression_explorer_factory.f90 procedures_maximum_boxes_compression_explorer_factory.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~procedures_maximum_boxes_compression_explorer_factory.f90 sourcefile~procedures_boxes_particle_teleportation_factory.f90 procedures_boxes_particle_teleportation_factory.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~procedures_boxes_particle_teleportation_factory.f90 sourcefile~procedures_volume_change_method_factory.f90 procedures_volume_change_method_factory.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~procedures_volume_change_method_factory.f90 sourcefile~procedures_box_volume_change_factory.f90 procedures_box_volume_change_factory.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~procedures_box_volume_change_factory.f90 sourcefile~procedures_box_particle_move_factory.f90 procedures_box_particle_move_factory.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~procedures_box_particle_move_factory.f90 sourcefile~procedures_dipolar_neighbourhoods_visitors_factory.f90 procedures_dipolar_neighbourhoods_visitors_factory.f90 sourcefile~types_physical_model_wrapper.f90->sourcefile~procedures_dipolar_neighbourhoods_visitors_factory.f90 sourcefile~procedures_dipolar_interactions_factory.f90->sourcefile~procedures_physical_model_factory.f90 sourcefile~classes_box_volume_change.f90 classes_box_volume_change.f90 sourcefile~procedures_dipolar_interactions_factory.f90->sourcefile~classes_box_volume_change.f90 sourcefile~classes_volume_change_method.f90 classes_volume_change_method.f90 sourcefile~procedures_dipolar_interactions_factory.f90->sourcefile~classes_volume_change_method.f90 sourcefile~classes_boxes_volume_exchange.f90 classes_boxes_volume_exchange.f90 sourcefile~procedures_dipolar_interactions_factory.f90->sourcefile~classes_boxes_volume_exchange.f90 sourcefile~procedures_dipolar_interactions_visitor.f90->sourcefile~classes_dipolar_interactions_facade.f90 sourcefile~procedures_dipolar_interactions_visitor.f90->sourcefile~procedures_plmc_visitor.f90 sourcefile~procedures_dipolar_interactions_visitor.f90->sourcefile~classes_box_volume_change.f90 sourcefile~procedures_dipolar_interactions_visitor.f90->sourcefile~classes_volume_change_method.f90 sourcefile~procedures_dipolar_interactions_visitor.f90->sourcefile~classes_boxes_volume_exchange.f90 sourcefile~classes_dipolar_interactions_facade.f90->sourcefile~procedures_dipolar_interactions_facades_factory.f90 sourcefile~classes_dipolar_interactions_facade.f90->sourcefile~types_physical_model_wrapper.f90 sourcefile~classes_dipolar_interactions_facade.f90->sourcefile~classes_box_volume_change.f90 sourcefile~classes_dipolar_interactions_facade.f90->sourcefile~classes_volume_change_method.f90 sourcefile~classes_dipolar_interactions_facade.f90->sourcefile~classes_boxes_volume_exchange.f90 sourcefile~classes_box_particle_move.f90->sourcefile~procedures_box_particle_move_factory.f90 sourcefile~procedures_transmutation_visitors.f90->sourcefile~classes_boxes_particles_swap.f90 sourcefile~procedures_transmutation_visitors.f90->sourcefile~classes_box_particles_swap.f90 sourcefile~classes_boxes_particle_teleportation.f90->sourcefile~procedures_boxes_particle_teleportation_factory.f90 sourcefile~procedures_box_particle_exchange_factory.f90->sourcefile~procedures_generating_algorithms_factory.f90 sourcefile~procedures_generating_algorithms_factory.f90->sourcefile~plmc_generate.f90 sourcefile~procedures_generating_algorithms_factory.f90->sourcefile~procedures_markov_chain_generator_factory.f90 sourcefile~procedures_boxes_particles_swap_factory.f90->sourcefile~procedures_generating_algorithms_factory.f90 sourcefile~procedures_box_particles_swap_factory.f90->sourcefile~procedures_generating_algorithms_factory.f90 sourcefile~types_markov_chain_explorer_wrapper.f90->sourcefile~procedures_markov_chain_explorer_factory.f90 sourcefile~procedures_exploring_writers_factory.f90 procedures_exploring_writers_factory.f90 sourcefile~types_markov_chain_explorer_wrapper.f90->sourcefile~procedures_exploring_writers_factory.f90 sourcefile~types_markov_chain_explorer_wrapper.f90->sourcefile~plmc_explore.f90 sourcefile~procedures_particle_insertion_method_factory.f90->sourcefile~procedures_markov_chain_explorer_factory.f90 sourcefile~procedures_exploration_inquirers.f90->sourcefile~procedures_dipolar_interactions_facades_factory.f90 sourcefile~procedures_exploration_inquirers.f90->sourcefile~procedures_markov_chain_explorer_factory.f90 sourcefile~procedures_exploration_inquirers.f90->sourcefile~procedures_exploring_writers_factory.f90 sourcefile~procedures_exploration_inquirers.f90->sourcefile~plmc_explore.f90 sourcefile~procedures_short_interactions_factory.f90 procedures_short_interactions_factory.f90 sourcefile~procedures_exploration_inquirers.f90->sourcefile~procedures_short_interactions_factory.f90 sourcefile~procedures_markov_chain_explorer_factory.f90->sourcefile~plmc_explore.f90 sourcefile~procedures_short_interactions_factory.f90->sourcefile~procedures_physical_model_factory.f90 sourcefile~procedures_plmc_resetter.f90->sourcefile~plmc_generate.f90 sourcefile~procedures_plmc_resetter.f90->sourcefile~plmc_explore.f90 sourcefile~procedures_plmc_visitor.f90->sourcefile~plmc_generate.f90 sourcefile~procedures_plmc_visitor.f90->sourcefile~plmc_explore.f90 sourcefile~procedures_boxes_volume_exchange_factory.f90->sourcefile~procedures_generating_algorithms_factory.f90 sourcefile~procedures_maximum_boxes_compression_explorer_factory.f90->sourcefile~procedures_markov_chain_explorer_factory.f90 sourcefile~procedures_boxes_particle_teleportation_factory.f90->sourcefile~procedures_generating_algorithms_factory.f90 sourcefile~procedures_volume_change_method_factory.f90->sourcefile~procedures_markov_chain_explorer_factory.f90 sourcefile~procedures_box_volume_change_factory.f90->sourcefile~procedures_generating_algorithms_factory.f90 sourcefile~procedures_box_particle_move_factory.f90->sourcefile~procedures_generating_algorithms_factory.f90 sourcefile~procedures_dipolar_neighbourhoods_visitors_factory.f90->sourcefile~procedures_markov_chain_explorer_factory.f90 sourcefile~classes_box_volume_change.f90->sourcefile~procedures_box_volume_change_factory.f90 sourcefile~classes_volume_change_method.f90->sourcefile~types_markov_chain_explorer_wrapper.f90 sourcefile~classes_volume_change_method.f90->sourcefile~procedures_exploration_inquirers.f90 sourcefile~classes_volume_change_method.f90->sourcefile~procedures_volume_change_method_factory.f90 sourcefile~classes_boxes_volume_exchange.f90->sourcefile~procedures_boxes_volume_exchange_factory.f90
Help


Source Code

module classes_dlc_visitor

use, intrinsic :: iso_fortran_env, only: DP => REAL64
use data_constants, only: num_dimensions, PI
use classes_periodic_box, only: Abstract_Periodic_Box
use classes_reciprocal_lattice, only: Abstract_Reciprocal_Lattice
use types_particle_wrapper, only: Concrete_Particle
use classes_dlc_weight, only: Abstract_DLC_Weight
use classes_dlc_structures, only: Abstract_DLC_Structures
use classes_structure_visitor, only: Abstract_Structure_Visitor
use procedures_dipolar_interactions_micro, only: set_fourier, set_exp_kz, reci_number_1_sym

implicit none

private

    type, extends(Abstract_Structure_Visitor), abstract, public :: Abstract_DLC_Visitor
    private
        class(Abstract_Periodic_Box), pointer :: periodic_box => null()
        integer :: reci_numbers(num_dimensions) = 0
        class(Abstract_DLC_Weight), pointer :: weight => null()
        class(Abstract_DLC_Structures), pointer :: structures => null()
    contains
        procedure :: construct => Abstract_construct
        procedure :: destroy => Abstract_destroy
        procedure :: target => Abstract_target
        procedure :: visit => Abstract_visit
        procedure :: visit_translation => Abstract_visit_translation
        procedure :: visit_transmutation => Abstract_visit_transmutation
        procedure :: visit_rotation => Abstract_visit_rotation
        procedure :: visit_add => Abstract_visit_add
        procedure :: visit_remove => Abstract_visit_remove
        procedure :: visit_switch => Abstract_visit_switch
        procedure, private :: visit_exchange => Abstract_visit_exchange
    end type Abstract_DLC_Visitor

    type, extends(Abstract_DLC_Visitor), public :: Concrete_DLC_Visitor

    end type Concrete_DLC_Visitor

    type, extends(Abstract_DLC_Visitor), public :: Null_DLC_Visitor
    contains
        procedure :: construct => Null_construct
        procedure :: destroy => Null_destroy
        procedure :: target => Null_target
        procedure :: visit => Null_visit
        procedure :: visit_translation => Null_visit_translation
        procedure :: visit_transmutation => Null_visit_transmutation
        procedure :: visit_switch => Null_visit_switch
        procedure, private :: visit_exchange => Null_visit_exchange
    end type Null_DLC_Visitor

contains

!implementation Abstract_DLC_Visitor

    subroutine Abstract_construct(this, periodic_box, reciprocal_lattice, weight, structures)
        class(Abstract_DLC_Visitor), intent(out) :: this
        class(Abstract_Periodic_Box), target, intent(in) :: periodic_box
        class(Abstract_Reciprocal_Lattice), intent(in) :: reciprocal_lattice
        class(Abstract_DLC_Weight), intent(in) :: weight
        class(Abstract_DLC_Structures), intent(in) :: structures

        this%periodic_box => periodic_box
        this%reci_numbers = reciprocal_lattice%get_numbers()
        call this%target(weight, structures)
    end subroutine Abstract_construct

    subroutine Abstract_destroy(this)
        class(Abstract_DLC_Visitor), intent(inout) :: this

        this%structures => null()
        this%weight => null()
        this%periodic_box => null()
    end subroutine Abstract_destroy

    subroutine Abstract_target(this, weight, structures)
        class(Abstract_DLC_Visitor), intent(inout) :: this
        class(Abstract_DLC_Weight), target, intent(in) :: weight
        class(Abstract_DLC_Structures), target, intent(in) :: structures

        this%weight => weight
        this%structures => structures
    end subroutine Abstract_target

    !> \[
    !>      U = \sum_{\vec{k}_{1:2}} w(\vec{k}_{1:2})
    !>          \Re[S_+(\vec{k}_{1:2}) S_-(\vec{k}_{1:2})^\ast]
    !> \]
    !> where \( w(\vec{k}_{1:2}) \) is [[Abstract_DLC_Weight]] and
    !> \( S_\pm(\vec{k}_{1:2}) \) is [[Abstract_DLC_Structures]].
    pure real(DP) function Abstract_visit(this) result(energy)
        class(Abstract_DLC_Visitor), intent(in) :: this

        integer :: n_1, n_2

        energy = 0._DP
        do n_2 = 0, this%reci_numbers(2)
            do n_1 = -reci_number_1_sym(this%reci_numbers, 0, n_2), this%reci_numbers(1)
                if (n_1**2 + n_2**2 > this%reci_numbers(1)**2) cycle
                energy = energy + this%weight%get(n_1, n_2) * &
                    real(this%structures%get_plus(n_1, n_2) * &
                        conjg(this%structures%get_minus(n_1, n_2)), DP)
            end do
        end do
        energy = 2._DP * energy ! symmetry: half wave vectors -> double energy
    end function Abstract_visit

    !> Energy delta when a particle is translated:
    !> \( (\vec{x}, \vec{\mu}) \to (\vec{x}^\prime, \vec{\mu}) \).
    !> \[
    !>      \Delta S_-^\ast(\vec{k}_{1:2}) =
    !>          (-k_{1:2} \mu_3 - i \vec{k}_{1:2} \cdot \vec{\mu}_{1:2})
    !>          \left(
    !>              e^{-k_{1:2} x^\prime_3} e^{-i \vec{k}_{1:2} \cdot \vec{x}^\prime_{1:2}} -
    !>              e^{-k_{1:2} x_3} e^{-i \vec{k}_{1:2} \cdot \vec{x}_{1:2}}
    !>          \right)
    !> \]
    !> \[
    !>      \Delta S_+(\vec{k}_{1:2}) = (+k_{1:2} \mu_3 + i \vec{k}_{1:2} \cdot \vec{\mu}_{1:2})
    !>          \left(
    !>              e^{+k_{1:2} x^\prime_3} e^{+i \vec{k}_{1:2} \cdot \vec{x}^\prime_{1:2}} -
    !>              e^{+k_{1:2} x_3} e^{+i \vec{k}_{1:2} \cdot \vec{x}_{1:2}}
    !>          \right)
    !> \]
    !> \[
    !>      \Delta S_+(\vec{k}_{1:2}) \Delta S_-^\ast(\vec{k}_{1:2}) =
    !>          \left[
    !>              -(k_{1:2} \mu_3)^2 + (\vec{k}_{1:2} \cdot \vec{\mu}_{1:2})^2 -
    !>              2 i k_{1:2} \mu_3 \vec{k}_{1:2} \cdot \vec{\mu}_{1:2}
    !>          \right]
    !>          \left(
    !>              2 - \\
    !>              e^{+k_{1:2} x^\prime_3} e^{+i \vec{k}_{1:2} \cdot \vec{x}^\prime_{1:2}}
    !>              e^{-k_{1:2} x_3} e^{-i \vec{k}_{1:2} \cdot \vec{x}_{1:2}} - \\
    !>              e^{-k_{1:2} x^\prime_3} e^{-i \vec{k}_{1:2} \cdot \vec{x}^\prime_{1:2}}
    !>              e^{+k_{1:2} x_3} e^{+i \vec{k}_{1:2} \cdot \vec{x}_{1:2}}
    !>          \right)
    !> \]
    pure real(DP) function Abstract_visit_translation(this, i_component, new_position, old) &
        result(delta_energy)
        class(Abstract_DLC_Visitor), intent(in) :: this
        integer, intent(in) :: i_component
        real(DP), intent(in) :: new_position(:)
        type(Concrete_Particle), intent(in) :: old

        real(DP) :: real_part_1, real_part_2, real_part_3

        real(DP) :: surface_size(2)
        real(DP), dimension(2) :: wave_1_x_position_old, wave_1_x_position_new, wave_vector
        real(DP) :: wave_dot_moment_12, wave_x_moment_3
        integer :: n_1, n_2

        complex(DP) :: fourier_position_new
        complex(DP), dimension(-this%reci_numbers(1):this%reci_numbers(1)) :: fourier_position_new_1
        complex(DP), dimension(-this%reci_numbers(2):this%reci_numbers(2)) :: fourier_position_new_2
        real(DP) :: exp_kz_new
        real(DP), dimension(0:this%reci_numbers(1), 0:this%reci_numbers(2)) :: exp_kz_new_tab
        complex(DP) :: fourier_position_old
        complex(DP), dimension(-this%reci_numbers(1):this%reci_numbers(1)) :: fourier_position_old_1
        complex(DP), dimension(-this%reci_numbers(2):this%reci_numbers(2)) :: fourier_position_old_2
        real(DP) :: exp_kz_old
        real(DP), dimension(0:this%reci_numbers(1), 0:this%reci_numbers(2)) :: exp_kz_old_tab

        delta_energy = 0._DP
        if (.not.this%structures%is_dipolar(i_component)) return

        surface_size = reshape(this%periodic_box%get_size(), [2])
        wave_1_x_position_old = 2._DP*PI * old%position(1:2) / surface_size
        call set_fourier(fourier_position_old_1, this%reci_numbers(1), wave_1_x_position_old(1))
        call set_fourier(fourier_position_old_2, this%reci_numbers(2), wave_1_x_position_old(2))
        call set_exp_kz(exp_kz_old_tab, surface_size, old%position(3))
        wave_1_x_position_new = 2._DP*PI * new_position(1:2) / surface_size
        call set_fourier(fourier_position_new_1, this%reci_numbers(1), wave_1_x_position_new(1))
        call set_fourier(fourier_position_new_2, this%reci_numbers(2), wave_1_x_position_new(2))
        call set_exp_kz(exp_kz_new_tab, surface_size, new_position(3))

        do n_2 = 0, this%reci_numbers(2)
            wave_vector(2) = 2._DP*PI * real(n_2, DP) / surface_size(2)
            do n_1 = -reci_number_1_sym(this%reci_numbers, 0, n_2), this%reci_numbers(1)
                wave_vector(1) = 2._DP*PI * real(n_1, DP) / surface_size(1)

                if (n_1**2 + n_2**2 > this%reci_numbers(1)**2) cycle

                fourier_position_old = fourier_position_old_1(n_1) * fourier_position_old_2(n_2)
                exp_kz_old = exp_kz_old_tab(abs(n_1), abs(n_2))
                fourier_position_new = fourier_position_new_1(n_1) * fourier_position_new_2(n_2)
                exp_kz_new = exp_kz_new_tab(abs(n_1), abs(n_2))

                wave_dot_moment_12 = dot_product(wave_vector, old%dipole_moment(1:2))
                wave_x_moment_3 = norm2(wave_vector) * old%dipole_moment(3)

                real_part_1 = real(this%structures%get_plus(n_1, n_2) * &
                    cmplx(-wave_x_moment_3, -wave_dot_moment_12, DP) * &
                    conjg(fourier_position_new/exp_kz_new - fourier_position_old/exp_kz_old), DP)
                real_part_2 = real(conjg(this%structures%get_minus(n_1, n_2)) * &
                    cmplx(+wave_x_moment_3, +wave_dot_moment_12, DP) * &
                    (fourier_position_new * exp_kz_new - fourier_position_old * exp_kz_old), DP)
                real_part_3 = real(cmplx(-wave_x_moment_3**2 + wave_dot_moment_12**2, &
                    -2._DP*wave_x_moment_3 * wave_dot_moment_12, DP) * (2._DP - &
                    fourier_position_new*exp_kz_new * conjg(fourier_position_old)/exp_kz_old - &
                    fourier_position_old*exp_kz_old * conjg(fourier_position_new)/exp_kz_new), DP)

                delta_energy = delta_energy + this%weight%get(n_1, n_2) * &
                    (real_part_1 + real_part_2 + real_part_3)
            end do
        end do
        delta_energy = 2._DP * delta_energy ! symmetry: half wave vectors -> double energy
    end function Abstract_visit_translation

    !> Energy delta when a particle is transmuted:
    !> \( (\vec{x}, \vec{\mu}) \to (\vec{x}, \vec{\mu}^\prime) \).
    !> \[
    !>      \Delta S_-^\ast(\vec{k}_{1:2}) =
    !>          \left[
    !>              -k_{1:2} (\mu^\prime_3 - \mu_3) -
    !>              i \vec{k}_{1:2} \cdot (\vec{\mu}^\prime_{1:2} - \vec{\mu}_{1:2})
    !>          \right]
    !>          e^{-k_{1:2} x_3} e^{-i \vec{k}_{1:2} \cdot \vec{x}_{1:2}}
    !> \]
    !> \[
    !>      \Delta S_+(\vec{k}_{1:2}) =
    !>          \left[
    !>              +k_{1:2} (\mu^\prime_3 - \mu_3) +
    !>              i \vec{k}_{1:2} \cdot (\vec{\mu}^\prime_{1:2} - \vec{\mu}_{1:2})
    !>          \right]
    !>          e^{+k_{1:2} x_3} e^{+i \vec{k}_{1:2} \cdot \vec{x}_{1:2}}
    !> \]
    !> \[
    !>      \Re[\Delta S_+(\vec{k}_{1:2}) \Delta S_-^\ast(\vec{k}_{1:2})] =
    !>          -[k_{1:2} (\mu^\prime_3 - \mu_3)]^2 +
    !>          [\vec{k}_{1:2} \cdot (\vec{\mu}^\prime_{1:2} - \vec{\mu}_{1:2})]^2
    !> \]
    pure real(DP) function Abstract_visit_transmutation(this, ij_components, new_dipole_moment, &
        old) result(delta_energy)
        class(Abstract_DLC_Visitor), intent(in) :: this
        integer, intent(in) :: ij_components(:)
        real(DP), intent(in) :: new_dipole_moment(:)
        type(Concrete_Particle), intent(in) :: old

        real(DP) :: real_part_1, real_part_2, real_part_3

        real(DP) :: surface_size(2)
        real(DP), dimension(2) :: wave_1_x_position, wave_vector
        real(DP) :: wave_dot_delta_moment_12, wave_delta_moment_3
        integer :: n_1, n_2

        complex(DP) :: fourier_position
        complex(DP), dimension(-this%reci_numbers(1):this%reci_numbers(1)) :: fourier_position_1
        complex(DP), dimension(-this%reci_numbers(2):this%reci_numbers(2)) :: fourier_position_2
        real(DP) :: exp_kz
        real(DP), dimension(0:this%reci_numbers(1), 0:this%reci_numbers(2)) :: exp_kz_tab

        delta_energy = 0._DP
        if (.not.(this%structures%is_dipolar(ij_components(1)) .or. &
            this%structures%is_dipolar(ij_components(2)))) return

        surface_size = reshape(this%periodic_box%get_size(), [2])
        wave_1_x_position = 2._DP*PI * old%position(1:2) / surface_size
        call set_fourier(fourier_position_1, this%reci_numbers(1), wave_1_x_position(1))
        call set_fourier(fourier_position_2, this%reci_numbers(2), wave_1_x_position(2))
        call set_exp_kz(exp_kz_tab, surface_size, old%position(3))

        do n_2 = 0, this%reci_numbers(2)
            wave_vector(2) = 2._DP*PI * real(n_2, DP) / surface_size(2)
            do n_1 = -reci_number_1_sym(this%reci_numbers, 0, n_2), this%reci_numbers(1)
                wave_vector(1) = 2._DP*PI * real(n_1, DP) / surface_size(1)

                if (n_1**2 + n_2**2 > this%reci_numbers(1)**2) cycle

                fourier_position = fourier_position_1(n_1) * fourier_position_2(n_2)
                exp_kz = exp_kz_tab(abs(n_1), abs(n_2))

                wave_dot_delta_moment_12 = dot_product(wave_vector, new_dipole_moment(1:2) - old%&
                    dipole_moment(1:2))
                wave_delta_moment_3 = norm2(wave_vector) * (new_dipole_moment(3) - old%&
                    dipole_moment(3))

                real_part_1 = real(this%structures%get_plus(n_1, n_2) * &
                    cmplx(-wave_delta_moment_3, -wave_dot_delta_moment_12, DP) * &
                    conjg(fourier_position) / exp_kz, DP)
                real_part_2 = real(conjg(this%structures%get_minus(n_1, n_2)) * &
                    cmplx(+wave_delta_moment_3, +wave_dot_delta_moment_12, DP) * &
                    fourier_position * exp_kz, DP)
                real_part_3 = -wave_delta_moment_3**2 + wave_dot_delta_moment_12**2

                delta_energy = delta_energy + this%weight%get(n_1, n_2) * &
                    (real_part_1 + real_part_2 + real_part_3)
            end do
        end do
        delta_energy = 2._DP * delta_energy ! symmetry: half wave vectors -> double energy
    end function Abstract_visit_transmutation

    pure real(DP) function Abstract_visit_rotation(this, i_component, new_dipole_moment, old) &
        result(delta_energy)
        class(Abstract_DLC_Visitor), intent(in) :: this
        integer, intent(in) :: i_component
        real(DP), intent(in) :: new_dipole_moment(:)
        type(Concrete_Particle), intent(in) :: old

        delta_energy = this%visit_transmutation([i_component, i_component], new_dipole_moment, old)
    end function Abstract_visit_rotation

    pure real(DP) function Abstract_visit_add(this, i_component, particle) result(delta_energy)
        class(Abstract_DLC_Visitor), intent(in) :: this
        integer, intent(in) :: i_component
        type(Concrete_Particle), intent(in) :: particle

        delta_energy = this%visit_exchange(i_component, particle, +1._DP)
    end function Abstract_visit_add

    pure real(DP) function Abstract_visit_remove(this, i_component, particle) result(delta_energy)
        class(Abstract_DLC_Visitor), intent(in) :: this
        integer, intent(in) :: i_component
        type(Concrete_Particle), intent(in) :: particle

        delta_energy = this%visit_exchange(i_component, particle, -1._DP)
    end function Abstract_visit_remove

    !> Energy delta when a particle of coordinates \( (\vec{x}, \vec{\mu}) \) is added
    !> (\( \pmb{+} \)) or removed (\( \pmb{-} \)).
    !> \[
    !>      \Delta S_-^\ast(\vec{k}_{1:2}) =
    !>          \pmb{\pm} (-k_{1:2} \mu_3 - i \vec{k}_{1:2} \cdot \vec{\mu}_{1:2})
    !>          e^{-k_{1:2} x_3} e^{-i \vec{k}_{1:2} \cdot \vec{x}_{1:2}}
    !> \]
    !> \[
    !>      \Delta S_+(\vec{k}_{1:2}) =
    !>          \pmb{\pm} (+k_{1:2} \mu_3 + i \vec{k}_{1:2} \cdot \vec{\mu}_{1:2})
    !>          e^{+k_{1:2} x_3} e^{+i \vec{k}_{1:2} \cdot \vec{x}_{1:2}}
    !> \]
    !> \[
    !>      \Re[\Delta S_+(\vec{k}_{1:2}) \Delta S_-^\ast(\vec{k}_{1:2})] =
    !>          -(k_{1:2} \mu_3)^2 + (\vec{k}_{1:2} \cdot \vec{\mu}_{1:2})^2
    !> \]
    pure real(DP) function Abstract_visit_exchange(this, i_component, particle, signed) &
        result(delta_energy)
        class(Abstract_DLC_Visitor), intent(in) :: this
        integer, intent(in) :: i_component
        type(Concrete_Particle), intent(in) :: particle
        real(DP), intent(in) :: signed

        real(DP) :: real_part_1, real_part_2, real_part_3

        real(DP) :: surface_size(2)
        real(DP), dimension(2) :: wave_1_x_position, wave_vector
        real(DP) :: wave_dot_moment_12, wave_x_moment_3
        integer :: n_1, n_2

        complex(DP) :: fourier_position
        complex(DP), dimension(-this%reci_numbers(1):this%reci_numbers(1)) :: fourier_position_1
        complex(DP), dimension(-this%reci_numbers(2):this%reci_numbers(2)) :: fourier_position_2
        real(DP) :: exp_kz
        real(DP), dimension(0:this%reci_numbers(1), 0:this%reci_numbers(2)) :: exp_kz_tab

        delta_energy = 0._DP
        if (.not.this%structures%is_dipolar(i_component)) return

        surface_size = reshape(this%periodic_box%get_size(), [2])
        wave_1_x_position = 2._DP*PI * particle%position(1:2) / surface_size
        call set_fourier(fourier_position_1, this%reci_numbers(1), wave_1_x_position(1))
        call set_fourier(fourier_position_2, this%reci_numbers(2), wave_1_x_position(2))
        call set_exp_kz(exp_kz_tab, surface_size, particle%position(3))

        do n_2 = 0, this%reci_numbers(2)
            wave_vector(2) = 2._DP*PI * real(n_2, DP) / surface_size(2)
            do n_1 = -reci_number_1_sym(this%reci_numbers, 0, n_2), this%reci_numbers(1)
                wave_vector(1) = 2._DP*PI * real(n_1, DP) / surface_size(1)

                if (n_1**2 + n_2**2 > this%reci_numbers(1)**2) cycle

                fourier_position = fourier_position_1(n_1) * fourier_position_2(n_2)
                exp_kz = exp_kz_tab(abs(n_1), abs(n_2))
                wave_dot_moment_12 = dot_product(wave_vector, particle%dipole_moment(1:2))
                wave_x_moment_3 = norm2(wave_vector) * particle%dipole_moment(3)

                real_part_1 = signed * real(this%structures%get_plus(n_1, n_2) * &
                    cmplx(-wave_x_moment_3, -wave_dot_moment_12, DP) * &
                    conjg(fourier_position) / exp_kz, DP)
                real_part_2 = signed * real(conjg(this%structures%get_minus(n_1, n_2)) * &
                    cmplx(+wave_x_moment_3, +wave_dot_moment_12, DP) * &
                    fourier_position * exp_kz, DP)
                real_part_3 = -wave_x_moment_3**2 + wave_dot_moment_12**2

                delta_energy = delta_energy + this%weight%get(n_1, n_2) * &
                    (real_part_1 + real_part_2 + real_part_3)
            end do
        end do
        delta_energy = 2._DP * delta_energy ! symmetry: half wave vectors -> double energy
    end function Abstract_visit_exchange

    !> Energy delta when 2 particles of coordinates \( (\vec{x}_1, \vec{\mu}_1) \) and
    !> \( (\vec{x}_2, \vec{\mu}_2) \) switch their positions.
    !> \[
    !>      \Delta S_-^\ast(\vec{k}_{1:2}) =
    !>          \left[
    !>              -k_{1:2} (\mu_{1, 3} - \mu_{2, 3}) -
    !>              i \vec{k}_{1:2} \cdot (\vec{\mu}_{1, 1:2} - \vec{\mu}_{2, 1:2})
    !>          \right] \\
    !>          \left(
    !>              e^{-k_{1:2} x_{2, 3}} e^{-i \vec{k}_{1:2} \cdot \vec{x}_{2, 1:2}} -
    !>              e^{-k_{1:2} x_{1, 3}} e^{-i \vec{k}_{1:2} \cdot \vec{x}_{1, 1:2}}
    !>          \right)
    !> \]
    !> \[
    !>      \Delta S_+(\vec{k}_{1:2}) =
    !>          \left[
    !>              +k_{1:2} (\mu_{1, 3} - \mu_{2, 3}) +
    !>              i \vec{k}_{1:2} \cdot (\vec{\mu}_{1, 1:2} - \vec{\mu}_{2, 1:2})
    !>          \right] \\
    !>          \left(
    !>              e^{+k_{1:2} x_{2, 3}} e^{+i \vec{k}_{1:2} \cdot \vec{x}_{2, 1:2}} -
    !>              e^{+k_{1:2} x_{1, 3}} e^{+i \vec{k}_{1:2} \cdot \vec{x}_{1, 1:2}}
    !>          \right)
    !> \]
    !> \[
    !>      \Delta S_+(\vec{k}_{1:2}) \Delta S_-^\ast(\vec{k}_{1:2}) =
    !>          \left\{
    !>              -[k_{1:2} (\mu_{1, 3} - \mu_{2, 3})]^2 +
    !>              [\vec{k}_{1:2} \cdot (\vec{\mu}_{1, 1:2} - \vec{\mu}_{2, 1:2})]^2 - \\
    !>              2 i k_{1:2} (\mu_{1, 3} - \mu_{2, 3})
    !>              \vec{k}_{1:2} \cdot (\vec{\mu}_{1, 1:2} - \vec{\mu}_{2, 1:2})
    !>          \right\}
    !>          \left(
    !>              2 - \\
    !>              e^{+k_{1:2} x_{2, 3}} e^{+i \vec{k}_{1:2} \cdot \vec{x}_{2, 1:2}}
    !>              e^{-k_{1:2} x_{1, 3}} e^{-i \vec{k}_{1:2} \cdot \vec{x}_{1, 1:2}} - \\
    !>              e^{+k_{1:2} x_{1, 3}} e^{+i \vec{k}_{1:2} \cdot \vec{x}_{1, 1:2}}
    !>              e^{-k_{1:2} x_{2, 3}} e^{-i \vec{k}_{1:2} \cdot \vec{x}_{2, 1:2}}
    !>          \right)
    !> \]
    pure real(DP) function Abstract_visit_switch(this, ij_components, particles) &
        result(delta_energy)
        class(Abstract_DLC_Visitor), intent(in) :: this
        integer, intent(in) :: ij_components(:)
        type(Concrete_Particle), intent(in) :: particles(:)

        real(DP) :: real_part_1, real_part_2, real_part_3

        real(DP) :: surface_size(2)
        real(DP), dimension(2) :: wave_1_x_position_1, wave_1_x_position_2, wave_vector
        real(DP) :: wave_dot_delta_moment_12, wave_delta_moment_3
        integer :: n_1, n_2

        complex(DP) :: fourier_position_1
        complex(DP), dimension(-this%reci_numbers(1):this%reci_numbers(1)) :: fourier_position_1_1
        complex(DP), dimension(-this%reci_numbers(2):this%reci_numbers(2)) :: fourier_position_1_2
        real(DP) :: exp_kz_1
        real(DP), dimension(0:this%reci_numbers(1), 0:this%reci_numbers(2)) :: exp_kz_1_tab
        complex(DP) :: fourier_position_2
        complex(DP), dimension(-this%reci_numbers(1):this%reci_numbers(1)) :: fourier_position_2_1
        complex(DP), dimension(-this%reci_numbers(2):this%reci_numbers(2)) :: fourier_position_2_2
        real(DP) :: exp_kz_2
        real(DP), dimension(0:this%reci_numbers(1), 0:this%reci_numbers(2)) :: exp_kz_2_tab

        delta_energy = 0._DP
        if (.not.(this%structures%is_dipolar(ij_components(1)) .or. &
            this%structures%is_dipolar(ij_components(2)))) return

        surface_size = reshape(this%periodic_box%get_size(), [2])
        wave_1_x_position_1 = 2._DP*PI * particles(1)%position(1:2) / surface_size
        call set_fourier(fourier_position_1_1, this%reci_numbers(1), wave_1_x_position_1(1))
        call set_fourier(fourier_position_1_2, this%reci_numbers(2), wave_1_x_position_1(2))
        call set_exp_kz(exp_kz_1_tab, surface_size, particles(1)%position(3))
        wave_1_x_position_2 = 2._DP*PI * particles(2)%position(1:2) / surface_size
        call set_fourier(fourier_position_2_1, this%reci_numbers(1), wave_1_x_position_2(1))
        call set_fourier(fourier_position_2_2, this%reci_numbers(2), wave_1_x_position_2(2))
        call set_exp_kz(exp_kz_2_tab, surface_size, particles(2)%position(3))

        do n_2 = 0, this%reci_numbers(2)
            wave_vector(2) = 2._DP*PI * real(n_2, DP) / surface_size(2)
            do n_1 = -reci_number_1_sym(this%reci_numbers, 0, n_2), this%reci_numbers(1)
                wave_vector(1) = 2._DP*PI * real(n_1, DP) / surface_size(1)

                if (n_1**2 + n_2**2 > this%reci_numbers(1)**2) cycle

                fourier_position_1 = fourier_position_1_1(n_1) * fourier_position_1_2(n_2)
                exp_kz_1 = exp_kz_1_tab(abs(n_1), abs(n_2))
                fourier_position_2 = fourier_position_2_1(n_1) * fourier_position_2_2(n_2)
                exp_kz_2 = exp_kz_2_tab(abs(n_1), abs(n_2))

                wave_dot_delta_moment_12 = dot_product(wave_vector, &
                    particles(1)%dipole_moment(1:2) - particles(2)%dipole_moment(1:2))
                wave_delta_moment_3 = norm2(wave_vector) * &
                    (particles(1)%dipole_moment(3) - particles(2)%dipole_moment(3))

                real_part_1 = real(this%structures%get_plus(n_1, n_2) * &
                    cmplx(-wave_delta_moment_3, -wave_dot_delta_moment_12, DP) * &
                    conjg(fourier_position_2 / exp_kz_2 - fourier_position_1 / exp_kz_1), DP)
                real_part_2 = real(conjg(this%structures%get_minus(n_1, n_2)) * &
                    cmplx(+wave_delta_moment_3, +wave_dot_delta_moment_12, DP) * &
                    (fourier_position_2 * exp_kz_2 - fourier_position_1 * exp_kz_1), DP)
                real_part_3 = real(cmplx(-wave_delta_moment_3**2 + wave_dot_delta_moment_12**2, &
                    -2._DP*wave_delta_moment_3 * wave_dot_delta_moment_12, DP) * (2._DP - &
                    fourier_position_2 * exp_kz_2 * conjg(fourier_position_1) / exp_kz_1 - &
                    fourier_position_1 * exp_kz_1 * conjg(fourier_position_2) / exp_kz_2), DP)

                delta_energy = delta_energy + this%weight%get(n_1, n_2) * &
                    (real_part_1 + real_part_2 + real_part_3)
            end do
        end do
        delta_energy = 2._DP * delta_energy ! symmetry: half wave vectors -> double energy
    end function Abstract_visit_switch

!end implementation Abstract_DLC_Visitor

!implementation Null_DLC_Visitor

    subroutine Null_construct(this, periodic_box, reciprocal_lattice, weight, structures)
        class(Null_DLC_Visitor), intent(out) :: this
        class(Abstract_Periodic_Box), target, intent(in) :: periodic_box
        class(Abstract_Reciprocal_Lattice), intent(in) :: reciprocal_lattice
        class(Abstract_DLC_Weight), intent(in) :: weight
        class(Abstract_DLC_Structures), intent(in) :: structures
    end subroutine Null_construct

    subroutine Null_destroy(this)
        class(Null_DLC_Visitor), intent(inout) :: this
    end subroutine Null_destroy

    subroutine Null_target(this, weight, structures)
        class(Null_DLC_Visitor), intent(inout) :: this
        class(Abstract_DLC_Weight), target, intent(in) :: weight
        class(Abstract_DLC_Structures), target, intent(in) :: structures
    end subroutine Null_target

    pure real(DP) function Null_visit(this) result(energy)
        class(Null_DLC_Visitor), intent(in) :: this
        energy = 0._DP
    end function Null_visit

    pure real(DP) function Null_visit_translation(this, i_component, new_position, old) &
        result(delta_energy)
        class(Null_DLC_Visitor), intent(in) :: this
        integer, intent(in) :: i_component
        real(DP), intent(in) :: new_position(:)
        type(Concrete_Particle), intent(in) :: old
        delta_energy = 0._DP
    end function Null_visit_translation

    pure real(DP) function Null_visit_transmutation(this, ij_components, new_dipole_moment, old) &
        result(delta_energy)
        class(Null_DLC_Visitor), intent(in) :: this
        integer, intent(in) :: ij_components(:)
        real(DP), intent(in) :: new_dipole_moment(:)
        type(Concrete_Particle), intent(in) :: old
        delta_energy = 0._DP
    end function Null_visit_transmutation

    pure real(DP) function Null_visit_exchange(this, i_component, particle, signed) &
        result(delta_energy)
        class(Null_DLC_Visitor), intent(in) :: this
        integer, intent(in) :: i_component
        type(Concrete_Particle), intent(in) :: particle
        real(DP), intent(in) :: signed
        delta_energy = 0._DP
    end function Null_visit_exchange

    pure real(DP) function Null_visit_switch(this, ij_components, particles) result(delta_energy)
        class(Null_DLC_Visitor), intent(in) :: this
        integer, intent(in) :: ij_components(:)
        type(Concrete_Particle), intent(in) :: particles(:)
        delta_energy = 0._DP
    end function Null_visit_switch

!end implementation Null_DLC_Visitor

end module classes_dlc_visitor

classes_average_num_particles.f90 classes_beta_pressure.f90 classes_beta_pressure_excess.f90 classes_box_particle_exchange.f90 classes_box_particle_move.f90 classes_box_particles_swap.f90 classes_box_size_checker.f90 classes_box_size_memento.f90 classes_box_volume_change.f90 classes_boxes_particle_teleportation.f90 classes_boxes_particles_swap.f90 classes_boxes_volume_exchange.f90 classes_changed_box_size.f90 classes_changed_box_size_ratio.f90 classes_changes_success_writer.f90 classes_complete_coordinates_reader.f90 classes_complete_coordinates_writer.f90 classes_component_chemical_potential.f90 classes_component_coordinates.f90 classes_component_coordinates_reader.f90 classes_component_coordinates_writer.f90 classes_component_dipole_moments.f90 classes_coordinates.f90 classes_coordinates_copier.f90 classes_density_explorer.f90 classes_des_convergence_parameter.f90 classes_des_real_component.f90 classes_des_real_pair.f90 classes_des_reci_structure.f90 classes_des_reci_visitor.f90 classes_des_reci_weight.f90 classes_des_self_component.f90 classes_des_surf_mixture.f90 classes_dipolar_interactions_facade.f90 classes_dipolar_neighbourhood.f90 classes_dipolar_neighbourhoods_visitor.f90 classes_dirac_distribution_plus.f90 classes_directed_graph_writer.f90 classes_dlc_structures.f90 classes_dlc_visitor.f90 classes_dlc_weight.f90 classes_exchanged_boxes_size.f90 classes_external_field.f90 classes_field_expression.f90 classes_floor_penetration.f90 classes_generating_algorithm.f90 classes_hard_contact.f90 classes_hetero_couples.f90 classes_line_writer.f90 classes_maximum_box_compression.f90 classes_maximum_box_compression_explorer.f90 classes_min_distance.f90 classes_mixture_total_moment.f90 classes_move_tuner.f90 classes_moved_coordinates.f90 classes_neighbour_cells.f90 classes_num_particles.f90 classes_number_to_string.f90 classes_pair_potential.f90 classes_parallelepiped_domain.f90 classes_particle_insertion_method.f90 classes_periodic_box.f90 classes_permittivity.f90 classes_plmc_propagator.f90 classes_potential_expression.f90 classes_radial_explorer.f90 classes_random_coordinates.f90 classes_random_orientation.f90 classes_random_position.f90 classes_real_writer.f90 classes_reciprocal_lattice.f90 classes_rectangle_writer.f90 classes_rotated_orientations.f90 classes_short_pairs_visitor.f90 classes_structure_factor.f90 classes_structure_visitor.f90 classes_temperature.f90 classes_tower_sampler.f90 classes_translated_positions.f90 classes_triangle_writer.f90 classes_tunable_move.f90 classes_visitable_cells.f90 classes_visitable_cells_memento.f90 classes_visitable_list.f90 classes_visitable_walls.f90 classes_volume_change_method.f90 classes_walls_visitor.f90 data_cells.f90 data_constants.f90 data_input_prefixes.f90 data_output_objects.f90 data_strings.f90 density.f90 module_changes_success.f90 module_list_node.f90 module_move_tuning.f90 plmc_explore.f90 plmc_generate.f90 procedures_average_nums_particles_factory.f90 procedures_beta_pressure_factory.f90 procedures_beta_pressures_excess_factory.f90 procedures_box_particle_exchange_factory.f90 procedures_box_particle_move_factory.f90 procedures_box_particles_swap_factory.f90 procedures_box_size.f90 procedures_box_size_memento_factory.f90 procedures_box_volume_change_factory.f90 procedures_boxes_particle_teleportation_factory.f90 procedures_boxes_particles_swap_factory.f90 procedures_boxes_size_checker_factory.f90 procedures_boxes_volume_exchange_factory.f90 procedures_cells_memento.f90 procedures_centered_block_micro.f90 procedures_changed_boxes_size_factory.f90 procedures_changed_boxes_size_ratio_factory.f90 procedures_changes_component_factory.f90 procedures_changes_factory.f90 procedures_changes_properties.f90 procedures_changes_success_writer_factory.f90 procedures_checks.f90 procedures_command_arguments.f90 procedures_complete_coordinates_reader.f90 procedures_complete_coordinates_reader_factory.f90 procedures_complete_coordinates_writer_factory.f90 procedures_component_chemical_potential_factory.f90 procedures_component_coordinates_factory.f90 procedures_component_coordinates_reader_factory.f90 procedures_component_coordinates_writer_factory.f90 procedures_component_dipole_moments_factory.f90 procedures_component_factory.f90 procedures_coordinates_copier_factory.f90 procedures_coordinates_micro.f90 procedures_coordinates_reader.f90 procedures_density_explorer_factory.f90 procedures_des_convergence_parameter_factory.f90 procedures_des_real_component_factory.f90 procedures_des_real_pair_factory.f90 procedures_des_reci_structure_factory.f90 procedures_des_reci_visitor_factory.f90 procedures_des_reci_weight_factory.f90 procedures_des_surf_mixture_factory.f90 procedures_dipolar_interactions_facades_factory.f90 procedures_dipolar_interactions_factory.f90 procedures_dipolar_interactions_micro.f90 procedures_dipolar_interactions_resetter.f90 procedures_dipolar_interactions_visitor.f90 procedures_dipolar_neighbourhoods_factory.f90 procedures_dipolar_neighbourhoods_visitors_factory.f90 procedures_dipoles_field_interaction.f90 procedures_dirac_distribution_plus.f90 procedures_directed_graph_writer_factory.f90 procedures_dlc_structures_factory.f90 procedures_dlc_visitor_factory.f90 procedures_dlc_weight_factory.f90 procedures_elementary_geometry.f90 procedures_elementary_statistics.f90 procedures_energies_writers_factory.f90 procedures_environment_factory.f90 procedures_environment_inquirers.f90 procedures_errors.f90 procedures_exchange_updaters.f90 procedures_exchange_visitors.f90 procedures_exchanged_boxes_size_factory.f90 procedures_exploration_inquirers.f90 procedures_exploring_observables_factory.f90 procedures_exploring_writers_factory.f90 procedures_external_fields_factory.f90 procedures_field_expression_factory.f90 procedures_field_expression_micro.f90 procedures_floor_penetration_factory.f90 procedures_generating_algorithms_factory.f90 procedures_generating_observables_factory.f90 procedures_generating_writers_factory.f90 procedures_hard_contact_factory.f90 procedures_hetero_couples_factory.f90 procedures_json_data_factory.f90 procedures_json_reports_factory.f90 procedures_line_writer_factory.f90 procedures_logical_factory.f90 procedures_markov_chain_explorer_factory.f90 procedures_markov_chain_generator_factory.f90 procedures_maximum_box_compression_factory.f90 procedures_maximum_boxes_compression_explorer_factory.f90 procedures_metropolis_algorithm.f90 procedures_min_distance_factory.f90 procedures_mixture_inquirers.f90 procedures_mixture_properties.f90 procedures_mixture_total_moments_factory.f90 procedures_move_tuner_factory.f90 procedures_moved_coordinates_factory.f90 procedures_neighbour_cells_factory.f90 procedures_num_particles_factory.f90 procedures_observables_changes_factory.f90 procedures_observables_energies_factory.f90 procedures_observables_factory.f90 procedures_pair_potential_factory.f90 procedures_parallelepiped_domain_macro.f90 procedures_parallelepiped_domain_micro.f90 procedures_parallelepiped_domains_factory.f90 procedures_particle_insertion_method_factory.f90 procedures_periodic_boxes_factory.f90 procedures_permittivity_factory.f90 procedures_physical_model_factory.f90 procedures_plmc_help.f90 procedures_plmc_iterations.f90 procedures_plmc_propagator_factory.f90 procedures_plmc_resetter.f90 procedures_plmc_visitor.f90 procedures_plmc_writer.f90 procedures_potential_expression_factory.f90 procedures_property_inquirers.f90 procedures_radial_explorer_factory.f90 procedures_random_coordinates_factory.f90 procedures_random_number.f90 procedures_random_seed_factory.f90 procedures_readers_factory.f90 procedures_real_writer_factory.f90 procedures_reals_factory.f90 procedures_reciprocal_lattices_factory.f90 procedures_rectangle_writer_factory.f90 procedures_selectors_resetters.f90 procedures_short_interactions_factory.f90 procedures_short_interactions_inquirers.f90 procedures_short_interactions_resetter.f90 procedures_short_interactions_visitor.f90 procedures_short_pairs_visitors_factory.f90 procedures_string_factory.f90 procedures_temperature_factory.f90 procedures_tower_sampler_factory.f90 procedures_transmutation_updaters.f90 procedures_transmutation_visitors.f90 procedures_triangle_observables.f90 procedures_triangle_writer_factory.f90 procedures_visit_condition.f90 procedures_visitable_cells_factory.f90 procedures_visitable_cells_memento_factory.f90 procedures_visitable_list_factory.f90 procedures_visitable_walls_factory.f90 procedures_volume_change_method_factory.f90 procedures_walls_visitors_factory.f90 procedures_writers_inquirers.f90 radial.f90 types_cells_wrapper.f90 types_changes_component_wrapper.f90 types_changes_success_writer_selector.f90 types_changes_wrapper.f90 types_component_coordinates_reader_selector.f90 types_component_coordinates_writer_selector.f90 types_component_wrapper.f90 types_dipolar_interactions_dynamic_wrapper.f90 types_dipolar_interactions_static_wrapper.f90 types_energies_writers.f90 types_environment_wrapper.f90 types_exploring_io.f90 types_exploring_writers_wrapper.f90 types_generating_io.f90 types_generating_observables_wrapper.f90 types_generating_writers_wrapper.f90 types_json_report.f90 types_logical_wrapper.f90 types_markov_chain_explorer_wrapper.f90 types_markov_chain_generator_wrapper.f90 types_mixture_wrapper.f90 types_move_tuner_parameters.f90 types_observables_changes.f90 types_observables_energies.f90 types_particle_wrapper.f90 types_physical_model_wrapper.f90 types_potential_domain.f90 types_potential_domain_selector.f90 types_raw_coordinates.f90 types_readers_wrapper.f90 types_real_wrapper.f90 types_short_interactions_wrapper.f90 types_string_wrapper.f90