Welcome to w2file’s documentation!

This package aims to provide a thin but useful abstraction for reading HDF5 data files from w2dynamics.

class w2file.W2File(filename=None, directory='.', prefix='')

A class for reading HDF5 data files from w2dynamics.

Parameters:
  • filename (str) – Name of the w2dynamics file. If not given, the HDF5 file with the latest timestamp is used.

  • directory (str) – Absolute or relative path to the directory in which the w2dynamics file is located.

  • prefix (str) – Prefix for the name of the w2dynamcis file in case filename is not given.

classmethod find_latest(directory='.', prefix='')

Find the w2dynamcis file with the most recent time stamp.

Parameters:
  • directory (str) – Directory in which to look for the w2dynamics file

  • prefix (str) – Prefix for the name of the w2dynamics file

Raises:

FileNotFoundError – If no HDF5 file with the given prefix and a proper time stamp is found

Returns:

Name of the found file

Return type:

str

property axes

Return datasets of “.axes” group as dictionary.

property config

Return attributes of “.config” group as dictionary.

property environment

Return attributes of “.environment” group as dictionary.

property quantities

Return dictionary of all the file’s w2dynamics quantities.

quantity(name, field_name='value', iteration_type=None, spin_orbit_indexes=None)

Return all datasets of the given w2dynamics quantity.

Parameters:
  • name (str) – Name of the w2dynamics quantity. For a list of all available quantities, see quantities().

  • field_name (str) – Name of the actual HDF5 dataset. It’s usually “value” or “error”.

  • iteration_type (str) – The type of iterations the quantity should be taken from: “dmft”, “stat” or “worm” (not case sensitive). If it’s anything else, all types of iterations are considered in alphabetical order, so this argument is only useful when iterations of different types are in a single w2dynamcis file.

  • spin_orbit_indexes (array-like) – The spin–orbit indices (also called worm components) of the quantity that should be returned. Only quantities with “worm” in their name have these and, as the name suggests, they combine the orbit and spin indices into a single one. For more details and a list of all available spin–orbit indexes see spin_orbit_indexes().

Returns:

The w2dynamics quantity, i.e., the datasets of the given name, for all iterations and inequivalent atoms (if applicable), orbits and spins or spin–orbit indices, frequencies, times, etc.

Return type:

numpy.ndarray

iter_groups(iteration_type=None)

Return a list of all iteration groups.

All entries in the list are terminated with a slash.

Parameters:

iteration_type (str) – If “dmft”, “stat” or “worm” (not case sensitive) only groups of that type are returned. Otherwise all iteration groups of all types are returned.

all_axes(quantity)

Return the names of all axes of the given quantity.

The list of names is taken from the “axes” attribute in “.quantities/<quantity>”. A possible “iter” axis is, however, prepended to the list if applicable.

property ineq_groups

Return all groups of inequivalent atoms (“ineq-###”).

All entries in the list are terminated with a slash.

spin_orbit_indexes(quantity)

Return the spin–orbit indexes of the given quantity.

They are the names of the direct subgroups of quantity, converted to int. If none are found (because quantity is not a worm quantity), an empty list is returned. To see how these compound spin–orbit indexes (also called band–spin indexes or worm components) are computed please refer to w2dynamics/w2dyn/auxiliaries/compound_index.py

Return type:

list(int)

property fileold_name_and_directory

Return the filename and directory of “general.fileold”.

Return type:

tuple(str, str)

property fileold

Return a W2File object of “general.fileold”.

property n

Return the density of the last iteration of “ineq-001”.

It is assumed that there is only a single orbital.

This property only exists for convenience. In the general case, the spin- and orbital-dependent density of all iterations and inequivalent atoms is obtained by reading “rho1” or “occ” with quantity().

Returns:

n(σ), σ in {↑, ↓}

Return type:

numpy.ndarray

property mu

Return the chemical potential of the last iteration.

If there are different types of iterations in the file, the last one in alphabetic order is chosen.

property U

Return the Hubbard interaction “atoms.1.udd”.

property beta

Return the inverse temperature “general.beta”.

property n_mu_U_beta

Return n, mu, U, β.

This is a convenience function. See n, mu, U, beta for details.