CheMPS2
Sobject.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 SOBJECT_CHEMPS2_H
21 #define SOBJECT_CHEMPS2_H
22 
23 #include "TensorT.h"
24 #include "SyBookkeeper.h"
25 
26 namespace CheMPS2{
34  class Sobject{
35 
36  public:
37 
39 
41  Sobject( const int index, SyBookkeeper * denBK );
42 
44  virtual ~Sobject();
45 
47 
48  int gNKappa() const;
49 
51 
52  double * gStorage();
53 
55 
65  int gKappa( const int NL, const int TwoSL, const int IL, const int N1, const int N2, const int TwoJ, const int NR, const int TwoSR, const int IR ) const;
66 
68 
70  int gKappa2index( const int kappa ) const;
71 
73 
83  double * gStorage( const int NL, const int TwoSL, const int IL, const int N1, const int N2, const int TwoJ, const int NR, const int TwoSR, const int IR );
84 
86 
87  int gIndex() const;
88 
90 
92  void Join( TensorT * Tleft, TensorT * Tright );
93 
95 
101  double Split( TensorT * Tleft, TensorT * Tright, const int virtualdimensionD, const bool movingright, const bool change );
102 
104 
105  void addNoise( const double NoiseLevel );
106 
108  void prog2symm();
109 
111  void symm2prog();
112 
114 
116  int gNL( const int ikappa ) const;
117 
119 
121  int gTwoSL( const int ikappa ) const;
122 
124 
126  int gIL( const int ikappa ) const;
127 
129 
131  int gN1( const int ikappa ) const;
132 
134 
136  int gN2( const int ikappa ) const;
137 
139 
141  int gTwoJ( const int ikappa ) const;
142 
144 
146  int gNR( const int ikappa ) const;
147 
149 
151  int gTwoSR( const int ikappa ) const;
152 
154 
156  int gIR( const int ikappa ) const;
157 
159 
161  int gReorder( const int ikappa ) const;
162 
163  private:
164 
166  int index;
167 
169  int Ilocal1;
170 
172  int Ilocal2;
173 
175  SyBookkeeper * denBK;
176 
178  int nKappa;
179 
181  int * sectorNL;
182  int * sectorTwoSL;
183  int * sectorIL;
184  int * sectorN1;
185  int * sectorN2;
186  int * sectorTwoJ;
187  int * sectorNR;
188  int * sectorTwoSR;
189  int * sectorIR;
190 
192  int * kappa2index;
193 
195  double * storage;
196 
198  int * reorder;
199 
200  };
201 }
202 
203 #endif
int gTwoSL(const int ikappa) const
Get the left spin symmetry of block ikappa.
Definition: Sobject.cpp:203
Sobject(const int index, SyBookkeeper *denBK)
Constructor.
Definition: Sobject.cpp:36
Definition: CASPT2.h:42
int gKappa2index(const int kappa) const
Get the storage jump corresponding to a certain symmetry block.
Definition: Sobject.cpp:190
double Split(TensorT *Tleft, TensorT *Tright, const int virtualdimensionD, const bool movingright, const bool change)
SVD an S-object into 2 TensorT's.
Definition: Sobject.cpp:260
void symm2prog()
Convert the storage from symmetric Hamiltonian convention to diagram convention.
Definition: Sobject.cpp:636
int gTwoJ(const int ikappa) const
Get the central spin symmetry of block ikappa.
Definition: Sobject.cpp:207
int gNKappa() const
Get the number of symmetry blocks.
Definition: Sobject.cpp:166
int gIL(const int ikappa) const
Get the left irrep symmetry of block ikappa.
Definition: Sobject.cpp:204
double * gStorage()
Get the pointer to the storage.
Definition: Sobject.cpp:168
int gKappa(const int NL, const int TwoSL, const int IL, const int N1, const int N2, const int TwoJ, const int NR, const int TwoSR, const int IR) const
Get the index corresponding to a certain symmetry block.
Definition: Sobject.cpp:172
void Join(TensorT *Tleft, TensorT *Tright)
Join two sites to form a composite S-object.
Definition: Sobject.cpp:212
void prog2symm()
Convert the storage from diagram convention to symmetric Hamiltonian convention.
Definition: Sobject.cpp:622
virtual ~Sobject()
Destructor.
Definition: Sobject.cpp:149
int gNL(const int ikappa) const
Get the left particle number symmetry of block ikappa.
Definition: Sobject.cpp:202
int gIR(const int ikappa) const
Get the right irrep symmetry of block ikappa.
Definition: Sobject.cpp:210
int gTwoSR(const int ikappa) const
Get the right spin symmetry of block ikappa.
Definition: Sobject.cpp:209
int gIndex() const
Get the location index.
Definition: Sobject.cpp:200
int gReorder(const int ikappa) const
Get the blocks from large to small: blocksize(reorder[i])>=blocksize(reorder[i+1]) ...
Definition: Sobject.cpp:170
int gNR(const int ikappa) const
Get the right particle number symmetry of block ikappa.
Definition: Sobject.cpp:208
void addNoise(const double NoiseLevel)
Add noise to the current S-object.
Definition: Sobject.cpp:650
int gN1(const int ikappa) const
Get the left local particle number symmetry of block ikappa.
Definition: Sobject.cpp:205
int gN2(const int ikappa) const
Get the right local particle number symmetry of block ikappa.
Definition: Sobject.cpp:206