RDKit API

This is the API reference for Rowan's RDKit API.


Functions

run_pka

Runs a pKa workflow on a single RDKit molecule.

from rowan.rowan_rdkit import run_pka

mol = Chem.MolFromSmiles("O=C(O)Cc1ccccc1")  # Phenylacetic acid

result = run_pka(mol)
print(result["acidic_pkas"], result["basic_pkas"])

Parameters

molecule (Chem.rdchem.Mol | Chem.rdchem.RWMol)

The RDKit molecule on which to compute pKa values.

mode ("reckless" | "rapid" | "careful")

Determines the thoroughness and cost of the pKa search.

timeout (int)

Maximum time (in seconds) to wait for the workflow to complete. Defaults to 600.

name (str)

Name of the workflow in Rowan. Defaults to "pKa API Workflow."

pka_range (tuple[int, int])

The pH range to explore for (de)protonation. Defaults to (2,12).

deprotonate_elements (list[int])

List of atomic numbers to consider for deprotonation. Defaults to [7, 8, 16].

protonate_elements (list[int])

List of atomic numbers to consider for protonation. Defaults to [7].

folder_uuid (str | None)

A specific folder to submit the workflow to, if desired.

Returns

{
  "acidic_pkas": {
    {
      "element": "O",
      "index": 2,
      "pKa": 5.098
    }
  },
  "basic_pkas": {
    {
      "element": "N",
      "index": 3,
      "pKa": 11.023,
    },
    {
      "element": "N",
      "index": 22,
      "pKa": 13.128,
    }
  }
}

batch_pka

Runs pKa workflows on a list of RDKit molecules.

from rowan.rowan_rdkit import batch_pka

mols = [Chem.MolFromSmiles(s) for s in ["CCO", "CC(=O)O"]]

results = batch_pka(mols, mode="rapid")
for r in results:
    print(r["acidic_pkas"], r["basic_pkas"])

Parameters

Same parameters as run_pka, except molecule is replaced by a list of molecules.


run_tautomers

Generates and scores possible tautomers for a single RDKit molecule.

from rowan.rowan_rdkit import run_tautomers

mol = Chem.MolFromSmiles("C1=CC=CC=C1O")

tauts = run_tautomers(mol, mode="reckless")
for t in tauts:
    print(t["predicted_relative_energy"], t["weight"])

Parameters

molecule (Chem.rdchem.Mol | Chem.rdchem.RWMol)

The RDKit molecule for which to compute tautomers.

mode ("reckless" | "rapid" | "careful")

Determines the thoroughness and cost of the tautomer search.

timeout (int)

Maximum time (in seconds) to wait for the workflow to complete. Defaults to 600.

name (str)

Name of the workflow in Rowan. Defaults to "Tautomers API Workflow."

folder_uuid (str | None)

A specific folder to submit the workflow to, if desired.

Returns

[
  {
    "molecule": <rdkit.Chem.rdchem.Mol>,
    "predicted_relative_energy": 0.00,  # in kcal/mol
    "weight": 0.91966
  },
  {
    "molecule": <rdkit.Chem.rdchem.Mol>,
    "predicted_relative_energy": 1.44,
    "weight": 0.08034
  }
]

batch_tautomers

Generates possible tautomers for a list of RDKit molecules.

from rowan.rowan_rdkit import batch_tautomers

mols = [Chem.MolFromSmiles("C1=CC=CC=C1O"), Chem.MolFromSmiles("C1=CC=CC=C1N")]

results = batch_tautomers(mols, mode="rapid")
for taut_list in results:
    # Each element in taut_list is a list of tautomer data for that molecule
    for t in taut_list:
        print(t["predicted_relative_energy"], t["weight"])

Parameters

Same parameters as run_tautomers, except molecule is replaced by a list of molecules.


run_energy

Computes the single-point energy for an RDKit molecule.

from rowan.rowan_rdkit import run_energy

mol = Chem.MolFromSmiles("CCO")
molh = Chem.AddHs(mol)
AllChem.EmbedMultipleConfs(molh)

energies = run_energy(molh, method="aimnet2_wb97md3")

Parameters

molecule (Chem.rdchem.Mol | Chem.rdchem.RWMol)

The RDKit molecule whose energy you want to compute.

method (str)

The method for energy computation. Defaults to aimnet2_wb97md3, but gfn2_xtb, gfn1_xtb, and gfn0_xtb are also reasonable options.

engine (str)

The engine for the calculation, typically aimnet2 or xtb.

timeout (int)

Maximum time (in seconds) to wait for the workflow to complete. Defaults to 600.

name (str)

Name of the workflow in Rowan. Defaults to "Energy API Workflow."

folder_uuid (str | None)

A specific folder to submit the workflow to, if desired.

Returns

[
  {
    "conformer_index": 0,
    "energy": -323.72498584120694
  }, 
  {
    "conformer_index": 1,
    "energy": -323.72851913600635
  }, 
  {
    "conformer_index": 2,
    "energy": -323.7187770466773
  }
]

batch_energy

Computes the single-point energy for a list of RDKit molecules.

from rowan.rowan_rdkit import batch_energy

mols = ... # need to add Hs and embed conformers

energies_list = batch_energy(mols, method="aimnet2_wb97md3")
for energies in energies_list:
    print(energies) 

Parameters

Same parameters as run_energy, except molecule is replaced by a list of molecules.


