DbExporter documentation

Note

This is the documentation of the general DbExporter class and the TCOD implementatation. TCOD itself accepts a number of plugins that know how to convert code-specific output to the TCOD format; these typically live in different repositories. For instance, you can find here the extensions for Quantum ESPRESSO.

TCOD database exporter

aiida.tools.dbexporters.tcod.cif_encode_contents(content, gzip=False, gzip_threshold=1024)[source]

Encodes data for usage in CIF text field in a best possible way: binary data is encoded using Base64 encoding; text with non-ASCII symbols, too long lines or lines starting with semicolons (‘;’) is encoded using Quoted-printable encoding.

Parameters:content – the content to be encoded
Return content:encoded content
Return encoding:
 a string specifying used encoding (None, ‘base64’, ‘ncr’, ‘quoted-printable’, ‘gzip+base64’)
aiida.tools.dbexporters.tcod.decode_textfield(content, method)[source]

Decodes the contents of encoded CIF textfield.

Parameters:
  • content – the content to be decoded
  • method – method, which was used for encoding the contents (None, ‘base64’, ‘ncr’, ‘quoted-printable’, ‘gzip+base64’)
Returns:

decoded content

Raises:

ValueError – if the encoding method is unknown

aiida.tools.dbexporters.tcod.decode_textfield_base64(content)[source]

Decodes the contents for CIF textfield from Base64 using standard Python implementation (base64.standard_b64decode())

Parameters:content – a string with contents
Returns:decoded string
aiida.tools.dbexporters.tcod.decode_textfield_gzip_base64(content)[source]

Decodes the contents for CIF textfield from Base64 and decompresses them with gzip.

Parameters:content – a string with contents
Returns:decoded string
aiida.tools.dbexporters.tcod.decode_textfield_ncr(content)[source]

Decodes the contents for CIF textfield from Numeric Character Reference.

Parameters:content – a string with contents
Returns:decoded string
aiida.tools.dbexporters.tcod.decode_textfield_quoted_printable(content)[source]

Decodes the contents for CIF textfield from quoted-printable encoding.

Parameters:content – a string with contents
Returns:decoded string
aiida.tools.dbexporters.tcod.deposit(what, type, author_name=None, author_email=None, url=None, title=None, username=None, password=False, user_email=None, code_label='cif_cod_deposit', computer_name=None, replace=None, message=None, **kwargs)[source]

Launches a aiida.orm.implementation.general.calculation.job.AbstractJobCalculation to deposit data node to *COD-type database.

Returns:launched aiida.orm.implementation.general.calculation.job.AbstractJobCalculation instance.
Raises:ValueError – if any of the required parameters are not given.
aiida.tools.dbexporters.tcod.deposition_cmdline_parameters(parser, expclass='Data')[source]

Provides descriptions of command line options, that are used to control the process of deposition to TCOD.

Parameters:
  • parser – an argparse.Parser instance
  • expclass – name of the exported class to be shown in help string for the command line options

Note

This method must not set any default values for command line options in order not to clash with any other data deposition plugins.

aiida.tools.dbexporters.tcod.encode_textfield_base64(content, foldwidth=76)[source]

Encodes the contents for CIF textfield in Base64 using standard Python implementation (base64.standard_b64encode()).

Parameters:
  • content – a string with contents
  • foldwidth – maximum width of line (default is 76)
Returns:

encoded string

aiida.tools.dbexporters.tcod.encode_textfield_gzip_base64(content, **kwargs)[source]

Gzips the given string and encodes it in Base64.

Parameters:content – a string with contents
Returns:encoded string
aiida.tools.dbexporters.tcod.encode_textfield_ncr(content)[source]

Encodes the contents for CIF textfield in Numeric Character Reference. Encoded characters:

  • \x09, \x0A, \x0D, \x20\x7E;
  • ;‘, if encountered on the beginning of the line;
  • \t
  • .‘ and ‘?‘, if comprise the entire textfield.
Parameters:content – a string with contents
Returns:encoded string
aiida.tools.dbexporters.tcod.encode_textfield_quoted_printable(content)[source]

