get the data about atoms in the system
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
subroutine gather_masses(this, masses, species_pcode, species_map)
class(mimic_communicator), intent(inout) :: this
!> mass of each atom in the system
real(dp), dimension(:), intent(out) :: masses
!> number of atoms per client code
integer, dimension(:), intent(in) :: species_pcode
!> mapping of MM species to CPMD species
integer, dimension(:,:), intent(in) :: species_map
real(dp), dimension(:,:), allocatable, target :: temp_masses
integer :: n_code, n_species
integer(kind=i32) :: num_species
allocate(temp_masses(maxval(species_pcode), this%num_clients))
temp_masses(:, :) = -1.0_dp
do n_code = 1, this%num_clients
num_species = species_pcode(n_code)
call this%send_command(MCL_SEND_ATOM_MASSES, n_code)
call mcl_receive(temp_masses(1:num_species, n_code), num_species, MCL_DATA, n_code)
do n_species = 1, species_pcode(n_code)
if (species_map(n_species, n_code) /= - 1) then
masses(species_map(n_species, n_code)) = temp_masses(n_species, n_code)
end if
end do ! n_species
end do ! n_code
end subroutine gather_masses