class_docstr: A featurizer that featurizes an RDKit mol object as a GraphData object with 3D coordinates. The 3D coordinates are represented in the node_pos_features attribute of the GraphData object of shape [num_atoms * num_conformers, 3].
  
  The ETKDGv2 algorithm is used to generate 3D coordinates for the molecule.
  The RDKit source for this algorithm can be found in RDkit/Code/GraphMol/DistGeomHelpers/Embedder.cpp
  The documentation can be found here:
  https://rdkit.org/docs/source/rdkit.Chem.rdDistGeom.html#rdkit.Chem.rdDistGeom.ETKDGv2
  
  This featurization requires RDKit.
  
  Examples
  --------
  >>> from deepchem.feat.molecule_featurizers.conformer_featurizer import RDKitConformerFeaturizer
  >>> featurizer = RDKitConformerFeaturizer()
  >>> molecule = "CCO"
  >>> conformer = featurizer.featurize(molecule)
  >>> print (type(conformer[0]))
  <class 'deepchem.feat.graph_data.GraphData'>
class_docstr_tok: ["A","featurizer","that","featurizes","an","RDKit","mol","object","as","a","GraphData","object","with","3D","coordinates",".","The","3D","coordinates","are","represented","in","the","node_pos_features","attribute","of","the","GraphData","object","of","shape","[","num_atoms","*","num_conformers",",","3","]",".","The","ETKDGv2","algorithm","is","used","to","generate","3D","coordinates","for","the","molecule",".","The","RDKit","source","for","this","algorithm","can","be","found","in","RDkit\/Code\/GraphMol\/DistGeomHelpers\/Embedder.cpp","The","documentation","can","be","found","here",":","https",":","\/\/rdkit.org\/docs\/source\/rdkit.Chem.rdDistGeom.html","#","rdkit.Chem.rdDistGeom.ETKDGv2","This","featurization","requires","RDKit",".","Examples","--","--","--","--",">",">",">","from","deepchem.feat.molecule_featurizers.conformer_featurizer","import","RDKitConformerFeaturizer",">",">",">","featurizer","=","RDKitConformerFeaturizer","(",")",">",">",">","molecule","=","``","CCO","''",">",">",">","conformer","=","featurizer.featurize","(","molecule",")",">",">",">","print","(","type","(","conformer","[","0","]",")",")","<","class","'deepchem.feat.graph_data.GraphData","'",">"]
docstr: Featurizes a molecule into a graph representation with 3D coordinates.
  
  Parameters
  ----------
  datapoint : RdkitMol
      RDKit molecule object
  
  Returns
  -------
  graph: List[GraphData]
      list of GraphData objects of the molecule conformers with 3D coordinates.
docstr_tok: ["Featurizes","a","molecule","into","a","graph","representation","with","3D","coordinates",".","Parameters","--","--","--","--","--","datapoint",":","RdkitMol","RDKit","molecule","object","Returns","--","--","--","-","graph",":","List","[","GraphData","]","list","of","GraphData","objects","of","the","molecule","conformers","with","3D","coordinates","."]
code: def _featurize(self, datapoint):
      """
      Featurizes a molecule into a graph representation with 3D coordinates.
  
      Parameters
      ----------
      datapoint : RdkitMol
          RDKit molecule object
  
      Returns
      -------
      graph: List[GraphData]
          list of GraphData objects of the molecule conformers with 3D coordinates.
      """
      # Derived from https://github.com/HannesStark/3DInfomax/blob/5cd32629c690e119bcae8726acedefdb0aa037fc/datasets/qm9_dataset_rdkit_conformers.py#L377
      # add hydrogen bonds to molecule because they are not in the smiles representation
      mol = Chem.AddHs(datapoint)
      ps = AllChem.ETKDGv2()
      ps.useRandomCoords = True
      AllChem.EmbedMolecule(mol, ps)
      # FIXME Add support for multiple conformers (wip)
      # AllChem.EmbedMultipleConfs(mol, self.num_conformers)
      # AllChem.MMFFOptimizeMolecule(mol)
      # rmsd_list = []
      # rdMolAlign.AlignMolConformers(mol, RMSlist=rmsd_list)
      # # insert 0 RMSD for first conformer
      # rmsd_list.insert(0, 0)
      # conformers = [
      #     mol.GetConformer(i)
      #     for i in range(self.num_conformers)
      #     if rmsd_list[i] < self.rmsd_cutoff
      # ]
      # # if conformer list is less than num_conformers, pad by repeating conformers
      # conf_idx = 0
      # while len(conformers) < self.num_conformers:
      #     conformers.append(conformers[conf_idx])
      #     conf_idx += 1
  
      # coordinates = [conf.GetPositions() for conf in conformers]
  
      AllChem.MMFFOptimizeMolecule(mol, confId=0)
      conf = mol.GetConformer()
      coordinates = conf.GetPositions()
  
      atom_features_list = []
      for atom in mol.GetAtoms():
          atom_features_list.append(self.atom_to_feature_vector(atom))
  
      edges_list = []
      edge_features_list = []
      for bond in mol.GetBonds():
          i = bond.GetBeginAtomIdx()
          j = bond.GetEndAtomIdx()
          edge_feature = self.bond_to_feature_vector(bond)
  
          # add edges in both directions
          edges_list.append((i, j))
          edge_features_list.append(edge_feature)
          edges_list.append((j, i))
          edge_features_list.append(edge_feature)
  
      # Graph connectivity in COO format with shape [2, num_edges]
      # FIXME Add support for multiple conformers (wip)
      # graph_list = []
      # for i in range(self.num_conformers):
      #     graph_list.append(
      #         GraphData(node_pos_features=np.array(coordinates[i]),
      #                   node_features=np.array(atom_features_list),
      #                   edge_features=np.array(edge_features_list),
      #                   edge_index=np.array(edges_list).T))
      # return graph_list
  
      return GraphData(
          node_pos_features=coordinates,
          node_features=np.array(atom_features_list),
          edge_features=np.array(edge_features_list),
          edge_index=np.array(edges_list).T,
      )
  
file_path: deepchem/deepchem/feat/molecule_featurizers/conformer_featurizer.py
imports: import numpy
  from rdkit import Chem
  from rdkit.Chem import AllChem
  from deepchem.feat.graph_data import GraphData
  from deepchem.feat import MolecularFeaturizer
label_desc: Use image node_id 3 for calling the RDKitConformerFeaturizer obj's underlying member method code with example usage: obj._featurize(datapoint) and returns: GraphData