[Rdkit-discuss] distance matrix for non-bonded atoms
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
From: Michal K. <mic...@gm...> - 2013-12-03 15:56:45
|
Hello, Is there any simpler (=faster) way of calculating the shortest distance between non-bonded atoms in a molecule? from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem import rdMolTransforms import numpy mol=Chem.MolFromSmiles("Cc2ccsc2c1sccc1C") mol=Chem.AddHs(mol) AllChem.EmbedMolecule(mol) AllChem.MMFFOptimizeMolecule(mol) dm=numpy.multiply(Chem.Get3DDistanceMatrix(mol),numpy.logical_not(Chem.GetAdjacencyMatrix(mol))) print("minimum non-bonded atom-atom distance: {}".format(numpy.min(dm[numpy.nonzero(dm)]))) Best wishes, Michal |