wrapper to request sizes of MM parts (number of atoms/species/fragments)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(sizes_type), | intent(out) | :: | sizes | sizes data Todocheck if it can be made intent(out) |
||
type(system_type), | intent(out) | :: | system_data | atom species of each atom in the system are stored here (-1 for overlapped) Todocheck if it can be made intent(out) |
subroutine mimic_request_sizes(sizes, system_data)
!> sizes data
!> @todo check if it can be made intent(out)
type(sizes_type), intent(out) :: sizes
!> atom species of each atom in the system are stored here (-1 for overlapped)
!> @todo check if it can be made intent(out)
type(system_type), intent(out) :: system_data
integer :: n_code
integer :: max_atom_count
integer, dimension(:,:), allocatable, target :: ids
integer, dimension(:), allocatable, target :: atoms_pcode_temp
integer, dimension(:), allocatable :: na_temp
call timer_start("mimic_request_sizes")
sizes%num_atoms = 0
sizes%num_species = 0
allocate(sizes%atoms_pcode(communicator%num_clients))
allocate(sizes%multipoles_patom(communicator%num_clients))
allocate(sizes%frag_num(communicator%num_clients))
allocate(sizes%nbonds_pcode(communicator%num_clients))
allocate(sizes%nangles_pcode(communicator%num_clients))
allocate(sizes%types_length_pcode(communicator%num_clients))
allocate(sizes%types_pcode(communicator%num_clients))
allocate(atoms_pcode_temp(communicator%num_clients))
! gather atom counts
call communicator%gather_atom_count(atoms_pcode_temp)
max_atom_count = maxval(atoms_pcode_temp)
allocate(na_temp(sum(atoms_pcode_temp)))
allocate(ids(max_atom_count, communicator%num_clients))
allocate(system_data%species(max_atom_count, communicator%num_clients))
allocate(sizes%multipoles_order(communicator%num_clients))
ids(:,:) = -1
system_data%species(:,:) = -1
na_temp = -1
! gather number of atom types per code
call communicator%gather_type_count(sizes%types_pcode)
call communicator%get_atom_species(atoms_pcode_temp, system_data%species, &
sizes%num_atoms, sizes%num_species, na_temp, &
system_data%species_map)
allocate(sizes%atoms_pspecies(sizes%num_species))
sizes%atoms_pspecies = na_temp(1:sizes%num_species)
sizes%atoms_pcode = atoms_pcode_temp
call communicator%get_multipole_order(sizes%multipoles_order)
do n_code = 1, communicator%num_clients
sizes%multipoles_patom(n_code) = (sizes%multipoles_order(n_code) + 3) * &
(sizes%multipoles_order(n_code) + 2) * &
(sizes%multipoles_order(n_code) + 1) / 6
end do
! gather fragment count
call communicator%gather_fragment_count(sizes%frag_num)
allocate(sizes%atoms_pfragment(maxval(sizes%frag_num), communicator%num_clients))
call communicator%gather_atom_fragment_count(sizes%frag_num, sizes%atoms_pfragment)
! gather number of bonds
call communicator%gather_bond_count(sizes%nbonds_pcode)
! gather number of angles
call communicator%gather_angle_count(sizes%nangles_pcode)
call communicator%gather_bonds(system_data%bonds, sizes%nbonds_pcode)
call communicator%gather_angles(system_data%angles, sizes%nangles_pcode)
call timer_stop
end subroutine mimic_request_sizes