Get 3D coordinates of the molecule.

This function requires that molecular conformation has been initialized.


mol (rdkit.Chem.rdchem.Mol) – RDKit molecule instance.


The 3D coordinates of atoms in the molecule. N for the number of atoms in the molecule. For failures in getting the conformations, None will be returned.

Return type

numpy.ndarray of shape (N, 3) or None


An error will occur in the example below since the molecule object does not carry conformation information.

>>> from rdkit import Chem
>>> from dgllife.utils import get_mol_3d_coordinates
>>> mol = Chem.MolFromSmiles('CCO')

Below we give a working example based on molecule conformation initialized from calculation.

>>> from rdkit.Chem import AllChem
>>> AllChem.EmbedMolecule(mol)
>>> AllChem.MMFFOptimizeMolecule(mol)
>>> coords = get_mol_3d_coordinates(mol)
>>> print(coords)
array([[ 1.20967478, -0.25802181,  0.        ],
       [-0.05021255,  0.57068079,  0.        ],
       [-1.15946223, -0.31265898,  0.        ]])