I am new to using the Python API for the CSD and am trying to filter the CSD for organic crystals with no disorder or errors, and one distinct molecule / component . I am trying to use the search.Search.Setttings() and specifying:

settings.only_organic= True 
settings.no_metals= True
settings.has_3d_coordinates= True
settings.no_disorder= True
settings.no_errors= True


Then applying:

for crystal in csd_crystals:
     if (len(crystal.molecule.components) == 1 and settings.test(crystal)):


However some crystals that don't meet these criteria are being selected - such as refcode AARBOX and ABABUB. What am I doing wrong?

Hi Puck,

there are a couple of issues with this script:

Firstly, the no_disorder setting actually has three distinct values corresponding to False (don't check disorder at all), True (check for significant disorder, i.e of heavy atoms), or 'All' (check for any disorder).  Since you have specified True, structures like AARBOX will pass as the disorder is only in the position of the hydrogens.

Secondly, you are checking the crystal for disorder, rather than the entry.  This is a less specific test than that of the entry, as the editorial decisions made for the entry are lost when constructing the crystal, and this is why ABABUB is found.

There is a third problem for which I must apologise: there is a bug in the processing of the test for entries which, coincidentally I fixed today.  This will appear in the next release of the API.  This concerns entries with disorder but where the editors have not suppressed any atoms.

A better check would be:

for entry in io.EntryReader('csd'):
    if settings.test(entry) and not entry.has_disorder and len(entry.molecule.components) == 1:

Please let me know how you get on with this.

Best wishes


Dear Richard, 


That has fixed it. Thanks a lot!



That's good to know, Puck. Feel free to raise any other issues you have with the API.

Best wishes


You must be signed in to post in this forum.