mol.GetSubstructMatches(Chem.MolFromSmarts(‘[*]=[*]’))

Should find all double bonds between non-aromatic atoms. If you want to include 
those Chem.Kekulize(mol) first.

On 8 Dec 2020, at 15.01, José Emilio Sánchez Aparicio 
<joseemilio.sanc...@uab.cat<mailto:joseemilio.sanc...@uab.cat>> wrote:

Dear all,

I need to find how many bonds of a certain type are in a molecule. For example, 
for DOUBLE bonds, I would do:

bond_number = 0
for bond in mol.GetBonds():
    if bond.GetType() == Chem.BondType.DOUBLE:
        bond_number += 1

However, searching for faster manners to do this, I found "rdqueries". For 
example, to find how many atoms of Carbon there are in a molecule, you could do:

q = rdqueries.AtomNumEqualsQueryAtom(6)
carbon_number = len(mol.GetAtomsMatchingQuery(q))

I'm wondering if some of you know the equivalent in "rdqueries" to find the 
number of bonds that match a type.

Many thanks in advance. Best,

José-Emilio Sánchez
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net<mailto:Rdkit-discuss@lists.sourceforge.net>
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Frdkit-discuss&amp;data=04%7C01%7Cjhjensen%40chem.ku.dk%7C5d1853f4894b40f5fb5408d89b977bec%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C1%7C637430422820009115%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&amp;sdata=A3DQM8k0SifBs7KL2F6zsqS981i1sfewrtBD4%2FdYIy8%3D&amp;reserved=0

_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to