aiida.tools.dbimporters.plugins package#

Module for plugins to import data from external databases into an AiiDA database.

Submodules#

“Implementation of DbImporter for the COD database.

class aiida.tools.dbimporters.plugins.cod.CodDbImporter(**kwargs)[source]#

Bases: DbImporter

Database importer for Crystallography Open Database.

__annotations__ = {}#
__init__(**kwargs)[source]#
__module__ = 'aiida.tools.dbimporters.plugins.cod'#
_angle_clause(key, alias, values)[source]#

Returns SQL query predicate for querying lattice angles.

_composition_clause(_, alias, values)[source]#

Returns SQL query predicate for querying elements in formula fields.

_connect_db()[source]#

Connects to the MySQL database for performing searches.

_disconnect_db()[source]#

Closes connection to the MySQL database.

_double_clause(key, alias, values, precision)[source]#

Returns SQL query predicate for querying double-valued fields.

_formula_clause(key, alias, values)[source]#

Returns SQL query predicate for querying formula fields.

_int_clause(key, alias, values)[source]#

Returns SQL query predicate for querying integer fields.

_keywords = {'a': ['a', <function CodDbImporter._length_clause>], 'alpha': ['alpha', <function CodDbImporter._angle_clause>], 'authors': ['authors', <function CodDbImporter._str_fuzzy_clause>], 'b': ['b', <function CodDbImporter._length_clause>], 'beta': ['beta', <function CodDbImporter._angle_clause>], 'c': ['c', <function CodDbImporter._length_clause>], 'chemical_name': ['chemname', <function CodDbImporter._str_fuzzy_clause>], 'determination_method': ['method', <function CodDbImporter._str_exact_or_none_clause>], 'diffraction_pressure': ['diffrpressure', <function CodDbImporter._pressure_clause>], 'diffraction_temp': ['diffrtemp', <function CodDbImporter._temperature_clause>], 'doi': ['doi', <function CodDbImporter._str_exact_clause>], 'element': ['element', <function CodDbImporter._composition_clause>], 'first_page': ['firstpage', <function CodDbImporter._str_exact_clause>], 'formula': ['formula', <function CodDbImporter._formula_clause>], 'gamma': ['gamma', <function CodDbImporter._angle_clause>], 'id': ['file', <function CodDbImporter._int_clause>], 'journal': ['journal', <function CodDbImporter._str_fuzzy_clause>], 'journal_issue': ['issue', <function CodDbImporter._str_exact_clause>], 'journal_volume': ['volume', <function CodDbImporter._int_clause>], 'last_page': ['lastpage', <function CodDbImporter._str_exact_clause>], 'measurement_pressure': ['cellpressure', <function CodDbImporter._pressure_clause>], 'measurement_temp': ['celltemp', <function CodDbImporter._temperature_clause>], 'mineral_name': ['mineral', <function CodDbImporter._str_fuzzy_clause>], 'number_of_elements': ['nel', <function CodDbImporter._int_clause>], 'spacegroup': ['sg', <function CodDbImporter._str_exact_clause>], 'spacegroup_hall': ['sgHall', <function CodDbImporter._str_exact_clause>], 'title': ['title', <function CodDbImporter._str_fuzzy_clause>], 'volume': ['vol', <function CodDbImporter._volume_clause>], 'year': ['year', <function CodDbImporter._int_clause>], 'z': ['Z', <function CodDbImporter._int_clause>]}#
_length_clause(key, alias, values)[source]#

Returns SQL query predicate for querying lattice vector lengths.

_pressure_clause(key, alias, values)[source]#

Returns SQL query predicate for querying pressure.

_str_exact_clause(key, alias, values)[source]#

Returns SQL query predicate for querying string fields.

_str_exact_or_none_clause(key, alias, values)[source]#

Returns SQL query predicate for querying string fields, allowing to use Python’s “None” in addition.

_str_fuzzy_clause(key, alias, values)[source]#

Returns SQL query predicate for fuzzy querying of string fields.

_temperature_clause(key, alias, values)[source]#

Returns SQL query predicate for querying temperature.

_volume_clause(key, alias, values)[source]#

Returns SQL query predicate for querying unit cell volume.

angle_precision = 0.001#
get_supported_keywords()[source]#

Returns the list of all supported query keywords.

Returns:

list of strings

length_precision = 0.001#
pressure_precision = 1#
query(**kwargs)[source]#

Performs a query on the COD database using keyword = value pairs, specified in kwargs.

Returns:

an instance of aiida.tools.dbimporters.plugins.cod.CodSearchResults.

