DbImporter documentation¶
Generic database importer class¶
This section describes the base class for the import of data from external databases.
-
aiida.tools.dbimporters.
DbImporterFactory
(pluginname)[source]¶ This function loads the correct DbImporter plugin class
-
class
aiida.tools.dbimporters.baseclasses.
CifEntry
(db_name=None, db_uri=None, id=None, version=None, extras={}, uri=None)[source]¶ Represents an entry from the structure database (COD, ICSD, ...).
-
cif
¶ Returns raw contents of a CIF file as string.
-
get_ase_structure
()[source]¶ Returns ASE representation of the CIF.
Note
To be removed, as it is duplicated in
aiida.orm.data.cif.CifData
.
-
get_cif_node
(store=False)[source]¶ Creates a CIF node, that can be used in AiiDA workflow.
Returns: aiida.orm.data.cif.CifData
object
-
-
class
aiida.tools.dbimporters.baseclasses.
DbEntry
(db_name=None, db_uri=None, id=None, version=None, extras={}, uri=None)[source]¶ Represents an entry from external database.
-
contents
¶ Returns raw contents of a file as string.
-
-
class
aiida.tools.dbimporters.baseclasses.
DbImporter
[source]¶ Base class for database importers.
-
get_supported_keywords
()[source]¶ Returns the list of all supported query keywords.
Returns: list of strings
-
query
(**kwargs)[source]¶ Method to query the database.
Parameters: - id – database-specific entry identificator
- element – element name from periodic table of elements
- number_of_elements – number of different elements
- mineral_name – name of mineral
- chemical_name – chemical name of substance
- formula – chemical formula
- volume – volume of the unit cell in cubic angstroms
- spacegroup – symmetry space group symbol in Hermann-Mauguin notation
- spacegroup_hall – symmetry space group symbol in Hall notation
- a – length of lattice vector in angstroms
- b – length of lattice vector in angstroms
- c – length of lattice vector in angstroms
- alpha – angles between lattice vectors in degrees
- beta – angles between lattice vectors in degrees
- gamma – angles between lattice vectors in degrees
- z – number of the formula units in the unit cell
- measurement_temp – temperature in kelvins at which the unit-cell parameters were measured
- measurement_pressure – pressure in kPa at which the unit-cell parameters were measured
- diffraction_temp – mean temperature in kelvins at which the intensities were measured
- diffraction_pressure – mean pressure in kPa at which the intensities were measured
- authors – authors of the publication
- journal – name of the journal
- title – title of the publication
- year – year of the publication
- journal_volume – journal volume of the publication
- journal_issue – journal issue of the publication
- first_page – first page of the publication
- last_page – last page of the publication
- doi – digital object identifyer (DOI), refering to the publication
Raises: NotImplementedError – if search using given keyword is not implemented.
-
-
class
aiida.tools.dbimporters.baseclasses.
DbSearchResults
(results)[source]¶ Base class for database results.
All classes, inheriting this one and overriding
at()
, are able to benefit from having functions__iter__
,__len__
and__getitem__
.-
DbSearchResults.
__iter__
()[source]¶ Instances of
aiida.tools.dbimporters.baseclasses.DbSearchResults
can be used as iterators.
-
DbSearchResults.
at
(position)[source]¶ Returns
position
-th result asaiida.tools.dbimporters.baseclasses.DbEntry
.Parameters: position – zero-based index of a result. Raises: IndexError – if position
is out of bounds.
-
DbSearchResults.
fetch_all
()[source]¶ Returns all query results as an array of
aiida.tools.dbimporters.baseclasses.DbEntry
.
-
DbSearchResults.
next
()[source]¶ Returns the next result of the query (instance of
aiida.tools.dbimporters.baseclasses.DbEntry
).Raises: StopIteration – when the end of result array is reached.
-
-
class
aiida.tools.dbimporters.baseclasses.
UpfEntry
(db_name=None, db_uri=None, id=None, version=None, extras={}, uri=None)[source]¶ Represents an entry from the pseudopotential database.
-
get_upf_node
(store=False)[source]¶ Creates an UPF node, that can be used in AiiDA workflow.
Returns: aiida.orm.data.upf.UpfData
object
-
Structural databases¶
COD database importer¶
-
class
aiida.tools.dbimporters.plugins.cod.
CodDbImporter
(**kwargs)[source]¶ Database importer for Crystallography Open Database.
-
get_supported_keywords
()[source]¶ Returns the list of all supported query keywords.
Returns: list of strings
-
query
(**kwargs)[source]¶ Performs a query on the COD database using
keyword = value
pairs, specified inkwargs
.Returns: an instance of aiida.tools.dbimporters.plugins.cod.CodSearchResults
.
-
ICSD database importer¶
-
exception
aiida.tools.dbimporters.plugins.icsd.
CifFileErrorExp
[source]¶ Raised when the author loop is missing in a CIF file.
-
class
aiida.tools.dbimporters.plugins.icsd.
IcsdDbImporter
(**kwargs)[source]¶ Importer for the Inorganic Crystal Structure Database, short ICSD, provided by FIZ Karlsruhe. It allows to run queries and analyse all the results. See the DbImporter documentation and tutorial page for more information.
Parameters: - server –
Server URL, the web page of the database. It is required in order to have access to the full database. I t should contain both the protocol and the domain name and end with a slash, as in:
server = "http://ICSDSERVER.com/"
- urladd – part of URL which is added between query and and the server URL
(default:
index.php?
). only needed for web page query - querydb – boolean, decides whether the mysql database is queried (default: True). If False, the query results are obtained through the web page query, which is restricted to a maximum of 1000 results per query.
- dl_db – icsd comes with a full (default:
icsd
) and a demo database (icsdd
). This parameter allows the user to switch to the demo database for testing purposes, if the access rights to the full database are not granted. - host –
MySQL database host. If the MySQL database is hosted on a different machine, use “127.0.0.1” as host, and open a SSH tunnel to the host using:
ssh -L 3306:localhost:3306 username@hostname.com
or (if e.g. you get an URLError with Errno 111 (Connection refused) upon querying):
ssh -L 3306:localhost:3306 -L 8010:localhost:80 username@hostname.com
- user – mysql database username (default: dba)
- passwd – mysql database password (default: sql)
- db – name of the database (default: icsd)
- port – Port to access the mysql database (default: 3306)
- server –
-
class
aiida.tools.dbimporters.plugins.icsd.
IcsdEntry
(uri, **kwargs)[source]¶ Represent an entry from Icsd.
Note: - Before July 2nd 2015, source[‘id’] contained icsd.IDNUM (internal icsd id number) and source[‘extras’][‘cif_nr’] the cif number (icsd.COLL_CODE).
- After July 2nd 2015, source[‘id’] has been replaced by the cif number and source[‘extras’][‘idnum’] is icsd.IDNUM .
-
cif
¶ Returns: cif file of Icsd entry.
-
get_cif_node
()[source]¶ Create a CIF node, that can be used in AiiDA workflow.
Returns: aiida.orm.data.cif.CifData
object
-
class
aiida.tools.dbimporters.plugins.icsd.
IcsdSearchResults
(query, db_parameters)[source]¶ Result manager for the query performed on ICSD.
Parameters: - query – mysql query or webpage query
- db_parameters – database parameter setup during the initialisation of the IcsdDbImporter.
-
exception
aiida.tools.dbimporters.plugins.icsd.
NoResultsWebExp
[source]¶ Raised when a webpage query returns no results.
-
aiida.tools.dbimporters.plugins.icsd.
correct_cif
(cif)[source]¶ Correct the format of the CIF files. At the moment, it only fixes missing quotes in the authors field (
ase.read.io
only works if the author names are quoted, if not an AssertionError is raised).Parameters: cif – A string containing the content of the CIF file. Returns: a string containing the corrected CIF file.
MPOD database importer¶
-
class
aiida.tools.dbimporters.plugins.mpod.
MpodDbImporter
(**kwargs)[source]¶ Database importer for Material Properties Open Database.
-
get_supported_keywords
()[source]¶ Returns the list of all supported query keywords.
Returns: list of strings
-
query
(**kwargs)[source]¶ Performs a query on the MPOD database using
keyword = value
pairs, specified inkwargs
.Returns: an instance of aiida.tools.dbimporters.plugins.mpod.MpodSearchResults
.
-
OQMD database importer¶
-
class
aiida.tools.dbimporters.plugins.oqmd.
OqmdDbImporter
(**kwargs)[source]¶ Database importer for Open Quantum Materials Database.
-
get_supported_keywords
()[source]¶ Returns the list of all supported query keywords.
Returns: list of strings
-
query
(**kwargs)[source]¶ Performs a query on the OQMD database using
keyword = value
pairs, specified inkwargs
.Returns: an instance of aiida.tools.dbimporters.plugins.oqmd.OqmdSearchResults
.
-
PCOD database importer¶
-
class
aiida.tools.dbimporters.plugins.pcod.
PcodDbImporter
(**kwargs)[source]¶ Database importer for Predicted Crystallography Open Database.
-
query
(**kwargs)[source]¶ Performs a query on the PCOD database using
keyword = value
pairs, specified inkwargs
.Returns: an instance of aiida.tools.dbimporters.plugins.pcod.PcodSearchResults
.
-
TCOD database importer¶
-
class
aiida.tools.dbimporters.plugins.tcod.
TcodDbImporter
(**kwargs)[source]¶ Database importer for Theoretical Crystallography Open Database.
-
query
(**kwargs)[source]¶ Performs a query on the TCOD database using
keyword = value
pairs, specified inkwargs
.Returns: an instance of aiida.tools.dbimporters.plugins.tcod.TcodSearchResults
.
-
Other databases¶
NNINC database importer¶
-
class
aiida.tools.dbimporters.plugins.nninc.
NnincDbImporter
(**kwargs)[source]¶ Database importer for NNIN/C Pseudopotential Virtual Vault.
-
get_supported_keywords
()[source]¶ Returns the list of all supported query keywords.
Returns: list of strings
-
query
(**kwargs)[source]¶ Performs a query on the NNIN/C Pseudopotential Virtual Vault using
keyword = value
pairs, specified inkwargs
.Returns: an instance of aiida.tools.dbimporters.plugins.nninc.NnincSearchResults
.
-