I have trouble retrieving coordinates from molecules that I read in using io.MoleculeReader. Here is a relevant code fragment (here I use a molecule from the database, but I tried sdf/mol2 formats, and encounter the exact same issue).

>>> import ccdc
>>> ccdc.__version__
>>> from ccdc import io
>>> reader = io.MoleculeReader( "CSD" )
>>> mol = reader.molecule( "ABEBUF" )
>>> print mol.to_string()
    39    41     2     0     0
Generated from the CSD
     1 O1       1.9287   5.1676   1.7209   O.2       1 RES1   0.0000
>>> mol.atoms[0]
>>> mol.atoms[0].coordinates # returns None, hence no output
>>> mol.atoms[0]._atom.site().orth() # from source code
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<snip>/ccdc/_lib/PackingSimilarityLib.py", line 693, in __repr__
    def __repr__(self): return _PackingSimilarityLib.Point___repr__(self)
RuntimeError: PackingSimilarity is available to CSD-Materials and CSD-Enterprise users.
To enable this functionality contact admin@ccdc.cam.ac.uk

I honestly do not know whether we are CSD-Materials or CSD-Enterprise users, but the online documentation indicates that this functionality is available to all users (https://downloads.ccdc.cam.ac.uk/documentation/API/release_notes.html#licensed-features).

This is on CentOS7 64bit. Unfortunately, I have not installed the package myself, and hence cannot give you any exact details, but I am guessing that installation was done using pip.

Can you let me know what the problem is, and how to resolve it?

Best wishes, Gabor

Dear Gabor,

I'm sorry to say you have come across a bug in the interaction between our licensing and our implementation.  The orth method has inadvertently taken its definition from a library with restrictions.  This will certainly be fixed in a forthcoming release, probably version 1.5.2 in about three months' time.

In the meantime I have provided a 'monkey patch' which will change the use of 'orth' to one in a library without these restrictions.  This should be applied in any script you use to examine the coordinates of a molecule's atoms.

Please let me know if anything is unclear about this, and my apologies for allowing this bug to slip into the release.

Best wishes
Richard Sykes


# Monkey-patch around the licence restriction

from ccdc.utilities import _private_importer
with _private_importer():
    import ChemistryLib
    import PackingSimilarityLib
PackingSimilarityLib.Point = ChemistryLib.Point


Dear Richard,

many thanks for your help! I can confirm that the patch solves the problem.

Best wishes, Gabor


You must be signed in to post in this forum.