httk.atomistic.io.cif.mcif_parser¶
Functions¶
|
Return the parent propagation basis as a list of |
|
Return |
|
Return the |
|
Convert one normalized mcif block to a neutral magnetic payload. |
|
Read every mcif data block as a neutral magnetic asymmetric-unit payload. |
|
Read an mcif into the neutral payload used by the |
|
Return the first structural mcif block as a neutral magnetic payload. |
Module Contents¶
- httk.atomistic.io.cif.mcif_parser.extract_parent_q_basis(cifblock)[source]¶
Return the parent propagation basis as a list of
(kx, ky, kz)tuples, orNoneif it is not present.- Parameters:
cifblock (dict[str, Any]) – Normalized mcif data for one data block.
- Returns:
Parent propagation vectors, or
Nonewhen the block has none.- Raises:
ValueError – If a propagation vector is not a three-component exact vector.
- Return type:
list[tuple[fractions.Fraction, fractions.Fraction, fractions.Fraction]] | None
- httk.atomistic.io.cif.mcif_parser.extract_fourier_coeffs(cifblock)[source]¶
Return
(coeff_rows, m)wherecoeff_rowsis a list of coefficient tuples(c1, c2, ..., cm)andmis the number of q-vectors detected (>= 0).All present
q{i}_coeffcolumns are found, zipped row-wise with missing entries filled by zeros, and duplicate coefficient tuples are removed.
- httk.atomistic.io.cif.mcif_parser.extract_fourier(cifblock)[source]¶
Return the
(basis, coeffs)descriptor, orNoneif there is insufficient data.basiscomes fromparent_propagation_vector.kxkykzandcoeffsare the unique coefficient tuples fromatom_site_Fourier_wave_vector.q*_coeff.- Parameters:
cifblock (dict[str, Any]) – Normalized mcif data for one data block.
- Returns:
The parent basis and unique coefficient rows, or
Nonewhen either is absent.- Return type:
tuple[list[tuple[fractions.Fraction, fractions.Fraction, fractions.Fraction]], list[tuple[Any, Ellipsis]]] | None
- httk.atomistic.io.cif.mcif_parser.cifblock_to_mag_asu(cifblock, *, error_on_nonmag=False)[source]¶
Convert one normalized mcif block to a neutral magnetic payload.
The payload keeps exact numeric tokens for positions and magnetic moments, raw symmetry-operation strings, and plain mappings and sequences rather than domain objects.
- Parameters:
- Returns:
A neutral mapping containing structural and magnetic channels.
- Raises:
ValueError – If required structural or magnetic data is missing or invalid.
- Return type:
- httk.atomistic.io.cif.mcif_parser.mag_asus_from_mcif_file(source, *, error_on_nonmag=False)[source]¶
Read every mcif data block as a neutral magnetic asymmetric-unit payload.
- Parameters:
source (str | os.PathLike[str] | collections.abc.Iterable[str]) – A filename, open text stream, or iterable of mcif lines.
error_on_nonmag (bool) – Reject blocks without usable magnetic moment columns.
- Returns:
Magnetic payloads for the data blocks in the source.
- Raises:
ValueError – If the mcif stream or a selected block is invalid.
- Return type:
- httk.atomistic.io.cif.mcif_parser.read_mcif_asus(source)[source]¶
Read an mcif into the neutral payload used by the
.mcifloader.Magnetic positions and moments remain exact central tokens, symmetry operations remain raw strings, and the result contains no magnetic-domain objects. Blocks without atom sites are skipped; blocks that cannot be interpreted are reported in
unparsed.- Parameters:
source (str | os.PathLike[str] | collections.abc.Iterable[str]) – A filename, open text stream, or iterable of mcif lines.
- Returns:
A neutral mcif payload containing magnetic blocks, unparsed reasons, and the header.
- Raises:
ValueError – If the mcif stream contains malformed data that prevents parsing.
- Return type:
- httk.atomistic.io.cif.mcif_parser.single_mag_asu_from_mcif_file(source, *, error_on_nonmag=False)[source]¶
Return the first structural mcif block as a neutral magnetic payload.
- Parameters:
source (str | os.PathLike[str] | collections.abc.Iterable[str]) – A filename, open text stream, or iterable of mcif lines.
error_on_nonmag (bool) – Reject the selected block without usable magnetic moments.
- Returns:
The first magnetic asymmetric-unit payload.
- Raises:
ValueError – If no structural block is available or the selected block is invalid.
- Return type: