Physical Simulation of SiDBs

These headers provide auxiliary functionality for the physical simulation of SiDBs layouts.

SiDB Charge States

Possible charge states of SiDBs.

Header: fiction/technology/sidb_charge_state.hpp

enum class fiction::sidb_charge_state : int8_t

Charge states of SiDBs.

Values:

enumerator NEGATIVE
enumerator NEUTRAL
enumerator POSITIVE
enumerator NONE
inline constexpr int8_t fiction::charge_state_to_sign(const sidb_charge_state &cs) noexcept

Converts the charge state into an integer (-1, 0, 1).

Parameters:

cs – SiDB charge state.

Returns:

Integer representing the SiDB’s charge state.

inline constexpr sidb_charge_state fiction::sign_to_charge_state(const int8_t sg) noexcept

Converts an integer (-1, 0, 1) into a charge state.

Parameters:

sg – Integer (-1, 0, 1) representing a charge state.

Returns:

sidb_charge_state representation of sg.

inline std::string fiction::charge_configuration_to_string(const std::vector<sidb_charge_state> &charge_distribution) noexcept

Converts a vector of charge states to a string representation ("-101...").

Parameters:

charge_distribution – A vector of SiDBs charge states.

Returns:

A string representation of the charge states.

SiDB Charge Distribution Surface

The charge distribution surface can be layered on top of any SiDB layout to add representation of possible charge distributions of the SiDBs. Charge distribution surfaces are returned by the SiDB physical simulation algorithms.

Header: fiction/technology/charge_distribution_surface.hpp

template<typename Lyt, bool has_charge_distribution_interface = std::conjunction_v<has_assign_charge_state<Lyt>, has_get_charge_state<Lyt>>>
class charge_distribution_surface : public Lyt

A layout type to layer on top of any SiDB cell-level layout. It implements an interface to store and access SiDBs’ charge states.

Template Parameters:
  • Lyt – SiDB cell-level layout type.

  • has_sidb_charge_distribution – Automatically determines whether a charge distribution interface is already present.

template<typename Lyt>
class charge_distribution_surface<Lyt, true> : public Lyt
template<typename Lyt>
class charge_distribution_surface<Lyt, false> : public Lyt

Public Functions

inline explicit charge_distribution_surface(const sidb_simulation_parameters &params = sidb_simulation_parameters{}, const sidb_charge_state cs = sidb_charge_state::NEGATIVE)

Standard constructor for empty layouts.

Parameters:
  • params – Physical parameters used for the simulation (µ_minus, base number, …).

  • cs – The charge state used for the initialization of all SiDBs, default is a negative charge.

inline explicit charge_distribution_surface(const Lyt &lyt, const sidb_simulation_parameters &params = sidb_simulation_parameters{}, const sidb_charge_state cs = sidb_charge_state::NEGATIVE)

Standard constructor for existing layouts.

Parameters:
  • lyt – Cell-level layout.

  • params – Physical parameters used for the simulation (µ_minus, base number, …).

  • cs – The charge state used for the initialization of all SiDBs, default is a negative charge.

  • variable_cells – SiDB which charge state is variable (called dependent-cell).

  • external_potential – Externally applied local electrostatic potential.

inline charge_distribution_surface(const charge_distribution_surface<Lyt> &cds)

Copy constructor.

Parameters:

cds – Other charge_distribution_surface.

inline charge_distribution_surface &operator=(const charge_distribution_surface &other)

Copy assignment operator.

Parameters:

othercharge_distribution_surface.

inline std::vector<std::pair<double, double>> get_all_sidb_locations_in_nm() const noexcept

This function returns the locations of all SiDBs in nm of the form (x,y).

Returns:

Vector of SiDB nanometer positions (unit: nm).

inline void assign_cell_type(const typename Lyt::cell &c, const typename Lyt::cell_type &ct) noexcept

This function assigns a cell type to a given cell of the underlying cell-level layout.

Parameters:
  • c – Cell whose type is changed.

  • ct – Cell type which is assigned to the given cell.

inline void assign_physical_parameters(const sidb_simulation_parameters &params) noexcept

This function assigns the physical parameters for the simulation.

Parameters:

params – Physical parameters to be assigned.

inline sidb_simulation_parameters get_simulation_params() const noexcept

This function retrieves the physical parameters of the simulation.

Returns:

sidb_simulation_parameters struct containing the physical parameters of the simulation.

