abiflows.database.mongoengine package

Subpackages

Submodules

abiflows.database.mongoengine.abinit_mixins module

List of mixins to provide standard interfaces with the result databases for abinit calculations. Most of them should still be considered as examples.

class abiflows.database.mongoengine.abinit_mixins.AbinitPseudoData(*args, **kwargs)[source]

Bases: mongoengine.document.EmbeddedDocument

Embedded document providing some fields and function to save abinit pseudopotential data

Inheritance Diagram

Inheritance diagram of AbinitPseudoData
pseudos_name

A list field that wraps a standard field, allowing multiple instances of the field to be used as a list in the database.

If using with ReferenceFields see: one-to-many-with-listfields

Note

Required means it cannot be empty - as the default for ListFields is []

pseudos_md5

A list field that wraps a standard field, allowing multiple instances of the field to be used as a list in the database.

If using with ReferenceFields see: one-to-many-with-listfields

Note

Required means it cannot be empty - as the default for ListFields is []

pseudos_path

A list field that wraps a standard field, allowing multiple instances of the field to be used as a list in the database.

If using with ReferenceFields see: one-to-many-with-listfields

Note

Required means it cannot be empty - as the default for ListFields is []

set_pseudos_vars(**kwargs)
set_pseudos_from_paths(pseudos_path)[source]
set_pseudos_from_files_file(files_file_path, num_pseudo)[source]

Sets the fields of the Document reading from the “.files” file.

Parameters
  • files_file_path – path to the .files file

  • num_pseudo – number of pseudos that should be read

set_pseudos_from_abinit_input(abinit_input)[source]

Sets the fields of the document using an abipy.abio.inputs.AbinitInput object.

Parameters

abinit_input – An abipy.abio.inputs.AbinitInput object

class abiflows.database.mongoengine.abinit_mixins.AbinitBasicInputMixin[source]

Bases: object

Mixin providing some basic fields that are required to run a calculation.

structure
ecut

Floating point number field.

nshiftk

32-bit integer field.

shiftk

A list field that wraps a standard field, allowing multiple instances of the field to be used as a list in the database.

If using with ReferenceFields see: one-to-many-with-listfields

Note

Required means it cannot be empty - as the default for ListFields is []

ngkpt

A list field that wraps a standard field, allowing multiple instances of the field to be used as a list in the database.

If using with ReferenceFields see: one-to-many-with-listfields

Note

Required means it cannot be empty - as the default for ListFields is []

kptrlatt

A list field that wraps a standard field, allowing multiple instances of the field to be used as a list in the database.

If using with ReferenceFields see: one-to-many-with-listfields

Note

Required means it cannot be empty - as the default for ListFields is []

dilatmx

Floating point number field.

occopt

32-bit integer field.

tsmear

Floating point number field.

pseudopotentials

An embedded document field - with a declared document_type. Only valid values are subclasses of EmbeddedDocument.

set_abinit_basic_from_abinit_input(abinit_input)[source]

sets the fields of the object from an abipy.abio.inputs.AbinitInput object

class abiflows.database.mongoengine.abinit_mixins.AbinitGSOutputMixin[source]

Bases: abiflows.database.mongoengine.mixins.GroundStateOutputMixin

Mixin providing generic fiels for abinit ground state calculation

Inheritance Diagram

Inheritance diagram of AbinitGSOutputMixin
gsr

Extend FileField. Use customized version of proxy_class so that we can use abiopen to construct the AbiPy object from the gridfs content.

class abiflows.database.mongoengine.abinit_mixins.AbinitDftpOutputMixin[source]

Bases: object

Mixin providing generic fiels for dfpt calculation

ddb

Extend FileField. Use customized version of proxy_class so that we can use abiopen to construct the AbiPy object from the gridfs content.

structure
class abiflows.database.mongoengine.abinit_mixins.AbinitPhononOutputMixin[source]

Bases: abiflows.database.mongoengine.abinit_mixins.AbinitDftpOutputMixin

Mixin providing generic fiels for phonon calculation

Inheritance Diagram

Inheritance diagram of AbinitPhononOutputMixin
phonon_bs

