code: def convert_mol_to_pdbqt(mol: RDKitMol, outfile: str) -> None:
      """Writes the provided ligand molecule to specified file in pdbqt format.
  
      Creates a torsion tree and write to pdbqt file. The torsion tree
      represents rotatable bonds in the molecule.
  
      Parameters
      ----------
      mol: rdkit.Chem.rdchem.Mol
          The molecule whose value is stored in pdb format in outfile
      outfile: str
          Filename for a valid pdb file with the extention .pdbqt
  
      Notes
      -----
      This function requires NetworkX to be installed.
      """
      try:
          import networkx as nx
      except ModuleNotFoundError:
          raise ImportError(
              "This function requires NetworkX to be installed."
          )
  
      # Walk through the original file and extract ATOM/HETATM lines and
      # add PDBQT charge annotations.
      pdb_map = _create_pdb_map(outfile)
      graph = _mol_to_graph(mol)
      rotatable_bonds = _get_rotatable_bonds(mol)
  
      # Remove rotatable bonds from this molecule
      for bond in rotatable_bonds:
          graph.remove_edge(bond[0], bond[1])
      # Get the connected components now that the rotatable bonds have
      # been removed.
      components = [x for x in nx.connected_components(graph)]
      comp_map = _create_component_map(mol, components)
  
      used_partitions = set()
      lines = []
      # The root is the largest connected component.
      root = max(enumerate(components), key=lambda x: len(x[1]))[0]
      # Write the root component
      lines.append("ROOT\n")
      for atom in components[root]:
          lines.append(pdb_map[atom])
      lines.append("ENDROOT\n")
      # We've looked at the root, so take note of that
      used_partitions.add(root)
      for bond in rotatable_bonds:
          valid, next_partition = _valid_bond(
              used_partitions, bond, root, comp_map
          )
          if not valid:
              continue
          _dfs(
              used_partitions,
              next_partition,
              bond,
              components,
              rotatable_bonds,
              lines,
              pdb_map,
              comp_map,
          )
      lines.append("TORSDOF %s" % len(rotatable_bonds))
      with open(outfile, "w") as fout:
          for line in lines:
              fout.write(line)
  
file_path: deepchem/deepchem/utils/pdbqt_utils.py
imports: from typing import Dict, List, Optional, Set, Tuple
  from deepchem.utils.typing import RDKitMol
label_desc: Use image node_id 5 for calling a global function with example usage: convert_mol_to_pdbqt(mol, outfile) without return types