inline bool charge_exists(const sidb_charge_state cs) const noexcept

This function checks if any SiDB exhibits the given charge state.

Parameters:

cs – Charge state.

inline int64_t cell_to_index(const typename Lyt::cell &c) const noexcept

This function searches the index of an SiDB.

Parameters:

c – The cell to find the index of.

Returns:

The index of the cell in the layout. Returns -1 if the cell is not part of the layout.

inline void assign_charge_state(const typename Lyt::cell &c, const sidb_charge_state cs, const bool update_charge_index = true) noexcept

This function assigns the given charge state to the given cell of the layout.

Parameters:
  • c – The cell to which a charge state is to be assigned.

  • cs – The charge state to be assigned to the cell.

  • update_charge_indextrue if the charge index should be changed, false otherwise.

inline void assign_charge_by_cell_index(const uint64_t index, const sidb_charge_state cs) noexcept

This function assigns the given charge state to the cell of the layout at the specified index. It updates the cell_charge member of strg object with the new charge state of the specified cell.

Parameters:
  • index – The index of the cell.

  • cs – The charge state to be assign to the cell.

inline void assign_all_charge_states(const sidb_charge_state cs) noexcept

This function assigns the charge state of all SiDBs in the layout to a given charge state.

Parameters:

cs – The charge state to be assigned to all the SiDBs.

inline void assign_dependent_cell(const typename Lyt::cell &c) noexcept

This function assigns the dependent cell (i.e., cell which charge state is set based on the neighbor cells and the population stability).

Note

c has to be part of the initialized charge distribution surface layout.

Parameters:

c – cell which is set as the dependent cell.

inline void assign_base_number(const uint8_t base) noexcept

This function assigns the base number for the simulation.

Parameters:

base – Base number to be assigned.

inline void add_sidb_defect_to_potential_landscape(const typename Lyt::cell &c, const sidb_defect &defect) noexcept

This function adds a defect to the layout.

Parameters:
  • c – The cell to which a defect is added.

  • defect – Defect which is added to the layout.

inline void erase_defect(const typename Lyt::cell &c) noexcept

This function erases a defect to the layout.

Parameters:

c – The cell where a defect is erased.

inline void assign_charge_state_by_cell_index(const uint64_t index, const sidb_charge_state cs, const bool update_charge_configuration = true) noexcept

This function assigns the given charge state to the cell (accessed by index) of the layout.

Parameters:
  • index – The index of the cell to which a charge state is to be assigned.

  • cs – The charge state to be assigned to the cell.

  • update_charge_configuration – if set to true, the charge distribution index is updated after the charge distribution is changed.

inline sidb_charge_state get_charge_state(const typename Lyt::cell &c) const noexcept

This function returns the charge state of a given cell.

Parameters:

c – The cell.

Returns:

The charge state of the given cell.

inline sidb_charge_state get_charge_state_by_index(const uint64_t index) const noexcept

This function returns the charge state of a cell of the layout at a given index.

Parameters:

index – The index of the cell.

Returns:

The charge state of the cell at the given index.

inline std::vector<sidb_charge_state> get_all_sidb_charges() const noexcept

This function returns all SiDB charges of the placed SiDBs as a vector.

Returns:

Vector of SiDB charge states.

inline std::vector<int64_t> negative_sidb_detection() const noexcept

This function can be used to detect which SiDBs must be negatively charged due to their location. Important: This function must be applied to a charge layout where all SiDBs are negatively initialized.

Returns:

Vector of indices describing which SiDBs must be negatively charged.

inline double get_nm_distance_between_sidbs(const typename Lyt::cell &c1, const typename Lyt::cell &c2) const noexcept

This function returns the distance between two cells in nanometer (unit: nm).

Parameters:
  • c1 – the first cell to compare.

  • c2 – the second cell to compare.

Returns:

a constexpr double representing the distance in nm between the two cells.

inline double get_nm_distance_by_indices(const uint64_t index1, const uint64_t index2) const noexcept

This function calculates and returns the distance between two cells in nanometer (accessed by indices) (unit: nm).

Parameters:
  • index1 – The first index.

  • index2 – The second index.

Returns:

The distance in nanometer between index1 and index2 (indices correspond to unique SiDBs) (unit: nm).

inline double calculate_chargeless_potential_between_sidbs_by_index(const uint64_t index1, const uint64_t index2) const noexcept

This function calculates and returns the chargeless electrostatic potential between two cells (SiDBs) in Volt (unit: V).

Parameters:
  • index1 – The first index.

  • index1 – The second index.

Returns:

The chargeless electrostatic potential between index1 and index2 (unit: V).

inline double calculate_chargeless_potential_between_sidbs(const typename Lyt::cell &c1, const typename Lyt::cell &c2) const noexcept

This function calculates and returns the chargeless potential in Volt of a pair of cells based on their distance and simulation parameters (unit: V).

Parameters:
  • c1 – The first cell.

  • c2 – The second cell.

Returns:

The potential between c1 and c2 (unit: V).

inline double get_chargeless_potential_between_sidbs(const typename Lyt::cell &c1, const typename Lyt::cell &c2) const noexcept

This function returns the chargeless electrostatic potential between two cells in V (unit: V).

Note

If the signed electrostatic potential \(V_{i,j}\) is required, use the get_potential_between_sidbs function.

Parameters:
  • c1 – The first cell.

  • c2 – The second cell.

Returns:

The chargeless electrostatic potential between c1 and c2, i.e, \(\frac{V_{i,j}}{n_j}\) (unit: V).

inline double get_chargeless_potential_by_indices(const uint64_t index1, const uint64_t index2) const noexcept

This function calculates and returns the chargeless potential of two indices (representing two SiDBs) in Volt.

Parameters:
  • index1 – The first index.

  • index2 – The second index.

Returns:

The potential between index1 and index2.

inline double get_potential_between_sidbs(const typename Lyt::cell &c1, const typename Lyt::cell &c2) const noexcept

This function calculates and returns the electrostatic potential at one cell (c1) generated by another cell (c2) in Volt (unit: V).

Note

If the chargeless electrostatic potential \(\frac{V_{i,j}}{n_j}\) is required, use the get_chargeless_potential_between_sidbs function.

Parameters:
  • c1 – The first cell.

  • c2 – The second cell.

Returns:

The electrostatic potential between c1 and c2, i.e., \(V_{i,j}\) (unit: V).

inline void update_local_potential(const charge_distribution_history history_mode = charge_distribution_history::NEGLECT) noexcept

This function calculates the local electrostatic potential in Volt for each SiDB position, including external electrostatic potentials (generated by electrodes, defects, etc.) (unit: V).

Parameters:

history_mode – If set to NEGLECT, the local electrostatic is calculated from scratch, without using the results of the previous charge distribution.

inline std::optional<double> get_local_potential(const typename Lyt::cell &c) const noexcept

The function returns the local electrostatic potential at a given SiDB position in V.

Parameters:

c – The cell defining the SiDB position.

Returns:

Local potential at given cell position. If there is no SiDB at the given cell, std::nullopt is returned (unit: V).

inline std::optional<double> get_local_potential_by_index(const uint64_t index) const noexcept

This function returns the local electrostatic potential at a given index position in Volt (unit: V).

Parameters:

index – The index defining the SiDB position.

Returns:

local potential at given index position. If there is no SiDB at the given index (which corresponds to a unique cell), std::nullopt is returned (unit: V).

inline void assign_system_energy_to_zero() noexcept

This function assign the electrostatic system energy to zero (unit: eV). It can be used if only one SiDB is charged.

inline void recompute_system_energy() noexcept

This function calculates the system’s total electrostatic potential energy and stores it in the storage (unit: eV).

inline double get_system_energy() const noexcept

This function returns the currently stored system’s total electrostatic potential energy in eV.

Returns:

The system’s total electrostatic potential energy (unit: eV).

inline void update_after_charge_change(const dependent_cell_mode dep_cell = dependent_cell_mode::FIXED, const energy_calculation energy_calculation_mode = energy_calculation::UPDATE_ENERGY, const charge_distribution_history history_mode = charge_distribution_history::NEGLECT) noexcept

The function updates the local potential (unit: Volt) and the system energy (unit: eV) after a charge change.

Parameters:
  • dep_cell – dependent_cell_mode::FIXED if the state of the dependent cell should not change, dependent_cell_mode::VARIABLE if it should.

  • energy_calculation_mode – energy_calculation::UPDATE_ENERGY if the electrostatic potential energy should be updated, energy_calculation::KEEP_ENERGY otherwise.

  • history_mode – charge_distribution_history::NEGLECT if the information (local electrostatic energy) of the previous charge distribution is used to make the update more efficient, charge_distribution_history::CONSIDER otherwise.