query_sql(**kwargs)[source]#

Forms a SQL query for querying the COD database using keyword = value pairs, specified in kwargs.

Returns:

string containing a SQL statement.

setup_db(**kwargs)[source]#

Changes the database connection details.

temperature_precision = 0.001#
volume_precision = 0.001#
class aiida.tools.dbimporters.plugins.cod.CodEntry(uri, db_name='Crystallography Open Database', db_uri='http://www.crystallography.net/cod', **kwargs)[source]#

Bases: CifEntry

Represents an entry from COD.

__annotations__ = {}#
__init__(uri, db_name='Crystallography Open Database', db_uri='http://www.crystallography.net/cod', **kwargs)[source]#

Creates an instance of aiida.tools.dbimporters.plugins.cod.CodEntry, related to the supplied URI.

__module__ = 'aiida.tools.dbimporters.plugins.cod'#
_license: str | None = 'CC0'#
class aiida.tools.dbimporters.plugins.cod.CodSearchResults(results)[source]#

Bases: DbSearchResults

Results of the search, performed on COD.

__annotations__ = {}#
__init__(results)[source]#
__len__()[source]#
__module__ = 'aiida.tools.dbimporters.plugins.cod'#
_base_url = 'http://www.crystallography.net/cod/'#
_get_source_dict(result_dict)[source]#

Returns a dictionary, which is passed as kwargs to the created DbEntry instance, describing the source of the entry.

Parameters:

result_dict – dictionary, describing an entry in the results.

_get_url(result_dict)[source]#

Returns an URL of an entry CIF file.

Parameters:

result_dict – dictionary, describing an entry in the results.

Implementation of DbImporter for the ICSD database.

Note: The implementation in this file is not compatible with the recent versions of ICSD, which are built with Apache Lucene and Tomcat. Older ICSD versions are supported, which included a MySQL database and a php-based web interface. The last confirmed compatible version was released in 2020.

exception aiida.tools.dbimporters.plugins.icsd.CifFileErrorExp[source]#

Bases: IcsdImporterExp

Raised when the author loop is missing in a CIF file.

__module__ = 'aiida.tools.dbimporters.plugins.icsd'#
class aiida.tools.dbimporters.plugins.icsd.IcsdDbImporter(**kwargs)[source]#

Bases: DbImporter

Importer for the Inorganic Crystal Structure Database, short ICSD, provided by FIZ Karlsruhe. It allows to run queries and analyse all the results.

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)

__annotations__ = {}#
__init__(**kwargs)[source]#

Construct a new instance.

__module__ = 'aiida.tools.dbimporters.plugins.icsd'#
_angle_clause(key, alias, values)[source]#

Return SQL query predicate for querying lattice angles.

_composition_clause(key, alias, values)[source]#

Return SQL query predicate for querying elements in formula fields.

_crystal_system_clause(key, alias, values)[source]#

Return SQL query predicate for querying crystal_system.

_density_clause(key, alias, values)[source]#

Return SQL query predicate for querying density.

_double_clause(key, alias, values, precision)[source]#

Return SQL query predicate for querying double-valued fields.

_formula_clause(key, alias, values)[source]#

Return SQL query predicate for querying formula fields.

_int_clause(key, alias, values)[source]#

Return SQL query predicate for querying integer fields :param key: Database keyword :param alias: Query parameter name :param values: Corresponding values from query :return: SQL query predicate

_length_clause(key, alias, values)[source]#

Return SQL query predicate for querying lattice vector lengths.

static _parse_all(key, values)[source]#

Convert numbers, strings, lists into strings. :param key: query parameter :param values: corresponding values :return retval: string

static _parse_mineral(key, values)[source]#

Convert mineral_name and chemical_name into right format. :param key: query parameter :param values: corresponding values :return retval: string

static _parse_number(key, values)[source]#

Convert int into string. :param key: query parameter :param values: corresponding values :return retval: string

static _parse_system(key, values)[source]#

Return crystal system in the right format. :param key: query parameter :param values: corresponding values :return retval: string

static _parse_volume(key, values)[source]#

Convert volume, cell parameter and angle queries into right format. :param key: query parameter :param values: corresponding values :return retval: string

_pressure_clause(key, alias, values)[source]#

Return SQL query predicate for querying pressure.

_query_sql_db(**kwargs)[source]#

Perform a query on Icsd mysql database using keyword = value pairs, specified in kwargs. Returns an instance of IcsdSearchResults. :param kwargs: A list of keyword = [values] pairs :return: IcsdSearchResults

