CheMPS2
Tensor.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 TENSOR_CHEMPS2_H
21 #define TENSOR_CHEMPS2_H
22 
23 #include "SyBookkeeper.h"
24 
25 namespace CheMPS2{
31  class Tensor{
32 
33  public:
34 
36 
37  virtual int gNKappa() const = 0;
38 
40 
41  virtual double * gStorage() = 0;
42 
44 
51  virtual int gKappa( const int N1, const int TwoS1, const int I1, const int N2, const int TwoS2, const int I2 ) const = 0;
52 
54 
56  virtual int gKappa2index( const int kappa ) const = 0;
57 
59 
66  virtual double * gStorage( const int N1, const int TwoS1, const int I1, const int N2, const int TwoS2, const int I2 ) = 0;
67 
69 
70  virtual int gIndex() const = 0;
71 
72  protected:
73 
75  int index;
76 
78  double * storage;
79 
81  int nKappa;
82 
84  int * kappa2index;
85 
86  };
87 }
88 
89 #endif
int index
Index of the Tensor object. For TensorT: a site index; for other tensors: a boundary index...
Definition: Tensor.h:75
Definition: CASPT2.h:42
virtual double * gStorage()=0
Get the pointer to the storage.
virtual int gIndex() const =0
Get the location index.
virtual int gNKappa() const =0
Get the number of tensor blocks.
virtual int gKappa2index(const int kappa) const =0
Get the storage jump corresponding to a certain tensor block.
virtual int gKappa(const int N1, const int TwoS1, const int I1, const int N2, const int TwoS2, const int I2) const =0
Get the index corresponding to a certain tensor block.
int * kappa2index
kappa2index[kappa] indicates the start of tensor block kappa in storage. kappa2index[nKappa] gives th...
Definition: Tensor.h:84
int nKappa
Number of Tensor blocks.
Definition: Tensor.h:81
double * storage
The actual variables. Tensor block kappa begins at storage+kappa2index[kappa] and ends at storage+kap...
Definition: Tensor.h:78