API Reference

important functions

sqsgenerator.parse_config(config: dict[str, Any] | str, inplace: bool = False) SqsConfigurationFloat | SqsConfigurationDouble[source]

Parse the configuration dictionary into a SqsConfiguration object.

Args:

config (dict[str, Any]): Configuration dictionary. inplace (bool, optional): If True, return a modified version of the input dictionary.

Returns:

SqsConfiguration: Parsed configuration object.

sqsgenerator.optimize(config: dict[str, ~typing.Any] | ~sqsgenerator.core._core.SqsConfigurationFloat | ~sqsgenerator.core._core.SqsConfigurationDouble | str, level: ~sqsgenerator.core._core.LogLevel = <LogLevel.warn: 1>, callback: ~typing.Callable[[~sqsgenerator.core._core.SqsCallbackContextFloat | ~sqsgenerator.core._core.SqsCallbackContextDouble], None] | None = None) SqsResultPackInteractFloat | SqsResultPackInteractDouble | SqsResultPackSplitFloat | SqsResultPackSplitDouble[source]

Optimize the SQS configuration based on the provided parameters.

Args:

config (dict[str, Any] | SqsConfiguration | str): The configuration data to optimize. level (LogLevel): The logging level for the optimization process. Defaults to LogLevel.warn. callback (SqsCallback | None): A callback function to monitor the optimization progress. Defaults to None.

Returns:

SqsResultPack: The result of the optimization process.

sqsgenerator.load_result_pack(data: str, prec: sqsgenerator.core._core.Prec = <Prec.single: 0>) sqsgenerator.core._core.SqsResultPackSplitFloat | sqsgenerator.core._core.SqsResultPackSplitDouble | sqsgenerator.core._core.SqsResultPackInteractFloat | sqsgenerator.core._core.SqsResultPackInteractDouble
sqsgenerator.write(structure: StructureFloat | StructureDouble, filename: str, fmt: str | None = None, backend: Literal['sqsgen', 'ase', 'pymatgen'] = 'sqsgen') None[source]

Write a structure to a file in the specified format.

Args:

structure (Structure): The structure to write. filename (str): The file path to write to. fmt (str): The file format to use.

sqsgenerator.read(filename: str, fmt: str | None = None, backend: Literal['sqsgen', 'ase', 'pymatgen']='sqsgen', prec: Prec = <Prec.double: 1>) StructureFloat | StructureDouble[source]

Read a structure from a file in the specified format.

Args:

filename (str): The file path to read from. fmt (str): The file format to use. backend (Literal[“sqsgen”, “ase”, “pymatgen”]): The backend to use for reading. prec (Prec): The precision type.

Returns:

Structure: The read structure.

conversion functions

sqsgenerator.to_ase(structure: StructureFloat | StructureDouble) Atoms[source]

Convert a Structure to an ASE Atoms object.

Args:

structure (Structure): The input Structure object.

Returns:

Atoms: The converted ASE Atoms object.

sqsgenerator.from_ase(atom: Atoms, prec: Prec = <Prec.double: 1>) StructureFloat | StructureDouble[source]

Convert an ASE Atoms object to a Structure.

Args:

atom (Atoms): The ASE Atoms object. prec (Prec, optional): The precision type. Defaults to Prec.double.

Returns:

Structure: The converted Structure object.

sqsgenerator.to_pymatgen(structure: StructureFloat | StructureDouble) Structure[source]

Convert a Structure to a pymatgen Structure.

Args:

structure (Structure): The input Structure object.

Returns:

PymatgenStructure: The converted pymatgen Structure object.

sqsgenerator.from_pymatgen(ps: Structure, prec: Prec = <Prec.double: 1>) StructureFloat | StructureDouble[source]

Convert a pymatgen Structure to a Structure.

Args:

ps (PymatgenStructure): The pymatgen Structure object. prec (Prec, optional): The precision type. Defaults to Prec.double.

Returns:

Structure: The converted Structure object.

classes

For each of the classes with a Double suffix there exists also a Float variant. The Float variants are not documented here to reduce clutter, but they behave exactly the same as their Double counterparts, just with lower precision.

sqsgenerator.core.Structure

alias of StructureFloat | StructureDouble

