get IDs of atoms per each fragment in the system
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
subroutine gather_atom_fragment_ids(this, atoms_pcode, fragment_data, fragment_ids)
class(mimic_communicator), intent(inout) :: this
!> number of fragments per each code
integer, dimension(:), intent(in) :: atoms_pcode
!> number of atoms per fragment per code
integer, dimension(:, :), intent(in) :: fragment_data
!> ids of atoms belonging to a fragment
integer, dimension(:, :, :), intent(inout) :: fragment_ids
integer :: n_code, n_fragment, n_atom
integer :: offset
integer(kind=i32), dimension(:), allocatable, target :: atoms_ids
do n_code = 1, this%num_clients
allocate(atoms_ids(atoms_pcode(n_code)))
call this%send_command(MCL_SEND_ATOMS_IN_FRAGMENTS, n_code)
call mcl_receive(atoms_ids, atoms_pcode(n_code), MCL_DATA, n_code)
offset = 0
do n_fragment = 1, size(fragment_data, 1)
if (fragment_data(n_fragment, n_code) == -1) then
exit
end if
do n_atom = 1, fragment_data(n_fragment, n_code)
fragment_ids(n_atom, n_fragment, n_code) = atoms_ids(offset + n_atom)
end do
offset = offset + fragment_data(n_fragment, n_code)
end do
deallocate(atoms_ids)
end do
end subroutine gather_atom_fragment_ids