code: def main():
      
      if "-h" in sys.argv or "--help" in sys.argv:
          print(__doc__)
          print("Usage: regen_libxcfunc.py path_to_libxc_docs.txt")
          return 0
  
      try:
          path = sys.argv[1]
      except IndexError:
          print(__doc__)
          print("Usage: regen_libxcfunc.py path_to_libxc_docs.txt")
          return 1
  
      xcfuncs = parse_libxc_docs(path)
  
      # Generate new json file in pycore
      pycore = os.path.abspath("../pymatgen/core/")
      jpath = os.path.join(pycore, "libxc_docs.json")
      write_libxc_docs_json(xcfuncs, jpath)
  
      # Build new enum list.
      enum_list = []
      for num, d in xcfuncs.items():
          # Remove XC_ from codename
          codename = d["Codename"][3:]
          enum_list.append("    %s = %s" % (codename, num))
      enum_list = "\n".join(enum_list) + "\n"
  
      # Re-generate enumerations.
      # [0] read py module.
      xcfuncpy_path = os.path.join(pycore, "libxcfunc.py")
      with open(xcfuncpy_path, "rt") as fh:
          lines = fh.readlines()
  
      # [1] insert new enum values in list
      start = lines.index("#begin_include_dont_touch\n")
      stop = lines.index("#end_include_dont_touch\n")
      lines.insert(stop, enum_list)
      del lines[start+1:stop]
  
      # [2] write new py module
      with open(xcfuncpy_path, "wt") as fh:
          fh.writelines(lines)
  
      print("Files have been regenerated")
      print("Remember to update libxc_version in libxcfuncs.py!")
  
      return 0
docs: Main function.