#include <nonp-ham.h>
|
static void | Diagonalize (int dim, double *mat, double *eigs, bool calc_eigenvectors) |
|
This is the class is for the 1D Hubbard without periodic boundary conditions
- Author
- Ward Poelmans wpoel.nosp@m.y86@.nosp@m.gmail.nosp@m..com
Definition at line 28 of file nonp-ham.h.
NonPeriodicHamiltonian::NonPeriodicHamiltonian |
( |
int |
L, |
|
|
int |
Nu, |
|
|
int |
Nd, |
|
|
double |
J, |
|
|
double |
U |
|
) |
| |
Constructor of the NonPeriodicHamiltonian class
- Parameters
-
L | Number of lattice sites |
Nu | Number of Up Electrons |
Nd | Number of Down Electrons |
J | The hopping strengh |
U | The onsite interaction strength |
Definition at line 28 of file nonp-ham.cpp.
NonPeriodicHamiltonian::~NonPeriodicHamiltonian |
( |
| ) |
|
|
virtual |
double BareHamiltonian::arpackDiagonalize |
( |
| ) |
|
|
virtualinherited |
void BareHamiltonian::BuildBase |
( |
| ) |
|
|
virtualinherited |
void Hamiltonian::BuildFullHam |
( |
| ) |
|
|
virtualinherited |
void BareHamiltonian::BuildHam |
( |
| ) |
|
|
virtualinherited |
This method is always present and should build the Hamiltonian, either full or sparse
Definition at line 165 of file bare-ham.cpp.
int BareHamiltonian::CalcDim |
( |
int |
L, |
|
|
int |
N |
|
) |
| |
|
staticinherited |
Calculates the dimension for the up or down electron space. Basically, it calculates the N-combination out of L. This algorithm is not perfect, overflow can occur but should be no problem for our small problems.
- Parameters
-
L | number of lattice sites |
N | number of up or down electrons |
- Returns
- the dimension of the up or down electron space
Definition at line 83 of file bare-ham.cpp.
int BareHamiltonian::CalcSign |
( |
int |
i, |
|
|
int |
j, |
|
|
myint |
a |
|
) |
| const |
|
protectedinherited |
Calculates the sign of the hop between site i and site j on ket a. Make sure that i < j!
- Parameters
-
i | the first sp |
j | the second sp |
a | the ket to use |
- Returns
- the sign of the hop
Definition at line 178 of file bare-ham.cpp.
int BareHamiltonian::CountBits |
( |
myint |
bits | ) |
|
|
staticinherited |
Counts the number of bits set. It uses the builtin gcc function __buildtin_popcount. You must compile with -march=native and it will then generate a POPCNT instruction on platforms that support it. Otherwise it will be slow. Consider using a different method here if you don't have the POPCNT instruction: there are fast SSSE3 and SSE2 ways to do this(google is your friend).
- Parameters
-
bits | the myint of which to count the number of bits set |
- Returns
- the number of bits set
Definition at line 106 of file bare-ham.cpp.
void BareHamiltonian::Diagonalize |
( |
int |
dim, |
|
|
double * |
mat, |
|
|
double * |
eigs, |
|
|
bool |
calc_eigenvectors |
|
) |
| |
|
staticprotectedinherited |
Helper for exact diagonalization: diagonalize the matrix given in mat with dimension dim, stores the eigenvalues in eigs and optionally the eigenvectors in mat
- Parameters
-
dim | the dimension of the matrix |
mat | the actual matrix (size: dim*dim) |
eigs | array of size dim to store eigenvalues |
calc_eigenvectors | whether or not the calculate the eigenvectors |
Definition at line 681 of file bare-ham.cpp.
std::vector< double > BareHamiltonian::ExactDiagonalizeFull |
( |
bool |
calc_eigenvectors = false | ) |
|
|
virtualinherited |
myint BareHamiltonian::getBaseDown |
( |
unsigned int |
i | ) |
const |
|
inherited |
Getter for the i base down ket
- Parameters
-
i | the number of the base ket |
- Returns
- the base ket
Definition at line 270 of file bare-ham.cpp.
myint BareHamiltonian::getBaseUp |
( |
unsigned int |
i | ) |
const |
|
inherited |
Getter for the i base up ket
- Parameters
-
i | the number of the base ket |
- Returns
- the base ket
Definition at line 260 of file bare-ham.cpp.
int BareHamiltonian::getDim |
( |
| ) |
const |
|
inherited |
double BareHamiltonian::getJ |
( |
| ) |
const |
|
inherited |
Getter for the hopping strength
- Returns
- the hopping strength
Definition at line 232 of file bare-ham.cpp.
int BareHamiltonian::getL |
( |
| ) |
const |
|
inherited |
Getter for the number of lattice sites
- Returns
- the number of lattice sites
Definition at line 196 of file bare-ham.cpp.
int BareHamiltonian::getNd |
( |
| ) |
const |
|
inherited |
Getter for the number of down electrons
- Returns
- the number of down electrons
Definition at line 214 of file bare-ham.cpp.
int BareHamiltonian::getNu |
( |
| ) |
const |
|
inherited |
Getter for the number of up electrons
- Returns
- the number of up electrons
Definition at line 205 of file bare-ham.cpp.
double BareHamiltonian::getU |
( |
| ) |
const |
|
inherited |
Getter for the onsite interaction strength
- Returns
- the onsite interaction strength
Definition at line 241 of file bare-ham.cpp.
int NonPeriodicHamiltonian::hopping |
( |
myint |
a, |
|
|
myint |
b, |
|
|
int |
jumpsign = 0 |
|
) |
| const |
|
protectedvirtual |
Calculates the hopping for the non periodic boundary conditions
- Parameters
-
a | the bra to use |
b | the ket to use |
jumpsign | ignored, has no meaning here, set to zero by default |
- Returns
- matrix element of the hopping term between the ket and the bra. You still have to multiply this with the hopping strength J
Reimplemented from Hamiltonian.
Definition at line 46 of file nonp-ham.cpp.
double BareHamiltonian::LanczosDiagonalize |
( |
int |
m = 0 | ) |
|
|
virtualinherited |
Calculates the lowest eigenvalue of the BareHamiltonian matrix using the lanczos algorithm. Needs lapack.
- Parameters
-
m | an optional estimate for the lanczos space size |
- Returns
- the lowest eigenvalue
Definition at line 313 of file bare-ham.cpp.
double BareHamiltonian::MemoryNeededArpack |
( |
| ) |
const |
|
inherited |
Calculates the amount of memory needed for the calculation if we use the arpack. It doesn't include the program code and stuff.
- Returns
- the amount of memory needed in bytes
Definition at line 643 of file bare-ham.cpp.
double BareHamiltonian::MemoryNeededFull |
( |
| ) |
const |
|
inherited |
Calculates the amount of memory needed for the calculation of all eigenvalues using the exact method. It doesn't include the program code and stuff.
- Returns
- the amount of memory needed in bytes
Definition at line 591 of file bare-ham.cpp.
double BareHamiltonian::MemoryNeededLanczos |
( |
| ) |
const |
|
inherited |
Calculates the amount of memory needed for the calculation if we use the lanczos method. It doesn't include the program code and stuff.
- Returns
- the amount of memory needed in bytes
Definition at line 617 of file bare-ham.cpp.
void Hamiltonian::mvprod |
( |
double * |
x, |
|
|
double * |
y, |
|
|
double |
alpha |
|
) |
| const |
|
virtualinherited |
void BareHamiltonian::Print |
( |
bool |
list = false | ) |
const |
|
inherited |
std::string BareHamiltonian::print_bin |
( |
myint |
num | ) |
const |
|
inherited |
Print a int in binary form to a string. Prints a much as needed to represent the current system.
- Parameters
-
num | the myint to print in binary form |
- Returns
- a string with the binary representation of num
Definition at line 138 of file bare-ham.cpp.
std::string BareHamiltonian::print_bin |
( |
myint |
num, |
|
|
int |
bitcount |
|
) |
| |
|
staticinherited |
Print a int in binary form to a string. It only prints the bitcount least significant bits
- Parameters
-
num | the myint to print in binary form |
bitcount | the number of bits to print (starting from the LSB) |
- Returns
- a string with the binary representation of num
Definition at line 118 of file bare-ham.cpp.
void BareHamiltonian::PrintBase |
( |
| ) |
const |
|
inherited |
void BareHamiltonian::PrintGroundstateVector |
( |
| ) |
const |
|
inherited |
Prints the groundstate in function of the basis vectors Only gives meanfull output after running BareHamiltonian::ExactDiagonalizeFull(true)
Definition at line 295 of file bare-ham.cpp.
void BareHamiltonian::SaveToFile |
( |
const std::string |
filename | ) |
const |
|
virtualinherited |
Save the hamiltonian matrix to a file in the HDF5 format
- Parameters
-
filename | the name of the file to write to |
Definition at line 727 of file bare-ham.cpp.
void BareHamiltonian::SaveToFile |
( |
const std::string |
filename, |
|
|
double * |
data, |
|
|
int |
dim |
|
) |
| const |
|
protectedinherited |
Save a array to a file in the HDF5 format
- Parameters
-
filename | the name of the file to write to |
data | a pointer to the array to write to a file |
dim | the size of the array |
Definition at line 741 of file bare-ham.cpp.
void BareHamiltonian::setU |
( |
double |
myU | ) |
|
|
inherited |
std::vector<myint> BareHamiltonian::baseDown |
|
protectedinherited |
vector to hold all bases ket's for down electrons
Definition at line 138 of file bare-ham.h.
std::vector<myint> BareHamiltonian::baseUp |
|
protectedinherited |
vector to hold all bases ket's for up electrons
Definition at line 136 of file bare-ham.h.
double* BareHamiltonian::ham |
|
protectedinherited |
myint BareHamiltonian::Hb |
|
protectedinherited |
the location of the highest bit
Definition at line 133 of file bare-ham.h.
double BareHamiltonian::J |
|
protectedinherited |
Number of down electrons.
Definition at line 120 of file bare-ham.h.
Number of up electrons.
Definition at line 118 of file bare-ham.h.
double BareHamiltonian::U |
|
protectedinherited |
On site interaction strength.
Definition at line 124 of file bare-ham.h.
The documentation for this class was generated from the following files: