parameters: (metadata)
return_statement: return metadata
docstring: Generates the list of N-Body computations to be performed for a given BSSE type.
  
      Parameters
      ----------
      metadata : dict of str
          Dictionary containing N-body metadata.
  
          Required ``'key': value`` pairs:
          ``'bsse_type_list'``: list of str
              List of requested BSSE treatments.  Possible values include lowercase ``'cp'``, ``'nocp'``,
              and ``'vmfc'``.
          ``'max_nbody'``: int
              Maximum number of bodies to include in the N-Body treatment.
              Possible: `max_nbody` <= `max_frag`
              Default: `max_nbody` = `max_frag`
          ``'max_frag'``: int
              Number of distinct fragments comprising full molecular supersystem.
  
      Returns
      -------
      metadata : dict of str
          Dictionary containing N-body metadata.
  
          New ``'key': value`` pair:
          ``'compute_dict'`` : dict of str: dict
              Dictionary containing subdicts enumerating compute lists for each possible BSSE treatment.
  
              Contents:
              ``'all'``: dict of int: set
                  Set containing full list of computations required
              ``'cp'``: dict of int: set
                  Set containing list of computations required for CP procedure
              ``'nocp'``: dict of int: set
                  Set containing list of computations required for non-CP procedure
              ``'vmfc_compute'``: dict of int: set
                  Set containing list of computations required for VMFC procedure
              ``'vmfc_levels'``: dict of int: set
                  Set containing list of levels required for VMFC procedure
docstring_summary: Generates the list of N-Body computations to be performed for a given BSSE type.
docstring_tokens: Generates the list of N - Body computations to be performed for a given BSSE type .
function: def build_nbody_compute_list(metadata):
      """Generates the list of N-Body computations to be performed for a given BSSE type.
  
      Parameters
      ----------
      metadata : dict of str
          Dictionary containing N-body metadata.
  
          Required ``'key': value`` pairs:
          ``'bsse_type_list'``: list of str
              List of requested BSSE treatments.  Possible values include lowercase ``'cp'``, ``'nocp'``,
              and ``'vmfc'``.
          ``'max_nbody'``: int
              Maximum number of bodies to include in the N-Body treatment.
              Possible: `max_nbody` <= `max_frag`
              Default: `max_nbody` = `max_frag`
          ``'max_frag'``: int
              Number of distinct fragments comprising full molecular supersystem.
  
      Returns
      -------
      metadata : dict of str
          Dictionary containing N-body metadata.
  
          New ``'key': value`` pair:
          ``'compute_dict'`` : dict of str: dict
              Dictionary containing subdicts enumerating compute lists for each possible BSSE treatment.
  
              Contents:
              ``'all'``: dict of int: set
                  Set containing full list of computations required
              ``'cp'``: dict of int: set
                  Set containing list of computations required for CP procedure
              ``'nocp'``: dict of int: set
                  Set containing list of computations required for non-CP procedure
              ``'vmfc_compute'``: dict of int: set
                  Set containing list of computations required for VMFC procedure
              ``'vmfc_levels'``: dict of int: set
                  Set containing list of levels required for VMFC procedure
      """
      # What levels do we need?
      nbody_range = range(1, metadata['max_nbody'] + 1)
      fragment_range = range(1, metadata['max_frag'] + 1)
  
      cp_compute_list = {x: set() for x in nbody_range}
      nocp_compute_list = {x: set() for x in nbody_range}
      vmfc_compute_list = {x: set() for x in nbody_range}
      vmfc_level_list = {x: set() for x in nbody_range}  # Need to sum something slightly different
  
      # Verify proper passing of bsse_type_list
      bsse_type_remainder = set(metadata['bsse_type_list']) - {'cp', 'nocp', 'vmfc'}
      if bsse_type_remainder:
          raise ValidationError("""Unrecognized BSSE type(s): %s
  Possible values are 'cp', 'nocp', and 'vmfc'.""" % ', '.join(str(i) for i in bsse_type_remainder))
  
      # Build up compute sets
      if 'cp' in metadata['bsse_type_list']:
          # Everything is in dimer basis
          basis_tuple = tuple(fragment_range)
          for nbody in nbody_range:
              for x in itertools.combinations(fragment_range, nbody):
                  if metadata['max_nbody'] == 1: break
                  cp_compute_list[nbody].add((x, basis_tuple))
  
      if 'nocp' in metadata['bsse_type_list'] or metadata['return_total_data']:
          # Everything in monomer basis
          for nbody in nbody_range:
              for x in itertools.combinations(fragment_range, nbody):
                  nocp_compute_list[nbody].add((x, x))
  
      if 'vmfc' in metadata['bsse_type_list']:
          # Like a CP for all combinations of pairs or greater
          for nbody in nbody_range:
              for cp_combos in itertools.combinations(fragment_range, nbody):
                  basis_tuple = tuple(cp_combos)
                  for interior_nbody in nbody_range:
                      for x in itertools.combinations(cp_combos, interior_nbody):
                          combo_tuple = (x, basis_tuple)
                          vmfc_compute_list[interior_nbody].add(combo_tuple)
                          vmfc_level_list[len(basis_tuple)].add(combo_tuple)
  
      # Build a comprehensive compute_range
      compute_list = {x: set() for x in nbody_range}
      for n in nbody_range:
          compute_list[n] |= cp_compute_list[n]
          compute_list[n] |= nocp_compute_list[n]
          compute_list[n] |= vmfc_compute_list[n]
          core.print_out("        Number of %d-body computations:     %d\n" % (n, len(compute_list[n])))
  
      metadata['compute_dict'] = {
          'all': compute_list,
          'cp': cp_compute_list,
          'nocp': nocp_compute_list,
          'vmfc_compute': vmfc_compute_list,
          'vmfc_levels': vmfc_level_list
      }
  
      return metadata