Encodes the contents for CIF textfield in quoted-printable encoding. In addition to non-ASCII characters, that are encoded by Python function quopri.encodestring(), following characters are encoded:

  • ;‘, if encountered on the beginning of the line;
  • \t‘ and ‘\r‘;
  • .‘ and ‘?‘, if comprise the entire textfield.
Parameters:content – a string with contents
Returns:encoded string
aiida.tools.dbexporters.tcod.export_cif(what, **kwargs)[source]

Exports given coordinate-containing *Data node to string of CIF format.

Returns:string with contents of CIF file.
aiida.tools.dbexporters.tcod.export_cifnode(what, parameters=None, trajectory_index=None, store=False, reduce_symmetry=True, **kwargs)[source]

The main exporter function. Exports given coordinate-containing *Data node to aiida.orm.data.cif.CifData node, ready to be exported to TCOD. All *Data types, having method _get_cif(), are supported in addition to aiida.orm.data.cif.CifData.

Parameters:
  • what – data node to be exported.
  • parameters – a aiida.orm.data.parameter.ParameterData instance, produced by the same calculation as the original exported node.
  • trajectory_index – a step to be converted and exported in case a aiida.orm.data.array.trajectory.TrajectoryData is exported.
  • store – boolean indicating whether to store intermediate nodes or not. Default False.
  • dump_aiida_database – boolean indicating whether to include the dump of AiiDA database (containing only transitive closure of the exported node). Default True.
  • exclude_external_contents – boolean indicating whether to exclude nodes from AiiDA database dump, that are taken from external repositores and have a URL link allowing to refetch their contents. Default False.
  • gzip – boolean indicating whether to Gzip large CIF text fields. Default False.
  • gzip_threshold – integer indicating the maximum size (in bytes) of uncompressed CIF text fields when the gzip option is in action. Default 1024.
Returns:

a aiida.orm.data.cif.CifData node.

aiida.tools.dbexporters.tcod.export_values(what, **kwargs)[source]

Exports given coordinate-containing *Data node to PyCIFRW CIF data structure.

Returns:CIF data structure.

Note

Requires PyCIFRW.

aiida.tools.dbexporters.tcod.extend_with_cmdline_parameters(parser, expclass='Data')[source]

Provides descriptions of command line options, that are used to control the process of exporting data to TCOD CIF files.

Parameters:
  • parser – an argparse.Parser instance
  • expclass – name of the exported class to be shown in help string for the command line options

Note

This method must not set any default values for command line options in order not to clash with any other data export plugins.

aiida.tools.dbexporters.tcod.translate_calculation_specific_values(calc, translator, **kwargs)[source]

Translates calculation-specific values from aiida.orm.implementation.general.calculation.job.AbstractJobCalculation subclass to appropriate TCOD CIF tags.

Parameters:
Raises:

ValueError – if translator is not derived from proper class.

TCOD parameter translator documentation

Base class

class aiida.tools.dbexporters.tcod_plugins.BaseTcodtranslator[source]

Base translator from calculation-specific input and output parameters to TCOD CIF dictionary tags.

classmethod get_BZ_integration_grid_X(calc, **kwargs)[source]

Returns a number of points in the Brillouin zone along reciprocal lattice vector X.

classmethod get_BZ_integration_grid_Y(calc, **kwargs)[source]

Returns a number of points in the Brillouin zone along reciprocal lattice vector Y.

classmethod get_BZ_integration_grid_Z(calc, **kwargs)[source]

Returns a number of points in the Brillouin zone along reciprocal lattice vector Z.

classmethod get_BZ_integration_grid_shift_X(calc, **kwargs)[source]

Returns the shift of the Brillouin zone points along reciprocal lattice vector X.

classmethod get_BZ_integration_grid_shift_Y(calc, **kwargs)[source]

Returns the shift of the Brillouin zone points along reciprocal lattice vector Y.

classmethod get_BZ_integration_grid_shift_Z(calc, **kwargs)[source]

