get_nfrags Function

public pure function get_nfrags(n_monomers, max_level) result(n_expected_fragments)

Calculate total number of fragments for given system size and max level

Computes the sum of binomial coefficients C(n,k) for k=1 to max_level, representing all possible fragments from monomers to max_level-mers. Uses int64 to handle large fragment counts that overflow int32.

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: n_monomers

Number of monomers in system

integer(kind=default_int), intent(in) :: max_level

Maximum fragment size

Return Value integer(kind=int64)

Total fragment count


Calls

proc~~get_nfrags~~CallsGraph proc~get_nfrags get_nfrags proc~binomial binomial proc~get_nfrags->proc~binomial

Called by

proc~~get_nfrags~~CalledByGraph proc~get_nfrags get_nfrags proc~run_fragmented_calculation run_fragmented_calculation proc~run_fragmented_calculation->proc~get_nfrags 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
integer(kind=default_int), private :: i

Loop counter


Source Code

   pure function get_nfrags(n_monomers, max_level) result(n_expected_fragments)
      !! Calculate total number of fragments for given system size and max level
      !!
      !! Computes the sum of binomial coefficients C(n,k) for k=1 to max_level,
      !! representing all possible fragments from monomers to max_level-mers.
      !! Uses int64 to handle large fragment counts that overflow int32.
      integer(default_int), intent(in) :: n_monomers  !! Number of monomers in system
      integer(default_int), intent(in) :: max_level   !! Maximum fragment size
      integer(int64) :: n_expected_fragments     !! Total fragment count
      integer(default_int) :: i  !! Loop counter

      n_expected_fragments = 0_int64
      do i = 1, max_level
         n_expected_fragments = n_expected_fragments + binomial(n_monomers, i)
      end do
   end function get_nfrags