_queryweb(**kwargs)[source]#

Perform a query on the Icsd web database using keyword = value pairs, specified in kwargs. Returns an instance of IcsdSearchResults. :note: Web search has a maximum result number fixed at 1000. :param kwargs: A list of keyword = [values] pairs :return: IcsdSearchResults

_str_exact_clause(key, alias, values)[source]#

Return SQL query predicate for querying string fields.

_str_fuzzy_clause(key, alias, values)[source]#

Return SQL query predicate for fuzzy querying of string fields.

_temperature_clause(key, alias, values)[source]#

Return SQL query predicate for querying temperature.

_volume_clause(key, alias, values)[source]#

Return SQL query predicate for querying unit cell volume.

angle_precision = 0.001#
density_precision = 0.001#
get_supported_keywords()[source]#
Returns:

List of all supported query keywords.

keywords = {'a': ('volume', <staticmethod(<function IcsdDbImporter._parse_volume>)>), 'alpha': ('volume', <staticmethod(<function IcsdDbImporter._parse_volume>)>), 'authors': ('authors', <staticmethod(<function IcsdDbImporter._parse_all>)>), 'b': ('volume', <staticmethod(<function IcsdDbImporter._parse_volume>)>), 'beta': ('volume', <staticmethod(<function IcsdDbImporter._parse_volume>)>), 'c': ('volume', <staticmethod(<function IcsdDbImporter._parse_volume>)>), 'chemical_name': ('mineral', <staticmethod(<function IcsdDbImporter._parse_mineral>)>), 'crystal_system': ('system', <staticmethod(<function IcsdDbImporter._parse_system>)>), 'element': ('elements', <staticmethod(<function IcsdDbImporter._parse_all>)>), 'formula': ('formula', <staticmethod(<function IcsdDbImporter._parse_all>)>), 'gamma': ('volume', <staticmethod(<function IcsdDbImporter._parse_volume>)>), 'id': ('authors', <staticmethod(<function IcsdDbImporter._parse_all>)>), 'journal': ('journal', <staticmethod(<function IcsdDbImporter._parse_all>)>), 'mineral_name': ('mineral', <staticmethod(<function IcsdDbImporter._parse_mineral>)>), 'number_of_elements': ('elementc', <staticmethod(<function IcsdDbImporter._parse_all>)>), 'spacegroup': ('spaceg', <staticmethod(<function IcsdDbImporter._parse_all>)>), 'title': ('title', <staticmethod(<function IcsdDbImporter._parse_all>)>), 'volume': ('volume', <staticmethod(<function IcsdDbImporter._parse_volume>)>), 'year': ('year', <staticmethod(<function IcsdDbImporter._parse_all>)>)}#
keywords_db = {'a': ['A_LEN', <function IcsdDbImporter._length_clause>], 'alpha': ['ALPHA', <function IcsdDbImporter._angle_clause>], 'authors': ['AUTHORS_TEXT', <function IcsdDbImporter._str_fuzzy_clause>], 'b': ['B_LEN', <function IcsdDbImporter._length_clause>], 'beta': ['BETA', <function IcsdDbImporter._angle_clause>], 'c': ['C_LEN', <function IcsdDbImporter._length_clause>], 'chemical_name': ['CHEM_NAME', <function IcsdDbImporter._str_fuzzy_clause>], 'crystal_system': ['CRYST_SYS_CODE', <function IcsdDbImporter._crystal_system_clause>], 'density': ['DENSITY_CALC', <function IcsdDbImporter._density_clause>], 'element': ['SUM_FORM;', <function IcsdDbImporter._composition_clause>], 'formula': ['SUM_FORM', <function IcsdDbImporter._formula_clause>], 'gamma': ['GAMMA', <function IcsdDbImporter._angle_clause>], 'id': ['COLL_CODE', <function IcsdDbImporter._int_clause>], 'journal': ['journal', <function IcsdDbImporter._str_fuzzy_clause>], 'measurement_temp': ['TEMPERATURE', <function IcsdDbImporter._temperature_clause>], 'molar_mass': ['MOL_MASS', <function IcsdDbImporter._density_clause>], 'number_of_elements': ['EL_COUNT', <function IcsdDbImporter._int_clause>], 'pdf_num': ['PDF_NUM', <function IcsdDbImporter._str_exact_clause>], 'spacegroup': ['SGR', <function IcsdDbImporter._str_exact_clause>], 'title': ['AU_TITLE', <function IcsdDbImporter._str_fuzzy_clause>], 'volume': ['C_VOL', <function IcsdDbImporter._volume_clause>], 'wyckoff': ['WYCK', <function IcsdDbImporter._str_exact_clause>], 'year': ['MPY', <function IcsdDbImporter._int_clause>], 'z': ['Z', <function IcsdDbImporter._int_clause>]}#
length_precision = 0.001#
pressure_precision = 1#
query(**kwargs)[source]#

