openforcefield / openff-toolkit

The Open Forcefield Toolkit provides implementations of the SMIRNOFF format, parameterization engine, and other tools. Documentation available at http://open-forcefield-toolkit.readthedocs.io
http://openforcefield.org
MIT License
313 stars 92 forks source link

Partial Charges for Rare Atoms #1903

Closed maciejwisniewski-drugdiscovery closed 1 month ago

maciejwisniewski-drugdiscovery commented 3 months ago

Hi,

I'm working with a dataset containing SMILES strings of various ligands, and I want to calculate partial charges for each of them using either the Gasteiger or AM1BCC method.

Here is the Python code I'm using:

import rdkit
from rdkit import Chem
from rdkit.Chem import rdDistGeom
from openff.toolkit import Molecule

smiles = 'C[AsH]C' #  example SMILES

charge_method = 'gasteiget' #  or 'am1bcc'

try:
    rdkit_mol = Chem.MolFromSmiles(smiles)
    # Generate Conformer
    rdkit_mol.RemoveAllConformers()
    rdkit_mol = Chem.AddHs(rdkit_mol)
    params = rdDistGeom.ETKDGv3()
    params.randomSeed = 0xd06f00d
    params.numThreads = 4
    params.maxAttempts = 100
    rdDistGeom.EmbedMultipleConfs(rdkit_mol, 1, params)
    # Load to OpenFF
    openff_mol = Molecule.from_rdkit(rdkit_mol,allow_undefined_stereo=True)
except:
    openff_mol = Molecule.from_smiles(smiles,allow_undefined_stereo=True)
    openff_mol.generate_conformers(n_conformers=1)

openff_mol.assign_partial_charges(partial_charge_method='gasteiger')
print(openff_mol.partial_charges)

However, I've encountered a couple of issues:

1. Ligands with Radicals (?):

RadicalsNotSupportedError: The OpenFF Toolkit does not currently support parsing molecules with S- and P-block radicals. Found 1 radical electrons on molecule [S]12[Fe]3[S]4[Fe]1[S]1[Fe]2[S]3[Fe]41.

Do you have any ideas how to omit that error?

2. Ligands with Atoms Lacking Parameters in Charge Calculation Methods:

List of Not Working Atoms in my DataSet

bad_atoms = ['Se','Fe','Ca','W','V','Co','As','Be','Mo','Te','Sb','Hg','Cr','Cu','Pd','Tb','Pr','Pb','Ir','Rh','Pt','Sn','Ni','Au','Zn','U','Ru','Cu']

Is there any chance to obtain charges for ligands with these specific atoms?

Maciek

j-wags commented 3 months ago

Hi @maciejwisniewski-drugdiscovery,

Unfortunately, we don't currently support loading/handling transition metals (which I believe is that issue causing the "radicals" error with the iron-containing compound in part 1), and even if we did, the AM1BCC charge method does not support the elements in your bad_atoms list from item 2. Currently OpenFF focuses on supporting druglike organic molecules, and while we have plans to expand our domain of applicability in the coming years, it will be a few years before we can generally handle transition metals.

Cheers, Jeff