-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathDeterminantMPS.C
72 lines (57 loc) · 1.42 KB
/
DeterminantMPS.C
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
#include "wrapper.h"
#ifndef SERIAL
#include "mpi.h"
#endif
#include "stdio.h"
#include "stdlib.h"
#include <string>
#include "fciqmchelper.h"
#include <iostream>
#include <boost/algorithm/string.hpp>
#include "global.h"
using namespace std;
int main(int argc, char* argv []) {
int rank=0, size=1;
#ifndef SERIAL
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
#endif
initBoostMPI(argc, argv);
ReadInputFromC(argv[1], 3);
int mpsstate=0;
//dmrginp.add_noninteracting_orbs() = false;
readMPSFromDiskAndInitializeStaticVariables();
//initializeGlobalMPS(mpsstate);
double overlap, hvalue;
unsigned long temp=1, occ=0;
int msgsize=1000;
char msgctr[msgsize];
ifstream file("determinants");
file.getline(msgctr, msgsize);
string s( msgctr);
vector<string> tok;
boost::split(tok, s, is_any_of(", \t"), token_compress_on);
int outMPS = atoi(tok[0].c_str());
std::vector<MPS> dets;
std::vector<bool> occupation;
for (int i=0; i<1; i++) {
file.getline(msgctr, msgsize);
//string occstring = "1 1 0 0 1 1 0 0 1 1 0 0 0 0 1 1";
string ss(msgctr);
stringstream stream(ss);
int n;
while (stream >> n) {
if (n==1)
occupation.push_back(1);
else
occupation.push_back(0);
}
dets.push_back(MPS(occupation));
}
dets[0].writeToDiskForDMRG(outMPS, true);
#ifndef SERIAL
MPI_Finalize();
#endif
return 0;
}