Depending on the db_parameters, the mysql database or the web page are queried. Valid parameters are found using IcsdDbImporter.get_supported_keywords().

Parameters:

kwargs – A list of ‘’keyword = [values]’’ pairs.

setup_db(**kwargs)[source]#

Change the database connection details. At least the host server has to be defined.

Parameters:

kwargs – db_parameters for the mysql database connection (host, user, passwd, db, port)

temperature_precision = 0.001#
volume_precision = 0.001#
class aiida.tools.dbimporters.plugins.icsd.IcsdEntry(uri, **kwargs)[source]#

Bases: CifEntry

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 .

__annotations__ = {}#
__init__(uri, **kwargs)[source]#

Create an instance of IcsdEntry, related to the supplied URI.

__module__ = 'aiida.tools.dbimporters.plugins.icsd'#
_license: str | None = 'ICSD'#
property contents#

Returns raw contents of a file as string. This overrides the DbEntry implementation because the ICSD php backend returns the contents of the CIF in ISO-8859-1 encoding. However, the PyCifRW library (and most other sensible applications), expects UTF-8. Therefore, we decode the original CIF data to unicode and encode it in the UTF-8 format

get_ase_structure()[source]#
Returns:

ASE structure corresponding to the cif file.

exception aiida.tools.dbimporters.plugins.icsd.IcsdImporterExp[source]#

Bases: Exception

Base class for ICSD exceptions.

__annotations__ = {}#
__module__ = 'aiida.tools.dbimporters.plugins.icsd'#
__weakref__#

list of weak references to the object (if defined)

class aiida.tools.dbimporters.plugins.icsd.IcsdSearchResults(query, db_parameters)[source]#

Bases: DbSearchResults

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.

__annotations__ = {}#
__init__(query, db_parameters)[source]#
__module__ = 'aiida.tools.dbimporters.plugins.icsd'#
_connect_db()[source]#

Connect to the MySQL database for performing searches.

_disconnect_db()[source]#

Close connection to the MySQL database.

at(position)[source]#

Return position-th result as IcsdEntry.

cif_url = '/index.php?format=cif&action=Export&id%5B%5D={}'#
db_name = 'Icsd'#
next()[source]#

Return next result as IcsdEntry.

query_db_version()[source]#

Query the version of the icsd database (last row of RELEASE_TAGS).

query_page()[source]#

Query the mysql or web page database, depending on the db_parameters. Store the number_of_results, cif file number and the corresponding icsd number.

Additionally, for the mysql case, determine if the origin of the structure is theoretical. This information is stored in the icsd_remarks mysql table. If the crystal has either “THE” or “ZTHE” tags, then it’s classified as theoretical.

Note:

Icsd uses its own number system, different from the CIF file numbers.

property results#

Return the list of results

exception aiida.tools.dbimporters.plugins.icsd.NoResultsWebExp[source]#

Bases: IcsdImporterExp

Raised when a webpage query returns no results.

__annotations__ = {}#
__module__ = 'aiida.tools.dbimporters.plugins.icsd'#
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.

“Implementation of DbImporter for the Materials Project database.

class aiida.tools.dbimporters.plugins.materialsproject.MaterialsProjectCifEntry(url, **kwargs)[source]#

Bases: CifEntry

A Materials Project entry class which extends the DbEntry class with a CifEntry class.

__annotations__ = {}#
__init__(url, **kwargs)[source]#

The DbSearchResults base class instantiates a new DbEntry by explicitly passing the url of the entry as an argument. In this case it is the same as the ‘uri’ value that is already contained in the source dictionary so we just copy it

__module__ = 'aiida.tools.dbimporters.plugins.materialsproject'#
_license: str | None = 'Materials Project'#
class aiida.tools.dbimporters.plugins.materialsproject.MaterialsProjectImporter(**kwargs)[source]#

Bases: DbImporter

Database importer for the Materials Project.

__annotations__ = {}#
__init__(**kwargs)[source]#

Instantiate the MaterialsProjectImporter by setting up the Materials API (MAPI) connection details.

__module__ = 'aiida.tools.dbimporters.plugins.materialsproject'#
_find(query, properties)[source]#

Query the database with a given dictionary of query parameters

Parameters:

