add_map_entry Subroutine

private subroutine add_map_entry(this, code_id, atom_id)

add an overlap entry to the map

Arguments

TypeIntentOptionalAttributesName
class(map_type), intent(inout) :: this
integer, intent(in) :: code_id

id of the code, treating the overlapped atom

integer, intent(in) :: atom_id

id of an overlapped atom within its treating code


Contents

Source Code


Source Code

subroutine add_map_entry(this, code_id, atom_id)

    class(map_type), intent(inout) :: this
    !> id of the code, treating the overlapped atom
    integer, intent(in) :: code_id
    !> id of an overlapped atom within its treating code
    integer, intent(in) :: atom_id

    integer, dimension(:), allocatable :: temp_codes, temp_atoms
    integer :: current_size = 0

    if (allocated(this%codes)) current_size = size(this%codes)

    allocate(temp_codes(current_size + 1))
    allocate(temp_atoms(current_size + 1))

    if (current_size /= 0) then
        temp_codes(1:current_size) = this%codes
        temp_atoms(1:current_size) = this%atoms
    end if

    call move_alloc(temp_atoms, this%atoms)
    call move_alloc(temp_codes, this%codes)

    this%codes(current_size + 1) = code_id
    this%atoms(current_size + 1) = atom_id

end subroutine add_map_entry