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 new file mode 100644 index 000000000..850a7625a --- /dev/null +++ b/bindings/pyfiction/include/pyfiction/algorithms/simulation/sidb/assess_physical_population_stability.hpp @@ -0,0 +1,92 @@ +// +// Created by marcel on 21.11.23. +// + +#ifndef PYFICTION_ASSESS_PHYSICAL_POPULATION_STABILITY_HPP +#define PYFICTION_ASSESS_PHYSICAL_POPULATION_STABILITY_HPP + +#include "pyfiction/documentation.hpp" +#include "pyfiction/types.hpp" + +#include + +#include +#include + +namespace pyfiction +{ + +namespace detail +{ + +template +void assess_physical_population_stability(pybind11::module& m) +{ + namespace py = pybind11; + using namespace pybind11::literals; + + py::class_>(m, "population_stability_information", + 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)) + .def_readwrite("transition_from_to", &fiction::population_stability_information::transition_from_to, + DOC(fiction_population_stability_information_transition_from_to)) + .def_readwrite("minimum_potential_difference_to_transition", + &fiction::population_stability_information::minimum_potential_difference_to_transition, + DOC(fiction_population_stability_information_minimum_potential_difference_to_transition)) + .def_readwrite("distance_corresponding_to_potential", + &fiction::population_stability_information::distance_corresponding_to_potential, + DOC(fiction_population_stability_information_distance_corresponding_to_potential)) + .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, + "params"_a = fiction::assess_physical_population_stability_params{}, + DOC(fiction_assess_physical_population_stability)); +} + +} // namespace detail + +inline void assess_physical_population_stability(pybind11::module& m) +{ + namespace py = pybind11; + + py::enum_(m, "transition_type", DOC(fiction_transition_type)) + .value("NEUTRAL_TO_NEGATIVE", fiction::transition_type::NEUTRAL_TO_NEGATIVE, + DOC(fiction_transition_type_NEUTRAL_TO_NEGATIVE)) + .value("NEGATIVE_TO_NEUTRAL", fiction::transition_type::NEGATIVE_TO_NEUTRAL, + DOC(fiction_transition_type_NEGATIVE_TO_NEUTRAL)) + .value("NEUTRAL_TO_POSITIVE", fiction::transition_type::NEUTRAL_TO_POSITIVE, + DOC(fiction_transition_type_NEUTRAL_TO_POSITIVE)) + .value("POSITIVE_TO_NEUTRAL", fiction::transition_type::POSITIVE_TO_NEUTRAL, + DOC(fiction_transition_type_POSITIVE_TO_NEUTRAL)) + + ; + + /** + * Parameters. + */ + py::class_( + m, "assess_physical_population_stability_params", DOC(fiction_assess_physical_population_stability_params)) + .def(py::init<>()) + .def_readwrite("physical_parameters", + &fiction::assess_physical_population_stability_params::physical_parameters, + DOC(fiction_assess_physical_population_stability_params_physical_parameters)) + .def_readwrite( + "precision_for_distance_corresponding_to_potential", + &fiction::assess_physical_population_stability_params::precision_for_distance_corresponding_to_potential, + DOC(fiction_assess_physical_population_stability_params_precision_for_distance_corresponding_to_potential)) + + ; + + // NOTE be careful with the order of the following calls! Python will resolve the first matching overload! + + detail::assess_physical_population_stability(m); +} + +} // namespace pyfiction + +#endif // PYFICTION_ASSESS_PHYSICAL_POPULATION_STABILITY_HPP diff --git a/bindings/pyfiction/include/pyfiction/algorithms/simulation/sidb/convert_potential_to_distance.hpp b/bindings/pyfiction/include/pyfiction/algorithms/simulation/sidb/convert_potential_to_distance.hpp new file mode 100644 index 000000000..fc6ccbd94 --- /dev/null +++ b/bindings/pyfiction/include/pyfiction/algorithms/simulation/sidb/convert_potential_to_distance.hpp @@ -0,0 +1,29 @@ +// +// Created by marcel on 21.11.23. +// + +#ifndef PYFICTION_CONVERT_POTENTIAL_TO_DISTANCE_HPP +#define PYFICTION_CONVERT_POTENTIAL_TO_DISTANCE_HPP + +#include "pyfiction/documentation.hpp" +#include "pyfiction/types.hpp" + +#include + +#include +#include + +namespace pyfiction +{ + +inline void convert_potential_to_distance(pybind11::module& m) +{ + using namespace pybind11::literals; + + m.def("convert_potential_to_distance", &fiction::convert_potential_to_distance, "potential"_a, "params"_a, + "precision"_a, DOC(fiction_convert_potential_to_distance)); +} + +} // namespace pyfiction + +#endif // PYFICTION_CONVERT_POTENTIAL_TO_DISTANCE_HPP diff --git a/bindings/pyfiction/pyfiction.cpp b/bindings/pyfiction/pyfiction.cpp index 952be0f90..4f8b768af 100644 --- a/bindings/pyfiction/pyfiction.cpp +++ b/bindings/pyfiction/pyfiction.cpp @@ -34,6 +34,8 @@ #include "pyfiction/algorithms/simulation/sidb/quickexact.hpp" #include "pyfiction/algorithms/simulation/sidb/quicksim.hpp" // #include "pyfiction/algorithms/simulation/sidb/random_sidb_layout_generator.hpp" +#include "pyfiction/algorithms/simulation/sidb/assess_physical_population_stability.hpp" +#include "pyfiction/algorithms/simulation/sidb/convert_potential_to_distance.hpp" #include "pyfiction/algorithms/simulation/sidb/sidb_charge_state.hpp" #include "pyfiction/algorithms/simulation/sidb/sidb_simulation_engine.hpp" #include "pyfiction/algorithms/simulation/sidb/sidb_simulation_parameters.hpp" @@ -100,6 +102,8 @@ PYBIND11_MODULE(pyfiction, m) pyfiction::sidb_simulation_parameters(m); pyfiction::sidb_simulation_result(m); pyfiction::can_positive_charges_occur(m); + pyfiction::assess_physical_population_stability(m); + pyfiction::convert_potential_to_distance(m); pyfiction::detect_bdl_pairs(m); pyfiction::is_operational(m); pyfiction::operational_domain(m); diff --git a/docs/algorithms/sidb_simulation.rst b/docs/algorithms/sidb_simulation.rst index 25d96fa26..4d129aaa0 100644 --- a/docs/algorithms/sidb_simulation.rst +++ b/docs/algorithms/sidb_simulation.rst @@ -58,20 +58,23 @@ Heuristic Ground State Simulation 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 - .. tabs:: .. tab:: C++ + **Header:** ``fiction/algorithms/simulation/sidb/quickexact.hpp`` + + .. doxygenstruct:: fiction::quickexact_params + :members: + .. doxygenfunction:: fiction::quickexact + **Header:** ``fiction/algorithms/simulation/sidb/exhaustive_ground_state_simulation.hpp`` .. doxygenfunction:: fiction::exhaustive_ground_state_simulation .. tab:: Python + .. autoclass:: fiction.pyfiction.quickexact_params + :members: + .. autofunction:: fiction.pyfiction.quickexact + .. autofunction:: fiction.pyfiction.exhaustive_ground_state_simulation @@ -183,7 +186,11 @@ Time-to-Solution (TTS) Statistics .. doxygenfunction:: fiction::time_to_solution .. tab:: Python - .. autofunction:: fiction.pyfiction.sim_acc_tts + .. autoclass:: fiction.pyfiction.time_to_solution_params + :members: + .. autoclass:: fiction.pyfiction.time_to_solution_stats + :members: + .. autofunction:: fiction.pyfiction.time_to_solution Random SiDB Layout Generator @@ -286,19 +293,35 @@ Binary-dot Logic (BDL) Pair Detection Assess Population Stability ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -**Header:** ``fiction/algorithms/simulation/sidb/assess_physical_population_stability.hpp`` +.. tabs:: + .. tab:: C++ + **Header:** ``fiction/algorithms/simulation/sidb/assess_physical_population_stability.hpp`` -.. doxygenenum:: fiction::transition_type -.. doxygenstruct:: fiction::population_stability_information - :members: -.. doxygenstruct:: fiction::assess_physical_population_stability_params - :members: -.. doxygenfunction:: fiction::assess_physical_population_stability + .. doxygenenum:: fiction::transition_type + .. doxygenstruct:: fiction::population_stability_information + :members: + .. doxygenstruct:: fiction::assess_physical_population_stability_params + :members: + .. doxygenfunction:: fiction::assess_physical_population_stability + + .. tab:: Python + .. autoclass:: fiction.pyfiction.transition_type + :members: + .. autoclass:: fiction.pyfiction.population_stability_information + :members: + .. autoclass:: fiction.pyfiction.assess_physical_population_stability_params + :members: + .. autofunction:: fiction.pyfiction.assess_physical_population_stability Convert Potential to Distance ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -**Header:** ``fiction/algorithms/simulation/sidb/convert_potential_to_distance.hpp`` +.. tabs:: + .. tab:: C++ + **Header:** ``fiction/algorithms/simulation/sidb/convert_potential_to_distance.hpp`` + + .. doxygenfunction:: fiction::convert_potential_to_distance -.. doxygenfunction:: fiction::convert_potential_to_distance + .. tab:: Python + .. autofunction:: fiction.pyfiction.convert_potential_to_distance