diff --git a/docs/algorithms/sidb_simulation.rst b/docs/algorithms/sidb_simulation.rst index db377604b..ffb774bfb 100644 --- a/docs/algorithms/sidb_simulation.rst +++ b/docs/algorithms/sidb_simulation.rst @@ -40,6 +40,7 @@ Exhaustive Ground State Simulation **Header:** ``fiction/algorithms/simulation/sidb/quickexact.hpp`` +.. doxygenenum:: fiction::required_simulation_base_number .. doxygenstruct:: fiction::quickexact_params :members: .. doxygenfunction:: fiction::quickexact diff --git a/include/fiction/algorithms/simulation/sidb/can_positive_charges_occur.hpp b/include/fiction/algorithms/simulation/sidb/can_positive_charges_occur.hpp index 6523da71a..d00909cfd 100644 --- a/include/fiction/algorithms/simulation/sidb/can_positive_charges_occur.hpp +++ b/include/fiction/algorithms/simulation/sidb/can_positive_charges_occur.hpp @@ -35,7 +35,10 @@ template // The charge layout is initialized with negatively charged SiDBs. Therefore, the local electrostatic potentials are // maximal. In this extreme case, if the banding is not sufficient for any SiDB to be positively charged, it will // not be for any other charge distribution. Therefore, no positively charged SiDBs can occur. - const charge_distribution_surface charge_lyt{lyt, sim_params, sidb_charge_state::NEGATIVE}; + charge_distribution_surface charge_lyt{lyt}; + charge_lyt.assign_physical_parameters(sim_params); + charge_lyt.assign_all_charge_states(sidb_charge_state::NEGATIVE); + charge_lyt.foreach_cell( [&result, &mu_plus, charge_lyt](const auto& c) noexcept { diff --git a/include/fiction/algorithms/simulation/sidb/exhaustive_ground_state_simulation.hpp b/include/fiction/algorithms/simulation/sidb/exhaustive_ground_state_simulation.hpp index 9ddfb3e59..ae1bbab60 100644 --- a/include/fiction/algorithms/simulation/sidb/exhaustive_ground_state_simulation.hpp +++ b/include/fiction/algorithms/simulation/sidb/exhaustive_ground_state_simulation.hpp @@ -52,7 +52,7 @@ exhaustive_ground_state_simulation(const Lyt& lyt, { const mockturtle::stopwatch stop{time_counter}; - charge_distribution_surface charge_lyt{lyt}; + charge_distribution_surface charge_lyt{lyt}; charge_lyt.assign_physical_parameters(params); charge_lyt.assign_all_charge_states(sidb_charge_state::NEGATIVE); diff --git a/include/fiction/algorithms/simulation/sidb/quickexact.hpp b/include/fiction/algorithms/simulation/sidb/quickexact.hpp index 7e4423ecb..2bda96cb7 100644 --- a/include/fiction/algorithms/simulation/sidb/quickexact.hpp +++ b/include/fiction/algorithms/simulation/sidb/quickexact.hpp @@ -24,6 +24,20 @@ namespace fiction { +/** + * Base number required for the correct physical simulation. + */ +enum class required_simulation_base_number +{ + /** + * Two state simulation (i.e., negative and neutral) is sufficient. + */ + TWO, + /** + * Three state simulation (i.e., negative, neutral, and positive) is required. + */ + THREE +}; /** * This struct stores the parameters for the *QuickExact* algorithm. */ @@ -73,9 +87,12 @@ class quickexact_impl public: quickexact_impl(const Lyt& lyt, const quickexact_params& parameter) : layout{lyt}, - charge_lyt{lyt, parameter.physical_parameters, sidb_charge_state::NEGATIVE}, + charge_lyt{lyt}, params{parameter} - {} + { + charge_lyt.assign_all_charge_states(sidb_charge_state::NEGATIVE); + charge_lyt.assign_physical_parameters(parameter.physical_parameters); + } sidb_simulation_result run() noexcept { @@ -89,11 +106,13 @@ class quickexact_impl initialize_charge_layout(); // Determine if three state simulation (i.e., positively charged SiDBs can occur) is required. - const bool three_state_simulation_required = + required_simulation_base_number base_number = (params.base_number_detection == quickexact_params::automatic_base_number_detection::ON && charge_lyt.is_three_state_simulation_required()) || - (params.base_number_detection == quickexact_params::automatic_base_number_detection::OFF && - params.physical_parameters.base == 3); + (params.base_number_detection == quickexact_params::automatic_base_number_detection::OFF && + params.physical_parameters.base == 3) ? + required_simulation_base_number::THREE : + required_simulation_base_number::TWO; // If layout has at least two SiDBs, all SiDBs that have to be negatively charged are erased from the // layout. @@ -104,54 +123,15 @@ class quickexact_impl // If the layout consists of SiDBs that do not need to be negatively charged. if (!all_sidbs_in_lyt_without_negative_preassigned_ones.empty()) { - // The first cell from all_sidbs_in_lyt_without_negative_preassigned_ones is chosen as the - // dependent-cell to initialize the layout (pre-assigned negatively charged SiDBs were erased with - // generate_layout_without_negative_sidbs). All SiDBs are set to neutrally charged. - charge_distribution_surface charge_lyt_with_assigned_dependent_cell{ - layout, params.physical_parameters, sidb_charge_state::NEUTRAL, - all_sidbs_in_lyt_without_negative_preassigned_ones[0]}; - - charge_lyt_with_assigned_dependent_cell.assign_local_external_potential( - params.local_external_potential); - charge_lyt_with_assigned_dependent_cell.assign_global_external_potential(params.global_potential); - if constexpr (has_get_sidb_defect_v) { - for (const auto& [cell, defect] : real_placed_defects) - { - charge_lyt_with_assigned_dependent_cell.add_sidb_defect_to_potential_landscape(cell, - defect); - } - } - - // IMPORTANT: The pre-assigned negatively charged SiDBs (they have to be negatively charged to - // fulfill the population stability) are considered as negatively charged defects in the layout. - // Hence, there are no "real" defects assigned, but in order to set some SiDBs with a fixed negative - // charge, this way of implementation is chosen. - for (const auto& cell : preassigned_negative_sidbs) - { - charge_lyt_with_assigned_dependent_cell.add_sidb_defect_to_potential_landscape( - cell, sidb_defect{sidb_defect_type::UNKNOWN, -1, - charge_lyt_with_assigned_dependent_cell.get_phys_params().epsilon_r, - charge_lyt_with_assigned_dependent_cell.get_phys_params().lambda_tf}); - } - - // Update all local potentials, system energy and physically validity. The Flag is set to "Variable" - // to allow dependent cell to change its charge state based on the N-1 SiDBs to fulfill the local - // population stability in its position. - charge_lyt_with_assigned_dependent_cell.update_after_charge_change(dependent_cell_mode::VARIABLE); - - // If no positively charged SiDB can occur in the layout. - if (!three_state_simulation_required) - { - result.additional_simulation_parameters.emplace_back("base_number", uint64_t{2}); - two_state_simulation(charge_lyt_with_assigned_dependent_cell); + charge_distribution_surface charge_layout{static_cast(layout)}; + conduct_simulation(charge_layout, base_number); } - // If positively charged SiDBs can occur in the layout, 3-state simulation is conducted. else { - result.additional_simulation_parameters.emplace_back("base_number", uint64_t{3}); - three_state_simulation(charge_lyt_with_assigned_dependent_cell); + charge_distribution_surface charge_layout{static_cast(layout)}; + conduct_simulation(charge_layout, base_number); } } @@ -174,7 +154,7 @@ class quickexact_impl // to external potentials or defects. else if (number_of_sidbs == 1) { - if (three_state_simulation_required) + if (base_number == required_simulation_base_number::THREE) { charge_lyt.assign_base_number(3); } @@ -268,14 +248,80 @@ class quickexact_impl * Simulation results. */ sidb_simulation_result result{}; + /** + * This function initializes the charge layout with necessary parameters, and conducts + * the physical simulation based on whether a three-state simulation is required. + * + * @tparam ChargeLyt The type of Charge Layout. + * @tparam ChargeLyt The type representing the charge layout to simulate. + * @param base_number `THREE` if a three-state simulation is required, `TWO` otherwise. + */ + template + void conduct_simulation(ChargeLyt& charge_layout, const required_simulation_base_number base_number) noexcept + { + static_assert(is_cell_level_layout_v, "ChargeLyt is not a cell-level layout"); + static_assert(has_sidb_technology_v, "ChargeLyt is not an SiDB layout"); + static_assert(has_siqad_coord_v, "ChargeLyt is not based on SiQAD coordinates"); + static_assert(is_charge_distribution_surface_v, "ChargeLyt is not a charge distribution surface"); + + charge_layout.assign_physical_parameters(params.physical_parameters); + charge_layout.assign_all_charge_states(sidb_charge_state::NEUTRAL); + charge_layout.assign_dependent_cell(all_sidbs_in_lyt_without_negative_preassigned_ones[0]); + + charge_layout.assign_local_external_potential(params.local_external_potential); + charge_layout.assign_global_external_potential(params.global_potential); + + // IMPORTANT: The pre-assigned negatively charged SiDBs (they have to be negatively charged to + // fulfill the population stability) are considered as negatively charged defects in the layout. + // Hence, there are no "real" defects assigned, but in order to set some SiDBs with a fixed + // negative charge, this way of implementation is chosen. + for (const auto& cell : preassigned_negative_sidbs) + { + charge_layout.add_sidb_defect_to_potential_landscape( + cell, sidb_defect{sidb_defect_type::UNKNOWN, -1, charge_layout.get_phys_params().epsilon_r, + charge_layout.get_phys_params().lambda_tf}); + } + + // Update all local potentials, system energy, and physical validity. The flag is set to + // `VARIABLE` to allow the dependent cell to change its charge state based on the N-1 SiDBs to + // fulfill the local population stability at its position. + charge_layout.update_after_charge_change(dependent_cell_mode::VARIABLE); + + if constexpr (has_get_sidb_defect_v) + { + for (const auto& [cell, defect] : real_placed_defects) + { + charge_layout.add_sidb_defect_to_potential_landscape(cell, defect); + } + } + + if (base_number == required_simulation_base_number::TWO) + { + result.additional_simulation_parameters.emplace_back("base_number", uint64_t{2}); + two_state_simulation(charge_layout); + } + // If positively charged SiDBs can occur in the layout, 3-state simulation is conducted. + else + { + result.additional_simulation_parameters.emplace_back("base_number", uint64_t{3}); + three_state_simulation(charge_layout); + } + } /** * This function conducts 2-state physical simulation (negative, neutral). * + * @tparam ChargeLyt Type of the charge distribution surface. * @param charge_layout Initialized charge layout. */ - void two_state_simulation(charge_distribution_surface& charge_layout) noexcept + template + void two_state_simulation(ChargeLyt& charge_layout) noexcept { + static_assert(is_cell_level_layout_v, "ChargeLyt is not a cell-level layout"); + static_assert(has_sidb_technology_v, "ChargeLyt is not an SiDB layout"); + static_assert(has_siqad_coord_v, "ChargeLyt is not based on SiQAD coordinates"); + static_assert(is_charge_distribution_surface_v, "ChargeLyt is not a charge distribution surface"); + charge_layout.assign_base_number(2); uint64_t previous_charge_index = 0; @@ -320,10 +366,17 @@ class quickexact_impl /** * This function conducts 3-state physical simulation (negative, neutral, positive). * + * @tparam ChargeLyt Type of the charge distribution surface. * @param charge_layout Initialized charge layout. */ - void three_state_simulation(charge_distribution_surface& charge_layout) noexcept + template + void three_state_simulation(ChargeLyt& charge_layout) noexcept { + static_assert(is_cell_level_layout_v, "ChargeLyt is not a cell-level layout"); + static_assert(has_sidb_technology_v, "ChargeLyt is not an SiDB layout"); + static_assert(has_siqad_coord_v, "ChargeLyt is not based on SiQAD coordinates"); + static_assert(is_charge_distribution_surface_v, "ChargeLyt is not a charge distribution surface"); + charge_layout.assign_all_charge_states(sidb_charge_state::NEGATIVE); charge_layout.update_after_charge_change(); // Not executed to detect if 3-state simulation is required, but to detect the SiDBs that could be positively @@ -466,7 +519,6 @@ class quickexact_impl * - It assigns the local external potential from the `params.local_external_potential` configuration to the charge * layout. * - It assigns the global external potential from `params.global_potential` to the charge layout. - * */ void initialize_charge_layout() noexcept { @@ -496,6 +548,7 @@ class quickexact_impl number_of_sidbs = charge_lyt.num_cells(); } /** + * * This function is used to generate a layout without the SiDBs that are pre-assigned to be negatively charged in a * physically-valid layout. */ diff --git a/include/fiction/algorithms/simulation/sidb/quicksim.hpp b/include/fiction/algorithms/simulation/sidb/quicksim.hpp index 1df196b24..771444da7 100644 --- a/include/fiction/algorithms/simulation/sidb/quicksim.hpp +++ b/include/fiction/algorithms/simulation/sidb/quicksim.hpp @@ -86,7 +86,7 @@ sidb_simulation_result quicksim(const Lyt& lyt, const quicksim_params& ps = { const mockturtle::stopwatch stop{time_counter}; - charge_distribution_surface charge_lyt{lyt}; + charge_distribution_surface charge_lyt{lyt}; // set the given physical parameters charge_lyt.assign_physical_parameters(ps.phys_params); diff --git a/include/fiction/technology/charge_distribution_surface.hpp b/include/fiction/technology/charge_distribution_surface.hpp index 07004ef8e..0682a0199 100644 --- a/include/fiction/technology/charge_distribution_surface.hpp +++ b/include/fiction/technology/charge_distribution_surface.hpp @@ -126,16 +126,10 @@ class charge_distribution_surface : public Lyt * Standard constructor for the charge_distribution_storage. * * @param params Physical parameters used for the simulation (ยต_minus, base number, ...). - * @param external_potential Externally applied local electrostatic potential. - * @param variable_cell SiDB which charge state is variable (called dependent-cell). */ - explicit charge_distribution_storage( - const sidb_simulation_parameters& params = sidb_simulation_parameters{}, - const std::unordered_map& external_potential = {}, - const typename Lyt::cell& variable_cell = {}) : - phys_params{params}, - local_external_pot{external_potential}, - dependent_cell{variable_cell} {}; + explicit charge_distribution_storage(const sidb_simulation_parameters& params = sidb_simulation_parameters{}) : + phys_params{params} + {} /** * Stores all physical parameters used for the simulation. */ @@ -254,6 +248,7 @@ class charge_distribution_surface : public Lyt initialize(cs); } + /** * Standard constructor for existing layouts. * @@ -263,12 +258,11 @@ class charge_distribution_surface : public Lyt * @param variable_cells SiDB which charge state is variable (called dependent-cell). * @param external_potential Externally applied local electrostatic potential. */ - explicit charge_distribution_surface( - const Lyt& lyt, const sidb_simulation_parameters& params = sidb_simulation_parameters{}, - const sidb_charge_state cs = sidb_charge_state::NEGATIVE, const typename Lyt::cell& variable_cells = {}, - const std::unordered_map& external_potential = {}) : + explicit charge_distribution_surface(const Lyt& lyt, + const sidb_simulation_parameters& params = sidb_simulation_parameters{}, + const sidb_charge_state cs = sidb_charge_state::NEGATIVE) : Lyt(lyt), - strg{std::make_shared(params, external_potential, variable_cells)} + strg{std::make_shared(params)} { static_assert(has_siqad_coord_v, "Lyt is not based on SiQAD coordinates"); static_assert(is_cell_level_layout_v, "Lyt is not a cell-level layout"); @@ -317,6 +311,17 @@ class charge_distribution_surface : public Lyt return positions; } + /** + * This function assigns a cell type to a given cell of the underlying cell-level layout. + * + * @param c Cell whose type is changed. + * @param ct Cell type which is assigned to the given cell. + */ + void assign_cell_type(const typename Lyt::cell& c, const typename Lyt::cell_type& ct) noexcept + { + Lyt::assign_cell_type(c, ct); + initialize(sidb_charge_state::NEGATIVE); + } /** * This function assigns the physical parameters for the simulation. * @@ -427,6 +432,22 @@ class charge_distribution_surface : public Lyt } this->charge_distribution_to_index(); } + /** + * This function assigns the dependent cell (i.e., cell which charge state is set based on the neighbor cells + * and the population stability). + * + * @param dependent_cell cell which is set as the dependent cell. + * + * @note dependent_cell has to be part of the initialized charge distribution surface layout. + */ + void assign_dependent_cell(const typename Lyt::cell& dependent_cell) noexcept + { + assert(cell_to_index(dependent_cell) != -1 && "dependent cell is not part of the layout"); + strg->dependent_cell = dependent_cell; + strg->max_charge_index = + static_cast(std::pow(static_cast(strg->phys_params.base), this->num_cells() - 1) - 1); + strg->dependent_cell_index = static_cast(cell_to_index(strg->dependent_cell)); + } /** * This function assigns the base number for the simulation. * @@ -1754,6 +1775,8 @@ class charge_distribution_surface : public Lyt */ void initialize(const sidb_charge_state cs = sidb_charge_state::NEGATIVE) noexcept { + strg->sidb_order = {}; + strg->cell_charge = {}; strg->sidb_order.reserve(this->num_cells()); strg->cell_charge.reserve(this->num_cells()); this->foreach_cell([this](const auto& c1) { strg->sidb_order.push_back(c1); }); @@ -1767,17 +1790,8 @@ class charge_distribution_surface : public Lyt this->charge_distribution_to_index(); this->initialize_nm_distance_matrix(); this->initialize_potential_matrix(); - if (!strg->dependent_cell.is_dead()) - { - strg->max_charge_index = - static_cast(std::pow(static_cast(strg->phys_params.base), this->num_cells() - 1) - 1); - } - else - { - strg->max_charge_index = - static_cast(std::pow(static_cast(strg->phys_params.base), this->num_cells()) - 1); - } - strg->dependent_cell_index = static_cast(cell_to_index(strg->dependent_cell)); + strg->max_charge_index = + static_cast(std::pow(static_cast(strg->phys_params.base), this->num_cells()) - 1); this->update_local_potential(); this->recompute_system_energy(); this->validity_check(); @@ -1993,16 +2007,6 @@ template charge_distribution_surface(const T&, const sidb_simulation_parameters&, sidb_charge_state cs) -> charge_distribution_surface; -template -charge_distribution_surface(const T&, const sidb_simulation_parameters&, sidb_charge_state cs, - const typename T::cell& variable_cells) -> charge_distribution_surface; - -template -charge_distribution_surface(const T&, const sidb_simulation_parameters&, sidb_charge_state cs, - const typename T::cell& variable_cells, - const std::unordered_map& external_pot) - -> charge_distribution_surface; - } // namespace fiction #endif // FICTION_CHARGE_DISTRIBUTION_SURFACE_HPP diff --git a/include/fiction/traits.hpp b/include/fiction/traits.hpp index a61c4120b..7f68dfbd2 100644 --- a/include/fiction/traits.hpp +++ b/include/fiction/traits.hpp @@ -599,6 +599,24 @@ template inline constexpr bool is_cell_level_layout_v = is_cell_level_layout::value; #pragma endregion +#pragma region is_charge_distribution_surface +template +struct is_charge_distribution_surface : std::false_type +{}; + +template +struct is_charge_distribution_surface< + Lyt, + std::enable_if_t, + std::void_t().assign_charge_state(cell(), sidb_charge_state())), + decltype(std::declval().get_charge_state(cell()))>>> : std::true_type +{}; + +template +inline constexpr bool is_charge_distribution_surface_v = is_charge_distribution_surface::value; +#pragma endregion + #pragma region has_is_empty_cell template struct has_is_empty_cell : std::false_type diff --git a/test/algorithms/simulation/sidb/critical_temperature.cpp b/test/algorithms/simulation/sidb/critical_temperature.cpp index 6ce31fb1f..2f8855372 100644 --- a/test/algorithms/simulation/sidb/critical_temperature.cpp +++ b/test/algorithms/simulation/sidb/critical_temperature.cpp @@ -23,14 +23,11 @@ using namespace fiction; TEMPLATE_TEST_CASE( "Test critical_temperature function", "[critical-temperature]", (cell_level_layout>>), - (cell_level_layout>>), - (cell_level_layout>>), - (cell_level_layout>>), - (cell_level_layout>>)) + (charge_distribution_surface>>>)) { SECTION("No physically valid charge distribution could be found") { - TestType lyt{{10, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 0}, sidb_technology::cell_type::INPUT); lyt.assign_cell_type({2, 1, 0}, sidb_technology::cell_type::INPUT); @@ -92,7 +89,7 @@ TEMPLATE_TEST_CASE( SECTION("four SiDBs with two valid charge distributions, QuickExact") { - TestType lyt{{10, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 1}, TestType::cell_type::NORMAL); lyt.assign_cell_type({2, 1}, TestType::cell_type::NORMAL); lyt.assign_cell_type({4, 1}, TestType::cell_type::NORMAL); @@ -112,7 +109,7 @@ TEMPLATE_TEST_CASE( SECTION("Y-shape SiDB AND gate") { - TestType lyt{{20, 10}, "AND gate"}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 1}, sidb_technology::cell_type::INPUT); lyt.assign_cell_type({2, 1, 1}, sidb_technology::cell_type::INPUT); diff --git a/test/algorithms/simulation/sidb/exhaustive_ground_state_simulation.cpp b/test/algorithms/simulation/sidb/exhaustive_ground_state_simulation.cpp index 11dfddf42..820bc8284 100644 --- a/test/algorithms/simulation/sidb/exhaustive_ground_state_simulation.cpp +++ b/test/algorithms/simulation/sidb/exhaustive_ground_state_simulation.cpp @@ -14,10 +14,12 @@ using namespace fiction; -TEMPLATE_TEST_CASE("Empty layout ExGS simulation", "[exhaustive-ground-state-simulation]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "Empty layout ExGS simulation", "[exhaustive-ground-state-simulation]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; const sidb_simulation_parameters params{2, -0.32}; @@ -29,10 +31,12 @@ TEMPLATE_TEST_CASE("Empty layout ExGS simulation", "[exhaustive-ground-state-sim CHECK(simulation_results.additional_simulation_parameters.empty()); } -TEMPLATE_TEST_CASE("Single SiDB ExGS simulation", "[exhaustive-ground-state-simulation]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "Single SiDB ExGS simulation", "[exhaustive-ground-state-simulation]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); const sidb_simulation_parameters params{2, -0.32}; @@ -43,10 +47,12 @@ TEMPLATE_TEST_CASE("Single SiDB ExGS simulation", "[exhaustive-ground-state-simu CHECK(simulation_results.charge_distributions.front().get_charge_state_by_index(0) == sidb_charge_state::NEGATIVE); } -TEMPLATE_TEST_CASE("ExGS simulation of a one BDL pair with one perturber", "[exhaustive-ground-state-simulation]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "ExGS simulation of a one BDL pair with one perturber", "[exhaustive-ground-state-simulation]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({4, 0, 0}, TestType::cell_type::NORMAL); @@ -58,10 +64,12 @@ TEMPLATE_TEST_CASE("ExGS simulation of a one BDL pair with one perturber", "[exh CHECK(simulation_results.charge_distributions.size() == 1); } -TEMPLATE_TEST_CASE("ExGS simulation of a two-pair BDL wire with one perturber", "[exhaustive-ground-state-simulation]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "ExGS simulation of a two-pair BDL wire with one perturber", "[exhaustive-ground-state-simulation]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({5, 0, 0}, TestType::cell_type::NORMAL); @@ -101,10 +109,12 @@ TEMPLATE_TEST_CASE("ExGS simulation of a two-pair BDL wire with one perturber", Catch::Matchers::WithinAbs(0.2460493219, physical_constants::POP_STABILITY_ERR)); } -TEMPLATE_TEST_CASE("ExGS simulation of a Y-shape SiDB arrangement", "[exhaustive-ground-state-simulation]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "ExGS simulation of a Y-shape SiDB arrangement", "[exhaustive-ground-state-simulation]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({-11, -2, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({-10, -1, 0}, TestType::cell_type::NORMAL); @@ -136,10 +146,12 @@ TEMPLATE_TEST_CASE("ExGS simulation of a Y-shape SiDB arrangement", "[exhaustive Catch::Matchers::WithinAbs(0.3191788254, physical_constants::POP_STABILITY_ERR)); } -TEMPLATE_TEST_CASE("ExGS simulation of a Y-shape SiDB OR gate with input 01", "[exhaustive-ground-state-simulation]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "ExGS simulation of a Y-shape SiDB OR gate with input 01", "[exhaustive-ground-state-simulation]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({6, 2, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({8, 3, 0}, TestType::cell_type::NORMAL); diff --git a/test/algorithms/simulation/sidb/quickexact.cpp b/test/algorithms/simulation/sidb/quickexact.cpp index 1783df6f1..41960fb74 100644 --- a/test/algorithms/simulation/sidb/quickexact.cpp +++ b/test/algorithms/simulation/sidb/quickexact.cpp @@ -16,10 +16,12 @@ using namespace fiction; -TEMPLATE_TEST_CASE("Empty layout QuickExact simulation", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "Empty layout QuickExact simulation", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; const quickexact_params params{sidb_simulation_parameters{2, -0.32}}; @@ -31,10 +33,12 @@ TEMPLATE_TEST_CASE("Empty layout QuickExact simulation", "[quickexact]", CHECK(simulation_results.additional_simulation_parameters.empty()); } -TEMPLATE_TEST_CASE("Single SiDB QuickExact simulation", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "Single SiDB QuickExact simulation", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); const quickexact_params params{sidb_simulation_parameters{2, -0.32}}; @@ -48,9 +52,11 @@ TEMPLATE_TEST_CASE("Single SiDB QuickExact simulation", "[quickexact]", TEMPLATE_TEST_CASE( "Single SiDB QuickExact simulation with one negatively charge defect (default initialization) in proximity", "[quickexact]", - (sidb_surface>>>)) + (sidb_surface>>>), + (charge_distribution_surface< + sidb_surface>>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); const quickexact_params params{sidb_simulation_parameters{2, -0.25}}; lyt.assign_sidb_defect({1, 2, 0}, sidb_defect{sidb_defect_type::UNKNOWN, -1, params.physical_parameters.epsilon_r, @@ -65,9 +71,11 @@ TEMPLATE_TEST_CASE( TEMPLATE_TEST_CASE( "Single SiDB QuickExact simulation with one negatively charge defect (changed lambda_tf) in proximity", "[quickexact]", - (sidb_surface>>>)) + (sidb_surface>>>), + (charge_distribution_surface< + sidb_surface>>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); const quickexact_params params{sidb_simulation_parameters{2, -0.25}}; @@ -83,9 +91,11 @@ TEMPLATE_TEST_CASE( TEMPLATE_TEST_CASE( "Single SiDB QuickExact simulation with one negatively charge defect (changed epsilon_r) in proximity", "[quickexact]", - (sidb_surface>>>)) + (sidb_surface>>>), + (charge_distribution_surface< + sidb_surface>>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); const quickexact_params params{sidb_simulation_parameters{2, -0.25}}; @@ -103,9 +113,11 @@ TEMPLATE_TEST_CASE( TEMPLATE_TEST_CASE( "four SiDBs QuickExact simulation with one negatively charge defect (changed epsilon_r) in proximity", "[quickexact]", - (sidb_surface>>>)) + (sidb_surface>>>), + (charge_distribution_surface< + sidb_surface>>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({-2, 0, 1}, TestType::cell_type::NORMAL); lyt.assign_cell_type({2, 0, 1}, TestType::cell_type::NORMAL); lyt.assign_cell_type({0, 1, 0}, TestType::cell_type::NORMAL); @@ -126,11 +138,13 @@ TEMPLATE_TEST_CASE( CHECK(simulation_results.charge_distributions.front().get_charge_state_by_index(3) == sidb_charge_state::NEUTRAL); } -TEMPLATE_TEST_CASE("Single SiDB QuickExact simulation with one highly negatively charge defect in proximity", - "[quickexact]", - (sidb_surface>>>)) +TEMPLATE_TEST_CASE( + "Single SiDB QuickExact simulation with one highly negatively charge defect in proximity", "[quickexact]", + (sidb_surface>>>), + (charge_distribution_surface< + sidb_surface>>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); const quickexact_params params{sidb_simulation_parameters{3, -0.1}}; @@ -147,9 +161,11 @@ TEMPLATE_TEST_CASE("Single SiDB QuickExact simulation with one highly negatively TEMPLATE_TEST_CASE( "Single SiDB QuickExact simulation with one highly negatively charge defect in proximity but with high screening", "[quickexact]", - (sidb_surface>>>)) + (sidb_surface>>>), + (charge_distribution_surface< + sidb_surface>>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); const quickexact_params params{sidb_simulation_parameters{2, -0.1}}; @@ -166,9 +182,11 @@ TEMPLATE_TEST_CASE( TEMPLATE_TEST_CASE( "Single SiDB QuickExact simulation with two highly negatively and oppositely charged defects in proximity", "[quickexact]", - (sidb_surface>>>)) + (sidb_surface>>>), + (charge_distribution_surface< + sidb_surface>>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); const quickexact_params params{sidb_simulation_parameters{2, -0.1}}; @@ -185,10 +203,12 @@ TEMPLATE_TEST_CASE( CHECK(simulation_results.charge_distributions.front().get_charge_state_by_index(0) == sidb_charge_state::NEGATIVE); } -TEMPLATE_TEST_CASE("Single SiDB QuickExact simulation with local external potential", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "Single SiDB QuickExact simulation with local external potential", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); quickexact_params params{sidb_simulation_parameters{2, -0.25}}; @@ -201,10 +221,12 @@ TEMPLATE_TEST_CASE("Single SiDB QuickExact simulation with local external potent CHECK(simulation_results.charge_distributions.front().get_charge_state_by_index(0) == sidb_charge_state::NEUTRAL); } -TEMPLATE_TEST_CASE("Single SiDB QuickExact simulation with local external potential (high)", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "Single SiDB QuickExact simulation with local external potential (high)", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); quickexact_params params{sidb_simulation_parameters{3, -0.25}}; @@ -216,10 +238,12 @@ TEMPLATE_TEST_CASE("Single SiDB QuickExact simulation with local external potent CHECK(simulation_results.charge_distributions.front().get_charge_state_by_index(0) == sidb_charge_state::POSITIVE); } -TEMPLATE_TEST_CASE("Single SiDB QuickExact simulation with global external potential", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "Single SiDB QuickExact simulation with global external potential", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); quickexact_params params{sidb_simulation_parameters{2, -0.25}}; @@ -231,10 +255,12 @@ TEMPLATE_TEST_CASE("Single SiDB QuickExact simulation with global external poten CHECK(simulation_results.charge_distributions.front().get_charge_state_by_index(0) == sidb_charge_state::NEUTRAL); } -TEMPLATE_TEST_CASE("Single SiDB QuickExact simulation with global external potential (high)", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "Single SiDB QuickExact simulation with global external potential (high)", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); quickexact_params params{sidb_simulation_parameters{3, -0.25}}; @@ -245,10 +271,12 @@ TEMPLATE_TEST_CASE("Single SiDB QuickExact simulation with global external poten CHECK(simulation_results.charge_distributions.front().get_charge_state_by_index(0) == sidb_charge_state::POSITIVE); } -TEMPLATE_TEST_CASE("Single SiDB QuickExact simulation with global external potential (high, positive)", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "Single SiDB QuickExact simulation with global external potential (high, positive)", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); quickexact_params params{sidb_simulation_parameters{3, -0.25}}; @@ -259,10 +287,12 @@ TEMPLATE_TEST_CASE("Single SiDB QuickExact simulation with global external poten CHECK(simulation_results.charge_distributions.front().get_charge_state_by_index(0) == sidb_charge_state::NEGATIVE); } -TEMPLATE_TEST_CASE("QuickExact simulation of a BDL pair", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "QuickExact simulation of a BDL pair", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({3, 3, 0}, TestType::cell_type::NORMAL); @@ -291,10 +321,12 @@ TEMPLATE_TEST_CASE("QuickExact simulation of a BDL pair", "[quickexact]", } } -TEMPLATE_TEST_CASE("QuickExact simulation of a two-pair BDL wire with one perturber", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "QuickExact simulation of a two-pair BDL wire with one perturber", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({5, 0, 0}, TestType::cell_type::NORMAL); @@ -336,7 +368,7 @@ TEMPLATE_TEST_CASE("QuickExact simulation of a two-pair BDL wire with one pertur TEMPLATE_TEST_CASE("QuickExact simulation of a one-pair BDL wire with two perturbers", "[quickexact]", (cell_level_layout>>)) { - TestType lyt{{50, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({5, 0, 0}, TestType::cell_type::NORMAL); @@ -371,10 +403,12 @@ TEMPLATE_TEST_CASE("QuickExact simulation of a one-pair BDL wire with two pertur Catch::Matchers::WithinAbs(0.1152677452, physical_constants::POP_STABILITY_ERR)); } -TEMPLATE_TEST_CASE("QuickExact simulation of a Y-shape SiDB arrangement", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "QuickExact simulation of a Y-shape SiDB arrangement", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({-11, -2, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({-10, -1, 0}, TestType::cell_type::NORMAL); @@ -408,9 +442,10 @@ TEMPLATE_TEST_CASE("QuickExact simulation of a Y-shape SiDB arrangement", "[quic TEMPLATE_TEST_CASE( "QuickExact simulation of a Y-shape SiDB OR gate with input 01, check energy and charge distribution", - "[quickexact]", (cell_level_layout>>)) + "[quickexact]", (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({16, 1, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({6, 2, 0}, TestType::cell_type::NORMAL); @@ -447,9 +482,10 @@ TEMPLATE_TEST_CASE( TEMPLATE_TEST_CASE( "QuickExact simulation of a Y-shape SiDB OR gate with input 01 and local external potential at perturber", - "[quickexact]", (cell_level_layout>>)) + "[quickexact]", (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({6, 2, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({8, 3, 0}, TestType::cell_type::NORMAL); @@ -480,11 +516,12 @@ TEMPLATE_TEST_CASE( CHECK(charge_lyt_first.get_charge_state({8, 3, 0}) == sidb_charge_state::NEGATIVE); } -TEMPLATE_TEST_CASE("QuickExact simulation of a Y-shape SiDB OR gate with input 01 and global external potential", - "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "QuickExact simulation of a Y-shape SiDB OR gate with input 01 and global external potential", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({6, 2, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({8, 3, 0}, TestType::cell_type::NORMAL); @@ -515,11 +552,12 @@ TEMPLATE_TEST_CASE("QuickExact simulation of a Y-shape SiDB OR gate with input CHECK(charge_lyt_first.get_charge_state({8, 3, 0}) == sidb_charge_state::NEUTRAL); } -TEMPLATE_TEST_CASE("QuickExact simulation of a Y-shape SiDB OR gate with input 01 and global external potential (high)", - "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "QuickExact simulation of a Y-shape SiDB OR gate with input 01 and global external potential (high)", + "[quickexact]", (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({6, 2, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({8, 3, 0}, TestType::cell_type::NORMAL); @@ -550,10 +588,12 @@ TEMPLATE_TEST_CASE("QuickExact simulation of a Y-shape SiDB OR gate with input 0 CHECK(charge_lyt_first.get_charge_state({8, 3, 0}) == sidb_charge_state::POSITIVE); } -TEMPLATE_TEST_CASE("QuickExact simulation of four SiDBs (far away)", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "QuickExact simulation of four SiDBs (far away)", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({10, 0, 0}, TestType::cell_type::NORMAL); @@ -573,11 +613,13 @@ TEMPLATE_TEST_CASE("QuickExact simulation of four SiDBs (far away)", "[quickexac CHECK(charge_lyt_first.get_charge_state({30, 0, 0}) == sidb_charge_state::NEGATIVE); } -TEMPLATE_TEST_CASE("QuickExact simulation of four SiDBs (far away) with one negatively charged defects in proximity", - "[quickexact]", - (sidb_surface>>>)) +TEMPLATE_TEST_CASE( + "QuickExact simulation of four SiDBs (far away) with one negatively charged defects in proximity", "[quickexact]", + (sidb_surface>>>), + (charge_distribution_surface< + sidb_surface>>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({10, 0, 0}, TestType::cell_type::NORMAL); @@ -598,11 +640,13 @@ TEMPLATE_TEST_CASE("QuickExact simulation of four SiDBs (far away) with one neg CHECK(charge_lyt_first.get_charge_state({30, 0, 0}) == sidb_charge_state::NEGATIVE); } -TEMPLATE_TEST_CASE("QuickExact simulation of four SiDBs (far away) with two negatively charged defects in proximity", - "[quickexact]", - (sidb_surface>>>)) +TEMPLATE_TEST_CASE( + "QuickExact simulation of four SiDBs (far away) with two negatively charged defects in proximity", "[quickexact]", + (sidb_surface>>>), + (charge_distribution_surface< + sidb_surface>>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({10, 0, 0}, TestType::cell_type::NORMAL); @@ -631,9 +675,11 @@ TEMPLATE_TEST_CASE("QuickExact simulation of four SiDBs (far away) with two nega TEMPLATE_TEST_CASE( "QuickExact simulation of four SiDBs (far away) with one negatively and positively charged defect in proximity", "[quickexact]", - (sidb_surface>>>)) + (sidb_surface>>>), + (charge_distribution_surface< + sidb_surface>>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({10, 0, 0}, TestType::cell_type::NORMAL); @@ -658,10 +704,12 @@ TEMPLATE_TEST_CASE( CHECK(charge_lyt_first.get_charge_state({30, 0, 0}) == sidb_charge_state::NEUTRAL); } -TEMPLATE_TEST_CASE("Seven randomly distributed DBs, test if dependent cell calculation works correctly", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "Seven randomly distributed DBs, test if dependent cell calculation works correctly", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({3, 3, 0}, TestType::cell_type::NORMAL); @@ -689,10 +737,12 @@ TEMPLATE_TEST_CASE("Seven randomly distributed DBs, test if dependent cell calcu CHECK(charge_lyt_first.get_charge_state({7, 10, 0}) == sidb_charge_state::NEGATIVE); } -TEMPLATE_TEST_CASE("three DBs next to each other", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "three DBs next to each other", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({-1, 3, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); @@ -726,10 +776,12 @@ TEMPLATE_TEST_CASE("three DBs next to each other", "[quickexact]", } } -TEMPLATE_TEST_CASE("three DBs next to each other, small mu-", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "three DBs next to each other, small mu-", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({-1, 3, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); @@ -748,10 +800,12 @@ TEMPLATE_TEST_CASE("three DBs next to each other, small mu-", "[quickexact]", CHECK(charge_lyt_first.get_charge_state({3, 3, 0}) == sidb_charge_state::NEGATIVE); } -TEMPLATE_TEST_CASE("four DBs next to each other, small mu-", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "four DBs next to each other, small mu-", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 3, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); @@ -768,10 +822,12 @@ TEMPLATE_TEST_CASE("four DBs next to each other, small mu-", "[quickexact]", Catch::Matchers::WithinAbs(0, physical_constants::POP_STABILITY_ERR)); } -TEMPLATE_TEST_CASE("seven DBs next to each other, small mu-", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "seven DBs next to each other, small mu-", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 3, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); @@ -791,10 +847,12 @@ TEMPLATE_TEST_CASE("seven DBs next to each other, small mu-", "[quickexact]", CHECK(charge_lyt_first.get_system_energy() > -2.74); } -TEMPLATE_TEST_CASE("7 DBs next to each other (positively charged DBs occur)", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "7 DBs next to each other (positively charged DBs occur)", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({1, 0, 0}, TestType::cell_type::NORMAL); @@ -815,9 +873,10 @@ TEMPLATE_TEST_CASE("7 DBs next to each other (positively charged DBs occur)", "[ TEMPLATE_TEST_CASE( "7 DBs next to each other | only one physically valid charge distribution with only one neutrally charged DB", - "[quickexact]", (cell_level_layout>>)) + "[quickexact]", (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({-6, 1, 1}, TestType::cell_type::NORMAL); lyt.assign_cell_type({2, 4, 1}, TestType::cell_type::NORMAL); @@ -836,10 +895,12 @@ TEMPLATE_TEST_CASE( CHECK(simulation_results.charge_distributions.size() == 1); } -TEMPLATE_TEST_CASE("4 DBs next to each other (positively charged DBs occur)", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "4 DBs next to each other (positively charged DBs occur)", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({1, 0, 0}, TestType::cell_type::NORMAL); @@ -853,10 +914,12 @@ TEMPLATE_TEST_CASE("4 DBs next to each other (positively charged DBs occur)", "[ CHECK(simulation_results.charge_distributions.size() == 2); } -TEMPLATE_TEST_CASE("5 DBs next to each other (positively charged DBs occur)", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "5 DBs next to each other (positively charged DBs occur)", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({-1, 0, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({2, 0, 0}, TestType::cell_type::NORMAL); @@ -874,16 +937,17 @@ TEMPLATE_TEST_CASE("5 DBs next to each other (positively charged DBs occur)", "[ CHECK(simulation_results.charge_distributions.size() == 1); } -TEMPLATE_TEST_CASE("3 DBs next to each other (positively charged DBs occur)", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "3 DBs next to each other (positively charged DBs occur)", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - using sidb_layout = cell_level_layout>>; - sidb_layout lyt{{20, 10}}; + TestType lyt{}; - lyt.assign_cell_type({5, 0, 0}, sidb_layout::cell_type::NORMAL); - lyt.assign_cell_type({6, 0, 0}, sidb_layout::cell_type::NORMAL); - lyt.assign_cell_type({7, 0, 0}, sidb_layout::cell_type::NORMAL); + lyt.assign_cell_type({5, 0, 0}, TestType::cell_type::NORMAL); + lyt.assign_cell_type({6, 0, 0}, TestType::cell_type::NORMAL); + lyt.assign_cell_type({7, 0, 0}, TestType::cell_type::NORMAL); const quickexact_params params{sidb_simulation_parameters{3, -0.32}}; @@ -895,16 +959,16 @@ TEMPLATE_TEST_CASE("3 DBs next to each other (positively charged DBs occur)", "[ } } -TEMPLATE_TEST_CASE("3 DBs next to each other with automatic base number detection", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "3 DBs next to each other with automatic base number detection", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - using sidb_layout = cell_level_layout>>; - - sidb_layout lyt{{20, 10}}; + TestType lyt{}; - lyt.assign_cell_type({5, 0, 0}, sidb_layout::cell_type::NORMAL); - lyt.assign_cell_type({6, 0, 0}, sidb_layout::cell_type::NORMAL); - lyt.assign_cell_type({7, 0, 0}, sidb_layout::cell_type::NORMAL); + lyt.assign_cell_type({5, 0, 0}, TestType::cell_type::NORMAL); + lyt.assign_cell_type({6, 0, 0}, TestType::cell_type::NORMAL); + lyt.assign_cell_type({7, 0, 0}, TestType::cell_type::NORMAL); const quickexact_params params{sidb_simulation_parameters{3, -0.32}}; @@ -924,10 +988,12 @@ TEMPLATE_TEST_CASE("3 DBs next to each other with automatic base number detectio CHECK(std::any_cast(simulation_results_new.additional_simulation_parameters[0].second) == 2); } -TEMPLATE_TEST_CASE("13 DBs which are all negatively charged", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "13 DBs which are all negatively charged", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({26, 10, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({23, 19, 1}, TestType::cell_type::NORMAL); @@ -963,10 +1029,12 @@ TEMPLATE_TEST_CASE("13 DBs which are all negatively charged", "[quickexact]", CHECK(lyt.num_cells() == 13); } -TEMPLATE_TEST_CASE("QuickExact simulation of a Y-shape SiDB OR gate with input 01", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "QuickExact simulation of a Y-shape SiDB OR gate with input 01", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({6, 2, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({8, 3, 0}, TestType::cell_type::NORMAL); @@ -1129,10 +1197,12 @@ TEMPLATE_TEST_CASE("QuickExact simulation of a Y-shape SiDB OR gate with input 0 } } -TEMPLATE_TEST_CASE("QuickExact simulation of a 3 DB Wire", "[quickexact]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "QuickExact simulation of a 3 DB Wire", "[quickexact]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); diff --git a/test/algorithms/simulation/sidb/quicksim.cpp b/test/algorithms/simulation/sidb/quicksim.cpp index 6d76aba47..ad785d8c0 100644 --- a/test/algorithms/simulation/sidb/quicksim.cpp +++ b/test/algorithms/simulation/sidb/quicksim.cpp @@ -14,8 +14,10 @@ using namespace fiction; -TEMPLATE_TEST_CASE("Zero iteration steps", "[quicksim]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "Zero iteration steps", "[quicksim]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { TestType lyt{}; @@ -28,10 +30,12 @@ TEMPLATE_TEST_CASE("Zero iteration steps", "[quicksim]", CHECK(simulation_results.algorithm_name == ""); } -TEMPLATE_TEST_CASE("Empty layout QuickSim simulation", "[quicksim]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "Empty layout QuickSim simulation", "[quicksim]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; const quicksim_params quicksim_params{sidb_simulation_parameters{2, -0.30}}; @@ -49,10 +53,12 @@ TEMPLATE_TEST_CASE("Empty layout QuickSim simulation", "[quicksim]", CHECK(simulation_results.charge_distributions.empty()); } -TEMPLATE_TEST_CASE("Single SiDB QuickSim simulation", "[quicksim]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "Single SiDB QuickSim simulation", "[quicksim]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); @@ -82,10 +88,12 @@ void check_for_runtime_measurement(const sidb_simulation_result& stats) noe CHECK(stats.simulation_runtime.count() > 0); } -TEMPLATE_TEST_CASE("QuickSim simulation of several SiDBs with varying thread counts", "[quicksim]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "QuickSim simulation of several SiDBs with varying thread counts", "[quicksim]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({3, 3, 0}, TestType::cell_type::NORMAL); @@ -149,10 +157,12 @@ TEMPLATE_TEST_CASE("QuickSim simulation of several SiDBs with varying thread cou } } -TEMPLATE_TEST_CASE("QuickSim simulation of an SiDB layout comprising of 10 SiDBs with varying thread counts", - "[quicksim]", (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "QuickSim simulation of an SiDB layout comprising of 10 SiDBs with varying thread counts", "[quicksim]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({-13, -1, 1}, TestType::cell_type::NORMAL); @@ -254,10 +264,12 @@ TEMPLATE_TEST_CASE("QuickSim simulation of an SiDB layout comprising of 10 SiDBs } } -TEMPLATE_TEST_CASE("QuickSim simulation of a Y-shape SiDB arrangement with varying thread counts", "[quicksim]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "QuickSim simulation of a Y-shape SiDB arrangement with varying thread counts", "[quicksim]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({-11, -2, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({-10, -1, 0}, TestType::cell_type::NORMAL); @@ -343,10 +355,12 @@ TEMPLATE_TEST_CASE("QuickSim simulation of a Y-shape SiDB arrangement with varyi } } -TEMPLATE_TEST_CASE("QuickSim simulation of a Y-shape SiDB OR gate with input 01 and varying thread counts", - "[quicksim]", (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "QuickSim simulation of a Y-shape SiDB OR gate with input 01 and varying thread counts", "[quicksim]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({6, 2, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({8, 3, 0}, TestType::cell_type::NORMAL); @@ -435,10 +449,12 @@ TEMPLATE_TEST_CASE("QuickSim simulation of a Y-shape SiDB OR gate with input 01 } } -TEMPLATE_TEST_CASE("QuickSim simulation of an SiDB BDL pair with varying thread counts", "[quicksim]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "QuickSim simulation of an SiDB BDL pair with varying thread counts", "[quicksim]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({6, 2, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({8, 2, 0}, TestType::cell_type::NORMAL); @@ -514,10 +530,12 @@ TEMPLATE_TEST_CASE("QuickSim simulation of an SiDB BDL pair with varying thread } } -TEMPLATE_TEST_CASE("QuickSim simulation of an layout comprising of 13 SiDBs", "[quicksim]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "QuickSim simulation of an layout comprising of 13 SiDBs", "[quicksim]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({11, 15, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({37, 8, 0}, TestType::cell_type::NORMAL); @@ -618,10 +636,12 @@ TEMPLATE_TEST_CASE("QuickSim simulation of an layout comprising of 13 SiDBs", "[ } } -TEMPLATE_TEST_CASE("QuickSim simulation of an layout comprising of 13 SiDBs, all negatively charged", "[quicksim]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "QuickSim simulation of an layout comprising of 13 SiDBs, all negatively charged", "[quicksim]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({26, 10, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({23, 19, 1}, TestType::cell_type::NORMAL); @@ -712,10 +732,12 @@ TEMPLATE_TEST_CASE("QuickSim simulation of an layout comprising of 13 SiDBs, all } } -TEMPLATE_TEST_CASE("QuickSim simulation of a Y-shape SiDB OR gate with input 01", "[ExGS]", - (cell_level_layout>>)) +TEMPLATE_TEST_CASE( + "QuickSim simulation of a Y-shape SiDB OR gate with input 01", "[ExGS]", + (cell_level_layout>>), + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; lyt.assign_cell_type({6, 2, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({8, 3, 0}, TestType::cell_type::NORMAL); diff --git a/test/algorithms/simulation/sidb/time_to_solution.cpp b/test/algorithms/simulation/sidb/time_to_solution.cpp index 013d3badd..046ddca42 100644 --- a/test/algorithms/simulation/sidb/time_to_solution.cpp +++ b/test/algorithms/simulation/sidb/time_to_solution.cpp @@ -21,13 +21,10 @@ using namespace fiction; TEMPLATE_TEST_CASE( "time to solution test", "[time-to-solution]", (cell_level_layout>>), - (cell_level_layout>>), - (cell_level_layout>>), - (cell_level_layout>>), - (cell_level_layout>>)) + (charge_distribution_surface>>>)) { - TestType lyt{{20, 10}}; + TestType lyt{}; SECTION("layout with no SiDB placed") { diff --git a/test/technology/charge_distribution_surface.cpp b/test/technology/charge_distribution_surface.cpp index 64fba70e4..7bd5c77fb 100644 --- a/test/technology/charge_distribution_surface.cpp +++ b/test/technology/charge_distribution_surface.cpp @@ -40,14 +40,16 @@ TEMPLATE_TEST_CASE( TestType lyt{}; using charge_layout = charge_distribution_surface; + CHECK(is_charge_distribution_surface_v); CHECK(is_cell_level_layout_v); CHECK(has_assign_charge_state_v); CHECK(has_get_charge_state_v); - const charge_layout defect_lyt{}; - const charge_layout defect_lyt_from_lyt{lyt}; + const charge_layout charge_lyt{}; + const charge_layout charge_lyt_from_lyt{lyt}; using charge_charge_layout = charge_distribution_surface; + CHECK(is_charge_distribution_surface_v); CHECK(is_cell_level_layout_v); CHECK(has_assign_charge_state_v); CHECK(has_get_charge_state_v); @@ -157,10 +159,9 @@ TEMPLATE_TEST_CASE( CHECK(charge_layout.get_charge_state_by_index(1) == sidb_charge_state::NEGATIVE); CHECK(charge_layout.get_charge_state_by_index(2) == sidb_charge_state::NEGATIVE); - charge_distribution_surface charge_layout_quickexact{lyt, - sidb_simulation_parameters{2}, - sidb_charge_state::NEGATIVE, - {5, 4}}; + charge_distribution_surface charge_layout_quickexact{lyt, sidb_simulation_parameters{2}, + sidb_charge_state::NEGATIVE}; + charge_layout_quickexact.assign_dependent_cell({5, 4}); charge_layout_quickexact.is_three_state_simulation_required(); CHECK(charge_layout_quickexact.get_charge_index_and_base().first == 0); charge_layout_quickexact.increase_charge_index_by_one( @@ -178,10 +179,9 @@ TEMPLATE_TEST_CASE( lyt.assign_cell_type({6, 5}, TestType::cell_type::NORMAL); lyt.assign_cell_type({7, 5}, TestType::cell_type::NORMAL); // assign dependent-cell at {5,5} - charge_distribution_surface charge_layout{lyt, - sidb_simulation_parameters{3, -0.25}, - sidb_charge_state::NEGATIVE, - {5, 5}}; + charge_distribution_surface charge_layout{lyt, sidb_simulation_parameters{3, -0.25}, + sidb_charge_state::NEGATIVE}; + charge_layout.assign_dependent_cell({5, 5}); CHECK(charge_layout.get_max_charge_index() == 8); CHECK(charge_layout.get_max_charge_index_sub_layout() == 0); @@ -274,10 +274,8 @@ TEMPLATE_TEST_CASE( lyt.assign_cell_type({10, 8}, TestType::cell_type::NORMAL); // dependent-cell is within the sublayout - charge_distribution_surface charge_layout{lyt, - sidb_simulation_parameters{}, - sidb_charge_state::NEGATIVE, - {5, 5}}; + charge_distribution_surface charge_layout{lyt, sidb_simulation_parameters{}, sidb_charge_state::NEGATIVE}; + charge_layout.assign_dependent_cell({5, 5}); CHECK(charge_layout.is_three_state_simulation_required()); charge_layout.assign_charge_state({6, 5}, sidb_charge_state::POSITIVE); charge_layout.assign_charge_state({7, 5}, sidb_charge_state::POSITIVE); @@ -285,10 +283,9 @@ TEMPLATE_TEST_CASE( CHECK(charge_layout.get_charge_index_of_sub_layout() == 8); // dependent-cell is not within the sublayout - charge_distribution_surface charge_layout_dependent_cell_not_in_sublayout{lyt, - sidb_simulation_parameters{}, - sidb_charge_state::NEGATIVE, - {10, 4}}; + charge_distribution_surface charge_layout_dependent_cell_not_in_sublayout{lyt, sidb_simulation_parameters{}, + sidb_charge_state::NEGATIVE}; + charge_layout_dependent_cell_not_in_sublayout.assign_dependent_cell({10, 4}); CHECK(charge_layout_dependent_cell_not_in_sublayout.is_three_state_simulation_required()); charge_layout_dependent_cell_not_in_sublayout.assign_charge_state({5, 5}, sidb_charge_state::POSITIVE); charge_layout_dependent_cell_not_in_sublayout.assign_charge_state({6, 5}, sidb_charge_state::POSITIVE); @@ -753,11 +750,8 @@ TEMPLATE_TEST_CASE( lyt_new.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); lyt_new.assign_cell_type({10, 5, 1}, TestType::cell_type::NORMAL); - charge_distribution_surface charge_layout_new{lyt_new, - params, - sidb_charge_state::NEUTRAL, - {}, - {{{0, 0, 1}, -0.5}}}; + charge_distribution_surface charge_layout_new{lyt_new, params, sidb_charge_state::NEUTRAL}; + charge_layout_new.assign_local_external_potential({{{0, 0, 1}, -0.5}}); REQUIRE(!charge_layout_new.get_local_external_potentials().empty()); CHECK(charge_layout_new.get_local_external_potentials().size() == 1); CHECK(charge_layout_new.get_local_external_potentials().size() == 1); @@ -1021,7 +1015,8 @@ TEMPLATE_TEST_CASE( lyt_new.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); lyt_new.assign_cell_type({10, 4, 1}, TestType::cell_type::NORMAL); - charge_distribution_surface charge_layout_new{lyt_new, params, sidb_charge_state::NEGATIVE, {10, 4, 1}}; + charge_distribution_surface charge_layout_new{lyt_new, params, sidb_charge_state::NEGATIVE}; + charge_layout_new.assign_dependent_cell({10, 4, 1}); charge_layout_new.assign_charge_state({0, 3, 1}, sidb_charge_state::NEGATIVE); charge_layout_new.assign_charge_state({1, 3, 0}, sidb_charge_state::NEGATIVE); @@ -1052,7 +1047,8 @@ TEMPLATE_TEST_CASE( lyt_new.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); lyt_new.assign_cell_type({10, 4, 1}, TestType::cell_type::NORMAL); - charge_distribution_surface charge_layout_new{lyt_new, params, sidb_charge_state::NEGATIVE, {10, 4, 1}}; + charge_distribution_surface charge_layout_new{lyt_new, params, sidb_charge_state::NEGATIVE}; + charge_layout_new.assign_dependent_cell({10, 4, 1}); REQUIRE(charge_layout_new.get_local_potential({0, 3, 1}).has_value()); REQUIRE(charge_layout_new.get_local_potential({1, 3, 0}).has_value()); @@ -1078,7 +1074,8 @@ TEMPLATE_TEST_CASE( lyt_new.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); lyt_new.assign_cell_type({10, 4, 1}, TestType::cell_type::NORMAL); - charge_distribution_surface charge_layout_new{lyt_new, params, sidb_charge_state::NEGATIVE, {10, 4, 1}}; + charge_distribution_surface charge_layout_new{lyt_new, params, sidb_charge_state::NEGATIVE}; + charge_layout_new.assign_dependent_cell({10, 4, 1}); charge_layout_new.assign_charge_state({0, 3, 1}, sidb_charge_state::NEGATIVE); charge_layout_new.assign_charge_state({1, 3, 0}, sidb_charge_state::NEUTRAL); @@ -1127,10 +1124,8 @@ TEMPLATE_TEST_CASE( lyt.assign_cell_type({3, 0, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({5, 0, 0}, TestType::cell_type::NORMAL); - charge_distribution_surface charge_layout{lyt, - sidb_simulation_parameters{}, - sidb_charge_state::NEGATIVE, - {3, 0, 0}}; + charge_distribution_surface charge_layout{lyt, sidb_simulation_parameters{}, sidb_charge_state::NEGATIVE}; + charge_layout.assign_dependent_cell({3, 0, 0}); CHECK(charge_layout.get_charge_state({0, 0, 0}) == sidb_charge_state::NEGATIVE); CHECK(charge_layout.get_charge_state({3, 0, 0}) == sidb_charge_state::NEGATIVE); CHECK(charge_layout.get_charge_state({5, 0, 0}) == sidb_charge_state::NEGATIVE); @@ -1150,7 +1145,8 @@ TEMPLATE_TEST_CASE( const sidb_simulation_parameters params{2, -0.32}; - charge_distribution_surface charge_layout{lyt, params, sidb_charge_state::NEGATIVE, {3, 0, 0}}; + charge_distribution_surface charge_layout{lyt, params, sidb_charge_state::NEGATIVE}; + charge_layout.assign_dependent_cell({3, 0, 0}); CHECK(charge_layout.get_charge_state({0, 0, 0}) == sidb_charge_state::NEGATIVE); CHECK(charge_layout.get_charge_state({3, 0, 0}) == sidb_charge_state::NEGATIVE); CHECK(charge_layout.get_charge_state({5, 0, 0}) == sidb_charge_state::NEGATIVE); @@ -1174,10 +1170,8 @@ TEMPLATE_TEST_CASE( lyt.assign_cell_type({3, 0, 0}, TestType::cell_type::NORMAL); lyt.assign_cell_type({5, 0, 0}, TestType::cell_type::NORMAL); - charge_distribution_surface charge_layout{lyt, - sidb_simulation_parameters{}, - sidb_charge_state::NEGATIVE, - {3, 0, 0}}; + charge_distribution_surface charge_layout{lyt, sidb_simulation_parameters{}, sidb_charge_state::NEGATIVE}; + charge_layout.assign_dependent_cell({3, 0, 0}); CHECK(charge_layout.get_charge_state({0, 0, 0}) == sidb_charge_state::NEGATIVE); CHECK(charge_layout.get_charge_state({3, 0, 0}) == sidb_charge_state::NEGATIVE); CHECK(charge_layout.get_charge_state({5, 0, 0}) == sidb_charge_state::NEGATIVE); @@ -1197,7 +1191,8 @@ TEMPLATE_TEST_CASE( const sidb_simulation_parameters params{2, -0.32}; - charge_distribution_surface charge_layout{lyt, params, sidb_charge_state::NEGATIVE, {0, 0, 0}}; + charge_distribution_surface charge_layout{lyt, params, sidb_charge_state::NEGATIVE}; + charge_layout.assign_dependent_cell({0, 0, 0}); CHECK(charge_layout.get_charge_state({0, 0, 0}) == sidb_charge_state::NEGATIVE); CHECK(charge_layout.get_charge_state({3, 0, 0}) == sidb_charge_state::NEGATIVE); CHECK(charge_layout.get_charge_state({5, 0, 0}) == sidb_charge_state::NEGATIVE); @@ -1667,11 +1662,8 @@ TEMPLATE_TEST_CASE( lyt_new.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); lyt_new.assign_cell_type({10, 5, 1}, TestType::cell_type::NORMAL); - charge_distribution_surface charge_layout_new{lyt_new, - params, - sidb_charge_state::NEUTRAL, - {}, - {{{0, 0, 1}, -0.5}}}; + charge_distribution_surface charge_layout_new{lyt_new, params, sidb_charge_state::NEUTRAL}; + charge_layout_new.assign_local_external_potential({{{0, 0, 1}, -0.5}}); REQUIRE(!charge_layout_new.get_local_external_potentials().empty()); CHECK(charge_layout_new.get_local_external_potentials().size() == 1); CHECK(charge_layout_new.get_local_external_potentials().size() == 1); @@ -1792,7 +1784,7 @@ TEMPLATE_TEST_CASE( lyt_new.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); lyt_new.assign_cell_type({10, 5, 1}, TestType::cell_type::NORMAL); - charge_distribution_surface charge_layout_new{lyt_new, params, sidb_charge_state::NEUTRAL, {}}; + charge_distribution_surface charge_layout_new{lyt_new, params, sidb_charge_state::NEUTRAL}; charge_layout_new.add_sidb_defect_to_potential_landscape( {5, 1, 1}, sidb_defect{sidb_defect_type::UNKNOWN, -1, charge_layout_new.get_phys_params().epsilon_r, @@ -1816,7 +1808,7 @@ TEMPLATE_TEST_CASE( lyt_new.assign_cell_type({1, 3, 0}, TestType::cell_type::NORMAL); lyt_new.assign_cell_type({10, 5, 1}, TestType::cell_type::NORMAL); - charge_distribution_surface charge_layout_new{lyt_new, params, sidb_charge_state::NEUTRAL, {}}; + charge_distribution_surface charge_layout_new{lyt_new, params, sidb_charge_state::NEUTRAL}; charge_layout_new.add_sidb_defect_to_potential_landscape( {5, 1, 1}, sidb_defect{sidb_defect_type::UNKNOWN, 1, charge_layout_new.get_phys_params().epsilon_r, @@ -1839,7 +1831,7 @@ TEMPLATE_TEST_CASE( lyt_new.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); lyt_new.assign_cell_type({10, 5, 1}, TestType::cell_type::NORMAL); - charge_distribution_surface charge_layout_new{lyt_new, params, sidb_charge_state::NEUTRAL, {}}; + charge_distribution_surface charge_layout_new{lyt_new, params, sidb_charge_state::NEUTRAL}; REQUIRE(charge_layout_new.get_local_potential({0, 0, 0}).has_value()); REQUIRE(charge_layout_new.get_local_potential({10, 5, 1}).has_value()); @@ -1860,7 +1852,7 @@ TEMPLATE_TEST_CASE( lyt_new.assign_cell_type({0, 0, 0}, TestType::cell_type::NORMAL); lyt_new.assign_cell_type({10, 5, 1}, TestType::cell_type::NORMAL); - charge_distribution_surface charge_layout{lyt_new, params, sidb_charge_state::NEUTRAL, {}}; + charge_distribution_surface charge_layout{lyt_new, params, sidb_charge_state::NEUTRAL}; REQUIRE(charge_layout.get_local_potential({0, 0, 0}).has_value()); REQUIRE(charge_layout.get_local_potential({10, 5, 1}).has_value()); @@ -1912,7 +1904,8 @@ TEMPLATE_TEST_CASE( const sidb_simulation_parameters params{2, -0.32}; - charge_distribution_surface charge_layout{lyt, params, sidb_charge_state::NEGATIVE, {0, 0, 0}}; + charge_distribution_surface charge_layout{lyt, params, sidb_charge_state::NEGATIVE}; + charge_layout.assign_dependent_cell({0, 0, 0}); REQUIRE(charge_layout.get_local_potential({0, 0, 0}).has_value()); REQUIRE(charge_layout.get_local_potential({3, 0, 0}).has_value()); @@ -1980,7 +1973,8 @@ TEMPLATE_TEST_CASE( const sidb_simulation_parameters params{2, -0.32}; - charge_distribution_surface charge_layout{lyt, params, sidb_charge_state::NEGATIVE, {0, 0, 0}}; + charge_distribution_surface charge_layout{lyt, params, sidb_charge_state::NEGATIVE}; + charge_layout.assign_dependent_cell({0, 0, 0}); REQUIRE(charge_layout.get_local_potential({0, 0, 0}).has_value()); REQUIRE(charge_layout.get_local_potential({3, 0, 0}).has_value()); @@ -2049,7 +2043,8 @@ TEMPLATE_TEST_CASE( const sidb_simulation_parameters params{2, -0.32}; - charge_distribution_surface charge_layout{lyt, params, sidb_charge_state::NEUTRAL, {0, 0, 0}}; + charge_distribution_surface charge_layout{lyt, params, sidb_charge_state::NEUTRAL}; + charge_layout.assign_dependent_cell({0, 0, 0}); REQUIRE(charge_layout.get_local_potential({0, 0, 0}).has_value()); REQUIRE(charge_layout.get_local_potential({3, 0, 0}).has_value()); @@ -2085,7 +2080,8 @@ TEMPLATE_TEST_CASE( const sidb_simulation_parameters params{2, -0.32}; - charge_distribution_surface charge_layout{lyt, params, sidb_charge_state::NEUTRAL, {0, 0, 0}}; + charge_distribution_surface charge_layout{lyt, params, sidb_charge_state::NEUTRAL}; + charge_layout.assign_dependent_cell({0, 0, 0}); REQUIRE(charge_layout.get_local_potential({0, 0, 0}).has_value()); REQUIRE(charge_layout.get_local_potential({3, 0, 0}).has_value());