diff --git a/docs/2x2__analysis_8py_source.html b/docs/2x2__analysis_8py_source.html new file mode 100644 index 0000000..3c390fe --- /dev/null +++ b/docs/2x2__analysis_8py_source.html @@ -0,0 +1,144 @@ + + +
+ + + + +|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
The implementation of the Ising model. +More...
+ +Go to the source code of this file.
+The implementation of the Ising model.
+ +Definition in file IsingModel.cpp.
+|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
The definition of the Ising model. +More...
+#include "constants.hpp"#include "data_type.hpp"#include "typedefs.hpp"#include "utils.hpp"#include <armadillo>#include <random>#include <unordered_map>Go to the source code of this file.
++Classes | |
| class | IsingModel |
| The Ising model in 2 dimensions. More... | |
+Macros | |
| #define | INDEX(I, N) (I + N) % N |
| #define | UP 0 |
| #define | LEFT 0 |
| #define | DOWN 1 |
| #define | RIGHT 1 |
The definition of the Ising model.
+ +Definition in file IsingModel.hpp.
+| #define DOWN 1 | +
Definition at line 29 of file IsingModel.hpp.
+ +| #define INDEX | +( | ++ | I, | +
| + | + | + | N | +
| + | ) | +(I + N) % N | +
Definition at line 24 of file IsingModel.hpp.
+ +| #define LEFT 0 | +
Definition at line 28 of file IsingModel.hpp.
+ +| #define RIGHT 1 | +
Definition at line 30 of file IsingModel.hpp.
+ +| #define UP 0 | +
Definition at line 27 of file IsingModel.hpp.
+ +|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
| Cdata_t | |
| CIsingModel | The Ising model in 2 dimensions |
| CIsingModelTest | Test class for the Ising model |
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
This is the complete list of members for IsingModel, including all inherited members.
+| E | IsingModel | private |
| energy_diff | IsingModel | private |
| get_E() | IsingModel | |
| get_M() | IsingModel | |
| initialize_energy() | IsingModel | private |
| initialize_energy_diff() | IsingModel | private |
| initialize_lattice() | IsingModel | private |
| initialize_magnetization() | IsingModel | private |
| initialize_neighbors() | IsingModel | private |
| IsingModel() | IsingModel | private |
| IsingModel(int L, double T) | IsingModel | |
| IsingModel(int L, double T, int val) | IsingModel | |
| IsingModelTest (defined in IsingModel) | IsingModel | friend |
| L | IsingModel | private |
| lattice | IsingModel | private |
| M | IsingModel | private |
| Metropolis() | IsingModel | |
| neighbors | IsingModel | private |
| T | IsingModel | private |
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
The Ising model in 2 dimensions. + More...
+ +#include <IsingModel.hpp>
+Public Member Functions | |
| IsingModel (int L, double T) | |
| Constructor for the Ising model. | |
| IsingModel (int L, double T, int val) | |
| Constructor for the Ising model. | |
| data_t | Metropolis () |
| The Metropolis algorithm. | |
| int | get_E () |
| Get the current energy. | |
| int | get_M () |
| Get the current magnetization. | |
+Private Member Functions | |
| void | initialize_lattice () |
| Initialize the lattice with a random distribution of 1s and -1s. | |
| void | initialize_neighbors () |
| initialize the neighbors matrix. | |
| void | initialize_energy_diff () |
| Initialize the hashmap with the correct values. | |
| void | initialize_magnetization () |
| Initialize the magnetization. | |
| void | initialize_energy () |
| Initialize the energy. | |
| IsingModel () | |
| Constructor used for testing. | |
+Private Attributes | |
| arma::Mat< int > | lattice |
| \( L \times L \) matrix where element \( x \in {-1, 1}\). | |
| arma::Mat< int > | neighbors |
| \( L \times 2 \) matrix with the neighbors of each element \( x_i \). | |
| std::unordered_map< int, double > | energy_diff |
| A hash map containing all possible energy changes. | |
| double | T |
| The temperature of the model. | |
| int | L |
| Size of the lattice. | |
| int | E |
| The current energy state. unit: \( J \). | |
| int | M |
| The current magnetic strength. unit: Unitless. | |
+Friends | |
| class | IsingModelTest |
The Ising model in 2 dimensions.
+None of the methods are parallelized, as there is very little benefit in doing so.
+ +Definition at line 37 of file IsingModel.hpp.
+
+
|
+ +private | +
Constructor used for testing.
+ +Definition at line 17 of file IsingModel.cpp.
+ +| IsingModel::IsingModel | +( | +int | +L, | +
| + | + | double | +T | +
| + | ) | ++ |
Constructor for the Ising model.
+| L | The size of the lattice. |
| T | The temperature for the system. |
Definition at line 21 of file IsingModel.cpp.
+ +| IsingModel::IsingModel | +( | +int | +L, | +
| + | + | double | +T, | +
| + | + | int | +val | +
| + | ) | ++ |
Constructor for the Ising model.
+| L | The size of the lattice. |
| T | The temperature for the system. |
| val | The value to set for all spins. |
Definition at line 32 of file IsingModel.cpp.
+ +| int IsingModel::get_E | +( | +) | ++ |
| int IsingModel::get_M | +( | +) | ++ |
Get the current magnetization.
+Definition at line 140 of file IsingModel.cpp.
+ +
+
|
+ +private | +
Initialize the energy.
+ +Definition at line 82 of file IsingModel.cpp.
+ +
+
|
+ +private | +
Initialize the hashmap with the correct values.
+ +Definition at line 67 of file IsingModel.cpp.
+ +
+
|
+ +private | +
Initialize the lattice with a random distribution of 1s and -1s.
+ +Definition at line 44 of file IsingModel.cpp.
+ +
+
|
+ +private | +
Initialize the magnetization.
+ +Definition at line 74 of file IsingModel.cpp.
+ +
+
|
+ +private | +
initialize the neighbors matrix.
+ +Definition at line 56 of file IsingModel.cpp.
+ +| data_t IsingModel::Metropolis | +( | +) | ++ |
The Metropolis algorithm.
+ +Definition at line 96 of file IsingModel.cpp.
+ +
+
|
+ +friend | +
Definition at line 39 of file IsingModel.hpp.
+ +
+
|
+ +private | +
The current energy state. unit: \( J \).
+ +Definition at line 68 of file IsingModel.hpp.
+ +
+
|
+ +private | +
A hash map containing all possible energy changes.
+ +Definition at line 56 of file IsingModel.hpp.
+ +
+
|
+ +private | +
Size of the lattice.
+ +Definition at line 64 of file IsingModel.hpp.
+ +
+
|
+ +private | +
\( L \times L \) matrix where element \( x \in {-1, 1}\).
+ +Definition at line 42 of file IsingModel.hpp.
+ +
+
|
+ +private | +
The current magnetic strength. unit: Unitless.
+ +Definition at line 72 of file IsingModel.hpp.
+ +
+
|
+ +private | +
\( L \times 2 \) matrix with the neighbors of each element \( x_i \).
+The reason why it's \( L \times 2 \) instead of \( L \times 2 \), is that we can see that we can use the same column for the left and upper neighbor, and we can use the same column for the right and lower neighbor.
+ +Definition at line 52 of file IsingModel.hpp.
+ +
+
|
+ +private | +
The temperature of the model.
+ +Definition at line 60 of file IsingModel.hpp.
+ +|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
This is the complete list of members for IsingModelTest, including all inherited members.
+| test_2x2_lattice(double tol, int max_cycles) | IsingModelTest | inline |
| test_init_functions() | IsingModelTest | inline |
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
Test class for the Ising model. + More...
++Public Member Functions | |
| void | test_init_functions () |
| Test That initializing works as intended. | |
| int | test_2x2_lattice (double tol, int max_cycles) |
| Test numerical data with analytical data. | |
Test class for the Ising model.
+ +Definition at line 30 of file test_suite.cpp.
+
+
|
+ +inline | +
Test numerical data with analytical data.
+| tol | The tolerance between the analytical and numerical solution. |
| max_cycles | The max number of Monte Carlo cycles. |
return int
+ +Definition at line 70 of file test_suite.cpp.
+ +
+
|
+ +inline | +
Test That initializing works as intended.
+ +Definition at line 34 of file test_suite.cpp.
+ +|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
This is the complete list of members for data_t, including all inherited members.
+| data_t() (defined in data_t) | data_t | inline |
| data_t(double E, double E2, double M, double M2, double M_abs) (defined in data_t) | data_t | inline |
| E (defined in data_t) | data_t | |
| E2 (defined in data_t) | data_t | |
| M (defined in data_t) | data_t | |
| M2 (defined in data_t) | data_t | |
| M_abs (defined in data_t) | data_t | |
| operator*(T num) (defined in data_t) | data_t | inline |
| operator*=(T num) (defined in data_t) | data_t | inline |
| operator+(const data_t &b) (defined in data_t) | data_t | inline |
| operator+=(const data_t &b) (defined in data_t) | data_t | inline |
| operator/(T num) (defined in data_t) | data_t | inline |
| operator/=(T num) (defined in data_t) | data_t | inline |
| operator=(T num) (defined in data_t) | data_t | inline |
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
+Public Member Functions | |
| data_t (double E, double E2, double M, double M2, double M_abs) | |
| template<class T > | |
| data_t | operator/ (T num) |
| template<class T > | |
| data_t & | operator/= (T num) |
| template<class T > | |
| data_t | operator* (T num) |
| template<class T > | |
| data_t & | operator*= (T num) |
| data_t | operator+ (const data_t &b) |
| data_t & | operator+= (const data_t &b) |
| template<class T > | |
| void | operator= (T num) |
+Public Attributes | |
| double | E |
| double | M |
| double | E2 |
| double | M2 |
| double | M_abs |
Definition at line 18 of file data_type.hpp.
+
+
|
+ +inline | +
Definition at line 22 of file data_type.hpp.
+ +
+
|
+ +inline | +
Definition at line 31 of file data_type.hpp.
+ +
+
|
+ +inline | +
Definition at line 63 of file data_type.hpp.
+ +
+
|
+ +inline | +
Definition at line 75 of file data_type.hpp.
+ +Definition at line 86 of file data_type.hpp.
+ +Definition at line 98 of file data_type.hpp.
+ +
+
|
+ +inline | +
Definition at line 40 of file data_type.hpp.
+ +
+
|
+ +inline | +
Definition at line 52 of file data_type.hpp.
+ +
+
|
+ +inline | +
Definition at line 109 of file data_type.hpp.
+ +| double data_t::E | +
Definition at line 20 of file data_type.hpp.
+ +| double data_t::E2 | +
Definition at line 20 of file data_type.hpp.
+ +| double data_t::M | +
Definition at line 20 of file data_type.hpp.
+ +| double data_t::M2 | +
Definition at line 20 of file data_type.hpp.
+ +| double data_t::M_abs | +
Definition at line 20 of file data_type.hpp.
+ +|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
Library of constants. +More...
+ +Go to the source code of this file.
++Macros | |
| #define | k_B 1.380649e-23 |
| Boltzmann constant. unit \( \frac{J}{K} \). | |
| #define k_B 1.380649e-23 | +
Boltzmann constant. unit \( \frac{J}{K} \).
+ +Definition at line 17 of file constants.hpp.
+ +|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
Implementation for the data_t type. +More...
+#include "data_type.hpp"Go to the source code of this file.
+Implementation for the data_t type.
+ +Definition in file data_type.cpp.
+|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
Header for the data_t type. +More...
+#include <sys/types.h>#include <type_traits>Go to the source code of this file.
++Classes | |
| class | data_t |
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
+Directories | |
| directory | scripts |
+Files | |
| file | data_type.cpp [code] |
| Implementation for the data_t type. | |
| file | IsingModel.cpp [code] |
| The implementation of the Ising model. | |
| file | main.cpp [code] |
| The main program. | |
| file | monte_carlo.cpp [code] |
| Implementation of the monte carlo functions. | |
| file | phase_transition_mpi.cpp [code] |
| Sweep over different temperatures and generate data. | |
| file | test_suite.cpp [code] |
| Sweep over different temperatures and generate data. | |
| file | testlib.cpp [code] |
| Implementation of the testing library. | |
| file | utils.cpp [code] |
| Implementation of the utils. | |
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
+Files | |
| file | constants.hpp [code] |
| Library of constants. | |
| file | data_type.hpp [code] |
| Header for the data_t type. | |
| file | IsingModel.hpp [code] |
| The definition of the Ising model. | |
| file | monte_carlo.hpp [code] |
| Functions for monte carlo simulations. | |
| file | testlib.hpp [code] |
| A small test library. | |
| file | typedefs.hpp [code] |
| Useful typedefs for cleaner code. | |
| file | utils.hpp [code] |
| Function prototypes and macros that are useful. | |
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
| ▼ include | |
| constants.hpp | Library of constants |
| data_type.hpp | Header for the data_t type |
| IsingModel.hpp | The definition of the Ising model |
| monte_carlo.hpp | Functions for monte carlo simulations |
| testlib.hpp | A small test library |
| typedefs.hpp | Useful typedefs for cleaner code |
| utils.hpp | Function prototypes and macros that are useful |
| ▼ src | |
| ▼ scripts | |
| burn_in_time.py | |
| pd_estimate.py | |
| phase_transition.py | |
| data_type.cpp | Implementation for the data_t type |
| IsingModel.cpp | The implementation of the Ising model |
| main.cpp | The main program |
| monte_carlo.cpp | Implementation of the monte carlo functions |
| phase_transition_mpi.cpp | Sweep over different temperatures and generate data |
| test_suite.cpp | Sweep over different temperatures and generate data |
| testlib.cpp | Implementation of the testing library |
| utils.cpp | Implementation of the utils |
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
|
+ 2 Dimensional Ising Model
+
+ Simulate the change in energy and magnetization in a ferro magnet
+ |
+
Compiling is as easy as running this command while being inside the src directory:
+To run main or test_suite, just run this command while being inside src:
+Before running the scripts, make sure that all libraries are installed. Using pip, you can install all requirements like this:
+This recursively install all the packages that are listed in requirements.txt.
+For the Python scripts, run them from the src directory like this:
+If you have any problems running the scripts, you might have to run this instead:
+For the phase_transition_mpi program, there are scripts in the src/jobs directory that come along with it. This is to be able to run it on a batch system using Slurm if you have access to one. This is the recommended way to use this program as it takes approximately 90 minutes to complete when using 8 processes where each process has 10 threads.
+If you happen to have such a system available to you, then you should clone this repo on that system, then compile it by running:
+You might have to load the Armadillo library using the module system before compiling.
+After compiling, you can schedule it by running:
+This section aims to give an idea to the time it takes for the program to run so that you know a bit what to expect if you decide to run it for yourself.
+The times mentioned here are times achieved on a computer with these specifications:
+The Doxygen theme used here is doxygen-awesome-css.
+