mimic_communicator Derived Type

type, public :: mimic_communicator

communicator type providing routines to handle data interactions


Contents

Source Code


Components

TypeVisibilityAttributesNameInitial
integer, public :: num_clients

number of client codes

type(maps_type), public, dimension(:), allocatable:: overlap_maps

mapping of overlapping atoms


Type-Bound Procedures

procedure, public :: init

  • public subroutine init(this, comm)

    initialize communication

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    integer, intent(inout) :: comm

    MPI communicator

procedure, public :: handshake

  • public subroutine handshake(this, paths)

    identify and connect clients

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    character(len=*), intent(in), dimension(:):: paths

    array of paths to working folders of clients

procedure, public :: send_command

  • public subroutine send_command(this, command, dest)

    send a command via the CommLib

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    integer, intent(in) :: command

    integer code of the command

    integer, intent(in) :: dest

    destination

procedure, public :: init_overlaps

  • public subroutine init_overlaps(this, overlap_maps)

    initialize overlap mapping

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    type(maps_type), dimension(:):: overlap_maps

    list of overlap_maps

procedure, public :: finalize

  • public subroutine finalize(this)

    routine sending an exit code to each client

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this

procedure, public :: destroy_comm

  • public subroutine destroy_comm(this)

    destructor for the commlib

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this

procedure, public :: get_atom_species

  • public subroutine get_atom_species(this, atoms_pcode, species, num_atoms, num_species, na, sp_map)

    Get the number of atoms per atomic species per code (with overlap treatment)

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    integer, intent(in), dimension(:):: atoms_pcode
    integer, intent(inout), dimension(:,:), allocatable, target:: species

    atom species of each atom in the system (-1 for overlapped)

    integer, intent(out) :: num_atoms
    integer, intent(out) :: num_species
    integer, intent(inout), dimension(:):: na
    integer, intent(out), dimension(:,:), allocatable:: sp_map

procedure, public :: send_coords

  • public subroutine send_coords(this, subsystems)

    send coordinates of atoms to client codes (sends a flattened array)

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    type(subsystem_type), intent(in), dimension(:):: subsystems

    subsystem_type belonging to each code

procedure, public :: gather_coords

  • public subroutine gather_coords(this, frag_code)

    gather coordinates of atoms within the system (dealing with overlaps) and store result in the tau matrix through pointers

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    type(subsystem_type), intent(in), dimension(:):: frag_code

    subsystem_type belonging to each code

procedure, public :: gather_forces

  • public subroutine gather_forces(this, frag_code)

    gather forces acting on atoms within the system and store result in the forces matrix through pointers

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    type(subsystem_type), intent(in), dimension(:):: frag_code

    subsystem_type belonging to each code

procedure, public :: gather_energies

  • public subroutine gather_energies(this, energy, frag_code)

    gather MM energies from clients

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    real(kind=dp), intent(out) :: energy

    resulting total MM energy

    type(subsystem_type), intent(in), dimension(:):: frag_code

    mapping of fragments per code

procedure, public :: gather_atom_fragment_count

  • public subroutine gather_atom_fragment_count(this, fragment_count, fragment_data)

    get the number of atoms per each fragment in the system

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    integer, intent(in), dimension(:):: fragment_count

    number of fragments per each code

    integer, intent(inout), dimension(:, :):: fragment_data

    number of atoms per fragment per code

procedure, public :: gather_atom_fragment_ids

  • public subroutine gather_atom_fragment_ids(this, atoms_pcode, fragment_data, fragment_ids)

    get IDs of atoms per each fragment in the system

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    integer, intent(in), dimension(:):: atoms_pcode

    number of fragments per each code

    integer, intent(in), dimension(:, :):: fragment_data

    number of atoms per fragment per code

    integer, intent(inout), dimension(:, :, :):: fragment_ids

    ids of atoms belonging to a fragment

procedure, public :: get_multipole_order

  • public subroutine get_multipole_order(this, multipoles_orders)

    get the orders of multipoles used in each client code

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    integer, intent(out), dimension(:), target:: multipoles_orders

    multipoles_orders array of orders

procedure, public :: gather_multipoles

  • public subroutine gather_multipoles(this, species, multipoles, atoms_pcode, multipoles_patom)

    get the data about atoms in the system

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    integer, intent(in), dimension(:,:), target:: species

    atom species of each atom in the system (-1 for overlapped)

    real(kind=dp), intent(inout), dimension(:,:,:), target:: multipoles

    multipoles of each atom in the system (0 charge for overlapped)

    integer, intent(in), dimension(:):: atoms_pcode

    number of atoms per client code

    integer, intent(in), dimension(:):: multipoles_patom

    amount of multipoles per atom per code

