gather coordinates of atoms within the system (dealing with overlaps) and store result in the tau matrix through pointers
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mimic_communicator), | intent(inout) | :: | this | |||
type(subsystem_type), | intent(in), | dimension(:) | :: | frag_code | subsystem_type belonging to each code |
subroutine gather_coords(this, frag_code)
class(mimic_communicator), intent(inout) :: this
!> subsystem_type belonging to each code
type(subsystem_type), dimension(:), intent(in) :: frag_code
real(kind=dp), dimension(:), allocatable, target :: coordinates
type(fragment_type) :: current_fragment
integer :: code_atoms
integer :: n_code, n_fragment, n_atom, n_map
integer :: offset, location
logical :: overlapped = .false.
do n_code = 1, this%num_clients
code_atoms = frag_code(n_code)%num_atoms
allocate(coordinates(code_atoms * 3))
call this%send_command(MCL_SEND_ATOM_COORDS, n_code)
call mcl_receive(coordinates, code_atoms * 3, MCL_DATA, n_code)
offset = 0
do n_fragment = 1, size(frag_code(n_code)%fragments)
current_fragment = frag_code(n_code)%fragments(n_fragment)
do n_atom = 1, current_fragment%num_atoms
location = (current_fragment%atoms(n_atom)%id - 1) * 3 + 1
do n_map = 1, size(this%overlap_maps(n_code)%maps)
if (this%overlap_maps(n_code)%maps(n_map)%id == &
current_fragment%atoms(n_atom)%id) then
overlapped = .true.
exit
end if
end do ! n_map
if (overlapped) then
overlapped = .false.
! offset = offset + 3
cycle
end if
current_fragment%atoms(n_atom)%coordinate = coordinates(location : location + 2)
end do ! n_atom
offset = offset + current_fragment%num_atoms * 3
end do ! n_fragment
deallocate(coordinates)
end do ! n_code
end subroutine gather_coords