forked from sanshar/Dice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SHCIrdm.h
113 lines (92 loc) · 4.52 KB
/
SHCIrdm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
Developed by Sandeep Sharma with contributions from James E. T. Smith and Adam
A. Holmes, 2017 Copyright (c) 2017, Sandeep Sharma
This file is part of DICE.
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SHCI_RDM_H
#define SHCI_RDM_H
#include <Eigen/Dense>
#include <boost/serialization/serialization.hpp>
#include <list>
#include <map>
#include <set>
#include <tuple>
#include <vector>
#include "global.h"
using namespace std;
using namespace Eigen;
class Determinant;
class HalfDet;
class oneInt;
class twoInt;
class twoIntHeatBath;
class twoIntHeatBathSHM;
class schedule;
namespace SHCISortMpiUtils {
class StitchDEH;
};
namespace SHCIrdm {
void makeRDM(int*& AlphaMajorToBetaLen, vector<int*>& AlphaMajorToBeta,
vector<int*>& AlphaMajorToDet, int*& BetaMajorToAlphaLen,
vector<int*>& BetaMajorToAlpha, vector<int*>& BetaMajorToDet,
int*& SinglesFromAlphaLen, vector<int*>& SinglesFromAlpha,
int*& SinglesFromBetaLen, vector<int*>& SinglesFromBeta,
Determinant* Dets, int DetsSize, int Norbs, int nelec,
CItype* cibra, CItype* ciket, MatrixXx& s2RDM);
void save1RDM(schedule& schd, MatrixXx& s1RDM, MatrixXx& oneRDM, int root);
void saveRDM(schedule& schd, MatrixXx& s2RDM, MatrixXx& twoRDM, int root);
void loadRDM(schedule& schd, MatrixXx& s2RDM, MatrixXx& twoRDM, int root);
void save3RDM(schedule& schd, MatrixXx& threeRDM, MatrixXx& s3RDM, int root,
size_t norbs);
void save4RDM(schedule& schd, MatrixXx& fourRDM, MatrixXx& s4RDM, int root,
int norbs);
void load3RDM(schedule& schd, MatrixXx& s3RDM, int root);
void EvaluateRDM(vector<vector<int> >& connections, Determinant* Dets,
int DetsSize, CItype* cibra, CItype* ciket,
vector<vector<size_t> >& orbDifference, int nelec,
schedule& schd, int root, MatrixXx& s2RDM, MatrixXx& twoRDM);
void EvaluateOneRDM(vector<vector<int> >& connections, Determinant* Dets,
int DetsSize, CItype* cibra, CItype* ciket,
vector<vector<size_t> >& orbDifference, int nelec,
schedule& schd, int root, MatrixXx& oneRDM,
MatrixXx& s1RDM);
void UpdateRDMResponsePerturbativeDeterministic(
Determinant* Dets, int DetsSize, CItype* ci, double& E0, oneInt& I1,
twoInt& I2, schedule& schd, double coreE, int nelec, int norbs,
SHCISortMpiUtils::StitchDEH& uniqueDEH, int root, double& Psi1Norm,
MatrixXx& s2RDM, MatrixXx& twoRDM);
void UpdateRDMPerturbativeDeterministic(
vector<Determinant>& Dets, MatrixXx& ci, double& E0, oneInt& I1, twoInt& I2,
schedule& schd, double coreE, int nelec, int norbs,
std::vector<SHCISortMpiUtils::StitchDEH>& uniqueDEH, int root,
MatrixXx& s2RDM, MatrixXx& twoRDM);
void populateSpatialRDM(int& i, int& j, int& k, int& l, MatrixXx& s2RDM,
CItype value, int& nSpatOrbs);
double ComputeEnergyFromSpinRDM(int norbs, int nelec, oneInt& I1, twoInt& I2,
double coreE, MatrixXx& twoRDM);
double ComputeEnergyFromSpatialRDM(int norbs, int nelec, oneInt& I1, twoInt& I2,
double coreE, MatrixXx& twoRDM);
void getUniqueIndices(Determinant& bra, Determinant& ket, vector<int>& cIndices,
vector<int>& dIndices);
void popSpatial3RDM(vector<int>& cs, vector<int>& ds, CItype value,
size_t& norbs, MatrixXx& s3RDM);
void popSpatial4RDM(vector<int>& cs, vector<int>& ds, CItype value, int& nSOs,
MatrixXx& s4RDM);
void Evaluate3RDM(Determinant* Dets, int DetsSize, CItype* cibra, CItype* ciket,
int nelec, schedule& schd, int root, MatrixXx& threeRDM,
MatrixXx& s3RDM);
void Evaluate4RDM(Determinant* Dets, int DetsSize, CItype* cibra, CItype* ciket,
int nelec, schedule& schd, int root, MatrixXx& fourRDM,
MatrixXx& s4RDM);
}; // namespace SHCIrdm
#endif