function_tokens: def build_nbody_compute_list ( metadata ) : # What levels do we need? nbody_range = range ( 1 , metadata [ 'max_nbody' ] + 1 ) fragment_range = range ( 1 , metadata [ 'max_frag' ] + 1 ) cp_compute_list = { x : set ( ) for x in nbody_range } nocp_compute_list = { x : set ( ) for x in nbody_range } vmfc_compute_list = { x : set ( ) for x in nbody_range } vmfc_level_list = { x : set ( ) for x in nbody_range } # Need to sum something slightly different # Verify proper passing of bsse_type_list bsse_type_remainder = set ( metadata [ 'bsse_type_list' ] ) - { 'cp' , 'nocp' , 'vmfc' } if bsse_type_remainder : raise ValidationError ( """Unrecognized BSSE type(s): %s
  Possible values are 'cp', 'nocp', and 'vmfc'.""" % ', ' . join ( str ( i ) for i in bsse_type_remainder ) ) # Build up compute sets if 'cp' in metadata [ 'bsse_type_list' ] : # Everything is in dimer basis basis_tuple = tuple ( fragment_range ) for nbody in nbody_range : for x in itertools . combinations ( fragment_range , nbody ) : if metadata [ 'max_nbody' ] == 1 : break cp_compute_list [ nbody ] . add ( ( x , basis_tuple ) ) if 'nocp' in metadata [ 'bsse_type_list' ] or metadata [ 'return_total_data' ] : # Everything in monomer basis for nbody in nbody_range : for x in itertools . combinations ( fragment_range , nbody ) : nocp_compute_list [ nbody ] . add ( ( x , x ) ) if 'vmfc' in metadata [ 'bsse_type_list' ] : # Like a CP for all combinations of pairs or greater for nbody in nbody_range : for cp_combos in itertools . combinations ( fragment_range , nbody ) : basis_tuple = tuple ( cp_combos ) for interior_nbody in nbody_range : for x in itertools . combinations ( cp_combos , interior_nbody ) : combo_tuple = ( x , basis_tuple ) vmfc_compute_list [ interior_nbody ] . add ( combo_tuple ) vmfc_level_list [ len ( basis_tuple ) ] . add ( combo_tuple ) # Build a comprehensive compute_range compute_list = { x : set ( ) for x in nbody_range } for n in nbody_range : compute_list [ n ] |= cp_compute_list [ n ] compute_list [ n ] |= nocp_compute_list [ n ] compute_list [ n ] |= vmfc_compute_list [ n ] core . print_out ( "        Number of %d-body computations:     %d\n" % ( n , len ( compute_list [ n ] ) ) ) metadata [ 'compute_dict' ] = { 'all' : compute_list , 'cp' : cp_compute_list , 'nocp' : nocp_compute_list , 'vmfc_compute' : vmfc_compute_list , 'vmfc_levels' : vmfc_level_list } return metadata