COD database importer¶
COD database importer is used to import crystal structures from the Crystallography Open Database (COD) to AiiDA.
An instance of
is created as follows:
from aiida.tools.dbimporters.plugins.cod import CodDbImporter importer = CodDbImporter()
No additional parameters are required for standard queries on the main COD server.
How to do a query¶
A search is initiated by supplying query statements using
results = importer.query(chemical_name="caffeine")
List of possible keywords can be listed using:
Values for the most of the keywords can be list. In that case the query will return entries, that match any of the values (binary OR) from the list. Moreover, in the case of multiple keywords, entries, that match all the conditions imposed by the keywords, will be returned (binary AND).
results = importer.query(chemical_name=["caffeine","serotonin"], year=[2000,2001])
is equivalent to the following SQL statement:
results = SELECT * FROM data WHERE ( chemical_name == "caffeine" OR chemical_name == "serotonin" ) AND ( year = 2000 OR year = 2001 )
print len(results) for entry in results: print entry