inline void validity_check() noexcept

The physically validity of the current charge distribution is evaluated and stored in the storage struct. A charge distribution is valid if the Population Stability and the Configuration Stability is fulfilled.

inline bool is_physically_valid() const noexcept

This function returns the currently stored validity of the present charge distribution layout.

Returns:

The validity of the present charge distribution.

inline void charge_distribution_to_index_general() const noexcept

The charge distribution of the charge distribution surface is converted to a unique index. It is used to map every possible charge distribution of an SiDB layout to a unique index.

IMPORTANT: This function can be used whenever a charge distribution needs to be converted to a charge index. However, this function is not optimized compared to charge_distribution_to_index.

inline void charge_distribution_to_index() const noexcept

The charge distribution of the charge distribution surface is converted to a unique index. It is used to map every possible charge distribution of an SiDB layout to a unique index.

inline charge_index_base get_charge_index_and_base() const noexcept

The charge index of the current charge distribution is returned.

Returns:

A pair with the charge index and the used base.

inline void increase_charge_index_by_one(const dependent_cell_mode dep_cell = dependent_cell_mode::FIXED, const energy_calculation energy_calculation_mode = energy_calculation::UPDATE_ENERGY, const charge_distribution_history history_mode = charge_distribution_history::NEGLECT, const exhaustive_sidb_simulation_engine engine = exhaustive_sidb_simulation_engine::EXGS) noexcept

The charge index is increased by one, but only if it is less than the maximum charge index for the given layout. If that’s the case, it is increased by one and afterward, the charge configuration is updated by invoking the index_to_charge_distribution() function.

Parameters:
  • dep_cell – dependent_cell_mode::FIXED if the state of the dependent cell should not change, dependent_cell_mode::VARIABLE if it should.

  • energy_calculation_mode – energy_calculation::UPDATE_ENERGY if the electrostatic potential energy should be updated, energy_calculation::KEEP_ENERGY otherwise.

  • history_mode – charge_distribution_history::NEGLECT if the information (local electrostatic energy) of the previous charge distribution is used to make the update more efficient, charge_distribution_history::CONSIDER otherwise.

  • engine – exhaustive_sidb_simulation_engine::EXGS if ExGS should be used, exhaustive_sidb_simulation_engine::QUICKEXACT for QuickExact.

inline uint64_t get_max_charge_index() const noexcept

This function returns the maximum index of the cell-level layout.

Returns:

The maximal possible charge distribution index.

inline void assign_charge_index(const uint64_t charge_index) noexcept

Assigns a given charge index to the charge distribution layout. Charge distribution is updated according to the set charge index.

Parameters:

charge_index – charge index of the new charge distribution.

inline void adjacent_search(const double alpha, std::vector<uint64_t> &negative_indices) noexcept

This function is used for the QuickSim algorithm (see quicksim.hpp). It gets a vector with indices representing negatively charged SiDBs as input. Afterward, a distant and a neutrally charged SiDB is localized using a min-max diversity algorithm. This selected SiDB is set to “negative” and the index is added to the input vector such that the next iteration works correctly.

Parameters:
  • alpha – A parameter for the algorithm (default: 0.7).

  • negative_indices – Vector of SiDBs indices that are already negatively charged (double occupied).

inline void assign_global_external_potential(const double potential_value, dependent_cell_mode dep_cell = dependent_cell_mode::FIXED) noexcept

This function can be used to assign a global external electrostatic potential in Volt (unit: V) to the layout (e.g this could be a planar external electrode).

Parameters:
  • potential_value – Value of the global external electrostatic potential in Volt (e.g. -0.3). Charge-transition levels are shifted by this value.

  • dep_cell – dependent_cell_mode::FIXED if the state of the dependent cell should not change, dependent_cell_mode::VARIABLE if it should.

inline bool is_three_state_simulation_required() noexcept

This function determines if given layout has to be simulated with three states since positively charged SiDBs can occur due to the local potential analysis. In addition, all SiDBs that can be positively charged are collected.

Note

All SiDBs have to be set to negatively charged.

Returns:

return value is true when three state simulation is required.

inline std::size_t num_negative_sidbs() const noexcept

Counts the number of SiDBs with a negative charge state.

