Hi Guillaume, Greg's solution is great for intra-molecular H-Bonds. If you want to achieve inter-molecular ones then it's a bit more complicated. I did such implementation in my package ODDT [https://github.com/oddt/oddt], which also uses RDKit. You can find the hbond function in interactions module [ https://github.com/oddt/oddt/blob/master/oddt/interactions.py#L92].
from oddt.toolkits import rdk > from oddt.interactions import hbond > hbond(rdk.Molecule(your_rdkit_mol1), > rdk.Molecule(your_rdkit_mol2), cutoff=3.5) The final function will return a series of donor-acceptor pairs which fall within cutoff, and a bool array saying if they match the angle criteria. Note, that it looks at D-A distance and not at H-A distance. ---- Pozdrawiam, | Best regards, Maciek Wójcikowski mac...@wojcikowski.pl 2016-09-14 12:16 GMT+02:00 Greg Landrum <greg.land...@gmail.com>: > Hi Guillaume, > > On Tue, Sep 13, 2016 at 10:12 PM, Guillaume GODIN < > guillaume.go...@firmenich.com> wrote: > >> 1 Does 3D coordinates of a conformer is in Angstroms ? >> >> If you read the conformer from a file, for example a mol file, then the > 3D coordinates are in whatever units they were in in that file. This is > usually Angstrsom. > If you generate the conformation using one of the RDKit embedding > functions, then they are certainly in Angstroms. > >> 2 How to enumerate all HBonding to determine the bond length ? >> > > Interesting question. Here's a python function that might be a starting > point: > > def findHBonds(m,confId=-1,possiblePartners='[#8,#7]', > possibleHs='[#1][#8,#7]',distThresh=2.5): > conf = m.GetConformer(confId) > partners =[x[0] for x in m.GetSubstructMatches(Chem.MolFromSmarts( > possiblePartners))] > hs= [x[0] for x in m.GetSubstructMatches(Chem. > MolFromSmarts(possibleHs))] > res = [] > for h in hs: > ph = conf.GetAtomPosition(h) > for partner in partners: > if m.GetBondBetweenAtoms(h,partner) is not None: > continue > d = conf.GetAtomPosition(partner).Distance(ph) > if d<=distThresh: > res.append((h,partner,d)) > return res > > > In order to allow flexibility about what an H bond is, I left the > definitions of the acceptors (partners in the above code) and polar Hs > (just Hs in the above code) as SMARTS definitions so that they can be > customized. > > > > ------------------------------------------------------------ > ------------------ > > _______________________________________________ > Rdkit-discuss mailing list > Rdkit-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss > >
------------------------------------------------------------------------------
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss