MoIndexTranslation
- class libadcc.MoIndexTranslation(*args, **kwargs)
Bases:
pybind11_objectOverloaded function.
__init__(self: libadcc.MoIndexTranslation, mospaces: libadcc.MoSpaces, space: str) -> None
Construct a MoIndexTranslation class from an MoSpaces object and the identifier for the space (e.g. o1o1, v1o1, o3v2o1v1, …)
__init__(self: libadcc.MoIndexTranslation, mospaces: libadcc.MoSpaces, subspaces: collections.abc.Sequence[str]) -> None
Construct a MoIndexTranslation class from an MoSpaces object and the list of identifiers for the space (e.g. [“o1”, “o1”] …)
Attributes Summary
Return the MoSpaces object supplied on initialisation
Return the number of dimensions.
Return the length along each dimension.
Return the space supplied on initialisation.
Return the space supplied on initialisation split into the subspace along each dimension, e.g. ["o1", "v1"] for the space "o1v1".
Methods Summary
block_index_of(self, tpl)Get the block index of an index, i.e. get the index which points to the block of the tensor in which the element with the passed index is contained in.
block_index_spatial_of(self, tpl)Get the spatial block index of an index
combine(*args, **kwargs)Overloaded function.
full_index_of(self, tpl)Map an index given in the space, which was passed upon construction, to the corresponding index in the full MO index range (the ffff space).
hf_provider_index_of(self, index)Map an index (given in the space passed upon construction) to the indexing convention of the host program provided to adcc as the HF provider.
inblock_index_of(self, tpl)Get the in-block index, i.e. the index within the tensor block.
map_range_to_hf_provider(self, ranges)Map a range of indices to host program indices, i.e. the indexing convention used in the HfProvider, which provides the SCF data to adcc.
spin_of(self, tpl)Get the spin block of each of the index components as a string.
split(self, tpl)Split an index into block index and in-block index
split_spin(self, tpl)Split an index into a spin block descriptor, a spatial block index and an in-block index.
Attributes Documentation
- mospaces
Return the MoSpaces object supplied on initialisation
- ndim
Return the number of dimensions.
- shape
Return the length along each dimension.
- space
Return the space supplied on initialisation.
- subspaces
Return the space supplied on initialisation split into the subspace along each dimension, e.g. [“o1”, “v1”] for the space “o1v1”.
Methods Documentation
- block_index_of(self: libadcc.MoIndexTranslation, tpl: tuple[SupportsInt | SupportsIndex, ...]) tuple[int, ...]
Get the block index of an index, i.e. get the index which points to the block of the tensor in which the element with the passed index is contained in.
- block_index_spatial_of(self: libadcc.MoIndexTranslation, tpl: tuple[SupportsInt | SupportsIndex, ...]) tuple[int, ...]
Get the spatial block index of an index
The spatial block index is the result of block_index_of modulo the spin blocks, i.e. it maps an index onto the index of the spatial blocks only, such that the resulting value is identical for two index where the MOs only differ by spin. For example the 1st core alpha and the 1st core beta orbital will map to the same value upon a call of this function.
- combine(*args, **kwargs)
Overloaded function.
combine(self: libadcc.MoIndexTranslation, bidx: tuple[typing.SupportsInt | typing.SupportsIndex, …], ibidx: tuple[typing.SupportsInt | typing.SupportsIndex, …]) -> tuple[int, …]
Combine a block index and an in-block index into the appropriate index. Effectively undoes the effect of ‘split’.
combine(self: libadcc.MoIndexTranslation, spin_block: str, bidx: tuple[typing.SupportsInt | typing.SupportsIndex, …], ibidx: tuple[typing.SupportsInt | typing.SupportsIndex, …]) -> tuple[int, …]
Combine a spin block (given as a string of ‘a’s or ‘b’s), a spatial-only block index and an in-block index into the appropriate index. Essentially undoes the effect of ‘spin_of’, ‘block_index_spatial_of’ and ‘inblock_index_of’.
- full_index_of(self: libadcc.MoIndexTranslation, tpl: tuple[SupportsInt | SupportsIndex, ...]) tuple[int, ...]
Map an index given in the space, which was passed upon construction, to the corresponding index in the full MO index range (the ffff space).
- hf_provider_index_of(self: libadcc.MoIndexTranslation, index: tuple[SupportsInt | SupportsIndex, ...]) tuple[int, ...]
Map an index (given in the space passed upon construction) to the indexing convention of the host program provided to adcc as the HF provider.
- inblock_index_of(self: libadcc.MoIndexTranslation, tpl: tuple[SupportsInt | SupportsIndex, ...]) tuple[int, ...]
Get the in-block index, i.e. the index within the tensor block.
- map_range_to_hf_provider(self: libadcc.MoIndexTranslation, ranges: tuple[tuple[SupportsInt | SupportsIndex, SupportsInt | SupportsIndex], ...]) list[dict[str, tuple[tuple[int, int], ...]]]
Map a range of indices to host program indices, i.e. the indexing convention used in the HfProvider, which provides the SCF data to adcc.
Since the mapping between subspace and host program indices might not be contiguous, a list of range mappings is returned. Each mapping is a dict with the keys ‘from’ and ‘to’: ‘from’ holds a range of indices (indexed in the MO subspace) and ‘to’ the equivalent range of indices in the Hartree-Fock provider these are mapped to. Both are given as a tuple of half-open [start, end) index pairs, one pair for each dimension, i.e. in the same format as the ranges argument.
- For example, for a two-dimensional space:
[{‘from’: ((0, 1), (0, 1)), ‘to’: ((0, 1), (2, 3))}, …]
- ranges Tuple of pairs of indices: One index pair for each dimension. Each
pair describes the range of indices along one axis, which should be mapped to the indexing convention of the HfProvider. The range should be thought of as a half-open interval [start, end), where start and end are the indexed passed as a pair to the function.
- spin_of(self: libadcc.MoIndexTranslation, tpl: tuple[SupportsInt | SupportsIndex, ...]) str
Get the spin block of each of the index components as a string.
- split(self: libadcc.MoIndexTranslation, tpl: tuple[SupportsInt | SupportsIndex, ...]) tuple[tuple[int, ...], tuple[int, ...]]
Split an index into block index and in-block index
- split_spin(self: libadcc.MoIndexTranslation, tpl: tuple[SupportsInt | SupportsIndex, ...]) tuple[str, tuple[int, ...], tuple[int, ...]]
Split an index into a spin block descriptor, a spatial block index and an in-block index.