Returns the shift of the Brillouin zone points along reciprocal lattice vector Z.

classmethod get_atom_site_residual_force_Cartesian_x(calc, **kwargs)[source]

Returns a list of x components for Cartesian coordinates of residual force for atom. The list order MUST be the same as in the resulting structure.

classmethod get_atom_site_residual_force_Cartesian_y(calc, **kwargs)[source]

Returns a list of y components for Cartesian coordinates of residual force for atom. The list order MUST be the same as in the resulting structure.

classmethod get_atom_site_residual_force_Cartesian_z(calc, **kwargs)[source]

Returns a list of z components for Cartesian coordinates of residual force for atom. The list order MUST be the same as in the resulting structure.

classmethod get_atom_type_basisset(calc, **kwargs)[source]

Returns a list of basisset names for each atom type. The list order MUST be the same as of get_atom_type_symbol().

classmethod get_atom_type_symbol(calc, **kwargs)[source]

Returns a list of atom types. Each atom site MUST occur only once in this list. List MUST be sorted.

classmethod get_atom_type_valence_configuration(calc, **kwargs)[source]

Returns valence configuration of each atom type. The list order MUST be the same as of get_atom_type_symbol().

classmethod get_computation_wallclock_time(calc, **kwargs)[source]

Returns the computation wallclock time in seconds.

classmethod get_ewald_energy(calc, **kwargs)[source]

Returns Ewald energy in eV.

classmethod get_exchange_correlation_energy(calc, **kwargs)[source]

Returns exchange correlation (XC) energy in eV.

classmethod get_fermi_energy(calc, **kwargs)[source]

Returns Fermi energy in eV.

classmethod get_hartree_energy(calc, **kwargs)[source]

Returns Hartree energy in eV.

classmethod get_integration_Methfessel_Paxton_order(calc, **kwargs)[source]

Returns the order of Methfessel-Paxton approximation if used.

classmethod get_integration_smearing_method(calc, **kwargs)[source]

Returns the smearing method name as string.

classmethod get_integration_smearing_method_other(calc, **kwargs)[source]

Returns the smearing method name as string if the name is different from specified in cif_dft.dic.

classmethod get_kinetic_energy_cutoff_EEX(calc, **kwargs)[source]

Returns kinetic energy cutoff for exact exchange (EEX) operator in eV.

classmethod get_kinetic_energy_cutoff_charge_density(calc, **kwargs)[source]

Returns kinetic energy cutoff for charge density in eV.

classmethod get_kinetic_energy_cutoff_wavefunctions(calc, **kwargs)[source]

Returns kinetic energy cutoff for wavefunctions in eV.

classmethod get_number_of_electrons(calc, **kwargs)[source]

Returns the number of electrons.

classmethod get_one_electron_energy(calc, **kwargs)[source]

Returns one electron energy in eV.

classmethod get_pseudopotential_atom_type(calc, **kwargs)[source]

Returns a list of atom types. Each atom type MUST occur only once in this list. List MUST be sorted.

classmethod get_pseudopotential_type(calc, **kwargs)[source]

Returns a list of pseudopotential types. List MUST be sorted by atom types.

classmethod get_pseudopotential_type_other_name(calc, **kwargs)[source]

Returns a list of other pseudopotential type names. List MUST be sorted by atom types.

classmethod get_software_executable_path(calc, **kwargs)[source]

Returns the file-system path to the executable that was run for this computation.

classmethod get_software_package(calc, **kwargs)[source]

Returns the package or program name that was used to produce the structure. Only package or program name should be used, e.g. ‘VASP’, ‘psi3’, ‘Abinit’, etc.

classmethod get_software_package_compilation_timestamp(calc, **kwargs)[source]

Returns the timestamp of package/program compilation in ISO 8601 format.

classmethod get_software_package_version(calc, **kwargs)[source]

Returns software package version used to compute and produce the computed structure file. Only version designator should be used, e.g. ‘3.4.0’, ‘2.1rc3’.

classmethod get_total_energy(calc, **kwargs)[source]

Returns the total energy in eV.