httk.atomistic.models.crystalpattern.anonymize

Validation and canonical labelling helpers for anonymized structures.

Functions

dummy_species(label)

Return the exact dummy species used by anonymous structures.

is_dummy_species(species)

Return whether species has precisely the sanctioned dummy-species shape.

canonical_dummy_assignment(amounts)

Map element-like keys to anonymous symbols by descending amount.

require_anonymizable(structure)

Reject structure features outside this phase's deliberate scope.

Module Contents

httk.atomistic.models.crystalpattern.anonymize.dummy_species(label)[source]

Return the exact dummy species used by anonymous structures.

Parameters:

label (str) – The anonymous symbol to use as the species name.

Returns:

The canonical dummy species.

Return type:

httk.atomistic.models.species.species.Species

httk.atomistic.models.crystalpattern.anonymize.is_dummy_species(species)[source]

Return whether species has precisely the sanctioned dummy-species shape.

Parameters:

species (httk.atomistic.models.species.species.Species) – The species to inspect.

Returns:

Whether the species is a canonical dummy species.

Return type:

bool

httk.atomistic.models.crystalpattern.anonymize.canonical_dummy_assignment(amounts)[source]

Map element-like keys to anonymous symbols by descending amount.

Parameters:

amounts (collections.abc.Sequence[tuple[str, fractions.Fraction | int]]) – The keys and represented site counts.

Returns:

The deterministic key-to-anonymous-symbol assignment.

Return type:

dict[str, str]

httk.atomistic.models.crystalpattern.anonymize.require_anonymizable(structure)[source]

Reject structure features outside this phase’s deliberate scope.

Only fully occupied, single-real-element site species are anonymized. Future phases may add merge or label-preserving modes for decorated species; this mode intentionally refuses those cases, as well as assemblies, stated compositions, and site moments.

Parameters:

structure (Any) – The structure whose representation is being anonymized.

Raises:

ValueError – If the structure contains unsupported composition features.