aiida.tools.dbimporters package

aiida.tools.dbimporters.DbImporterFactory(pluginname)[source]

This function loads the correct DbImporter plugin class

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()[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.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
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__ = dict_proxy({'__module__': 'aiida.tools.dbimporters.baseclasses', 'contents': <property object>, '__dict__': <attribute '__dict__' of 'DbEntry' objects>, '__weakref__': <attribute '__weakref__' of 'DbEntry' objects>, '_license': None, '__doc__': '\n Represents an entry from external database.\n ', '__init__': <function __init__>, '__repr__': <function __repr__>})
__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__() <==> repr(x)[source]
__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__ = dict_proxy({'get_supported_keywords': <function get_supported_keywords>, '__module__': 'aiida.tools.dbimporters.baseclasses', '__weakref__': <attribute '__weakref__' of 'DbImporter' objects>, '__dict__': <attribute '__dict__' of 'DbImporter' objects>, 'query': <function query>, 'setup_db': <function setup_db>, '__doc__': '\n Base class for database importers.\n '})
__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__ = dict_proxy({'__module__': 'aiida.tools.dbimporters.baseclasses', 'next': <function next>, '__dict__': <attribute '__dict__' of 'DbSearchResultsIterator' objects>, '__weakref__': <attribute '__weakref__' of 'DbSearchResultsIterator' objects>, '__doc__': '\n Iterator for search results\n ', '__init__': <function __init__>})
__init__(results, increment=1)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

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

list of weak references to the object (if defined)

next()[source]
__dict__ = dict_proxy({'__module__': 'aiida.tools.dbimporters.baseclasses', '_get_url': <function _get_url>, 'fetch_all': <function fetch_all>, '__getitem__': <function __getitem__>, 'next': <function next>, 'DbSearchResultsIterator': <class 'aiida.tools.dbimporters.baseclasses.DbSearchResultsIterator'>, '__iter__': <function __iter__>, '__len__': <function __len__>, '_get_source_dict': <function _get_source_dict>, '__dict__': <attribute '__dict__' of 'DbSearchResults' objects>, '__weakref__': <attribute '__weakref__' of 'DbSearchResults' objects>, '__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 __init__>, 'at': <function at>})
__getitem__(key)[source]
__init__(results)[source]

x.__init__(…) initializes x; see help(type(x)) for 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.data.upf.UpfData object