intersect_atom_lists Subroutine

private pure subroutine intersect_atom_lists(atoms1, n1, atoms2, n2, intersection, n_intersect)

Compute intersection of two atom lists

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: atoms1(:)
integer, intent(in) :: n1
integer, intent(in) :: atoms2(:)
integer, intent(in) :: n2
integer, intent(out) :: intersection(:)
integer, intent(out) :: n_intersect

Called by

proc~~intersect_atom_lists~~CalledByGraph proc~intersect_atom_lists intersect_atom_lists proc~dfs_pie_accumulate dfs_pie_accumulate proc~dfs_pie_accumulate->proc~intersect_atom_lists proc~dfs_pie_accumulate->proc~dfs_pie_accumulate proc~gmbe_enumerate_pie_terms gmbe_enumerate_pie_terms proc~gmbe_enumerate_pie_terms->proc~dfs_pie_accumulate proc~run_fragmented_calculation run_fragmented_calculation proc~run_fragmented_calculation->proc~gmbe_enumerate_pie_terms proc~run_calculation run_calculation proc~run_calculation->proc~run_fragmented_calculation proc~compute_energy_and_forces compute_energy_and_forces proc~compute_energy_and_forces->proc~run_calculation proc~run_multi_molecule_calculations run_multi_molecule_calculations proc~run_multi_molecule_calculations->proc~run_calculation program~main main program~main->proc~run_calculation

Variables

Type Visibility Attributes Name Initial
integer, private :: i
integer, private :: j

Source Code

   pure subroutine intersect_atom_lists(atoms1, n1, atoms2, n2, intersection, n_intersect)
      !! Compute intersection of two atom lists
      integer, intent(in) :: atoms1(:), n1, atoms2(:), n2
      integer, intent(out) :: intersection(:)
      integer, intent(out) :: n_intersect
      integer :: i, j

      n_intersect = 0
      do i = 1, n1
         if (atoms1(i) < 0) cycle
         do j = 1, n2
            if (atoms2(j) < 0) cycle
            if (atoms1(i) == atoms2(j)) then
               n_intersect = n_intersect + 1
               intersection(n_intersect) = atoms1(i)
               exit
            end if
         end do
      end do
   end subroutine intersect_atom_lists