query – a dictionary with the query parameters

_properties = 'structure'#
_supported_keywords = None#
_verify_api_key()[source]#

Verify the supplied API key by issuing a request to Materials Project.

property api_key#

Return the API key configured for the importer

get_supported_keywords()[source]#

Returns the list of all supported query keywords

Returns:

list of strings

property properties#

Return the properties that will be queried

query(**kwargs)[source]#

Query the database with a given dictionary of query parameters for a given properties

Parameters:
  • query – a dictionary with the query parameters

  • properties – the properties to query

setup_db(**kwargs)[source]#

Setup the required parameters to the REST API

class aiida.tools.dbimporters.plugins.materialsproject.MaterialsProjectSearchResults(results, return_class)[source]#

Bases: DbSearchResults

A collection of MaterialsProjectEntry query result entries.

Parameters:

results – query result entry dictionary

Return_class:

the class associated with each

__annotations__ = {}#
__init__(results, return_class)[source]#
__module__ = 'aiida.tools.dbimporters.plugins.materialsproject'#
_db_name = 'Materials Project'#
_db_uri = 'https://materialsproject.org'#
_get_source_dict(result_dict)[source]#

Return the source information dictionary of an Materials Project query result entry

Parameters:

result_dict – query result entry dictionary

_get_url(result_dict)[source]#

Return the permanent URI of the result entry

Parameters:

result_dict – query result entry dictionary

_material_base_url = 'https://materialsproject.org/materials/'#
_version = '2024-04-20 11:26:50.524076'#

“Implementation of DbImporter for the MPDS database.

class aiida.tools.dbimporters.plugins.mpds.ApiFormat(value)[source]#

Bases: Enum

An enumeration.

CIF = 'cif'#
JSON = 'json'#
__module__ = 'aiida.tools.dbimporters.plugins.mpds'#
class aiida.tools.dbimporters.plugins.mpds.MpdsCifEntry(url, **kwargs)[source]#

Bases: CifEntry, MpdsEntry

An extension of the MpdsEntry class with the CifEntry class, which will treat the contents property through the URI as a cif file

__annotations__ = {}#
__init__(url, **kwargs)[source]#

The DbSearchResults base class instantiates a new DbEntry by explicitly passing the url of the entry as an argument. In this case it is the same as the ‘uri’ value that is already contained in the source dictionary so we just copy it

__module__ = 'aiida.tools.dbimporters.plugins.mpds'#
class aiida.tools.dbimporters.plugins.mpds.MpdsDbImporter(url=None, api_key=None)[source]#

Bases: DbImporter

Database importer for the Materials Platform for Data Science (MPDS)

__annotations__ = {}#
__init__(url=None, api_key=None)[source]#

Instantiate the MpdsDbImporter by setting up the API connection details

Parameters:
  • url – the full base url of the REST API endpoint

  • api_key – the API key to be used for HTTP requests

__module__ = 'aiida.tools.dbimporters.plugins.mpds'#
_api_key = None#
_collection = 'structures'#
_pagesize = 1000#
_supported_keywords = ['props', 'elements', 'classes', 'lattices', 'formulae', 'sgs', 'protos', 'aeatoms', 'aetype', 'authors', 'codens', 'years']#
_url = 'https://api.mpds.io/v0/download/facet'#
property api_key#

Return the API key configured for the importer

property collection#

Return the collection that will be queried

find(query, fmt=ApiFormat.JSON)[source]#

Query the database with a given dictionary of query parameters

Parameters:

query – a dictionary with the query parameters

get(fmt=ApiFormat.JSON, **kwargs)[source]#

Perform a GET request to the REST API using the kwargs as request parameters The url and API key will be used that were set upon construction

Parameters:
  • fmt – the format of the response, ‘cif’ or json’ (default)

  • kwargs – parameters for the GET request

static get_id_from_cif(cif)[source]#

Extract the entry id from the string formatted cif response of the MPDS API

Parameters:

cif – string representation of the cif file

Returns:

entry id of the cif file or None if could not be found

static get_response_content(response, fmt=ApiFormat.JSON)[source]#

Analyze the response of an HTTP GET request, verify that the response code is OK and return the json loaded response text

Parameters:

response – HTTP response

Raises:
property get_supported_keywords#

Returns the list of all supported query keywords

Returns:

list of strings

property pagesize#

Return the pagesize set for the importer

query(query, collection=None)[source]#

Query the database with a given dictionary of query parameters for a given collection

Parameters:
  • query – a dictionary with the query parameters

  • collection – the collection to query

