CheMPS2
TensorT.h
1 /*
2  CheMPS2: a spin-adapted implementation of DMRG for ab initio quantum chemistry
3  Copyright (C) 2013-2016 Sebastian Wouters
4 
5  This program 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 2 of the License, or
8  (at your option) any later version.
9 
10  This program 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 along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 
20 #ifndef TENSORT_CHEMPS2_H
21 #define TENSORT_CHEMPS2_H
22 
23 #include "Tensor.h"
24 #include "SyBookkeeper.h"
25 
26 namespace CheMPS2{
32  class TensorT : public Tensor{
33 
34  public:
35 
37 
39  TensorT( const int site_index, const SyBookkeeper * denBK );
40 
42  virtual ~TensorT();
43 
45 
46  int gNKappa() const;
47 
49 
50  double * gStorage();
51 
53 
60  int gKappa( const int N1, const int TwoS1, const int I1, const int N2, const int TwoS2, const int I2 ) const;
61 
63 
65  int gKappa2index( const int kappa ) const;
66 
68 
75  double * gStorage( const int N1, const int TwoS1, const int I1, const int N2, const int TwoS2, const int I2 );
76 
78 
79  int gIndex() const;
80 
82 
83  const SyBookkeeper * gBK() const;
84 
86 
87  void sBK( const SyBookkeeper * newBK );
88 
90  void random();
91 
93 
95  void number_operator( const double alpha, const double beta );
96 
98 
99  void QR( Tensor * Rstorage );
100 
102 
103  void LQ( Tensor * Lstorage );
104 
106 
107  void LeftMultiply( Tensor * Mx );
108 
110 
111  void RightMultiply( Tensor * Mx );
112 
114  void Reset();
115 
117 
118  bool CheckLeftNormal() const;
119 
121 
122  bool CheckRightNormal() const;
123 
124  private:
125 
127  const SyBookkeeper * denBK;
128 
130  int * sectorNL;
131 
133  int * sectorNR;
134 
136  int * sectorTwoSL;
137 
139  int * sectorTwoSR;
140 
142  int * sectorIL;
143 
145  int * sectorIR;
146 
148  void DeleteAllArrays();
149 
151  void AllocateAllArrays();
152 
153  };
154 }
155 
156 #endif
void random()
Fill storage with random numbers 0 < val < 1.
Definition: TensorT.cpp:167
void RightMultiply(Tensor *Mx)
Multiply at the right with a diagonal TensorOperator.
Definition: TensorT.cpp:412
virtual ~TensorT()
Destructor.
Definition: TensorT.cpp:106
void LQ(Tensor *Lstorage)
Right-normalization.
Definition: TensorT.cpp:291
TensorT(const int site_index, const SyBookkeeper *denBK)
Constructor.
Definition: TensorT.cpp:29
int gIndex() const
Get the location index.
Definition: TensorT.cpp:161
Definition: CASPT2.h:42
int gNKappa() const
Get the number of symmetry blocks.
Definition: TensorT.cpp:132
void sBK(const SyBookkeeper *newBK)
Set the pointer to the symmetry bookkeeper.
Definition: TensorT.cpp:165
double * gStorage()
Get the pointer to the storage.
Definition: TensorT.cpp:134
int gKappa(const int N1, const int TwoS1, const int I1, const int N2, const int TwoS2, const int I2) const
Get the index corresponding to a certain tensor block.
Definition: TensorT.cpp:136
void QR(Tensor *Rstorage)
Left-normalization.
Definition: TensorT.cpp:188
void LeftMultiply(Tensor *Mx)
Multiply at the left with a diagonal TensorOperator.
Definition: TensorT.cpp:391
const SyBookkeeper * gBK() const
Get the pointer to the symmetry bookkeeper.
Definition: TensorT.cpp:163
void number_operator(const double alpha, const double beta)
Apply alpha * ( number operator ) + beta to the MPS tensor.
Definition: TensorT.cpp:175
bool CheckLeftNormal() const
Check whether the TensorT is left-normal.
Definition: TensorT.cpp:433
bool CheckRightNormal() const
Check whether the TensorT is right-normal.
Definition: TensorT.cpp:474
void Reset()
Reset the TensorT (if virtual dimensions are changed)
Definition: TensorT.cpp:125
int gKappa2index(const int kappa) const
Get the storage jump corresponding to a certain tensor block.
Definition: TensorT.cpp:151