class sqsgenerator.core.StructureDouble
property atoms
bytes(self: sqsgenerator.core._core.StructureDouble) bytes
property distance_matrix
dump(self: sqsgenerator.core._core.StructureDouble, arg0: sqsgenerator.core._core.StructureFormat) str
property frac_coords
static from_bytes(bytes: str) sqsgenerator.core._core.StructureDouble
static from_json(arg0: str, arg1: sqsgenerator.core._core.StructureFormat) sqsgenerator.core._core.ParseError | sqsgenerator.core._core.StructureDouble
static from_poscar(string: str) sqsgenerator.core._core.ParseError | sqsgenerator.core._core.StructureDouble
property lattice
property num_species
shell_matrix(self: sqsgenerator.core._core.StructureDouble, shell_radii: collections.abc.Sequence[SupportsFloat | SupportsIndex], atol: SupportsFloat | SupportsIndex = 2.220446049250313e-16, rtol: SupportsFloat | SupportsIndex = 1e-09) Annotated[numpy.typing.NDArray[numpy.uint64], '[m, n]']
property sites
property species
supercell(self: sqsgenerator.core._core.StructureDouble, sa: SupportsInt | SupportsIndex, sb: SupportsInt | SupportsIndex, sc: SupportsInt | SupportsIndex) sqsgenerator.core._core.StructureDouble
property symbols
without_vacancies(self: sqsgenerator.core._core.StructureDouble) sqsgenerator.core._core.StructureDouble
sqsgenerator.core.SqsResultPack

alias of SqsResultPackInteractFloat | SqsResultPackInteractDouble | SqsResultPackSplitFloat | SqsResultPackSplitDouble

sqsgenerator.core.SqsResult

alias of SqsResultInteractFloat | SqsResultInteractDouble | SqsResultSplitFloat | SqsResultSplitDouble

class sqsgenerator.core.SqsResultInteractDouble
property objective
rank(self: sqsgenerator.core._core.SqsResultInteractDouble) str
shell_index(self: sqsgenerator.core._core.SqsResultInteractDouble, shell: SupportsInt | SupportsIndex) int | None
property species
species_index(self: sqsgenerator.core._core.SqsResultInteractDouble, species: SupportsInt | SupportsIndex) int | None
sro(*args, **kwargs)

Overloaded function.

  1. sro(self: sqsgenerator.core._core.SqsResultInteractDouble, shell: typing.SupportsInt | typing.SupportsIndex, i: str, j: str) -> sqsgenerator.core._core.SroParameterDouble

  2. sro(self: sqsgenerator.core._core.SqsResultInteractDouble, shell: typing.SupportsInt | typing.SupportsIndex, i: typing.SupportsInt | typing.SupportsIndex, j: typing.SupportsInt | typing.SupportsIndex) -> sqsgenerator.core._core.SroParameterDouble

  3. sro(self: sqsgenerator.core._core.SqsResultInteractDouble, shell: typing.SupportsInt | typing.SupportsIndex) -> list[sqsgenerator.core._core.SroParameterDouble]

  4. sro(self: sqsgenerator.core._core.SqsResultInteractDouble, i: typing.SupportsInt | typing.SupportsIndex, j: typing.SupportsInt | typing.SupportsIndex) -> list[sqsgenerator.core._core.SroParameterDouble]

  5. sro(self: sqsgenerator.core._core.SqsResultInteractDouble, i: str, j: str) -> list[sqsgenerator.core._core.SroParameterDouble]

  6. sro(self: sqsgenerator.core._core.SqsResultInteractDouble) -> typing.Annotated[numpy.typing.NDArray[numpy.float64], “[?, ?, ?]”]

structure(self: sqsgenerator.core._core.SqsResultInteractDouble) sqsgenerator.core._core.StructureDouble
class sqsgenerator.core.SqsResultSplitDouble
property objective
property species
structure(self: sqsgenerator.core._core.SqsResultSplitDouble) sqsgenerator.core._core.StructureDouble
sublattices(self: sqsgenerator.core._core.SqsResultSplitDouble) list[sqsgenerator.core._core.SqsResultInteractDouble]
sqsgenerator.core.SqsConfiguration

alias of SqsConfigurationFloat | SqsConfigurationDouble

class sqsgenerator.core.SqsConfigurationDouble
bytes(self: sqsgenerator.core._core.SqsConfigurationDouble) bytes
property chunk_size
property composition
static from_bytes(arg0: str) sqsgenerator.core._core.SqsConfigurationDouble
property iteration_mode
property iterations
json(self: sqsgenerator.core._core.SqsConfigurationDouble) str
property pair_weights
property prefactors
property shell_radii
property shell_weights
structure(self: sqsgenerator.core._core.SqsConfigurationDouble) sqsgenerator.core._core.StructureDouble
property sublattice_mode
property target_objective
property thread_config