CheMPS2
TensorX.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 TENSORX_CHEMPS2_H
21 #define TENSORX_CHEMPS2_H
22 
23 #include "Tensor.h"
24 #include "TensorL.h"
25 #include "TensorQ.h"
26 #include "TensorOperator.h"
27 #include "TensorF0.h"
28 #include "TensorF1.h"
29 #include "Problem.h"
30 #include "SyBookkeeper.h"
31 
32 namespace CheMPS2{
38  class TensorX : public TensorOperator{
39 
40  public:
41 
43 
47  TensorX(const int boundary_index, const bool moving_right, const SyBookkeeper * denBK, const Problem * Prob);
48 
50  virtual ~TensorX();
51 
53 
60  void update(TensorT * denT, TensorL ** Ltensors, TensorX * Xtensor, TensorQ * Qtensor, TensorOperator * Atensor, TensorOperator * Ctensor, TensorOperator * Dtensor);
61 
63 
64  void update(TensorT * denT);
65 
66  private:
67 
68  //Problem containing the matrix elements
69  const Problem * Prob;
70 
71  //helper functions
72  void makenewRight(const int ikappa, TensorT * denT);
73  void makenewLeft(const int ikappa, TensorT * denT);
74  void addTermQLRight(const int ikappa, TensorT * denT, TensorL ** Lprev, TensorQ * Qprev, double * workmemRR, double * workmemLR, double * workmemLL);
75  void addTermQLLeft(const int ikappa, TensorT * denT, TensorL ** Lprev, TensorQ * Qprev, double * workmemLL, double * workmemLR, double * workmemRR);
76  void addTermALeft(const int ikappa, TensorT * denT, TensorOperator * Aprev, double * workmemLR, double * workmemLL);
77  void addTermARight(const int ikappa, TensorT * denT, TensorOperator * Aprev, double * workmemRR, double * workmemLR);
78  void addTermCRight(const int ikappa, TensorT * denT, TensorOperator * denC, double * workmemLR);
79  void addTermCLeft(const int ikappa, TensorT * denT, TensorOperator * denC, double * workmemLR);
80  void addTermDRight(const int ikappa, TensorT * denT, TensorOperator * denD, double * workmemLR);
81  void addTermDLeft(const int ikappa, TensorT * denT, TensorOperator * denD, double * workmemLR);
82 
83  };
84 }
85 
86 #endif
void update(TensorT *denT, TensorL **Ltensors, TensorX *Xtensor, TensorQ *Qtensor, TensorOperator *Atensor, TensorOperator *Ctensor, TensorOperator *Dtensor)
Clear and add the relevant terms to the TensorX.
Definition: TensorX.cpp:58
Definition: CASPT2.h:42
TensorX(const int boundary_index, const bool moving_right, const SyBookkeeper *denBK, const Problem *Prob)
Constructor.
Definition: TensorX.cpp:27
bool moving_right
Whether or not moving right.
virtual ~TensorX()
Destructor.
Definition: TensorX.cpp:42