An implementation of the Bose Hubbard model with exact and mean field calculations to characterize the phase of the system.
This repository contains the implementation of the Bose-Hubbard model, which describes interacting bosons on a lattice. The aim of this project is to study the phase transition in the Bose-Hubbard model using various numerical methods. The theoretical and numerical tools used for this project are described in this article.
-
include/
: Contains the header files for the project.hamiltonian.hpp
: Defines theBH
class representing the Bose-Hubbard Hamiltonian.neighbours.hpp
: Defines theNeighbours
class for generating the list of neighbours for different lattice structures.operator.hpp
: Defines theOperator
class for various matrix diagonalization methods.analysis.hpp
: Defines theAnalysis
class for calculating and saving physical quantities with an exact or a mean field approach.resource.hpp
: Defines theResource
class for utility functions for timing, memory usage and parallelization.
-
src/
: Contains the source files for the project. -
external/
: Contains external dependencies.spectra/
: Header-only C++ library for large scale eigenvalue problems.
-
CMakeLists.txt
: CMake configuration file for building the project. -
figures/
: Directory to store the generated plots.
- Eigen: A C++ template library for linear algebra.
- Spectra: A header-only C++ library for large scale eigenvalue problems.
- TkInter: A standard GUI toolkit for Python (required for viewing plots).
- OpenMP: An API for parallel programming in C, C++, and Fortran.
- tqdm: A header-only C++ port of the popular python module tqdm.
- (Optional) Doxygen: A tool for generating documentation from annotated C++ sources.
To build the project on a Linux system, follow these steps:
-
Clone the repository:
git clone https://github.com/Maximilien-Hantonne/Bose-Hubbard-Phase-Transition.git cd Bose-Hubbard-Phase-Transition
-
Create a build directory and navigate to it:
mkdir build cd build
-
Run CMake to configure the project:
cmake ..
-
Build the project:
cmake --build .
To generate the documentation using Doxygen, follow these steps:
To generate the HTML documentation using Doxygen on a Linux system, follow these steps:
-
Ensure Doxygen is installed on your system.
-
Run Doxygen with the provided
Doxyfile
:doxygen Doxyfile
The documentation will be generated in the docs/html
directory. The main page can be opened by navigating to docs/html/index.html
in your web browser:
firefox docs/html/index.html
To generate the LaTeX documentation using Doxygen on a Linux system, follow these steps:
-
Ensure Doxygen and LaTeX are installed on your system. You can install LaTeX using:
sudo apt-get install texlive-full
-
Run Doxygen with the provided
Doxyfile
:doxygen Doxyfile
-
Navigate to the
docs/latex
directory:cd docs/latex
-
Compile the LaTeX documentation:
make
The PDF documentation will be generated in the docs/latex
directory.
The project provides classes to represent the Bose-Hubbard Hamiltonian and to perform various operations and calculations related to the model. The main goals of the files are:
BH
: Represents the Bose-Hubbard Hamiltonian.Neighbours
: Generates the list of neighbours for different lattice structures i.e. the geometry of the lattice.Operator
: Provides various matrix diagonalization methods.Analysis
: Computes the physical quantities for exact or mean-field approach of Bose-Hubbard model.
The main
function parses command-line arguments to set up the parameters for the Bose-Hubbard model.
Command-line options:
-m, --sites
: Number of sites in the lattice.-n, --bosons
: Number of bosons in the lattice.-J, --hopping
: Hopping parameter.-U, --interaction
: On-site interaction parameter.-u, --potential
: Chemical potential.-r, --range
: Range for chemical potential and interaction.-s, --step
: Step for chemical potential and interaction.-f, --fixed
: Fixed parameter (J, U, or u)-t, --type
: type of calculation (exact or mean)-h, --help
: Display usage information.
To view the plots generated by the plot.py
or plot_mean_field.py
script, you need to have the TkInter windowing system installed. You can install it using:
sudo apt-get install python3-tk
The plot.py
script will generate plots for the gap ratio, boson density, and compressibility and then the projection of the PCA on the data and visualize the projected points along with their k-means clustering labels.
The plot_mean_field.py
will generate the map of the order parameter to visualize the transition Mott insulator/superfluid.
Some already calculated plots can be seen in the figures folder.
Make sure you have the required dependencies installed. You can then launch the program by typing for example :
./QuantumProject -m 5 -n 5 -J 100 -U 0 -u 0 -r 100 -s 5 -f "J" --t "exact"
It's not necessary to precise all parameters for the simulation. The parameters you use should match your goal. For example if you want to compute again the phase diagram in the mean-field approximation (see the figures), with 1000 iterations over
./QuantumProject -i 1000 -e 6 --t "mean"
Note that parallelization and optimization are used by default, but it can cause issues during the compilation. For example:
corrupted size vs. prev_size while consolidating
Aborted (core dumped)
To avoid it, you can disable the optimisation, although it makes the execution way slower. To do so, ensure to compile in the Debug mode:
cmake -DCMAKE_BUILD_TYPE=Debug ..
Feel free to contribute to our project
This project is licensed under the GNU GPLv3 - see LICENCE file for details.