CheMPS2
Correlations.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 CORRELATIONS_CHEMPS2_H
21 #define CORRELATIONS_CHEMPS2_H
22 
23 #include "SyBookkeeper.h"
24 #include "Problem.h"
25 #include "TwoDM.h"
26 #include "TensorGYZ.h"
27 #include "TensorKM.h"
28 
29 namespace CheMPS2{
98  class Correlations{
99 
100  public:
101 
103 
106  Correlations(const SyBookkeeper * denBKIn, const Problem * ProbIn, TwoDM * the2DMin);
107 
109  virtual ~Correlations();
110 
112 
115  double getCspin_DMRG(const int row, const int col) const;
116 
118 
121  double getCspin_HAM(const int row, const int col) const;
122 
124 
127  double getCdens_DMRG(const int row, const int col) const;
128 
130 
133  double getCdens_HAM(const int row, const int col) const;
134 
136 
139  double getCspinflip_DMRG(const int row, const int col) const;
140 
142 
145  double getCspinflip_HAM(const int row, const int col) const;
146 
148 
151  double getCdirad_DMRG(const int row, const int col) const;
152 
154 
157  double getCdirad_HAM(const int row, const int col) const;
158 
160 
163  double getMutualInformation_DMRG(const int row, const int col) const;
164 
166 
169  double getMutualInformation_HAM(const int row, const int col) const;
170 
172 
174  double SingleOrbitalEntropy_DMRG(const int index) const;
175 
177 
179  double SingleOrbitalEntropy_HAM(const int index) const;
180 
182 
188  void FillSite(TensorT * denT, TensorGYZ ** Gtensors, TensorGYZ ** Ytensors, TensorGYZ ** Ztensors, TensorKM ** Ktensors, TensorKM ** Mtensors);
189 
191 
193  double MutualInformationDistance(const double power) const;
194 
196 
198  void Print(const int precision=6, const int columnsPerLine=8) const;
199 
201  void mpi_broadcast();
202 
203  private:
204 
205  //The BK containing all the irrep information
206  const SyBookkeeper * denBK;
207 
208  //The problem containing orbital reshuffling and symmetry information
209  const Problem * Prob;
210 
211  //The 2-RDM of the active space
212  TwoDM * the2DM;
213 
214  //The number of active space orbitals
215  int L;
216 
217  //The spin correlation function
218  double * Cspin;
219 
220  //The density correlation function
221  double * Cdens;
222 
223  //The spin-flip correlation function
224  double * Cspinflip;
225 
226  //The singlet diradical correlation function
227  double * Cdirad;
228 
229  //The two-orbital mutual information
230  double * MutInfo;
231 
232  //Helper function: fills Cspin, Cdens, Cspinflip, and Cdirad (the latter only partially)
233  void FillSpinDensSpinflip();
234 
235  //Helper functions for FillSite
236  double diagram1(TensorT * denT, TensorGYZ * denY, double * workmem) const;
237  double diagram2(TensorT * denT, TensorGYZ * denZ, double * workmem) const;
238  double diagram3(TensorT * denT, TensorGYZ * denG, double * workmem) const;
239  double diagram4(TensorT * denT, TensorKM * denK, double * workmem) const;
240  double diagram5(TensorT * denT, TensorKM * denM, double * workmem) const;
241 
242  //Helper function to print tables in a nice format
243  void PrintTableNice(const double * table, const int sPrecision, const int columnsPerLine) const;
244 
245  };
246 }
247 
248 #endif
Correlations(const SyBookkeeper *denBKIn, const Problem *ProbIn, TwoDM *the2DMin)
Constructor.
double getMutualInformation_HAM(const int row, const int col) const
Get a mutual information term, using the HAM indices.
Definition: CASPT2.h:42
double getMutualInformation_DMRG(const int row, const int col) const
Get a mutual information term, using the DMRG indices.
void FillSite(TensorT *denT, TensorGYZ **Gtensors, TensorGYZ **Ytensors, TensorGYZ **Ztensors, TensorKM **Ktensors, TensorKM **Mtensors)
Fill at the current step of the iterations the two-orbital mutual information and the remaining part ...
void Print(const int precision=6, const int columnsPerLine=8) const
Print the correlation functions and two-orbital mutual information.
double getCdens_HAM(const int row, const int col) const
Get a Cdens term, using the HAM indices.
double getCdirad_HAM(const int row, const int col) const
Get a Cdirad term, using the HAM indices.
double SingleOrbitalEntropy_HAM(const int index) const
Get the single-orbital entropy for a certain site, using hte HAM indices.
double SingleOrbitalEntropy_DMRG(const int index) const
Get the single-orbital entropy for a certain site, using the DMRG indices.
void mpi_broadcast()
Broadcast the diradical correlation function and the two-orbital mutual information.
double getCspin_HAM(const int row, const int col) const
Get a Cspin term, using the HAM indices.
double getCspinflip_HAM(const int row, const int col) const
Get a Cspinflip term, using the HAM indices.
double getCspin_DMRG(const int row, const int col) const
Get a Cspin term, using the DMRG indices.
virtual ~Correlations()
Destructor.
double getCspinflip_DMRG(const int row, const int col) const
Get a Cspinflip term, using the DMRG indices.
double MutualInformationDistance(const double power) const
Return Idistance(power) (see return for definition)
double getCdens_DMRG(const int row, const int col) const
Get a Cdens term, using the DMRG indices.
double getCdirad_DMRG(const int row, const int col) const
Get a Cdirad term, using the DMRG indices.