run_optimize

Optimizes the geometry of each conformer in a single RDKit molecule. Returns a new molecule with updated conformer geometries, plus optionally the energies of each conformer.

from rowan.rowan_rdkit import run_optimize

mol = Chem.MolFromSmiles("CCO")
molh = Chem.AddHs(mol)
AllChem.EmbedMultipleConfs(molh)

opt_mol_data = run_optimize(mol, method="aimnet2_wb97md3", return_energies=True)
print(opt_mol_data["rdkit_molecule"])
print(opt_mol_data["energies"])

Parameters

molecule (Chem.rdchem.Mol | Chem.rdchem.RWMol)

The RDKit molecule which you want to optimize.

method (str)

The method for energy computation. Defaults to aimnet2_wb97md3, but gfn2_xtb, gfn1_xtb, and gfn0_xtb are also reasonable options.

engine (str)

The engine for the calculation, typically aimnet2 or xtb.

return_energies (bool)

Whether to return final energies for each conformer. Defaults to False.

timeout (int)

Maximum time (in seconds) to wait for the workflow to complete. Defaults to 600.

name (str)

Name of the workflow in Rowan. Defaults to "Optimize API Workflow."

folder_uuid (str | None)

A specific folder to submit the workflow to, if desired.

Returns

{
  "rdkit_molecule: <rdkit.Chem.rdchem.Mol>,
  "energies": [-323.7187770466773, -323.72498584120694]
}

batch_optimize

Optimizes the geometry of each conformer in a list of RDKit molecules.

from rowan.rowan_rdkit import batch_optimize

mols = ... # need to add Hs and embed conformers

opt_results = batch_optimize(mols, method="aimnet2_wb97md3", return_energies=True)
for res in opt_results:
    print(res["rdkit_molecule"])
    print(res["energies"])

Parameters

Same parameters as optimize, except molecule is replaced by a list of molecules.


run_conformers

Generates a specified number of low-energy conformers for a single RDKit molecule.

from rowan.rowan_rdkit import run_conformers

mol = Chem.MolFromSmiles("CCO")

conf_data = run_conformers(mol, num_conformers=5, return_energies=True)
print(conf_data["rdkit_molecule"])
print(conf_data["energies"])  # energies for each of the 5 lowest conformers

Parameters

molecule (Chem.rdchem.Mol | Chem.rdchem.RWMol)

The RDKit molecule for which to generate conformers.

num_conformers (int)

The number of low-energy conformers to request. Defaults to 10.

method (str)

The method for conformer search/optimization. Defaults to aimnet2_wb97md3, but gfn2_xtb, gfn1_xtb, and gfn0_xtb are also reasonable options.

mode ("reckless" | "rapid")

The mode for the conformer search. Defaults to "rapid".

return_energies (bool)

Whether to return final energies for each conformer. Defaults to False.

timeout (int)

Maximum time (in seconds) to wait for the workflow to complete. Defaults to 600.

name (str)

Name of the workflow in Rowan. Defaults to "Conformer API Workflow."

folder_uuid (str | None)

A specific folder to submit the workflow to, if desired.

Returns

{
  "rdkit_molecule": <rdkit.Chem.rdchem.Mol>,
  "energies": [-323.7187770466773, -323.72498584120694]
}

batch_conformers

Generates a specified number of low-energy conformers for a list of RDKit molecules.

from rowan.rowan_rdkit import batch_conformers

mols = [Chem.MolFromSmiles("CCO"), Chem.MolFromSmiles("c1ccccc1")]

batch_conf_data = batch_conformers(mols, num_conformers=5, return_energies=True)
for conf_data in batch_conf_data:
    print(conf_data["rdkit_molecule"])
    print(conf_data["energies"])

Parameters

Same parameters as run_conformers, except molecule is replaced by a list of molecules.


run_charges

Computes atom-centered charges for an RDKit molecule.

from rowan.rowan_rdkit import run_energy

mol = Chem.MolFromSmiles("CCO")
molh = Chem.AddHs(mol)
AllChem.EmbedMultipleConfs(molh)

charges = run_charges(molh, method="aimnet2_wb97md3")

Parameters

molecule (Chem.rdchem.Mol | Chem.rdchem.RWMol)

The RDKit molecule whose energy you want to compute.

method (str)

The method for charge computation. Defaults to aimnet2_wb97md3, but gfn2_xtb, gfn1_xtb, and gfn0_xtb are also reasonable options.

engine (str)

The engine for the calculation, typically aimnet2 or xtb.

timeout (int)

Maximum time (in seconds) to wait for the workflow to complete. Defaults to 600.

name (str)

Name of the workflow in Rowan. Defaults to "Charges API Workflow."

folder_uuid (str | None)

A specific folder to submit the workflow to, if desired.

Returns

[
  {
    "conformer_index": 0,
    "charges": [0.113, 0.010, -0.226, ...]
  }, 
  {
    "conformer_index": 1,
    "charges": [0.220, -0.117, -0.021, ...]
  }
]

batch_charges

Computes the atom-centered charges for a list of RDKit molecules.

from rowan.rowan_rdkit import batch_charges

mols = ... # need to add Hs and embed conformers

charges_list = batch_charges(mols, method="aimnet2_wb97md3")
for charges in charges_list
    print(charges) 

Parameters

Same parameters as run_charges, except molecule is replaced by a list of molecules.