I'm not sure whether you want to get these distances for the entire molecule or just certain atom pairs. But I guess the simplest way to get the distance between two atoms would be…
>>> from rdkit import Chem
>>> import numpy as np
>>> from rdkit.Chem import AllChem
>>> mol = Chem.MolFromSmiles('CCCCC')
>>> AllChem.EmbedMolecule(mol)
>>> AllChem.UFFOptimizeMolecule(mol)
>>> conf = mol.GetConformer()
>>> at1Coords = np.array(conf.GetAtomPosition(1))
>>> at2Coords = np.array(conf.GetAtomPosition(2))
>>> print np.linalg.norm(at1Coords-at2Coords)
1.52139356317
This can be optimised by not using numpy, I've not looked but there must be
some sort of euclidean distance using the Point3D class in RDKit.
Best,
Nick
Nicholas C. Firth | PhD Student | Cancer Therapeutics
The Institute of Cancer Research | 15 Cotswold Road | Belmont | Sutton | Surrey
| SM2 5NG
T 020 8722 4033 | E [email protected]<mailto:[email protected]> |
W www.icr.ac.uk<http://www.icr.ac.uk/> | Twitter
@ICRnews<https://twitter.com/ICRnews>
Facebook
www.facebook.com/theinstituteofcancerresearch<http://www.facebook.com/theinstituteofcancerresearch>
Making the discoveries that defeat cancer
[cid:[email protected]]
On 3 Dec 2013, at 15:56, Michal Krompiec
<[email protected]<mailto:[email protected]>> wrote:
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
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company
Limited by Guarantee, Registered in England under Company No. 534147 with its
Registered Office at 123 Old Brompton Road, London SW7 3RP.
This e-mail message is confidential and for use by the addressee only. If the
message is received by anyone other than the addressee, please return the
message to the sender by replying to it and then delete the message from your
computer and network.<<inline: image001.gif>>
------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________ Rdkit-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

