Random SiDB Layout Generator

Header: fiction/technology/sidb/generators/random_layout_generator.hpp

struct generate_random_layout_params

Parameters of the random layout generator.

Public Types

enum class positive_charges : uint8_t

Whether positively charged SiDBs may occur in the generated layout.

Values:

enumerator ALLOWED

Positive charges are allowed.

enumerator FORBIDDEN

Positive charges are forbidden: SiDBs that would enable them are removed again.

enumerator MAY_OCCUR

Positive charges have to be possible: generation is repeated until they are.

Public Members

std::pair<lattice_site, lattice_site> coordinate_pair = {}

The area to place SiDBs in, as two opposite corners.

uint64_t number_of_sidbs = 0

Number of SiDBs to place.

positive_charges positive_sidbs = positive_charges::ALLOWED

Positive charge policy.

model::simulation_parameters sim_params = {}

Physical parameters for the positive charge check.

uint64_t maximal_attempts = static_cast<uint64_t>(10E6)

Maximum number of placement attempts.

uint64_t number_of_unique_generated_layouts = 1

Number of unique layouts to generate with generate_multiple_random_layouts.

uint64_t maximal_attempts_for_multiple_layouts = 1'000'000

Maximum number of generation attempts for multiple layouts.

utils::progress_callback on_progress = {}

Callback that receives the number of placed SiDBs and, for multiple layouts, the number of generated layouts.

inline std::optional<layout> fiction::sidb::generators::generate_random_layout(const generate_random_layout_params &params, const std::optional<layout> &skeleton = std::nullopt)

Generates a random SiDB layout by placing SiDBs at random sites of an area, optionally on top of a skeleton. The skeleton’s lattice, dots, and defects carry over; sites that hold a defect or that a neutral defect affects are left empty. Depending on the positive charge policy, SiDBs that would allow positive charges are removed again, or the generation is repeated until positive charges are possible.

Parameters:
  • params – Parameters.

  • skeleton – The skeleton to place SiDBs on, if any.

Returns:

The generated layout, or std::nullopt if not all SiDBs could be placed within the attempt limit.

inline std::optional<std::vector<layout>> fiction::sidb::generators::generate_multiple_random_layouts(const generate_random_layout_params &params, const std::optional<layout> &skeleton = std::nullopt)

Generates several unique random SiDB layouts with generate_random_layout.

Parameters:
  • params – Parameters; number_of_unique_generated_layouts layouts are requested.

  • skeleton – The skeleton to place SiDBs on, if any.

Returns:

The layouts, or std::nullopt if none could be generated within the attempt limit.

class positive_charges(*values)

Whether positively charged SiDBs may occur in the generated layout.

ALLOWED = 0
FORBIDDEN = 1
MAY_OCCUR = 2
generate_random_sidb_layout(lyt_skeleton: sidb_layout | None = None, *, coordinate_pair: tuple[lattice_site, lattice_site] = ((0, 0, 0), (0, 0, 0)), number_of_sidbs: int = 0, positive_sidbs: positive_charges = positive_charges.ALLOWED, base: int = 3, mu_minus: float = -0.32, epsilon_r: float = 5.6, lambda_tf: float = 5.0, maximal_attempts: int = 10000000, on_progress: Callable[[str, int, int], None] | None = None) → sidb_layout | None

Generate a random SiDB layout within coordinate_pair, optionally extending lyt_skeleton. The keyword options select physical values, charge restrictions, and attempt limits. Returns None when the attempt limit does not produce a layout.

Parameters:
  • coordinate_pair – The area to place SiDBs in, as two opposite corners.

  • number_of_sidbs – Number of SiDBs to place.

  • positive_sidbs – Allow positive charges, forbid positive charges, or require that positive charges may occur.

  • base – Number of charge states: 2 for negative and neutral, or 3 to include positive charges.

  • mu_minus – Negative-charge transition energy in eV.

  • epsilon_r – Relative permittivity (dimensionless).

  • lambda_tf – Thomas-Fermi screening distance in nm.

  • maximal_attempts – Maximum number of placement attempts.

  • on_progress – Callback receiving (task, completed, total); None disables progress reporting.

generate_multiple_random_sidb_layouts(lyt_skeleton: sidb_layout | None = None, *, coordinate_pair: tuple[lattice_site, lattice_site] = ((0, 0, 0), (0, 0, 0)), number_of_sidbs: int = 0, positive_sidbs: positive_charges = positive_charges.ALLOWED, base: int = 3, mu_minus: float = -0.32, epsilon_r: float = 5.6, lambda_tf: float = 5.0, maximal_attempts: int = 10000000, number_of_unique_generated_layouts: int = 1, maximal_attempts_for_multiple_layouts: int = 1000000, on_progress: Callable[[str, int, int], None] | None = None) → list[sidb_layout] | None

Generate distinct random SiDB layouts, optionally extending lyt_skeleton. The keyword options select the area, physical values, requested count, and attempt limits. Returns None if no layout is generated; the attempt limit can yield fewer layouts than requested.

Parameters:
  • coordinate_pair – The area to place SiDBs in, as two opposite corners.

  • number_of_sidbs – Number of SiDBs to place.

  • positive_sidbs – Allow positive charges, forbid positive charges, or require that positive charges may occur.

  • base – Number of charge states: 2 for negative and neutral, or 3 to include positive charges.

  • mu_minus – Negative-charge transition energy in eV.

  • epsilon_r – Relative permittivity (dimensionless).

  • lambda_tf – Thomas-Fermi screening distance in nm.

  • maximal_attempts – Maximum number of placement attempts.

  • number_of_unique_generated_layouts – Number of unique layouts to generate with generate_multiple_random_sidb_layouts.

  • maximal_attempts_for_multiple_layouts – Maximum number of generation attempts for multiple layouts.

  • on_progress – Callback receiving (task, completed, total); None disables progress reporting.