AFLOW Custom Deserializers

Unfortunately, the AFLOW library uses a custom-built serialization language for its keywords. This means that it isn’t possible to standardize the deserialization across all AFLOW Database Keywords. Instead, we have to implement custom deserialization for some of the keyword types.

Functions for casting AFLOW type names to valid python objects. This also creates numpy.ndarray for vector or tensor-valued properties.

aflow.caster.cast(atype, keyword, value)[source]

Casts the specified value to a python type, using the AFLOW type as a reference.

Note

Unfortunately, some of the AFLOW type names are not descriptive or unique enough to make general rule casting possible. Instead, we have to encode some exceptions directly in this module.

Parameters:
  • atype (str) – name of the AFLOW type.
  • keyword (str) – name of the keyword that the value is associated with.
  • value – object (usually a string) to cast into python types.
aflow.caster.docstrings = {'kpoints': "dict: with keys ['relaxation', 'static', 'points', 'nsamples']\ndescribing the cells for the relaxation and static calculations, the\nk-space symmetry points of the structure and the number of samples."}

dict – key-value pairs for custom docstrings describing the return value of keywords with complex structure.

aflow.caster.exceptions = ['forces', 'kpoints', 'positions_cartesian', 'positions_fractional', 'spind', 'stoich']

list – of AFLOW keywords for which the casting has to be handled in a special way.

aflow.caster.ptype(atype, keyword)[source]

Returns a str representing the python type for the specified AFLOW type and keyword.

Parameters:
  • atype (str) – name of the AFLOW type.
  • keyword (str) – name of the keyword that the value is associated with.