Returns:

The number of SiDBs with a negative charge state.

inline std::size_t num_neutral_sidbs() const noexcept

Counts the number of SiDBs with a neutral charge state.

Returns:

The number of SiDBs with a neutral charge state.

inline std::size_t num_positive_sidbs() const noexcept

Counts the number of SiDBs with a positive charge state.

Returns:

The number of SiDBs with a positive charge state.

inline std::vector<typename Lyt::cell> get_positive_candidates() const noexcept

This functions returns all cells that could be positively charged. However, this must not be necessarily the case in a physically valid layout.

Returns:

All cell that could be positively charged.

inline int64_t three_state_cell_to_index(const typename Lyt::cell &c) const noexcept

This function searches the index of a cell which is part of the sublayout (i.e. it should be a cell which can be positively charged).

Parameters:

c – Cell that should be part of the sublayout.

Returns:

Index (i.e. position in the vector) of the input cell.

inline int64_t two_state_cell_to_index(const typename Lyt::cell &c) const noexcept

This function searches the index of a cell which is not part of the sublayout (i.e. it should be a cell which is either neutrally or negatively charged).

Parameters:

c – Cell that should not be part of the sublayout.

Returns:

Index (i.e. position in the vector) of the input cell.

inline Lyt::cell index_to_cell(const uint64_t index) const noexcept

This function searches the cell of a given index.

Parameters:

c – The index to find the cell of.

Returns:

The cell in the layout for the given index. Returns dead-coordinate if the index is not assigned to a not empty cell in the layout.

inline Lyt::cell index_to_three_state_cell(const uint64_t index) const noexcept

This function finds the cell for a given index which is a candidate to be positively charged of a given index.

Parameters:

index – The index to find the cell of (cell is candidate to be positively charged).

Returns:

Positive cell candidate. Dead-coordinate is returned if the index is not assigned to a not empty cell in the layout.

inline Lyt::cell index_to_two_state_cell(const uint64_t index) const noexcept

This function finds the cell which can only be neutrally or negatively charged of a given index.

Parameters:

index – The index to find the cell of.

Returns:

The cell (which cannot be positively charged) in the layout for the given index. Dead-coordinate is returned if the index is not assigned to a not empty cell in the layout.

inline double chargeless_potential_at_given_distance(const double distance) const noexcept

This function calculates and returns the chargeless electrostatic potential in Volt for a given distance in nanometer.

Parameters:

distance – Distance in nanometer between position and defect (unit: nm).

Returns:

The chargeless electrostatic potential at a given distance (unit: V).

inline double chargeless_potential_generated_by_defect_at_given_distance(const double distance, const sidb_defect &defect = sidb_defect{}) const noexcept

This function calculates the chargeless potential in Volt generated by a defect at a given distance in nanometer.