setup_db(url=None, api_key=None, collection=None)[source]#

Setup the required parameters for HTTP requests to the REST API

Parameters:
  • url – the full base url of the REST API endpoint

  • api_key – the API key to be used for HTTP requests

property structures#

Access the structures collection in the MPDS

property url#

Return the base url configured for the importer

class aiida.tools.dbimporters.plugins.mpds.MpdsEntry(_, **kwargs)[source]#

Bases: DbEntry

Represents an MPDS database entry

__annotations__ = {}#
__init__(_, **kwargs)[source]#

Set the class license from the source dictionary

__module__ = 'aiida.tools.dbimporters.plugins.mpds'#
class aiida.tools.dbimporters.plugins.mpds.MpdsSearchResults(results, return_class=None)[source]#

Bases: DbSearchResults

Collection of MpdsEntry query result entries.

__annotations__ = {}#
__init__(results, return_class=None)[source]#
__module__ = 'aiida.tools.dbimporters.plugins.mpds'#
_db_name = 'Materials Platform for Data Science'#
_db_uri = 'https://mpds.io/'#
_get_source_dict(result_dict)[source]#

Return the source information dictionary of an MPDS query result entry

Parameters:

result_dict – query result entry dictionary

_get_url(result_dict)[source]#

Return the permanent URI of the result entry

Parameters:

result_dict – query result entry dictionary

_return_class#

alias of MpdsEntry

class aiida.tools.dbimporters.plugins.mpds.StructuresCollection(engine)[source]#

Bases: object

Collection of structures.

__dict__ = mappingproxy({'__module__': 'aiida.tools.dbimporters.plugins.mpds', '__doc__': 'Collection of structures.', '__init__': <function StructuresCollection.__init__>, 'engine': <property object>, 'find': <function StructuresCollection.find>, '__dict__': <attribute '__dict__' of 'StructuresCollection' objects>, '__weakref__': <attribute '__weakref__' of 'StructuresCollection' objects>, '__annotations__': {}})#
__init__(engine)[source]#
__module__ = 'aiida.tools.dbimporters.plugins.mpds'#
__weakref__#

list of weak references to the object (if defined)

property engine#

Return the query engine

find(query, fmt=ApiFormat.JSON)[source]#

Query the structures collection with a given dictionary of query parameters

Parameters:

query – a dictionary with the query parameters

“Implementation of DbImporter for the MPOD database.

class aiida.tools.dbimporters.plugins.mpod.MpodDbImporter(**kwargs)[source]#

Bases: DbImporter

Database importer for Material Properties Open Database.

__annotations__ = {}#
__init__(**kwargs)[source]#
__module__ = 'aiida.tools.dbimporters.plugins.mpod'#
_keywords = {'authors': ['publ_author', <function MpodDbImporter._str_clause>], 'cod_id': ['cod_code', <function MpodDbImporter._str_clause>], 'element': ['element', None], 'formula': ['formula', <function MpodDbImporter._str_clause>], 'phase_name': ['phase_name', <function MpodDbImporter._str_clause>]}#
_str_clause(key, alias, values)[source]#

Returns part of HTTP GET query for querying string fields.

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 in kwargs.

Returns:

an instance of aiida.tools.dbimporters.plugins.mpod.MpodSearchResults.

query_get(**kwargs)[source]#

Forms a HTTP GET query for querying the MPOD database. May return more than one query in case an intersection is needed.

Returns:

a list containing strings for HTTP GET statement.

setup_db(query_url=None, **kwargs)[source]#

Changes the database connection details.

class aiida.tools.dbimporters.plugins.mpod.MpodEntry(uri, **kwargs)[source]#

Bases: CifEntry

Represents an entry from MPOD.

__annotations__ = {}#
__init__(uri, **kwargs)[source]#

Creates an instance of aiida.tools.dbimporters.plugins.mpod.MpodEntry, related to the supplied URI.

__module__ = 'aiida.tools.dbimporters.plugins.mpod'#
class aiida.tools.dbimporters.plugins.mpod.MpodSearchResults(results)[source]#

Bases: DbSearchResults

Results of the search, performed on MPOD.

__annotations__ = {}#
__init__(results)[source]#
__len__()[source]#
__module__ = 'aiida.tools.dbimporters.plugins.mpod'#
_base_url = 'http://mpod.cimav.edu.mx/datafiles/'#
_get_source_dict(result_dict)[source]#

Returns a dictionary, which is passed as kwargs to the created DbEntry instance, describing the source of the entry.

Parameters:

result_dict – dictionary, describing an entry in the results.

