code: def amchar_to_int(amchar, hij=False):
      '''Convert an angular momentum integer to a character
  
      The return value is a list of integers (to handle sp, spd, ... orbitals)
  
      For example, converts 'p' to [1] and 'sp' to [0,1]
  
      If hij is True, the ordering spdfghijkl is used. Otherwise, the
      ordering will be spdfghikl (skipping j)
      '''
  
      if hij:
          amchar_map = _amchar_map_hij
      else:
          amchar_map = _amchar_map_hik
  
      amchar_lower = amchar.lower()
  
      amint = []
  
      for c in amchar_lower:
          if c not in amchar_map:
              raise KeyError('Angular momentum character {} is not valid'.format(c))
  
          amint.append(amchar_map.index(c))
  
      return aminf amchar_to_int(amchar, hij=False):
      '''Convert an angular momentum integer to a character
  
      The return value is a list of integers (to handle sp, spd, ... orbitals)
  
      For example, converts 'p' to [1] and 'sp' to [0,1]
  
      If hij is True, the ordering spdfghijkl is used. Otherwise, the
      ordering will be spdfghikl (skipping j)
      '''
  
      if hij:
          amchar_map = _amchar_map_hij
      else:
          amchar_map = _amchar_map_hik
  
      amchar_lower = amchar.lower()
  
      amint = []
  
      for c in amchar_lower:
          if c not in amchar_map:
              raise KeyError('Angular momentum character {} is not valid'.format(c))
  
          amint.append(amchar_map.index(c))
  
      return amint
docs: Convert an angular momentum integer to a character
  
      The return value is a list of integers (to handle sp, spd, ... orbitals)
  
      For example, converts 'p' to [1] and 'sp' to [0,1]
  
      If hij is True, the ordering spdfghijkl is used. Otherwise, the
      ordering will be spdfghikl (skipping j)