get the data about atoms in the system
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
subroutine gather_multipoles(this, species, multipoles, &
atoms_pcode, multipoles_patom)
class(mimic_communicator), intent(inout) :: this
!> atom species of each atom in the system (-1 for overlapped)
integer, dimension(:,:), intent(in), target :: species
!> multipoles of each atom in the system (0 charge for overlapped)
real(dp), dimension(:,:,:), intent(inout), target :: multipoles
!> number of atoms per client code
integer, dimension(:), intent(in) :: atoms_pcode
!> amount of multipoles per atom per code
integer, dimension(:), intent(in) :: multipoles_patom
integer :: offset = 1
integer :: n_code, n_atom
integer(kind=i32) :: n_atoms
real(dp), dimension(:), target, allocatable :: multipoles_temp
do n_code = 1, this%num_clients
n_atoms = atoms_pcode(n_code)
allocate(multipoles_temp(n_atoms * multipoles_patom(n_code)))
call this%send_command(MCL_SEND_ATOM_MULTIPOLES, n_code)
call mcl_receive(multipoles_temp, n_atoms * multipoles_patom(n_code), MCL_DATA, n_code)
offset = 1
do n_atom = 1, n_atoms
multipoles(1:multipoles_patom(n_code), n_atom, n_code) = multipoles_temp(offset : offset + multipoles_patom(n_code) - 1)
if (species(n_atom, n_code) == -1) then
multipoles(:, n_atom, n_code) = 0.0_dp
end if
offset = offset + multipoles_patom(n_code)
end do
deallocate(multipoles_temp)
end do
end subroutine gather_multipoles