_get_url(result_dict)[source]#

Returns an URL of an entry CIF file.

Parameters:

result_dict – dictionary, describing an entry in the results.

“Implementation of DbImporter for the NNIN/C database.

class aiida.tools.dbimporters.plugins.nninc.NnincDbImporter(**kwargs)[source]#

Bases: DbImporter

Database importer for NNIN/C Pseudopotential Virtual Vault.

__annotations__ = {}#
__init__(**kwargs)[source]#
__module__ = 'aiida.tools.dbimporters.plugins.nninc'#
_keywords = {'element': ['element', None], 'pseudopotential_class': ['frmspclass', <function NnincDbImporter._str_clause>], 'xc_approximation': ['frmxcprox', <function NnincDbImporter._str_clause>], 'xc_type': ['frmxctype', <function NnincDbImporter._str_clause>]}#
_str_clause(key, alias, values)[source]#

Returns part of HTTP GET query for querying string fields.

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 in kwargs.

Returns:

an instance of aiida.tools.dbimporters.plugins.nninc.NnincSearchResults.

query_get(**kwargs)[source]#

Forms a HTTP GET query for querying the NNIN/C Pseudopotential Virtual Vault.

Returns:

a string with HTTP GET statement.

setup_db(query_url=None, **kwargs)[source]#

Changes the database connection details.

class aiida.tools.dbimporters.plugins.nninc.NnincEntry(uri, **kwargs)[source]#

Bases: UpfEntry

Represents an entry from NNIN/C Pseudopotential Virtual Vault.

__annotations__ = {}#
__init__(uri, **kwargs)[source]#

Creates an instance of aiida.tools.dbimporters.plugins.nninc.NnincEntry, related to the supplied URI.

__module__ = 'aiida.tools.dbimporters.plugins.nninc'#
class aiida.tools.dbimporters.plugins.nninc.NnincSearchResults(results)[source]#

Bases: DbSearchResults

Results of the search, performed on NNIN/C Pseudopotential Virtual Vault.

__annotations__ = {}#
__init__(results)[source]#
__len__()[source]#
__module__ = 'aiida.tools.dbimporters.plugins.nninc'#
_base_url = 'http://nninc.cnf.cornell.edu/psp_files/'#
_get_source_dict(result_dict)[source]#

Returns a dictionary, which is passed as kwargs to the created DbEntry instance, describing the source of the entry.

Parameters:

result_dict – dictionary, describing an entry in the results.

_get_url(result_dict)[source]#

Returns an URL of an entry CIF file.

Parameters:

result_dict – dictionary, describing an entry in the results.

“Implementation of DbImporter for the OQMD database.

class aiida.tools.dbimporters.plugins.oqmd.OqmdDbImporter(**kwargs)[source]#

Bases: DbImporter

Database importer for Open Quantum Materials Database.

__annotations__ = {}#
__init__(**kwargs)[source]#
__module__ = 'aiida.tools.dbimporters.plugins.oqmd'#
_keywords = {'element': ['element', None]}#
_str_clause(key, alias, values)[source]#

Returns part of HTTP GET query for querying string fields.

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 in kwargs.

Returns:

an instance of aiida.tools.dbimporters.plugins.oqmd.OqmdSearchResults.

query_get(**kwargs)[source]#

Forms a HTTP GET query for querying the OQMD database.

Returns:

a strings for HTTP GET statement.

setup_db(query_url=None, **kwargs)[source]#

Changes the database connection details.

class aiida.tools.dbimporters.plugins.oqmd.OqmdEntry(uri, **kwargs)[source]#

Bases: CifEntry

Represents an entry from OQMD.

__annotations__ = {}#
__init__(uri, **kwargs)[source]#

Creates an instance of aiida.tools.dbimporters.plugins.oqmd.OqmdEntry, related to the supplied URI.

__module__ = 'aiida.tools.dbimporters.plugins.oqmd'#
class aiida.tools.dbimporters.plugins.oqmd.OqmdSearchResults(results)[source]#

Bases: DbSearchResults

Results of the search, performed on OQMD.

__annotations__ = {}#
__init__(results)[source]#
__len__()[source]#
__module__ = 'aiida.tools.dbimporters.plugins.oqmd'#
_base_url = 'http://oqmd.org/materials/export/conventional/cif/'#
_get_source_dict(result_dict)[source]#

Returns a dictionary, which is passed as kwargs to the created DbEntry instance, describing the source of the entry.

Parameters:

result_dict – dictionary, describing an entry in the results.

_get_url(result_dict)[source]#

