fragment_should_be_screened Function

private function fragment_should_be_screened(fragment, n, sys_geom, driver_config) result(should_screen)

Uses

  • proc~~fragment_should_be_screened~~UsesGraph proc~fragment_should_be_screened fragment_should_be_screened module~mqc_config_adapter mqc_config_adapter proc~fragment_should_be_screened->module~mqc_config_adapter module~mqc_physical_fragment mqc_physical_fragment proc~fragment_should_be_screened->module~mqc_physical_fragment module~mqc_config_adapter->module~mqc_physical_fragment module~mqc_calculation_keywords mqc_calculation_keywords module~mqc_config_adapter->module~mqc_calculation_keywords module~mqc_config_parser mqc_config_parser module~mqc_config_adapter->module~mqc_config_parser module~mqc_elements mqc_elements module~mqc_config_adapter->module~mqc_elements module~mqc_error mqc_error module~mqc_config_adapter->module~mqc_error module~mqc_method_config mqc_method_config module~mqc_config_adapter->module~mqc_method_config pic_logger pic_logger module~mqc_config_adapter->pic_logger pic_types pic_types module~mqc_config_adapter->pic_types module~mqc_cgto mqc_cgto module~mqc_physical_fragment->module~mqc_cgto module~mqc_physical_fragment->module~mqc_elements module~mqc_physical_fragment->module~mqc_error module~mqc_geometry mqc_geometry module~mqc_physical_fragment->module~mqc_geometry 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_physical_fragment->pic_types module~mqc_calculation_keywords->pic_types module~mqc_calculation_defaults mqc_calculation_defaults module~mqc_calculation_keywords->module~mqc_calculation_defaults module~mqc_cgto->pic_types module~mqc_config_parser->module~mqc_physical_fragment module~mqc_config_parser->module~mqc_error module~mqc_config_parser->module~mqc_geometry module~mqc_config_parser->pic_types module~mqc_calc_types mqc_calc_types module~mqc_config_parser->module~mqc_calc_types module~mqc_config_parser->module~mqc_calculation_defaults module~mqc_method_types mqc_method_types module~mqc_config_parser->module~mqc_method_types module~mqc_elements->pic_types pic_ascii pic_ascii module~mqc_elements->pic_ascii module~mqc_geometry->pic_types module~mqc_method_config->pic_types module~mqc_method_config->module~mqc_method_types 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 module~mqc_calc_types->pic_types module~mqc_calculation_defaults->pic_types module~mqc_method_types->pic_types

Check if a fragment should be screened out based on distance cutoffs. Returns true if the fragment itself OR any of its k-subsets (k >= 2) exceeds the corresponding k-mer cutoff. This ensures MBE subset consistency.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: fragment(:)
integer, intent(in) :: n
type(system_geometry_t), intent(in) :: sys_geom
type(driver_config_t), intent(in) :: driver_config

Return Value logical


Calls

proc~~fragment_should_be_screened~~CallsGraph proc~fragment_should_be_screened fragment_should_be_screened proc~calculate_monomer_distance calculate_monomer_distance proc~fragment_should_be_screened->proc~calculate_monomer_distance proc~get_next_combination get_next_combination proc~fragment_should_be_screened->proc~get_next_combination proc~to_angstrom to_angstrom proc~calculate_monomer_distance->proc~to_angstrom

Called by

proc~~fragment_should_be_screened~~CalledByGraph proc~fragment_should_be_screened fragment_should_be_screened proc~apply_distance_screening apply_distance_screening proc~apply_distance_screening->proc~fragment_should_be_screened proc~run_fragmented_calculation run_fragmented_calculation proc~run_fragmented_calculation->proc~apply_distance_screening 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 program~main->proc~run_multi_molecule_calculations

Variables

Type Visibility Attributes Name Initial
real(kind=dp), private :: cutoff
real(kind=dp), private :: distance
logical, private :: has_next
integer, private :: indices(n)
integer, private :: j
integer, private :: num_cutoffs
integer, private :: subset(n)
integer, private :: subset_size

Source Code

   function fragment_should_be_screened(fragment, n, sys_geom, driver_config) result(should_screen)
      !! Check if a fragment should be screened out based on distance cutoffs.
      !! Returns true if the fragment itself OR any of its k-subsets (k >= 2) exceeds
      !! the corresponding k-mer cutoff. This ensures MBE subset consistency.
      use mqc_physical_fragment, only: calculate_monomer_distance
      use mqc_config_adapter, only: driver_config_t

      integer, intent(in) :: fragment(:)
      integer, intent(in) :: n
      type(system_geometry_t), intent(in) :: sys_geom
      type(driver_config_t), intent(in) :: driver_config
      logical :: should_screen

      integer :: subset_size, num_cutoffs
      integer :: indices(n), subset(n)
      integer :: j
      real(dp) :: distance, cutoff
      logical :: has_next

      should_screen = .false.
      num_cutoffs = size(driver_config%fragment_cutoffs)

      ! Check all subset sizes from 2 up to n (the full fragment)
      ! If any k-subset exceeds the k-mer cutoff, screen this fragment
      do subset_size = 2, n
         ! Skip if no cutoff defined for this level
         if (subset_size > num_cutoffs) cycle

         cutoff = driver_config%fragment_cutoffs(subset_size)
         ! Skip if cutoff is non-positive (no screening for this level)
         if (cutoff <= 0.0_dp) cycle

         ! Initialize first combination indices
         do j = 1, subset_size
            indices(j) = j
         end do

         ! Loop through all combinations of this size
         do
            ! Build current subset
            do j = 1, subset_size
               subset(j) = fragment(indices(j))
            end do

            ! Calculate distance for this subset
            distance = calculate_monomer_distance(sys_geom, subset(1:subset_size))

            ! If subset exceeds cutoff, screen the whole fragment
            if (distance > cutoff) then
               should_screen = .true.
               return
            end if

            ! Get next combination
            call get_next_combination(indices, subset_size, n, has_next)
            if (.not. has_next) exit
         end do
      end do

   end function fragment_should_be_screened