I'm getting odd results with the attached structure.  It seems I can only attach one file, so I've attached the structure.  The script I'm running is at the bottom.  When I run it, I get:

Num atoms in Test Mol : 36

Unusual bonds : 1
[u'C17', u'N16'] [16, 15] 1.35176561208 1.30825121262 1.30575835705 3.46603009836 False 17


When I analyse the structure in Mogul, the z score is 0.628 for that bond, based on 7599 hits, whereas here it's 3.466 and 17 respectively. It's very odd, too, that it only complains about 1 of the C-N bonds in the pyridine, not the other!


Any hints as to what I'm going on will be gratefully received!




PS the indentation in the script is obviously mangled by this text box.


#!/usr/bin/env python

from ccdc import io
from ccdc.conformer import GeometryAnalyser
from ccdc.molecule import Molecule

import sys

engine = GeometryAnalyser()

mol_reader = io.MoleculeReader( sys.argv[1] )
mol = mol_reader[0]
print 'Num atoms in %s : %d' % ( mol.identifier , len( mol.atoms ) )

mol_checked = engine.analyse_molecule( mol )

print 'Unusual bonds : %d' % len([b for b in mol_checked.analysed_bonds if b.unusual])
for b in mol_checked.analysed_bonds :
if b.unusual :
print b.atom_labels , b.atom_indices , b.value , b.mean , b.median , b.z_score , b.generalised , b.nhits

Hi Dave,

Sorry for the delay in getting back to you, but I've just seen this post.

There are a few things to clarify here.

1) CSD data

The CSD Python API, by default, uses the November release of the database, but is is possible to add multiple libraries to the calculation (e.g. the CSD updates) if you want to. 

To have consistent results I've changed the Mogul settings in Mercury from CSD-System --> Mogul Settings... where in the Include library column I've selected only CSD 5.37.

2) Standardisation of aromatic and delocalised bonds

It is important to standardise your input molecule according to CSD conventions. Mogul does it automatically, while in the API you need two additional lines of code:




from ccdc.io import MoleculeReader
from ccdc.conformer import GeometryAnalyser

mol = MoleculeReader('test2_3d_opt.sdf')[0]

geometry_analysed_mol = engine.analyse_molecule(mol)

for b in geometry_analysed_mol.analysed_bonds:
    print b.atom_labels , b.atom_indices , b.value , b.mean , b.median , b.z_score , b.generalised , b.nhits


I hope that helps.

Best wishes,




Hi Ilenia,

Thanks for the reply. I had stumbled upon the standardise_aromatic_bonds() bit some time after posting, but not the delocalised_bonds() equivalent. I'll amend my script accordingly. If this step isn't in the documentation examples, can I suggest it's added?  It seems to be quite important!

Thanks for the tip about the databases, I'll add that, too, though clearly in this case it was a secondary effect.





You must be signed in to post in this forum.