Parameters:
  • distance – Distance between position and defect (unit: nm.

  • sidb_defect – Defect (including defect specific parameters).

Returns:

The chargeless electrostatic potential in Volt generated by the defect at a given distance (unit: V).

inline void assign_local_external_potential(const std::unordered_map<typename Lyt::cell, double> &external_potential) noexcept

This function can be used to assign an external local electrostatic potential in Volt to the layout. All important attributes of the charge layout are updated automatically.

Parameters:
  • cell – Cell to which the local external potential is applied.

  • external_voltage – External electrostatic potential in Volt applied to different cells.

inline std::unordered_map<typename Lyt::cell, double> get_local_external_potentials() noexcept

This function returns the local external electrostatic potential in Volt applied to the layout.

Returns:

External electrostatic potential as unordered map. The cell is used as key and the external electrostatic potential in Volt (unit: V) at its position as value.

inline std::unordered_map<typename Lyt::cell, double> get_local_defect_potentials() noexcept

This function returns the local electrostatic potentials which are generated by defects.

Returns:

Local electrostatic potential in Volt generated by the defects at each each cell.

inline std::unordered_map<typename Lyt::cell, const sidb_defect> get_defects() noexcept

This function returns the defects.

Returns:

Placed defects with cell position and type.

inline void update_charge_state_of_dependent_cell() noexcept

The charge state of the dependent-SiDB is updated based on the local electrostatic potential at its position. All other local electrostatic potentials are then also updated if the charge state of the dependent-SiDB has changed.

inline uint64_t get_charge_index_of_sub_layout() const noexcept

This function returns the charge index of the sublayout (cells that can be positively charged).

Returns:

The charge distribution index of the sublayout.

inline void charge_index_gray_code_to_charge_distribution(const uint64_t new_gray_code, const uint64_t old_gray_code) noexcept

This function changes the current charge distribution based on two given Gray codes (Important: The two Gray codes should only differ by one bit)

Parameters:
  • new_gray_code – Gray code as uint64_t of the new charge distribution.

  • old_gray_code – Gray code as uint64_t of the previous charge distribution layout.

inline void increase_charge_index_of_sub_layout_by_one(const dependent_cell_mode dependent_cell_fixed = dependent_cell_mode::FIXED, const energy_calculation recompute_system_energy = energy_calculation::UPDATE_ENERGY, const charge_distribution_history consider_history = charge_distribution_history::NEGLECT, const exhaustive_sidb_simulation_engine engine = exhaustive_sidb_simulation_engine::QUICKEXACT) noexcept

The charge index of the sublayout is increased by one and the charge distribution is updated correspondingly.

Parameters:
  • dependent_cell – dependent_cell_mode::FIXED if the state of the dependent cell should not change, dependent_cell_mode::VARIABLE if it should.

  • energy_calculation_mode – energy_calculation::UPDATE_ENERGY if the electrostatic potential energy should be updated, energy_calculation::KEEP_ENERGY otherwise.

  • history_mode – charge_distribution_history::NEGLECT if the information (local electrostatic energy) of the previous charge distribution is used to make the update more efficient, charge_distribution_history::CONSIDER otherwise.

  • engine – exhaustive_sidb_simulation_engine::EXGS if ExGSshould be used, exhaustive_sidb_simulation_engine::QUICKEXACT forQuickExact`.

inline void assign_charge_index_by_gray_code(const uint64_t current_gray_code, const uint64_t previous_gray_code, const dependent_cell_mode dep_cell = dependent_cell_mode::FIXED, const energy_calculation energy_calc_mode = energy_calculation::UPDATE_ENERGY, const charge_distribution_history history_mode = charge_distribution_history::NEGLECT) noexcept

The charge index is assigned by a Gray code number in decimal.

Parameters:
  • current_gray_code – Gray code in decimal representing the new charge distribution.

  • previous_gray_code – Gray code in decimal representing the old charge distribution.

  • dep_cell – dependent_cell_mode::FIXED if the state of the dependent cell should not change, dependent_cell_mode::VARIABLE if it should.

  • energy_calculation_mode – energy_calculation::UPDATE_ENERGY if the electrostatic potential energy should be updated, energy_calculation::KEEP_ENERGY otherwise.

  • history_mode – charge_distribution_history::NEGLECT if the information (local electrostatic energy) of the previous charge distribution is used to make the update more efficient, charge_distribution_history::CONSIDER otherwise.

inline void reset_charge_index_sub_layout(const exhaustive_sidb_simulation_engine engine = exhaustive_sidb_simulation_engine::QUICKEXACT) noexcept

Resets the charge index of the sublayout (cells of the layout that can also be positively charged).

inline uint64_t get_max_charge_index_sub_layout() const noexcept

Returns the maximum index of the sublayout (cells that can be positively charged).

Returns:

The maximal possible charge distribution index of the sublayout.

inline void assign_charge_index_by_two_gray_codes(const uint64_t gray_code, const uint64_t gray_code_old) noexcept

Assign a given charge index to the charge distribution layout. This function should be used if new and old charge index are given as Gray code to provide high performance.

Parameters:
  • gray_code – charge index (as Gray code in decimal) of the new charge distribution.

  • gray_code_old – charge index (as Gray code in decimal) of the old charge distribution.

inline std::vector<typename Lyt::cell> get_sidb_order() const noexcept

This function returns all SiDBs of the layout.

Returns:

Vector with all cells.

inline void add_sidb(const typename Lyt::cell &c, const sidb_charge_state charge) noexcept

This function can be used to add an SiDB to the layout. The SiDB is only added to the cell_charge and the sidb_order vector.

Parameters:
  • c – Cell which is added to the layout.

  • charge – Charge state of the added cell.

struct charge_distribution_storage

Public Functions

inline explicit charge_distribution_storage(const sidb_simulation_parameters &params = sidb_simulation_parameters{})

Standard constructor for the charge_distribution_storage.

Parameters:

params – Physical parameters used for the simulation (µ_minus, base number, …).

Public Members

sidb_simulation_parameters simulation_parameters = {}

Stores all physical parameters used for the simulation.

std::vector<typename Lyt::cell> sidb_order = {}

All cells that are occupied by an SiDB are stored in order.

std::vector<typename Lyt::cell> sidb_order_without_three_state_cells = {}

All cells that cannot be positively charged in a physically valid layout.

std::vector<sidb_charge_state> cell_charge = {}

The SiDBs’ charge states are stored. Corresponding cells are stored in sidb_order.

distance_matrix nm_dist_mat = {}

Distance between SiDBs are stored as matrix (unit: nm).

potential_matrix pot_mat = {}

Electrostatic potential between SiDBs are stored as matrix (here, still charge-independent, unit: V).

std::unordered_map<typename Lyt::cell, double> defect_local_pot = {}

Electrostatic potential at each SiDB position which is generated by defects (unit: eV).

std::unordered_map<typename Lyt::cell, double> local_external_pot = {}

External electrostatic potential in V at each SiDB position (can be used when different potentials are applied to different SiDBs).

local_potential local_pot = {}

Electrostatic potential at each SiDB position. Has to be updated when charge distribution is changed (unit: V).

double system_energy = {0.0}

Stores the electrostatic energy of a given charge distribution (unit: eV).

bool validity = false

Label if given charge distribution is physically valid (see https://ieeexplore.ieee.org/document/8963859).

charge_index_base charge_index_and_base = {}

Each charge distribution is assigned a unique index (first entry of pair), second one stores the base number (2- or 3-state simulation).

uint64_t charge_index_sublayout = {}

Charge index of the sublayout (collection of SiDBs that could be positively charged for a specific charge configuration of the layout).

uint64_t max_charge_index = {}

Depending on the number of SiDBs and the base number, a maximal number of possible charge distributions exists.

uint64_t max_charge_index_sulayout = {}

Depending on the number of SiDBs in the SiDBs, a maximal number of possible charge distributions exists.

std::pair<int64_t, int8_t> cell_history_gray_code = {}

This pair stores the cell index and its previously charge state (important when all possible charge distributions are enumerated and checked for physical validity).

std::vector<std::pair<uint64_t, int8_t>> cell_history = {}

This vector stores the cells and its previously charge states of the charge distribution before the charge index was changed.

std::unordered_map<typename Lyt::cell, const sidb_defect> defects = {}

This unordered map stores the cells and the placed defect.

Lyt::cell dependent_cell = {}

Dependent cell is the cell which charge state is determined by all other SiDBs in the layout.

uint64_t dependent_cell_index = {}

Charge index of the dependent cell in the layout.

std::vector<typename Lyt::cell> three_state_cells = {}

This vector collects all cells that could potentially be positively charged based on the maximum possible local potential.

bool dependent_cell_in_sub_layout = {}

True indicates that the dependent SiDB is in the sublayout.

Physical Constants

Header: fiction/technology/physical_constants.hpp

constexpr double fiction::physical_constants::EPSILON = 8.8541878 * 1E-12

The vacuum permittivity \(\epsilon_0\) in \(F \cdot m^{-1}\).

constexpr double fiction::physical_constants::ELEMENTARY_CHARGE = 1.6021766 * 1E-19

The elementary charge \(e\) in \(C\).

constexpr double fiction::physical_constants::K_E = 8.987552 * 1E9

The Coulomb constant \(k\) in \(N \cdot m^{2} \cdot C^{-2}\).

constexpr double fiction::physical_constants::POP_STABILITY_ERR = 1E-6

The pop stability error is used for physical simulations to avoid floating-point errors.

constexpr double fiction::physical_constants::PI = 3.14159265359

A value of \(\pi\) that is accurate to 11 decimal places.

Euclidean distance between two SiDBs in nanometers

Header: fiction/technology/sidb_nm_distance.hpp

template<typename Lyt>
constexpr double fiction::sidb_nm_distance(const Lyt &lyt, const coordinate<Lyt> &source, const coordinate<Lyt> &target) noexcept

Computes the distance between two SiDB cells in nanometers (unit: nm).

Template Parameters:

Lyt – SiDB cell-level layout type.

Parameters:
  • source – The source cell.

  • target – The target cell.

Returns:

The distance between the two cells in nanometers (unit: nm).