I am processing some XYZ files using the
rdkit library in python. I came across some strange/unexpected behaviour.
Consider a sample XYZ file of methanol with coordinates in Angstroms:
6 Methanol H 1.2001 0.0363 0.8431 H 0.9877 0.8943 -0.7114 H 1.0155 -0.8918 -0.6742 C 0.7031 0.0083 -0.1305 O -0.6582 -0.0067 0.1730 H -1.1326 -0.0311 -0.6482
I am using the following code to visualise this compound. I am running the below code on Google Colab.
!pip install rdkit from rdkit.Chem.rdmolfiles import MolFromXYZFile coord_filepath = '/content/drive/MyDrive/input_files/methanol.xyz' mol = MolFromXYZFile(coord_filepath) display(mol)
The output from the display looks like this:
I am a bit puzzled about the extra Hydrogens in the image.
I tried to double check the atoms in the rdkit
for atom in mol.GetAtoms(): print(atom.GetSymbol())
It displays as expected:
H H H C O H
With coordinates in nanometers, the behaviour persists, with a bit better spacing between the various atoms/molecules.
So is this behaviour a bug or am I missing something conceptually?