From 76c2d4d1270893c4bf8e727bc6f1bb5eb3e2a83f Mon Sep 17 00:00:00 2001 From: Drewniok Date: Fri, 12 Apr 2024 09:56:16 +0200 Subject: [PATCH] :art: rename function and update docu. --- .../assess_physical_population_stability.hpp | 15 ++-- .../pyfiction/pybind11_mkdoc_docstrings.hpp | 4 +- .../pyfiction/technology/sidb_nm_distance.hpp | 4 +- ...st_assess_physical_population_stability.py | 27 ++++-- .../test/technology/test_sidb_nm_distance.py | 20 ++--- docs/algorithms/exact.rst | 3 + docs/algorithms/one_pass_synthesis.rst | 4 +- docs/algorithms/sidb_simulation.rst | 90 +++++++++++++------ docs/technology/sidb_lattice.rst | 4 +- docs/technology/simulation.rst | 4 +- .../physical_design/design_sidb_gates.hpp | 4 +- .../simulation/sidb/detect_bdl_pairs.hpp | 5 +- ...defect_influence_position_and_distance.hpp | 2 +- .../charge_distribution_surface.hpp | 14 +-- .../fiction/technology/sidb_nm_distance.hpp | 4 +- ...defect_influence_position_and_distance.cpp | 6 +- 16 files changed, 134 insertions(+), 76 deletions(-) diff --git a/bindings/pyfiction/include/pyfiction/algorithms/simulation/sidb/assess_physical_population_stability.hpp b/bindings/pyfiction/include/pyfiction/algorithms/simulation/sidb/assess_physical_population_stability.hpp index 9258453ed..4c0df375b 100644 --- a/bindings/pyfiction/include/pyfiction/algorithms/simulation/sidb/assess_physical_population_stability.hpp +++ b/bindings/pyfiction/include/pyfiction/algorithms/simulation/sidb/assess_physical_population_stability.hpp @@ -20,13 +20,14 @@ namespace detail { template -void assess_physical_population_stability(pybind11::module& m) +void assess_physical_population_stability(pybind11::module& m, const std::string& lattice = "") { namespace py = pybind11; using namespace pybind11::literals; - py::class_>(m, "population_stability_information", - DOC(fiction_population_stability_information)) + py::class_>( + m, fmt::format("population_stability_information{}", lattice).c_str(), + DOC(fiction_population_stability_information)) .def(py::init<>()) .def_readwrite("critical_cell", &fiction::population_stability_information::critical_cell, DOC(fiction_population_stability_information_critical_cell)) @@ -41,7 +42,8 @@ void assess_physical_population_stability(pybind11::module& m) .def_readwrite("system_energy", &fiction::population_stability_information::system_energy, DOC(fiction_population_stability_information_system_energy)); - m.def("assess_physical_population_stability", &fiction::assess_physical_population_stability, "lyt"_a, + m.def(fmt::format("assess_physical_population_stability{}", lattice).c_str(), + &fiction::assess_physical_population_stability, "lyt"_a, "params"_a = fiction::assess_physical_population_stability_params{}, DOC(fiction_assess_physical_population_stability)); } @@ -78,9 +80,8 @@ inline void assess_physical_population_stability(pybind11::module& m) // NOTE be careful with the order of the following calls! Python will resolve the first matching overload! - detail::assess_physical_population_stability(m); - // detail::assess_physical_population_stability(m); - // detail::assess_physical_population_stability(m); + detail::assess_physical_population_stability(m, "_100"); + detail::assess_physical_population_stability(m, "_111"); } } // namespace pyfiction diff --git a/bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp b/bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp index 76ce06f89..a5f8b5e70 100644 --- a/bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp +++ b/bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp @@ -6548,13 +6548,13 @@ algorithm.)doc"; static const char *__doc_fiction_detail_yen_k_shortest_paths_impl_yen_k_shortest_paths_impl = R"doc()doc"; static const char *__doc_fiction_detect_bdl_pairs = - R"doc(This algorithm detects BDL pairs in an SiDB layout. It does so by + R"doc(This algorithm detects BDL pairs in an SiDB layout. It does so by first collecting all dots of the given type and then uniquely pairing them up based on their distance. Lower and upper distance thresholds can be defined (defaults = 0.75 nm and 1.5 nm, respectively) to narrow down the range in which SiDBs could be considered a BDL pair. The distance between two dots is computed using the -`sidb_nanometer_distance` function. The algorithm returns a vector of +`sidb_nm_distance` function. The algorithm returns a vector of BDL pairs. Template parameter ``Lyt``: diff --git a/bindings/pyfiction/include/pyfiction/technology/sidb_nm_distance.hpp b/bindings/pyfiction/include/pyfiction/technology/sidb_nm_distance.hpp index b9a9e7e11..881e771d9 100644 --- a/bindings/pyfiction/include/pyfiction/technology/sidb_nm_distance.hpp +++ b/bindings/pyfiction/include/pyfiction/technology/sidb_nm_distance.hpp @@ -23,8 +23,8 @@ void nanometer_distance(pybind11::module& m, const std::string& lattice = "") { using namespace pybind11::literals; - m.def(fmt::format("sidb_nanometer_distance{}", lattice).c_str(), &fiction::sidb_nanometer_distance, "lyt"_a, - "source"_a, "target"_a); + m.def(fmt::format("sidb_nm_distance{}", lattice).c_str(), &fiction::sidb_nm_distance, "lyt"_a, "source"_a, + "target"_a, DOC(fiction_sidb_nanometer_distance)); } } // namespace detail diff --git a/bindings/pyfiction/test/algorithms/simulation/sidb/test_assess_physical_population_stability.py b/bindings/pyfiction/test/algorithms/simulation/sidb/test_assess_physical_population_stability.py index a063ba756..abc9b2f7d 100644 --- a/bindings/pyfiction/test/algorithms/simulation/sidb/test_assess_physical_population_stability.py +++ b/bindings/pyfiction/test/algorithms/simulation/sidb/test_assess_physical_population_stability.py @@ -5,22 +5,39 @@ class TestAssessPhysicalPopulationStability(unittest.TestCase): - def test_three_DBs(self): - layout = sidb_layout((2, 3)) + def test_three_DBs_100_lattice(self): + layout = sidb_lattice_100((2, 3)) layout.assign_cell_type((0, 1), sidb_technology.cell_type.NORMAL) layout.assign_cell_type((0, 3), sidb_technology.cell_type.NORMAL) layout.assign_cell_type((1, 1), sidb_technology.cell_type.NORMAL) params = assess_physical_population_stability_params() params.simulation_parameters.mu_minus = -0.25 - cds = charge_distribution_surface(layout) - result = assess_physical_population_stability(layout, params) + cds = charge_distribution_surface_100(layout) + result = assess_physical_population_stability_100(layout, params) self.assertEqual(len(result), 5) self.assertLessEqual(result[0].system_energy, result[1].system_energy) self.assertLessEqual(result[1].system_energy, result[2].system_energy) params.simulation_parameters.mu_minus = -0.32 - result = assess_physical_population_stability(cds, params) + result = assess_physical_population_stability_100(cds, params) self.assertEqual(len(result), 1) + def test_three_DBs_111_lattice(self): + layout = sidb_lattice_111((2, 3)) + layout.assign_cell_type((0, 1), sidb_technology.cell_type.NORMAL) + layout.assign_cell_type((0, 3), sidb_technology.cell_type.NORMAL) + layout.assign_cell_type((1, 1), sidb_technology.cell_type.NORMAL) + params = assess_physical_population_stability_params() + params.simulation_parameters.mu_minus = -0.25 + cds = charge_distribution_surface_111(layout) + result = assess_physical_population_stability_111(layout, params) + self.assertEqual(len(result), 5) + self.assertLessEqual(result[0].system_energy, result[1].system_energy) + self.assertLessEqual(result[1].system_energy, result[2].system_energy) + + params.simulation_parameters.mu_minus = -0.32 + result = assess_physical_population_stability_111(cds, params) + self.assertEqual(len(result), 2) + if __name__ == '__main__': unittest.main() diff --git a/bindings/pyfiction/test/technology/test_sidb_nm_distance.py b/bindings/pyfiction/test/technology/test_sidb_nm_distance.py index b0c9de5b0..046721b00 100644 --- a/bindings/pyfiction/test/technology/test_sidb_nm_distance.py +++ b/bindings/pyfiction/test/technology/test_sidb_nm_distance.py @@ -8,25 +8,25 @@ def test_sidb_nm_distance_100_lattice(self): layout_one = sidb_lattice_100((10, 10)) # Replace the placeholders with actual values or function calls - self.assertEqual(sidb_nanometer_distance_100(layout_one, (0, 0), (0, 0)), 0) - self.assertEqual(sidb_nanometer_distance_100(layout_one, (1, 0), (1, 0)), 0) - self.assertEqual(sidb_nanometer_distance_100(layout_one, (1, 1), (1, 1)), 0) + self.assertEqual(sidb_nm_distance_100(layout_one, (0, 0), (0, 0)), 0) + self.assertEqual(sidb_nm_distance_100(layout_one, (1, 0), (1, 0)), 0) + self.assertEqual(sidb_nm_distance_100(layout_one, (1, 1), (1, 1)), 0) # Replace the placeholders with actual values or function calls - self.assertAlmostEqual(sidb_nanometer_distance_100(layout_one, (0, 0), (2, 0)), 2 * 0.384) - self.assertAlmostEqual(sidb_nanometer_distance_100(layout_one, (0, 0), (0, 1)), 0.225) + self.assertAlmostEqual(sidb_nm_distance_100(layout_one, (0, 0), (2, 0)), 2 * 0.384) + self.assertAlmostEqual(sidb_nm_distance_100(layout_one, (0, 0), (0, 1)), 0.225) def test_sidb_nm_distance_100_lattice(self): layout_one = sidb_lattice_111((10, 10)) # Replace the placeholders with actual values or function calls - self.assertEqual(sidb_nanometer_distance_111(layout_one, (0, 0), (0, 0)), 0) - self.assertEqual(sidb_nanometer_distance_111(layout_one, (1, 0), (1, 0)), 0) - self.assertEqual(sidb_nanometer_distance_111(layout_one, (1, 1), (1, 1)), 0) + self.assertEqual(sidb_nm_distance_111(layout_one, (0, 0), (0, 0)), 0) + self.assertEqual(sidb_nm_distance_111(layout_one, (1, 0), (1, 0)), 0) + self.assertEqual(sidb_nm_distance_111(layout_one, (1, 1), (1, 1)), 0) # Replace the placeholders with actual values or function calls - self.assertAlmostEqual(sidb_nanometer_distance_111(layout_one, (0, 0), (2, 0)), 1.33) - self.assertAlmostEqual(sidb_nanometer_distance_111(layout_one, (0, 0), (0, 1)), 0.3839967) + self.assertAlmostEqual(sidb_nm_distance_111(layout_one, (0, 0), (2, 0)), 1.33) + self.assertAlmostEqual(sidb_nm_distance_111(layout_one, (0, 0), (0, 1)), 0.3839967) if __name__ == '__main__': diff --git a/docs/algorithms/exact.rst b/docs/algorithms/exact.rst index 6b2c86be1..fcf0424e9 100644 --- a/docs/algorithms/exact.rst +++ b/docs/algorithms/exact.rst @@ -15,6 +15,9 @@ network specifications under constraints. This approach finds exact results but .. doxygenstruct:: fiction::exact_physical_design_stats :members: .. doxygenfunction:: fiction::exact(const Ntk& ntk, const exact_physical_design_params& ps = {}, exact_physical_design_stats* pst = nullptr) + .. doxygenfunction:: exact_with_blacklist(const Ntk& ntk, const surface_black_list& black_list, + exact_physical_design_params ps = {}, + exact_physical_design_stats* pst = nullptr) .. tab:: Python .. autoclass:: mnt.pyfiction.exact_params diff --git a/docs/algorithms/one_pass_synthesis.rst b/docs/algorithms/one_pass_synthesis.rst index 7f4a09960..9464abea2 100644 --- a/docs/algorithms/one_pass_synthesis.rst +++ b/docs/algorithms/one_pass_synthesis.rst @@ -14,5 +14,5 @@ opportunity to generate even smaller layouts than ``exact``. Consequently, this :members: .. doxygenstruct:: fiction::one_pass_synthesis_stats :members: -.. doxygenfunction:: fiction::one_pass_synthesis(const std::vector& tts, one_pass_synthesis_params& ps = {}, one_pass_synthesis_stats* pst = nullptr) -.. doxygenfunction:: fiction::one_pass_synthesis(const Ntk& ntk, const one_pass_synthesis_params& ps = {}, one_pass_synthesis_stats* pst = nullptr) +.. doxygenfunction:: fiction::one_pass_synthesis(const std::vector& tts, one_pass_synthesis_params& ps = {}, one_pass_synthesis_stats* pst = nullptr) +.. doxygenfunction:: fiction::one_pass_synthesis(const Ntk& ntk, const one_pass_synthesis_params& ps = {}, one_pass_synthesis_stats* pst = nullptr) diff --git a/docs/algorithms/sidb_simulation.rst b/docs/algorithms/sidb_simulation.rst index 97b62c69a..3158bbe8f 100644 --- a/docs/algorithms/sidb_simulation.rst +++ b/docs/algorithms/sidb_simulation.rst @@ -30,7 +30,9 @@ Simulation Result :members: .. tab:: Python - .. autoclass:: mnt.pyfiction.sidb_simulation_result + .. autoclass:: mnt.pyfiction.sidb_simulation_result_100 + :members: + .. autoclass:: mnt.pyfiction.sidb_simulation_result_111 :members: @@ -52,7 +54,8 @@ Heuristic Ground State Simulation .. autoclass:: mnt.pyfiction.quicksim_params :members: - .. autofunction:: mnt.pyfiction.quicksim + .. autofunction:: mnt.pyfiction.quicksim_100 + .. autofunction:: mnt.pyfiction.quicksim_111 Exhaustive Ground State Simulation @@ -73,11 +76,15 @@ Exhaustive Ground State Simulation .. doxygenfunction:: fiction::exhaustive_ground_state_simulation .. tab:: Python - .. autoclass:: mnt.pyfiction.quickexact_params + .. autoclass:: mnt.pyfiction.quickexact_params_100 + :members: + .. autoclass:: mnt.pyfiction.quickexact_params_111 :members: - .. autofunction:: mnt.pyfiction.quickexact + .. autofunction:: mnt.pyfiction.quickexact_100 + .. autofunction:: mnt.pyfiction.quickexact_111 - .. autofunction:: mnt.pyfiction.exhaustive_ground_state_simulation + .. autofunction:: mnt.pyfiction.exhaustive_ground_state_simulation_100 + .. autofunction:: mnt.pyfiction.exhaustive_ground_state_simulation_111 Engine Selectors @@ -121,14 +128,11 @@ Energy Calculation .. tab:: Python .. autofunction:: mnt.pyfiction.energy_distribution - .. autofunction:: mnt.pyfiction.minimum_energy - - .. autofunction:: mnt.pyfiction.is_ground_state - + .. autofunction:: mnt.pyfiction.minimum_energy_100 + .. autofunction:: mnt.pyfiction.minimum_energy_111 -**Header:** ``fiction/algorithms/simulation/sidb/determine_groundstate_from_simulation_results.hpp`` - -.. doxygenfunction:: fiction::determine_groundstate_from_simulation_results + .. autofunction:: mnt.pyfiction.is_ground_state_100 + .. autofunction:: mnt.pyfiction.is_ground_state_111 Temperature Behavior @@ -162,8 +166,10 @@ Temperature Behavior :members: .. autoclass:: mnt.pyfiction.critical_temperature_params :members: - .. autofunction:: mnt.pyfiction.critical_temperature_gate_based - .. autofunction:: mnt.pyfiction.critical_temperature_non_gate_based + .. autofunction:: mnt.pyfiction.critical_temperature_gate_based_100 + .. autofunction:: mnt.pyfiction.critical_temperature_non_gate_based_100 + .. autofunction:: mnt.pyfiction.critical_temperature_gate_based_111 + .. autofunction:: mnt.pyfiction.critical_temperature_non_gate_based_111 .. autofunction:: mnt.pyfiction.occupation_probability_gate_based .. autofunction:: mnt.pyfiction.occupation_probability_non_gate_based @@ -199,7 +205,8 @@ Time-to-Solution (TTS) Statistics :members: .. autoclass:: mnt.pyfiction.time_to_solution_stats :members: - .. autofunction:: mnt.pyfiction.time_to_solution + .. autofunction:: mnt.pyfiction.time_to_solution_100 + .. autofunction:: mnt.pyfiction.time_to_solution_111 Random SiDB Layout Generator @@ -233,7 +240,7 @@ Operational Domain Computation .. doxygenenum:: fiction::operational_status .. doxygenstruct:: fiction::is_operational_params :members: - .. doxygenfunction:: fiction::is_operational + .. doxygenfunction:: fiction::is_operational_100 .. doxygenfunction:: fiction::operational_input_patterns **Header:** ``fiction/algorithms/simulation/sidb/operational_domain.hpp`` @@ -256,7 +263,10 @@ Operational Domain Computation :members: .. autoclass:: mnt.pyfiction.is_operational_params :members: - .. autofunction:: mnt.pyfiction.is_operational + .. autofunction:: mnt.pyfiction.is_operational_100 + .. autofunction:: mnt.pyfiction.is_operational_111 + .. autofunction:: mnt.pyfiction.operational_input_patterns_100 + .. autofunction:: mnt.pyfiction.operational_input_patterns_111 .. autoclass:: mnt.pyfiction.sweep_parameter :members: @@ -269,10 +279,14 @@ Operational Domain Computation .. autoclass:: mnt.pyfiction.operational_domain_stats :members: - .. autofunction:: mnt.pyfiction.operational_domain_grid_search - .. autofunction:: mnt.pyfiction.operational_domain_random_sampling - .. autofunction:: mnt.pyfiction.operational_domain_flood_fill - .. autofunction:: mnt.pyfiction.operational_domain_contour_tracing + .. autofunction:: mnt.pyfiction.operational_domain_grid_search_100 + .. autofunction:: mnt.pyfiction.operational_domain_grid_search_111 + .. autofunction:: mnt.pyfiction.operational_domain_random_sampling_100 + .. autofunction:: mnt.pyfiction.operational_domain_random_sampling_111 + .. autofunction:: mnt.pyfiction.operational_domain_flood_fill_100 + .. autofunction:: mnt.pyfiction.operational_domain_flood_fill_111 + .. autofunction:: mnt.pyfiction.operational_domain_contour_tracing_100 + .. autofunction:: mnt.pyfiction.operational_domain_contour_tracing_111 Utility Functions @@ -291,6 +305,20 @@ Simulation Equivalence Checking .. autofunction:: fiction::check_simulation_results_for_equivalence +Determine the Ground State from Simulation Results +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. tabs:: + .. tab:: C++ + **Header:** ``fiction/algorithms/simulation/sidb/determine_groundstate_from_simulation_results.hpp`` + + .. doxygenfunction:: fiction::determine_groundstate_from_simulation_results + + .. tab:: Python + .. doxygenfunction:: fiction::determine_groundstate_from_simulation_results_100 + .. doxygenfunction:: fiction::determine_groundstate_from_simulation_results_111 + + Charge Detection ^^^^^^^^^^^^^^^^ @@ -301,7 +329,8 @@ Charge Detection .. doxygenfunction:: fiction::can_positive_charges_occur .. tab:: Python - .. autofunction:: mnt.pyfiction.can_positive_charges_occur + .. autofunction:: mnt.pyfiction.can_positive_charges_occur_100 + .. autofunction:: mnt.pyfiction.can_positive_charges_occur_111 Binary-dot Logic (BDL) Pair Detection ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -317,11 +346,14 @@ Binary-dot Logic (BDL) Pair Detection .. doxygenfunction:: fiction::detect_bdl_pairs .. tab:: Python - .. autoclass:: mnt.pyfiction.bdl_pair + .. autoclass:: mnt.pyfiction.bdl_pair_100 + :members: + .. autoclass:: mnt.pyfiction.bdl_pair_111 :members: .. autoclass:: mnt.pyfiction.detect_bdl_pairs_params :members: - .. autofunction:: mnt.pyfiction.detect_bdl_pairs + .. autofunction:: mnt.pyfiction.detect_bdl_pairs_100 + .. autofunction:: mnt.pyfiction.detect_bdl_pairs_111 Assess Population Stability @@ -343,9 +375,12 @@ Assess Population Stability :members: .. autoclass:: mnt.pyfiction.population_stability_information :members: - .. autoclass:: mnt.pyfiction.assess_physical_population_stability_params + .. autoclass:: mnt.pyfiction.assess_physical_population_stability_params_100 + :members: + .. autoclass:: mnt.pyfiction.assess_physical_population_stability_params_111 :members: - .. autofunction:: mnt.pyfiction.assess_physical_population_stability + .. autofunction:: mnt.pyfiction.assess_physical_population_stability_100 + .. autofunction:: mnt.pyfiction.assess_physical_population_stability_111 Positive Charge Detection @@ -358,7 +393,8 @@ Positive Charge Detection .. doxygenfunction:: fiction::can_positive_charges_occur .. tab:: Python - .. autofunction:: fiction::can_positive_charges_occur + .. autofunction:: fiction::can_positive_charges_occur_100 + .. autofunction:: fiction::can_positive_charges_occur_111 Convert Potential to Distance diff --git a/docs/technology/sidb_lattice.rst b/docs/technology/sidb_lattice.rst index 618d40288..e3fa13c37 100644 --- a/docs/technology/sidb_lattice.rst +++ b/docs/technology/sidb_lattice.rst @@ -11,5 +11,7 @@ The SiDB lattice layout can be layered on top of an SiDB cell-level layout. It i :members: .. tab:: Python - .. autoclass:: mnt.pyfiction.sidb_lattice + .. autoclass:: mnt.pyfiction.sidb_lattice_100 + :members: + .. autoclass:: mnt.pyfiction.sidb_lattice_111 :members: diff --git a/docs/technology/simulation.rst b/docs/technology/simulation.rst index f857abaa3..8607dbd1c 100644 --- a/docs/technology/simulation.rst +++ b/docs/technology/simulation.rst @@ -66,7 +66,7 @@ Euclidean distance between two SiDBs in nanometers .. tab:: C++ **Header:** ``fiction/technology/sidb_nm_distance.hpp`` - .. doxygenfunction:: fiction::sidb_nanometer_distance + .. doxygenfunction:: fiction::sidb_nm_distance_100 .. tab:: Python - .. autoclass:: mnt.pyfiction.sidb_nanometer_distance + .. autoclass:: mnt.pyfiction.sidb_nm_distance_111 diff --git a/include/fiction/algorithms/physical_design/design_sidb_gates.hpp b/include/fiction/algorithms/physical_design/design_sidb_gates.hpp index 46a6ddf0c..d97b2c014 100644 --- a/include/fiction/algorithms/physical_design/design_sidb_gates.hpp +++ b/include/fiction/algorithms/physical_design/design_sidb_gates.hpp @@ -241,8 +241,8 @@ class design_sidb_gates_impl { for (std::size_t j = i + 1; j < cell_indices.size(); j++) { - if (sidb_nanometer_distance(Lyt{}, all_sidbs_in_canvas[cell_indices[i]], - all_sidbs_in_canvas[cell_indices[j]]) < 0.5) + if (sidb_nm_distance(Lyt{}, all_sidbs_in_canvas[cell_indices[i]], + all_sidbs_in_canvas[cell_indices[j]]) < 0.5) { return true; } diff --git a/include/fiction/algorithms/simulation/sidb/detect_bdl_pairs.hpp b/include/fiction/algorithms/simulation/sidb/detect_bdl_pairs.hpp index 0acbafcdc..27008dc60 100644 --- a/include/fiction/algorithms/simulation/sidb/detect_bdl_pairs.hpp +++ b/include/fiction/algorithms/simulation/sidb/detect_bdl_pairs.hpp @@ -80,7 +80,7 @@ struct detect_bdl_pairs_params * This algorithm detects BDL pairs in an SiDB layout. It does so by first collecting all dots of the given type and * then uniquely pairing them up based on their distance. Lower and upper distance thresholds can be defined (defaults = * 0.75 nm and 1.5 nm, respectively) to narrow down the range in which SiDBs could be considered a BDL pair. The - * distance between two dots is computed using the `sidb_nanometer_distance` function. The algorithm returns a vector of + * distance between two dots is computed using the `sidb_nm_distance` function. The algorithm returns a vector of * BDL pairs. * * @tparam Lyt SiDB cell-level layout type. @@ -153,8 +153,7 @@ std::vector> detect_bdl_pairs(const Lyt& lyt, const typename techn { for (auto j = i + 1; j < dots.size(); ++j) { - pairwise_distances.emplace_back(dots[i], dots[j], - sidb_nanometer_distance(lyt, dots[i], dots[j])); + pairwise_distances.emplace_back(dots[i], dots[j], sidb_nm_distance(lyt, dots[i], dots[j])); } } diff --git a/include/fiction/algorithms/simulation/sidb/maximum_defect_influence_position_and_distance.hpp b/include/fiction/algorithms/simulation/sidb/maximum_defect_influence_position_and_distance.hpp index a1d2d3105..d823f4a53 100644 --- a/include/fiction/algorithms/simulation/sidb/maximum_defect_influence_position_and_distance.hpp +++ b/include/fiction/algorithms/simulation/sidb/maximum_defect_influence_position_and_distance.hpp @@ -141,7 +141,7 @@ class maximum_defect_influence_position_and_distance_impl layout.foreach_cell( [this, &defect, &distance](const auto& cell) { - const auto current_distance = sidb_nanometer_distance(layout, cell, defect); + const auto current_distance = sidb_nm_distance(layout, cell, defect); if (current_distance < distance) { distance = current_distance; diff --git a/include/fiction/technology/charge_distribution_surface.hpp b/include/fiction/technology/charge_distribution_surface.hpp index bf3c2f513..be9a29f39 100644 --- a/include/fiction/technology/charge_distribution_surface.hpp +++ b/include/fiction/technology/charge_distribution_surface.hpp @@ -503,7 +503,7 @@ class charge_distribution_surface : public Lyt this->foreach_cell( [this, &c, &defect](const auto& c1) { - const auto dist = sidb_nanometer_distance(*this, c1, c); + const auto dist = sidb_nm_distance(*this, c1, c); const auto pot = chargeless_potential_generated_by_defect_at_given_distance(dist, defect); if (strg->defect_local_pot.empty()) @@ -523,7 +523,7 @@ class charge_distribution_surface : public Lyt this->foreach_cell( [this, &c, &defect](const auto& c1) { - const auto dist = sidb_nanometer_distance(*this, c1, c); + const auto dist = sidb_nm_distance(*this, c1, c); strg->defect_local_pot[c1] = strg->defect_local_pot[c1] + @@ -553,11 +553,11 @@ class charge_distribution_surface : public Lyt [this, &c](const auto& c1) { strg->local_pot[static_cast(cell_to_index(c1))] -= - chargeless_potential_generated_by_defect_at_given_distance( - sidb_nanometer_distance(*this, c1, c), strg->defects[c]) * + chargeless_potential_generated_by_defect_at_given_distance(sidb_nm_distance(*this, c1, c), + strg->defects[c]) * static_cast(strg->defects[c].charge); strg->defect_local_pot[c1] -= chargeless_potential_generated_by_defect_at_given_distance( - sidb_nanometer_distance(*this, c1, c), strg->defects[c]) * + sidb_nm_distance(*this, c1, c), strg->defects[c]) * static_cast(strg->defects[c].charge); }); strg->defects.erase(c); @@ -899,7 +899,7 @@ class charge_distribution_surface : public Lyt for (const auto& [cell2, defect2] : strg->defects) { defect_interaction += - chargeless_potential_at_given_distance(sidb_nanometer_distance(*this, cell1, cell2)); + chargeless_potential_at_given_distance(sidb_nm_distance(*this, cell1, cell2)); } } strg->system_energy = total_potential + 0.5 * defect_energy + 0.5 * defect_interaction; @@ -1907,7 +1907,7 @@ class charge_distribution_surface : public Lyt { for (uint64_t j = 0u; j < strg->sidb_order.size(); j++) { - strg->nm_dist_mat[i][j] = sidb_nanometer_distance(*this, strg->sidb_order[i], strg->sidb_order[j]); + strg->nm_dist_mat[i][j] = sidb_nm_distance(*this, strg->sidb_order[i], strg->sidb_order[j]); } } } diff --git a/include/fiction/technology/sidb_nm_distance.hpp b/include/fiction/technology/sidb_nm_distance.hpp index a18d75f82..1d869a0de 100644 --- a/include/fiction/technology/sidb_nm_distance.hpp +++ b/include/fiction/technology/sidb_nm_distance.hpp @@ -21,8 +21,8 @@ namespace fiction * @return The distance between the two cells in nanometers (unit: nm). */ template -[[nodiscard]] constexpr double sidb_nanometer_distance(const Lyt& lyt, const coordinate& source, - const coordinate& target) noexcept +[[nodiscard]] constexpr double sidb_nm_distance(const Lyt& lyt, const coordinate& source, + const coordinate& target) noexcept { static_assert(is_cell_level_layout_v, "Lyt is not a cell-level layout"); static_assert(has_sidb_technology_v, "Lyt is not based on SiDB technology"); diff --git a/test/algorithms/simulation/sidb/maximum_defect_influence_position_and_distance.cpp b/test/algorithms/simulation/sidb/maximum_defect_influence_position_and_distance.cpp index 7bfe20bc1..5f1a36455 100644 --- a/test/algorithms/simulation/sidb/maximum_defect_influence_position_and_distance.cpp +++ b/test/algorithms/simulation/sidb/maximum_defect_influence_position_and_distance.cpp @@ -61,7 +61,7 @@ TEST_CASE("Test influence distance function", "[maximum-defect-influence-positio const auto [defect_pos, distance] = maximum_defect_influence_position_and_distance(lat, sim_params); CHECK_THAT(round_to_n_decimal_places(distance, 4) - - round_to_n_decimal_places(sidb_nanometer_distance(lat, {0, 0, 0}, {-1, 0, 1}), 4), + round_to_n_decimal_places(sidb_nm_distance(lat, {0, 0, 0}, {-1, 0, 1}), 4), Catch::Matchers::WithinAbs(0.0, physical_constants::POP_STABILITY_ERR)); } @@ -76,7 +76,7 @@ TEST_CASE("Test influence distance function", "[maximum-defect-influence-positio const auto [defect_pos, distance] = maximum_defect_influence_position_and_distance(lat, sim_params); CHECK_THAT(round_to_n_decimal_places(distance, 4) - - round_to_n_decimal_places(sidb_nanometer_distance(lat, {0, 0, 0}, {0, 1, 0}), 4), + round_to_n_decimal_places(sidb_nm_distance(lat, {0, 0, 0}, {0, 1, 0}), 4), Catch::Matchers::WithinAbs(0.0, physical_constants::POP_STABILITY_ERR)); } @@ -94,7 +94,7 @@ TEST_CASE("Test influence distance function", "[maximum-defect-influence-positio const auto [defect_pos, distance] = maximum_defect_influence_position_and_distance(lat, sim_params); CHECK_THAT(round_to_n_decimal_places(distance, 4) - - round_to_n_decimal_places(sidb_nanometer_distance(lat, {6, 0, 0}, {10, 0, 0}), 4), + round_to_n_decimal_places(sidb_nm_distance(lat, {6, 0, 0}, {10, 0, 0}), 4), Catch::Matchers::WithinAbs(0.0, physical_constants::POP_STABILITY_ERR)); }