HubbardGPU
Hubbard diagonalisation on the GPU (and CPU)
 All Classes Files Functions Variables Typedefs Friends Macros
ham-spin.h
Go to the documentation of this file.
1 /* Copyright (C) 2014 Ward Poelmans
2 
3  This file is part of Hubbard-GPU.
4 
5  Hubbard-GPU is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  Hubbard-GPU is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with Hubbard-GPU. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef HAM_SPIN_H
20 #define HAM_SPIN_H
21 
22 #include <vector>
23 #include <memory>
24 #include <tuple>
25 #include <cstring>
26 
27 #include "bare-ham.h"
28 #include "helpers.h"
29 
30 
37 {
38  public:
39  SpinHamiltonian(int L, int Nu, int Nd, double J, double U);
40  virtual ~SpinHamiltonian();
41 
42  void BuildBase();
43  void BuildFullHam();
44 
45  void BuildPartFullHam();
46 
47  void BuildHamWithS(int myS);
48 
49  virtual void mvprod(double *x, double *y, double alpha) const;
50 
51  std::vector<double> ExactDiagonalizeFull(bool calc_eigenvectors);
52 
53  virtual std::vector< std::tuple<int,int,double> > ExactSpinDiagonalizeFull(bool calc_eigenvectors);
54 
55  std::vector< std::tuple<int,int,double> > ExactSpinDiagonalize(int myS, bool calc_eigenvectors);
56 
57  void BuildSpinBase();
58 
59  void PrintBase() const;
60 
61  void SaveBasis(const char *filename) const;
62 
63  void ReadBasis(const char *filename);
64 
65  void GenerateData(double Ubegin, double Uend, double step, std::string filename);
66 
67  protected:
68  int Sz;
69 
70  double hopping(myint) const;
71 
72  int interaction(myint, myint, myint, myint) const;
73 
74  std::vector< std::unique_ptr<matrix> > blockmat;
75 
76  std::unique_ptr<class SpinBasis> spinbasis;
77 };
78 
79 
80 #endif /* HAM_SPIN_H */
81 
82 /* vim: set ts=8 sw=4 tw=0 expandtab :*/