# How to install TB_Sim in your personal computer In this guide we will show how to install a bootleg TB_Sim distribution in your machine. By bootleg, I mean, it won't be able to get all the updates from the server! If somehow you manage to get a copy directly from the tuleap server, `svn update` should work just fine. ## 1. Requierements Very basic. Either: * A TB_Sim folder got from your work machine or tuleap. * A Linux bare metal installation. * A virtual machine running Linux. * A WSL interface running Linux. ## 2. Components You need to have a fortran 90 compiler. Most of the codes are better suited to be used with `mpif90` which can be installed with ``` sudo apt-get install libopenmpi-dev ``` It is likely you need to instal blas and lapack too: ``` sudo apt-get install libblas-dev liblapack-dev ``` Also, the `fftw` should be installed: ``` sudo apt-get install libfftw3-dev libfftw3-doc ``` Normally, you should not tinker with these to be readable by the TB_Sim distribution. So at this point, your are ready to go. :::warning **Caveat:** The amount of external dependences needed might vary depenening on your linux distribution. ::: ## 3. Preparing the compilation and `PATH` variables ### 3.1 Preparing the compiler We will store all the executables and compilator in a folder that will be contained in the `PATH` In this guide we will create this folder in the home directory with the name `bin`. In this folder, create the empty file `f90GFORTmpi` and fill it with the following content: ``` FLNAME=`basename $1 .f90` MODDIR={your path to tbsim}/TB_Sim/trunk/modules/compiled/GFORTmpi OBJDIR={your path to tbsim}/TB_Sim/trunk/modules/compiled/GFORTmpi OPTION="-ffree-form -cpp -O3 -fopenmp -fPIC -fno-second-underscore -DOPENMP -DMPI -DSSE -DIOASYNC -DBENCH $EXTRAOPTS" mpif90 $OPTION -I . -I /usr/include -I $MODDIR -o $FLNAME $FLNAME.f90 $OBJDIR/*.o $OBJDIR/lapack95/*.o -llapack -lblas -lrt -lfftw3 ``` After that, run ``` chmod +x f90GFORTmpi ``` The compiler is good to go. ### 3.2 Adding everything to the PATH We need to add all the python dependencies, to the path and our bin folder too. Now add `bin` folder to your PATH, and also all the python dependences. To do so, open the `.bashrc` file and add the following lines ``` export PATH=$PATH:$HOME//home/esteban/bin:. export PYTHONPATH=$PYTHONPATH:{your path to tb sim}/trunk/codes/negf/qbit/python export PYTHONPATH=$PYTHONPATH:{your path to tb sim}/trunk/codes/negf/geometry_builders export PYTHONPATH=$PYTHONPATH:{your path to tb sim}/trunk/codes/negf/qbit/scripts/quantum_box_kp/code ``` End the changes by doing ``` source .bashrc ``` ## 4. Compiling Proceed to the following route: ``` {your path to tb sim}/TB_Sim/trunk/modules ``` And run ``` make clean make ``` If everything went fine, you should see a lot of verbose in the terminal and how the modules are being compiled. ## 5. Final steps You have successfully installed TB_Sim, now you should compile the codes of your interest, such as `qbitKP`, `gmatrixKP`, etc etc and move them to a folder in your path (in our example `bin`).