Extend FileField. Use customized version of proxy_class so that we can use abiopen to construct the AbiPy object from the gridfs content.

phonon_dos

Extend FileField. Use customized version of proxy_class so that we can use abiopen to construct the AbiPy object from the gridfs content.

anaddb_nc

Extend FileField. Use customized version of proxy_class so that we can use abiopen to construct the AbiPy object from the gridfs content.

abiflows.database.mongoengine.abinit_results module

class abiflows.database.mongoengine.abinit_results.RelaxAbinitInput(*args, **kwargs)[source]

Bases: abiflows.database.mongoengine.abinit_mixins.AbinitBasicInputMixin, mongoengine.document.EmbeddedDocument

EmbeddedDocument containing the typical inputs for a relaxation workflow.

Inheritance Diagram

Inheritance diagram of RelaxAbinitInput
last_input
kppa

32-bit integer field.

class abiflows.database.mongoengine.abinit_results.RelaxAbinitOutput(*args, **kwargs)[source]

Bases: abiflows.database.mongoengine.abinit_mixins.AbinitGSOutputMixin, mongoengine.document.EmbeddedDocument

EmbeddedDocument containing the typical outputs for a relaxation workflow.

Inheritance Diagram

Inheritance diagram of RelaxAbinitOutput
hist_files

A dictionary field that wraps a standard Python dictionary. This is similar to an embedded document, but the structure is not defined.

Note

Required means it cannot be empty - as the default for DictFields is {}

New in version 0.3.

Changed in version 0.5: - Can now handle complex / varying types of data

outfile_ioncell

A GridFS storage field for abinit related files with automatic compression of the file with gzip.

class abiflows.database.mongoengine.abinit_results.RelaxResult(*args, **values)[source]

Bases: abiflows.database.mongoengine.mixins.MaterialMixin, abiflows.database.mongoengine.mixins.DateMixin, abiflows.database.mongoengine.mixins.DirectoryMixin, abiflows.database.mongoengine.mixins.CustomFieldMixin, mongoengine.document.Document

Document containing the results for a relaxation workflow consisting of an ion followed by ioncell relaxations.

Inheritance Diagram

Inheritance diagram of RelaxResult
history

A dictionary field that wraps a standard Python dictionary. This is similar to an embedded document, but the structure is not defined.

Note

Required means it cannot be empty - as the default for DictFields is {}

New in version 0.3.

Changed in version 0.5: - Can now handle complex / varying types of data

mp_id

A unicode string field.

abinit_input

An embedded document field - with a declared document_type. Only valid values are subclasses of EmbeddedDocument.

abinit_output

An embedded document field - with a declared document_type. Only valid values are subclasses of EmbeddedDocument.

time_report
fw_id

32-bit integer field.

exception DoesNotExist

Bases: mongoengine.errors.DoesNotExist

exception MultipleObjectsReturned

Bases: mongoengine.errors.MultipleObjectsReturned

id

A field wrapper around MongoDB’s ObjectIds.

objects

The default QuerySet Manager.

Custom QuerySet Manager functions can extend this class and users can add extra queryset functionality. Any custom manager methods must accept a Document class as its first argument, and a QuerySet as its second argument.

The method function should return a QuerySet , probably the same one that was passed in, but modified in some way.

class abiflows.database.mongoengine.abinit_results.PhononAbinitInput(*args, **kwargs)[source]

Bases: abiflows.database.mongoengine.abinit_mixins.AbinitBasicInputMixin, mongoengine.document.EmbeddedDocument

EmbeddedDocument containing the typical inputs for a phonon workflow.

Inheritance Diagram

Inheritance diagram of PhononAbinitInput
gs_input
ddk_input
dde_input
wfq_input
phonon_input
kppa

32-bit integer field.

ngqpt

A list field that wraps a standard field, allowing multiple instances of the field to be used as a list in the database.

If using with ReferenceFields see: one-to-many-with-listfields

Note

Required means it cannot be empty - as the default for ListFields is []

qpoints

A list field that wraps a standard field, allowing multiple instances of the field to be used as a list in the database.

If using with ReferenceFields see: one-to-many-with-listfields

Note

