check_fragment_overlap Subroutine

public subroutine check_fragment_overlap(fragments, nfrag, error)

Uses

  • proc~~check_fragment_overlap~~UsesGraph proc~check_fragment_overlap check_fragment_overlap module~mqc_config_parser mqc_config_parser proc~check_fragment_overlap->module~mqc_config_parser pic_io pic_io proc~check_fragment_overlap->pic_io module~mqc_calc_types mqc_calc_types module~mqc_config_parser->module~mqc_calc_types module~mqc_calculation_defaults mqc_calculation_defaults module~mqc_config_parser->module~mqc_calculation_defaults module~mqc_error mqc_error module~mqc_config_parser->module~mqc_error module~mqc_geometry mqc_geometry module~mqc_config_parser->module~mqc_geometry module~mqc_method_types mqc_method_types module~mqc_config_parser->module~mqc_method_types module~mqc_physical_fragment mqc_physical_fragment module~mqc_config_parser->module~mqc_physical_fragment pic_types pic_types module~mqc_config_parser->pic_types module~mqc_calc_types->pic_types module~mqc_calculation_defaults->pic_types module~mqc_geometry->pic_types module~mqc_method_types->pic_types module~mqc_physical_fragment->module~mqc_error module~mqc_physical_fragment->module~mqc_geometry module~mqc_physical_fragment->pic_types module~mqc_cgto mqc_cgto module~mqc_physical_fragment->module~mqc_cgto module~mqc_elements mqc_elements module~mqc_physical_fragment->module~mqc_elements module~mqc_physical_constants mqc_physical_constants module~mqc_physical_fragment->module~mqc_physical_constants module~mqc_xyz_reader mqc_xyz_reader module~mqc_physical_fragment->module~mqc_xyz_reader module~mqc_cgto->pic_types module~mqc_elements->pic_types pic_ascii pic_ascii module~mqc_elements->pic_ascii module~mqc_physical_constants->pic_types module~mqc_xyz_reader->module~mqc_error module~mqc_xyz_reader->module~mqc_geometry module~mqc_xyz_reader->pic_types

Check if any atoms appear in multiple fragments This is O(nfrag * natoms_per_frag^2) which is acceptable for typical fragment sizes

Arguments

Type IntentOptional Attributes Name
type(input_fragment_t), intent(in) :: fragments(:)
integer, intent(in) :: nfrag
type(error_t), intent(out) :: error

Calls

proc~~check_fragment_overlap~~CallsGraph proc~check_fragment_overlap check_fragment_overlap proc~error_set error_t%error_set proc~check_fragment_overlap->proc~error_set to_char to_char proc~check_fragment_overlap->to_char

Called by

proc~~check_fragment_overlap~~CalledByGraph proc~check_fragment_overlap check_fragment_overlap proc~initialize_fragmented_system initialize_fragmented_system proc~initialize_fragmented_system->proc~check_fragment_overlap proc~geometry_to_system_fragmented geometry_to_system_fragmented proc~geometry_to_system_fragmented->proc~initialize_fragmented_system proc~molecule_to_system_geometry molecule_to_system_geometry proc~molecule_to_system_geometry->proc~initialize_fragmented_system proc~config_to_system_geometry config_to_system_geometry proc~config_to_system_geometry->proc~geometry_to_system_fragmented proc~config_to_system_geometry->proc~molecule_to_system_geometry proc~run_multi_molecule_calculations run_multi_molecule_calculations proc~run_multi_molecule_calculations->proc~config_to_system_geometry program~main main program~main->proc~config_to_system_geometry program~main->proc~run_multi_molecule_calculations

Variables

Type Visibility Attributes Name Initial
integer, private :: atom_i
integer, private :: atom_j
integer, private :: i
integer, private :: j
integer, private :: k
integer, private :: l

Source Code

   subroutine check_fragment_overlap(fragments, nfrag, error)
      !! Check if any atoms appear in multiple fragments
      !! This is O(nfrag * natoms_per_frag^2) which is acceptable for typical fragment sizes
      use mqc_config_parser, only: input_fragment_t
      use pic_io, only: to_char

      type(input_fragment_t), intent(in) :: fragments(:)
      integer, intent(in) :: nfrag
      type(error_t), intent(out) :: error

      integer :: i, j, k, l
      integer :: atom_i, atom_j

      ! Compare each pair of fragments
      do i = 1, nfrag - 1
         do j = i + 1, nfrag
            ! Compare atoms in fragment i with atoms in fragment j
            do k = 1, size(fragments(i)%indices)
               atom_i = fragments(i)%indices(k)
               do l = 1, size(fragments(j)%indices)
                  atom_j = fragments(j)%indices(l)
                  if (atom_i == atom_j) then
                     ! Found overlapping atom
                    call error%set(ERROR_VALIDATION, "Overlapping fragments detected: fragments "//to_char(i)//" and "// &
                                    to_char(j)//" both contain atom "//to_char(atom_i)// &
                                    ". Set allow_overlapping_fragments = true to allow this.")
                     return
                  end if
               end do
            end do
         end do
      end do

   end subroutine check_fragment_overlap