mqc_fragment_lookup Module

Provides O(1) hash table for mapping monomer combinations to fragment indices Hash-based lookup table type


Uses

    • pic_hash_32bit
    • pic_types
    • pic_sorting
    • mqc_error
  • module~~mqc_fragment_lookup~~UsesGraph module~mqc_fragment_lookup mqc_fragment_lookup module~mqc_error mqc_error module~mqc_fragment_lookup->module~mqc_error pic_hash_32bit pic_hash_32bit module~mqc_fragment_lookup->pic_hash_32bit pic_sorting pic_sorting module~mqc_fragment_lookup->pic_sorting pic_types pic_types module~mqc_fragment_lookup->pic_types

Used by

  • module~~mqc_fragment_lookup~~UsedByGraph module~mqc_fragment_lookup mqc_fragment_lookup module~mqc_frag_utils mqc_frag_utils module~mqc_frag_utils->module~mqc_fragment_lookup module~mqc_driver mqc_driver module~mqc_driver->module~mqc_frag_utils module~mqc_mbe mqc_mbe module~mqc_driver->module~mqc_mbe module~mqc_mbe_fragment_distribution_scheme mqc_mbe_fragment_distribution_scheme module~mqc_driver->module~mqc_mbe_fragment_distribution_scheme module~mqc_mbe->module~mqc_frag_utils module~mqc_mbe_fragment_distribution_scheme->module~mqc_mbe proc~compute_energy_and_forces compute_energy_and_forces proc~compute_energy_and_forces->module~mqc_driver program~main main program~main->module~mqc_driver module~mpi_fragment_work_smod mpi_fragment_work_smod module~mpi_fragment_work_smod->module~mqc_mbe_fragment_distribution_scheme module~mqc_gmbe_fragment_distribution_scheme mqc_gmbe_fragment_distribution_scheme module~mqc_gmbe_fragment_distribution_scheme->module~mqc_mbe_fragment_distribution_scheme module~mqc_hessian_distribution_scheme mqc_hessian_distribution_scheme module~mqc_hessian_distribution_scheme->module~mqc_mbe_fragment_distribution_scheme module~mqc_serial_fragment_processor mqc_serial_fragment_processor module~mqc_serial_fragment_processor->module~mqc_mbe_fragment_distribution_scheme module~mqc_unfragmented_workflow mqc_unfragmented_workflow module~mqc_unfragmented_workflow->module~mqc_mbe_fragment_distribution_scheme proc~gmbe_run_distributed gmbe_context_t%gmbe_run_distributed proc~gmbe_run_distributed->module~mqc_mbe_fragment_distribution_scheme proc~gmbe_run_distributed->module~mqc_gmbe_fragment_distribution_scheme proc~mbe_run_distributed mbe_context_t%mbe_run_distributed proc~mbe_run_distributed->module~mqc_mbe_fragment_distribution_scheme proc~mbe_run_serial mbe_context_t%mbe_run_serial proc~mbe_run_serial->module~mqc_mbe_fragment_distribution_scheme proc~gmbe_run_serial gmbe_context_t%gmbe_run_serial proc~gmbe_run_serial->module~mqc_gmbe_fragment_distribution_scheme

Derived Types

type, public ::  fragment_lookup_t

Hash-based lookup table for O(1) fragment index retrieval

Components

Type Visibility Attributes Name Initial
logical, public :: initialized = .false.
integer(kind=int64), public :: n_entries = 0
type(hash_entry_t), public, allocatable :: table(:)
integer, public :: table_size = 0

Type-Bound Procedures

procedure, public :: destroy => fragment_lookup_destroy
procedure, public :: find => fragment_lookup_find
procedure, public :: init => fragment_lookup_init
procedure, public :: insert => fragment_lookup_insert

type, private ::  hash_entry_t

Single entry in hash table (private helper type)

Components

Type Visibility Attributes Name Initial
integer, public, allocatable :: key(:)

Sorted monomer indices

type(hash_entry_t), public, pointer :: next => null()

Chain for collisions

integer(kind=int64), public :: value

Fragment index


Functions

private pure function arrays_equal_internal(a, b, n) result(equal)

Check if two arrays are equal

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: a(:)
integer, intent(in) :: b(:)
integer, intent(in) :: n

Return Value logical

private function fragment_lookup_find(this, monomers, n) result(idx)

Find fragment index for given monomer combination

Arguments

Type IntentOptional Attributes Name
class(fragment_lookup_t), intent(in) :: this
integer, intent(in) :: monomers(:)
integer, intent(in) :: n

Return Value integer(kind=int64)

private pure function next_prime_internal(n) result(p)

Find next prime number >= n (simple implementation)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n

Return Value integer


Subroutines

private pure subroutine fragment_lookup_destroy(this)

Clean up hash table and all chains

Arguments

Type IntentOptional Attributes Name
class(fragment_lookup_t), intent(inout) :: this

private pure subroutine fragment_lookup_init(this, estimated_entries)

Initialize hash table with estimated size

Arguments

Type IntentOptional Attributes Name
class(fragment_lookup_t), intent(inout) :: this
integer(kind=int64), intent(in) :: estimated_entries

private subroutine fragment_lookup_insert(this, monomers, n, fragment_idx, error)

Insert a monomer combination -> fragment index mapping

Arguments

Type IntentOptional Attributes Name
class(fragment_lookup_t), intent(inout) :: this
integer, intent(in) :: monomers(:)
integer, intent(in) :: n
integer(kind=int64), intent(in) :: fragment_idx
type(error_t), intent(out), optional :: error