Required means it cannot be empty - as the default for ListFields is []

qppa

32-bit integer field.

class abiflows.database.mongoengine.abinit_results.PhononAbinitOutput(*args, **kwargs)[source]

Bases: abiflows.database.mongoengine.abinit_mixins.AbinitPhononOutputMixin, mongoengine.document.EmbeddedDocument

EmbeddedDocument containing the typical outputs for a phonon workflow.

Inheritance Diagram

Inheritance diagram of PhononAbinitOutput
gs_gsr

Extend FileField. Use customized version of proxy_class so that we can use abiopen to construct the AbiPy object from the gridfs content.

gs_outfile

A GridFS storage field for abinit related files with automatic compression of the file with gzip.

class abiflows.database.mongoengine.abinit_results.PhononResult(*args, **values)[source]

Bases: abiflows.database.mongoengine.mixins.MaterialMixin, abiflows.database.mongoengine.mixins.DateMixin, abiflows.database.mongoengine.mixins.DirectoryMixin, abiflows.database.mongoengine.mixins.CustomFieldMixin, mongoengine.document.Document

Document containing the results for a phonon workflow. Includes information from the various steps of the workflow (scf, nscf, ddk, dde, ph, anaddb)

Inheritance Diagram

Inheritance diagram of PhononResult
mp_id

A unicode string field.

relax_db
relax_id

A unicode string field.

time_report
fw_id

32-bit integer field.

abinit_input

An embedded document field - with a declared document_type. Only valid values are subclasses of EmbeddedDocument.

abinit_output

An embedded document field - with a declared document_type. Only valid values are subclasses of EmbeddedDocument.

exception DoesNotExist

Bases: mongoengine.errors.DoesNotExist

exception MultipleObjectsReturned

Bases: mongoengine.errors.MultipleObjectsReturned

id

A field wrapper around MongoDB’s ObjectIds.

objects

The default QuerySet Manager.

Custom QuerySet Manager functions can extend this class and users can add extra queryset functionality. Any custom manager methods must accept a Document class as its first argument, and a QuerySet as its second argument.

The method function should return a QuerySet , probably the same one that was passed in, but modified in some way.

class abiflows.database.mongoengine.abinit_results.DteAbinitInput(*args, **kwargs)[source]

Bases: abiflows.database.mongoengine.abinit_mixins.AbinitBasicInputMixin, mongoengine.document.EmbeddedDocument

EmbeddedDocument containing the typical inputs for a DTE workflow.

Inheritance Diagram

Inheritance diagram of DteAbinitInput
gs_input
ddk_input
dde_input
dte_input
phonon_input
kppa

32-bit integer field.

with_phonons

Boolean field type.

New in version 0.1.2.

class abiflows.database.mongoengine.abinit_results.DteAbinitOutput(*args, **kwargs)[source]

Bases: abiflows.database.mongoengine.abinit_mixins.AbinitDftpOutputMixin, mongoengine.document.EmbeddedDocument

EmbeddedDocument containing the typical outputs for a DTE workflow.

Inheritance Diagram

Inheritance diagram of DteAbinitOutput
gs_gsr

Extend FileField. Use customized version of proxy_class so that we can use abiopen to construct the AbiPy object from the gridfs content.

gs_outfile

A GridFS storage field for abinit related files with automatic compression of the file with gzip.

anaddb_nc

Extend FileField. Use customized version of proxy_class so that we can use abiopen to construct the AbiPy object from the gridfs content.

epsinf

A list field that wraps a standard field, allowing multiple instances of the field to be used as a list in the database.

If using with ReferenceFields see: one-to-many-with-listfields

Note

Required means it cannot be empty - as the default for ListFields is []

eps0

A list field that wraps a standard field, allowing multiple instances of the field to be used as a list in the database.

If using with ReferenceFields see: one-to-many-with-listfields

Note

Required means it cannot be empty - as the default for ListFields is []

dchide

A list field that wraps a standard field, allowing multiple instances of the field to be used as a list in the database.

If using with ReferenceFields see: one-to-many-with-listfields

Note

Required means it cannot be empty - as the default for ListFields is []

dchidt