procedure, public :: gather_masses

  • public subroutine gather_masses(this, masses, species_pcode, species_map)

    get the data about atoms in the system

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    real(kind=dp), intent(out), dimension(:):: masses

    mass of each atom in the system

    integer, intent(in), dimension(:):: species_pcode

    number of atoms per client code

    integer, intent(in), dimension(:,:):: species_map

    mapping of MM species to CPMD species

procedure, public :: gather_bonds

  • public subroutine gather_bonds(this, bonds, bonds_number)

    get the bond constraints data - atom indices and lengths

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    type(bond_type), intent(out), dimension(:,:), allocatable:: bonds

    list of constrained bonds in the simulation, return value

    integer, intent(inout), dimension(:):: bonds_number

    number of bond constraints in the system. WARNING!!! this routine updates this value

procedure, public :: gather_angles

  • public subroutine gather_angles(this, angles, angle_number)

    get the angle constraints data - atom indices and equilibrium values

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    type(angle_type), intent(out), dimension(:,:), allocatable:: angles

    list of angle constraints, return value

    integer, intent(in), dimension(:):: angle_number

    number of angle constraints

procedure, public :: gather_int

  • public subroutine gather_int(this, data, command)

    gather integer parameter from client codes

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    integer, intent(out), dimension(:), target:: data

    Integer data to gather

    integer, intent(in) :: command

    MCL command to execute

procedure, public :: send_int

  • public subroutine send_int(this, data, command)

    gather integer parameter from client codes

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    integer, intent(in), dimension(:), target:: data

    Integer data to gather

    integer, intent(in) :: command

    MCL command to execute

procedure, public :: gather_elements

  • public subroutine gather_elements(this, elements_pcode, elements, species_map)

    gather element number associated to MM atom types

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    integer, intent(in), dimension(:):: elements_pcode

    number of elements to expect per code

    integer, intent(out), dimension(:):: elements

    element numbers per code

    integer, intent(in), dimension(:,:):: species_map

procedure, public :: gather_atom_count

  • public subroutine gather_atom_count(this, atoms_pcode)

    gather atom count from all clients

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    integer, intent(out), dimension(:), target:: atoms_pcode

    Integer data to gather

procedure, public :: gather_fragment_count

  • public subroutine gather_fragment_count(this, frags_pcode)

    gather fragment count from all clients

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    integer, intent(out), dimension(:), target:: frags_pcode

    Integer data to gather

procedure, public :: gather_bond_count

  • public subroutine gather_bond_count(this, bonds_pcode)

    gather bond count from all clients

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    integer, intent(out), dimension(:), target:: bonds_pcode

    Integer data to gather

procedure, public :: gather_angle_count

  • public subroutine gather_angle_count(this, angles_pcode)

    gather angle count from all clients

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    integer, intent(out), dimension(:), target:: angles_pcode

    Integer data to gather

procedure, public :: gather_type_count

  • public subroutine gather_type_count(this, types_pcode)

    gather atom types count from all clients

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this
    integer, intent(out), dimension(:), target:: types_pcode

    Integer data to gather

procedure, public :: issue_force_comp

  • public subroutine issue_force_comp(this)

    issue a command to compute forces and energies

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_communicator), intent(inout) :: this

Source Code

    type mimic_communicator
        !> number of client codes
        integer :: num_clients
        !> mapping of overlapping atoms
        type(maps_type), dimension(:), allocatable :: overlap_maps
    contains
        procedure :: init
        procedure :: handshake
        procedure :: send_command
        procedure :: init_overlaps
        procedure :: finalize
        procedure :: destroy_comm
        procedure :: get_atom_species
        procedure :: send_coords
        procedure :: gather_coords
        procedure :: gather_forces
        procedure :: gather_energies
        procedure :: gather_atom_fragment_count
        procedure :: gather_atom_fragment_ids
        procedure :: get_multipole_order
        procedure :: gather_multipoles
        procedure :: gather_masses
        procedure :: gather_bonds
        procedure :: gather_angles
        procedure :: gather_int
        procedure :: send_int
        procedure :: gather_elements
        procedure :: gather_atom_count
        procedure :: gather_fragment_count
        procedure :: gather_bond_count
        procedure :: gather_angle_count
        procedure :: gather_type_count
        procedure :: issue_force_comp
    end type mimic_communicator