Thanks Richard. That's very helpful.
It would be useful to have a "no elements heavier than" (if only syntactic sugar) since this is a common operation which is present in Conquest. The suggested work-arounds are not pretty!
Thanks for the "iterating over the CSD" idiom. That will provide a more elegant solution. It would be useful to include this in the documentation / script examples.
P.S. Another helpful warning would be if the max R-factor is <1. Properly speaking 5% should be entered as 0.05, where-as the API is clearly expecting the R-factor * 100. A search with 0.05 returned 1 result, where clearly the depositors had made a mistake! An R-factor of <1% would be physically ludicrous so there's no worry about generating bogus warnings.
I'm a newcomer to using the CSD API, so this may be a newbie question. On the other hand the code below is simple enough that it should work or tell the user they have done something stupid!
I'm searching the CSD specifically for structures containing disorder. The doesn't seem to be a one-step way to do this, so I'm having to subtract a list of structures that don't contain disorder from a list of all matching structures.
from ccdc.search import TextNumericSearch, Search
search_settings = Search.Settings()
search_settings.has_3d_coordinates = True
search_settings.max_r_factor = 10.0
search_settings.no_metals = True
search_settings.not_polymeric = True
search_settings.only_organic = True
search_settings.no_errors = True
search_settings.no_disorder = True
search = TextNumericSearch()
search.settings = search_settings
nodishits = [hit.identifier for hit in search.search()]
print("Found %i hits without disorder" % len(nodishits))
Problem 1: How to list all structures? I settled on TextNumericSearch with a year bogus range, which will essentially give me everything. Without the add_citation, the search silently returns no results. I wanted to specify "no higher atoms than Cl", but didn't see a way to do this in the API, so settled on no_metals instead. Oddly TextNumericSearch didn't seem to allow settings to be set in construction (which the other search methods did).
Problem 2: This search only returns 656 results, which makes no sense!