A list field that wraps a standard field, allowing multiple instances of the field to be used as a list in the database.

If using with ReferenceFields see: one-to-many-with-listfields

Note

Required means it cannot be empty - as the default for ListFields is []

class abiflows.database.mongoengine.abinit_results.DteResult(*args, **values)[source]

Bases: abiflows.database.mongoengine.mixins.MaterialMixin, abiflows.database.mongoengine.mixins.DateMixin, abiflows.database.mongoengine.mixins.DirectoryMixin, abiflows.database.mongoengine.mixins.CustomFieldMixin, mongoengine.document.Document

Document containing the results for a dte workflow. Includes information from the various steps of the workflow (scf, ddk, dde, ph, dte, anaddb)

Inheritance Diagram

Inheritance diagram of DteResult
mp_id

A unicode string field.

relax_db
relax_id

A unicode string field.

time_report
fw_id

32-bit integer field.

abinit_input

An embedded document field - with a declared document_type. Only valid values are subclasses of EmbeddedDocument.

abinit_output

An embedded document field - with a declared document_type. Only valid values are subclasses of EmbeddedDocument.

exception DoesNotExist

Bases: mongoengine.errors.DoesNotExist

exception MultipleObjectsReturned

Bases: mongoengine.errors.MultipleObjectsReturned

id

A field wrapper around MongoDB’s ObjectIds.

objects

The default QuerySet Manager.

Custom QuerySet Manager functions can extend this class and users can add extra queryset functionality. Any custom manager methods must accept a Document class as its first argument, and a QuerySet as its second argument.

The method function should return a QuerySet , probably the same one that was passed in, but modified in some way.

class abiflows.database.mongoengine.abinit_results.DfptAbinitInput(*args, **kwargs)[source]

Bases: abiflows.database.mongoengine.abinit_mixins.AbinitBasicInputMixin, mongoengine.document.EmbeddedDocument

EmbeddedDocument containing the typical inputs for a dfpt workflow.

Inheritance Diagram

Inheritance diagram of DfptAbinitInput
gs_input
ddk_input
dde_input
wfq_input
phonon_input
strain_input
dte_input
kppa

32-bit integer field.

ngqpt

A list field that wraps a standard field, allowing multiple instances of the field to be used as a list in the database.

If using with ReferenceFields see: one-to-many-with-listfields

Note

Required means it cannot be empty - as the default for ListFields is []

qpoints

A list field that wraps a standard field, allowing multiple instances of the field to be used as a list in the database.

If using with ReferenceFields see: one-to-many-with-listfields

Note

Required means it cannot be empty - as the default for ListFields is []

qppa

32-bit integer field.

class abiflows.database.mongoengine.abinit_results.DfptAbinitOutput(*args, **kwargs)[source]

Bases: abiflows.database.mongoengine.abinit_mixins.AbinitPhononOutputMixin, mongoengine.document.EmbeddedDocument

EmbeddedDocument containing the typical outputs for a dfpt workflow.

Inheritance Diagram

Inheritance diagram of DfptAbinitOutput
gs_gsr

Extend FileField. Use customized version of proxy_class so that we can use abiopen to construct the AbiPy object from the gridfs content.

gs_outfile

A GridFS storage field for abinit related files with automatic compression of the file with gzip.

class abiflows.database.mongoengine.abinit_results.DfptResult(*args, **values)[source]

Bases: abiflows.database.mongoengine.mixins.MaterialMixin, abiflows.database.mongoengine.mixins.DateMixin, abiflows.database.mongoengine.mixins.DirectoryMixin, abiflows.database.mongoengine.mixins.CustomFieldMixin, mongoengine.document.Document

Document containing the results for a dfpt workflow. Includes information from the various steps of the workflow (scf, nscf, ddk, dde, ph, strain, dte, anaddb)

Inheritance Diagram

Inheritance diagram of DfptResult
mp_id

A unicode string field.

relax_db
relax_id

A unicode string field.

time_report
fw_id

32-bit integer field.

abinit_input

An embedded document field - with a declared document_type. Only valid values are subclasses of EmbeddedDocument.

abinit_output