Returns an URL of an entry CIF file.

Parameters:

result_dict – dictionary, describing an entry in the results.

“Implementation of DbImporter for the PCOD database.

class aiida.tools.dbimporters.plugins.pcod.PcodDbImporter(**kwargs)[source]#

Bases: CodDbImporter

Database importer for Predicted Crystallography Open Database.

__annotations__ = {}#
__init__(**kwargs)[source]#
__module__ = 'aiida.tools.dbimporters.plugins.pcod'#
_keywords = {'a': ['a', <function CodDbImporter._length_clause>], 'alpha': ['alpha', <function CodDbImporter._angle_clause>], 'b': ['b', <function CodDbImporter._length_clause>], 'beta': ['beta', <function CodDbImporter._angle_clause>], 'c': ['c', <function CodDbImporter._length_clause>], 'element': ['element', <function CodDbImporter._composition_clause>], 'formula': ['formula', <function CodDbImporter._formula_clause>], 'gamma': ['gamma', <function CodDbImporter._angle_clause>], 'id': ['file', <function CodDbImporter._int_clause>], 'number_of_elements': ['nel', <function CodDbImporter._int_clause>], 'spacegroup': ['sg', <function CodDbImporter._str_exact_clause>], 'text': ['text', <function CodDbImporter._str_fuzzy_clause>], 'volume': ['vol', <function CodDbImporter._volume_clause>]}#
query(**kwargs)[source]#

Performs a query on the PCOD database using keyword = value pairs, specified in kwargs.

Returns:

an instance of aiida.tools.dbimporters.plugins.pcod.PcodSearchResults.

query_sql(**kwargs)[source]#

Forms a SQL query for querying the PCOD database using keyword = value pairs, specified in kwargs.

Returns:

string containing a SQL statement.

class aiida.tools.dbimporters.plugins.pcod.PcodEntry(uri, db_name='Predicted Crystallography Open Database', db_uri='http://www.crystallography.net/pcod', **kwargs)[source]#

Bases: CodEntry

Represents an entry from PCOD.

__annotations__ = {}#
__init__(uri, db_name='Predicted Crystallography Open Database', db_uri='http://www.crystallography.net/pcod', **kwargs)[source]#

Creates an instance of aiida.tools.dbimporters.plugins.pcod.PcodEntry, related to the supplied URI.

__module__ = 'aiida.tools.dbimporters.plugins.pcod'#
_license: str | None = 'CC0'#
class aiida.tools.dbimporters.plugins.pcod.PcodSearchResults(results)[source]#

Bases: CodSearchResults

Results of the search, performed on PCOD.

__annotations__ = {}#
__init__(results)[source]#
__module__ = 'aiida.tools.dbimporters.plugins.pcod'#
_base_url = 'http://www.crystallography.net/pcod/cif/'#
_get_url(result_dict)[source]#

Returns an URL of an entry CIF file.

Parameters:

result_dict – dictionary, describing an entry in the results.

“Implementation of DbImporter for the TCOD database.

class aiida.tools.dbimporters.plugins.tcod.TcodDbImporter(**kwargs)[source]#

Bases: CodDbImporter

Database importer for Theoretical Crystallography Open Database.

__annotations__ = {}#
__init__(**kwargs)[source]#
__module__ = 'aiida.tools.dbimporters.plugins.tcod'#
query(**kwargs)[source]#

Performs a query on the TCOD database using keyword = value pairs, specified in kwargs.

Returns:

an instance of aiida.tools.dbimporters.plugins.tcod.TcodSearchResults.

class aiida.tools.dbimporters.plugins.tcod.TcodEntry(uri, db_name='Theoretical Crystallography Open Database', db_uri='http://www.crystallography.net/tcod', **kwargs)[source]#

Bases: CodEntry

Represents an entry from TCOD.

__annotations__ = {}#
__init__(uri, db_name='Theoretical Crystallography Open Database', db_uri='http://www.crystallography.net/tcod', **kwargs)[source]#

Creates an instance of aiida.tools.dbimporters.plugins.tcod.TcodEntry, related to the supplied URI.

__module__ = 'aiida.tools.dbimporters.plugins.tcod'#
_license: str | None = 'CC0'#
class aiida.tools.dbimporters.plugins.tcod.TcodSearchResults(results)[source]#

Bases: CodSearchResults

Results of the search, performed on TCOD.

__annotations__ = {}#
__init__(results)[source]#
__module__ = 'aiida.tools.dbimporters.plugins.tcod'#
_base_url = 'http://www.crystallography.net/tcod/'#