httk.io.cif.expand_asu¶
Functions¶
|
Hashable key for a position after snapping. |
|
Look for k in pos_map; if missing, check the 26 neighbors |
|
Apply a (fractional) symmetry operation and wrap to [0,1). |
|
|
|
Optional helper mirroring your magnetic 'separate_noneq_atoms' behavior: |
|
Generalized ASU expansion. |
|
|
|
Numbering that separates non-equivalent atoms (labels), mapping each label to a unique id, |
|
Read a CIF file, expand the asymmetric unit, and return the result. |
|
Read an mCIF file, expand the asymmetric unit, and return the result. |
Module Contents¶
- httk.io.cif.expand_asu.pos_key(v, grid_den, tol=1e-08)[source]¶
Hashable key for a position after snapping.
- httk.io.cif.expand_asu.find_adjacent_key_wrap(k, pos_map, grid_dens)[source]¶
Look for k in pos_map; if missing, check the 26 neighbors (Chebyshev distance 1) with periodic boundaries. Return (found_key or None).
- httk.io.cif.expand_asu.apply_op_frac(R, t, f)[source]¶
Apply a (fractional) symmetry operation and wrap to [0,1). Works with int-like R and float-like t/f.
- httk.io.cif.expand_asu.asu_data_to_numbers_by_labels(asu_data)[source]¶
Optional helper mirroring your magnetic ‘separate_noneq_atoms’ behavior: give each distinct label a unique number (even if same element symbol).
- httk.io.cif.expand_asu.expand_asu(positions_frac, species, ops, *, grid_dens=16384, tol=1e-06, moments=None, apply_op_moment_fn: collections.abc.Callable[Ellipsis, Any] | None = None, spin_basis=None, basis=None, mag_grid_dens=16384) tuple[Any, Ellipsis][source]¶
Generalized ASU expansion.
For a non-magnetic expansion:
positions_full, species_full = expand_asu(pos, species, ops)
For a magnetic expansion:
positions_full, species_full, moments_full, mom_classes, symops_classes = expand_asu( pos, species, ops, moments=moments, apply_op_moment_fn=apply_op_moment, spin_basis=spin_basis, basis=basis, mag_grid_dens=mag_grid_dens)
For non-magnetic input
opsare(R, t); for magnetic input they are(R, t, time_flag). Duplicate positions are removed using snapped position keys with neighbour wrap-around.
- httk.io.cif.expand_asu.mag_asu_data_to_numbers(mag_asu_data)[source]¶
Numbering that separates non-equivalent atoms (labels), mapping each label to a unique id, while still storing element symbol as numbers_to_species[id]. This is the corrected intent of your original helper.
- httk.io.cif.expand_asu.cif_to_struct(fs, *, separate_noneq_atoms=False, tol=1e-06)[source]¶
Read a CIF file, expand the asymmetric unit, and return the result.
fsis a filename or file-like object (anything accepted by theread_ciflayer). Whenseparate_noneq_atomsis true, unique numbers are assigned by CIF label (even for the same element); otherwise numbers are assigned by element symbol.tolcontrols the expansion consistency tolerance. Returns a dict with the expanded structure data.
- httk.io.cif.expand_asu.expand_mag_asu(fs, *, separate_noneq_atoms=False, error_on_nonmag=True, tol=1e-06, mag_grid_dens=16384)[source]¶
Read an mCIF file, expand the asymmetric unit, and return the result.
fsis a filename or file-like object (anything accepted by theread_cifstack). Whenseparate_noneq_atomsis true, unique numbers are assigned by CIF label (even for the same element symbol); otherwise numbers are assigned by element symbol. Whenerror_on_nonmagis true, an error is raised if no magnetic moments can be extracted.tolis the expansion consistency tolerance andmag_grid_densis the density used when snapping magnetization directions and classes. Returns a dict with the expanded magnetic structure data.