An embedded document field - with a declared document_type. Only valid values are subclasses of EmbeddedDocument.

has_phonons

Boolean field type.

New in version 0.1.2.

has_ddk

Boolean field type.

New in version 0.1.2.

has_dde

Boolean field type.

New in version 0.1.2.

has_strain

Boolean field type.

New in version 0.1.2.

has_dte

Boolean field type.

New in version 0.1.2.

exception DoesNotExist

Bases: mongoengine.errors.DoesNotExist

exception MultipleObjectsReturned

Bases: mongoengine.errors.MultipleObjectsReturned

id

A field wrapper around MongoDB’s ObjectIds.

objects

The default QuerySet Manager.

Custom QuerySet Manager functions can extend this class and users can add extra queryset functionality. Any custom manager methods must accept a Document class as its first argument, and a QuerySet as its second argument.

The method function should return a QuerySet , probably the same one that was passed in, but modified in some way.

abiflows.database.mongoengine.mixins module

List of mixins to provide standard interfaces with the result databases. Most of them should still be considered as examples.

class abiflows.database.mongoengine.mixins.CalculationMetadataMixin[source]

Bases: object

Mixin providing fields for the metadata of the calculation

user

A unicode string field.

cluster

A unicode string field.

execution_date

Datetime field.

Uses the python-dateutil library if available alternatively use time.strptime to parse the dates. Note: python-dateutil’s parser is fully featured and when installed you can utilise it to convert varying types of date formats into valid python datetime objects.

Note: To default the field to the current datetime, use: DateTimeField(default=datetime.utcnow)

Note: Microseconds are rounded to the nearest millisecond.

Pre UTC microsecond support is effectively broken. Use ComplexDateTimeField if you need accurate microsecond support.

class abiflows.database.mongoengine.mixins.RunStatsMixin[source]

Bases: object

Mixin providing fields for the statistics of execution of the calculation

core_num

32-bit integer field.

elapsed_time

Floating point number field.

maximum_memory_used

Floating point number field.

number_of_restarts

32-bit integer field.

number_of_errors

32-bit integer field.

number_of_warnings

32-bit integer field.

class abiflows.database.mongoengine.mixins.SpaceGroupMixin[source]

Bases: object

Mixin providing fields to save space group data.

crystal_system

A unicode string field.

hall

A unicode string field.

number

32-bit integer field.

point_group

A unicode string field.

source

A unicode string field.

symbol

A unicode string field.

fill_from_structure(**kwargs)
set_space_group_from_structure(structure)[source]
class abiflows.database.mongoengine.mixins.SpaceGroupDocument(*args, **kwargs)[source]

Bases: abiflows.database.mongoengine.mixins.SpaceGroupMixin, mongoengine.document.EmbeddedDocument

Embedded document to describe the spacegroup of a material

class abiflows.database.mongoengine.mixins.MaterialMixin[source]

Bases: object

Mixin providing the fields describing the material examined in the calculation

pretty_formula

A unicode string field.

full_formula

A unicode string field.

spacegroup

An embedded document field - with a declared document_type. Only valid values are subclasses of EmbeddedDocument.

unit_cell_formula

A dictionary field that wraps a standard Python dictionary. This is similar to an embedded document, but the structure is not defined.

Note

Required means it cannot be empty - as the default for DictFields is {}

New in version 0.3.

Changed in version 0.5: - Can now handle complex / varying types of data

reduced_cell_formula

A dictionary field that wraps a standard Python dictionary. This is similar to an embedded document, but the structure is not defined.

Note

Required means it cannot be empty - as the default for DictFields is {}

New in version 0.3.

Changed in version 0.5: - Can now handle complex / varying types of data

anonymous_formula

A unicode string field.

elements

A list field that wraps a standard field, allowing multiple instances of the field to be used as a list in the database.

If using with ReferenceFields see: one-to-many-with-listfields

Note

Required means it cannot be empty - as the default for ListFields is []

nelements

32-bit integer field.

nsites

32-bit integer field.

chemsys

A unicode string field.

set_material_data_from_structure(structure, space_group=True, symprec=0.001, angle_tolerance=5)[source]

Sets the fields of the Document using a Structure and Spglib to determine the space group properties

Parameters
  • structure – A abipy.core.structure.Structure

  • space_group – if True sets the spacegroup fields using spglib.

  • symprec (float) – Tolerance for symmetry finding.

  • angle_tolerance (float) – Angle tolerance for symmetry finding.

class abiflows.database.mongoengine.mixins.CalculationTypeMixin[source]

Bases: object

Mixin providing fields for basic details of the calculation

xc_functional

A unicode string field.

pseudo_type

A unicode string field.

is_hubbard

Boolean field type.

New in version 0.1.2.

pseudo_dojo_table

A unicode string field.

class abiflows.database.mongoengine.mixins.GroundStateOutputMixin[source]

Bases: object

Mixin providing generic fields for ground state calculation

final_energy

Floating point number field.

efermi

Floating point number field.

total_magnetization

Floating point number field.

structure
class abiflows.database.mongoengine.mixins.HubbardsField(field=None, *args, **kwargs)[source]

Bases: mongoengine.fields.DictField

Dictfield to validate the passed values

validate(value)[source]

Make sure that a list of valid fields is being used.

class abiflows.database.mongoengine.mixins.HubbardMixin[source]

Bases: object

Mixin providing hubbard fields

hubbards

Dictfield to validate the passed values

class abiflows.database.mongoengine.mixins.DateMixin[source]

Bases: object

Mixin providing timestamp fields

created_on

Datetime field.

Uses the python-dateutil library if available alternatively use time.strptime to parse the dates. Note: python-dateutil’s parser is fully featured and when installed you can utilise it to convert varying types of date formats into valid python datetime objects.

Note: To default the field to the current datetime, use: DateTimeField(default=datetime.utcnow)

Note: Microseconds are rounded to the nearest millisecond.

Pre UTC microsecond support is effectively broken. Use ComplexDateTimeField if you need accurate microsecond support.

modified_on

Datetime field.

Uses the python-dateutil library if available alternatively use time.strptime to parse the dates. Note: python-dateutil’s parser is fully featured and when installed you can utilise it to convert varying types of date formats into valid python datetime objects.

Note: To default the field to the current datetime, use: DateTimeField(default=datetime.utcnow)

Note: Microseconds are rounded to the nearest millisecond.

Pre UTC microsecond support is effectively broken. Use ComplexDateTimeField if you need accurate microsecond support.

class abiflows.database.mongoengine.mixins.DirectoryMixin[source]

Bases: object

Mixin providing the field to store the directories used during the workflow

dir_names

A dictionary field that wraps a standard Python dictionary. This is similar to an embedded document, but the structure is not defined.

Note

Required means it cannot be empty - as the default for DictFields is {}

New in version 0.3.

Changed in version 0.5: - Can now handle complex / varying types of data

set_dir_names_from_fws_wf(wf)[source]

Fills the the dir_names of the mixin using the COMPLETED launches of a firework workflow. Needs access to the full data of the workflow: Fireworks and Launches.

class abiflows.database.mongoengine.mixins.CustomFieldMixin[source]

Bases: object

Mixin providing a DictField for storing user specific additional properties

custom

A dictionary field that wraps a standard Python dictionary. This is similar to an embedded document, but the structure is not defined.

Note

Required means it cannot be empty - as the default for DictFields is {}

New in version 0.3.

Changed in version 0.5: - Can now handle complex / varying types of data

abiflows.database.mongoengine.utils module

Utilities to handle mongoengine classes and connections.

class abiflows.database.mongoengine.utils.DatabaseData(database, host=None, port=None, collection=None, username=None, password=None)[source]

Bases: monty.json.MSONable

Basic class providing data to connect to a collection in the database and switching to that collection. Wraps mongoengine’s connect and switch_collection functions.

classmethod from_dict(d)[source]
Parameters

d – Dict representation.

Returns

MSONable class.

as_dict()[source]

A JSON serializable dict representation of an object.

as_dict_no_credentials()[source]
connect_mongoengine(alias='default')[source]

Open the connection to the selected database

switch_collection(cls)[source]

Switches to the chosen collection using Mongoengine’s switch_collection.

Module contents