forked from sanshar/Block
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CSFOverlapHelement.C
76 lines (62 loc) · 1.65 KB
/
CSFOverlapHelement.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
73
74
75
76
#ifndef SERIAL
#include "mpi.h"
#endif
#include "wrapper.h"
#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], -1);
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 ndets = atoi(tok[0].c_str());
std::vector<MPS> dets;
for (int i=0; i<ndets; i++) {
file.getline(msgctr, msgsize);
//string occstring = "1 1 0 0 1 1 0 0 1 1 0 0 0 0 1 1";
intFromString(occ, msgctr);
dets.push_back(MPS(&occ, 1));
}
/*
for (int i=0; i<ndets; i++)
for (int j=i; j<ndets; j++) {
calcHamiltonianAndOverlap(dets[i], dets[j], hvalue, overlap);
printf("<D%i|H|D%i> = %18.10f \n", i, j, hvalue);
}
*/
printf ("Interaction Matrix, Row(i,j) = <Di|H|Dj>\n");
for (int i=0; i<ndets; i++) {
for (int j=0; j<ndets; j++) {
calcHamiltonianAndOverlap(dets[i], dets[j], hvalue, overlap);
printf(" %12.3e ", hvalue);
}
printf("\n");
}
#ifndef SERIAL
MPI_Finalize();
#endif
return 0;
}