aiida.tools.dbimporters package

class aiida.tools.dbimporters.DbImporter[source]

Bases: object

Base class for database importers.

__dict__ = mappingproxy({'__module__': 'aiida.tools.dbimporters.baseclasses', '__doc__': '\n Base class for database importers.\n ', 'query': <function DbImporter.query>, 'setup_db': <function DbImporter.setup_db>, 'get_supported_keywords': <function DbImporter.get_supported_keywords>, '__dict__': <attribute '__dict__' of 'DbImporter' objects>, '__weakref__': <attribute '__weakref__' of 'DbImporter' objects>})
__module__ = 'aiida.tools.dbimporters.baseclasses'
__weakref__

list of weak references to the object (if defined)

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.

setup_db(**kwargs)[source]

Sets the database parameters. The method should reconnect to the database using updated parameters, if already connected.

Submodules

class aiida.tools.dbimporters.baseclasses.CifEntry(db_name=None, db_uri=None, id=None, version=None, extras={}, uri=None)[source]

Bases: aiida.tools.dbimporters.baseclasses.DbEntry

Represents an entry from the structure database (COD, ICSD, …).

__module__ = 'aiida.tools.dbimporters.baseclasses'
cif

Returns raw contents of a CIF file as string.

get_aiida_structure(converter='pymatgen', store=False, **kwargs)[source]
Returns:AiiDA structure corresponding to the CIF file.
get_ase_structure()[source]

Returns ASE representation of the CIF.

Note

To be removed, as it is duplicated in aiida.orm.nodes.data.cif.CifData.

get_cif_node(store=False, parse_policy='lazy')[source]

Creates a CIF node, that can be used in AiiDA workflow.

Returns:aiida.orm.nodes.data.cif.CifData object
get_parsed_cif()[source]

Returns data structure, representing the CIF file. Can be created using PyCIFRW or any other open-source parser.

Returns:list of lists
get_raw_cif()[source]

Returns raw contents of a CIF file as string.

Returns:contents of a file as string
class aiida.tools.dbimporters.baseclasses.DbEntry(db_name=None, db_uri=None, id=None, version=None, extras={}, uri=None)[source]

Bases: object

Represents an entry from external database.

__dict__ = mappingproxy({'__module__': 'aiida.tools.dbimporters.baseclasses', '__doc__': '\n Represents an entry from external database.\n ', '_license': None, '__init__': <function DbEntry.__init__>, '__repr__': <function DbEntry.__repr__>, 'contents': <property object>, '__dict__': <attribute '__dict__' of 'DbEntry' objects>, '__weakref__': <attribute '__weakref__' of 'DbEntry' objects>})
__init__(db_name=None, db_uri=None, id=None, version=None, extras={}, uri=None)[source]

Sets the basic parameters for the database entry:

Parameters:
  • db_name – name of the source database
  • db_uri – URI of the source database
  • id – structure identifyer in the database
  • version – version of the database
  • extras – a dictionary with some extra parameters (e.g. database ID number)
  • uri – URI of the structure (should be permanent)
__module__ = 'aiida.tools.dbimporters.baseclasses'
__repr__()[source]

Return repr(self).

__weakref__

list of weak references to the object (if defined)

_license = None
contents

Returns raw contents of a file as string.

class aiida.tools.dbimporters.baseclasses.DbImporter[source]

Bases: object

Base class for database importers.

__dict__ = mappingproxy({'__module__': 'aiida.tools.dbimporters.baseclasses', '__doc__': '\n Base class for database importers.\n ', 'query': <function DbImporter.query>, 'setup_db': <function DbImporter.setup_db>, 'get_supported_keywords': <function DbImporter.get_supported_keywords>, '__dict__': <attribute '__dict__' of 'DbImporter' objects>, '__weakref__': <attribute '__weakref__' of 'DbImporter' objects>})
__module__ = 'aiida.tools.dbimporters.baseclasses'
__weakref__

list of weak references to the object (if defined)

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.

setup_db(**kwargs)[source]

Sets the database parameters. The method should reconnect to the database using updated parameters, if already connected.

class aiida.tools.dbimporters.baseclasses.DbSearchResults(results)[source]

Bases: object

Base class for database results.

All classes, inheriting this one and overriding at(), are able to benefit from having functions __iter__, __len__ and __getitem__.

class DbSearchResultsIterator(results, increment=1)[source]

Bases: object

Iterator for search results

__dict__ = mappingproxy({'__module__': 'aiida.tools.dbimporters.baseclasses', '__doc__': '\n Iterator for search results\n ', '__init__': <function DbSearchResults.DbSearchResultsIterator.__init__>, '__next__': <function DbSearchResults.DbSearchResultsIterator.__next__>, 'next': <function DbSearchResults.DbSearchResultsIterator.next>, '__dict__': <attribute '__dict__' of 'DbSearchResultsIterator' objects>, '__weakref__': <attribute '__weakref__' of 'DbSearchResultsIterator' objects>})
__init__(results, increment=1)[source]

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'aiida.tools.dbimporters.baseclasses'
__next__()[source]
__weakref__

list of weak references to the object (if defined)

next()[source]

The iterator method expected by python 2.x, implemented as python 3.x style method.

__dict__ = mappingproxy({'__module__': 'aiida.tools.dbimporters.baseclasses', '__doc__': '\n Base class for database results.\n\n All classes, inheriting this one and overriding ``at()``, are able to\n benefit from having functions ``__iter__``, ``__len__`` and\n ``__getitem__``.\n ', '__init__': <function DbSearchResults.__init__>, 'DbSearchResultsIterator': <class 'aiida.tools.dbimporters.baseclasses.DbSearchResults.DbSearchResultsIterator'>, '__iter__': <function DbSearchResults.__iter__>, '__len__': <function DbSearchResults.__len__>, '__getitem__': <function DbSearchResults.__getitem__>, 'fetch_all': <function DbSearchResults.fetch_all>, 'next': <function DbSearchResults.next>, 'at': <function DbSearchResults.at>, '_get_source_dict': <function DbSearchResults._get_source_dict>, '_get_url': <function DbSearchResults._get_url>, '__dict__': <attribute '__dict__' of 'DbSearchResults' objects>, '__weakref__': <attribute '__weakref__' of 'DbSearchResults' objects>})
__getitem__(key)[source]
__init__(results)[source]

Initialize self. See help(type(self)) for accurate signature.

__iter__()[source]

Instances of aiida.tools.dbimporters.baseclasses.DbSearchResults can be used as iterators.

__len__()[source]
__module__ = 'aiida.tools.dbimporters.baseclasses'
__weakref__

list of weak references to the object (if defined)

_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.
at(position)[source]

Returns position-th result as aiida.tools.dbimporters.baseclasses.DbEntry.

Parameters:position – zero-based index of a result.
Raises:IndexError – if position is out of bounds.
fetch_all()[source]

Returns all query results as an array of aiida.tools.dbimporters.baseclasses.DbEntry.

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]

Bases: aiida.tools.dbimporters.baseclasses.DbEntry

Represents an entry from the pseudopotential database.

__module__ = 'aiida.tools.dbimporters.baseclasses'
get_upf_node(store=False)[source]

Creates an UPF node, that can be used in AiiDA workflow.

Returns:aiida.orm.nodes.data.upf.UpfData object