-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqmcSysDescription.cpp
211 lines (186 loc) · 6.25 KB
/
qmcSysDescription.cpp
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#include "qmcSysDescription.h"
#include "qmcInputGenerator.h"
#include "observables.h"
#include "jastrows.h"
using namespace std;
xmlNode qmcSysDescription::getHamiltonianNode() const {
xmlNode nd;
nd.name = "hamiltonian";
nd.addAttribute("name", hamname);
nd.addAttribute("type", "generic");
nd.addAttribute("target", epsetname);
for (int i = 0; i < observables.size(); i++) {
xmlNode on = observables[i]->createXmlNode();
nd.addChild(on);
}
return nd;
}
xmlNode qmcSysDescription::getIonPtclSetNode() const {
xmlNode nd;
nd.name = "particleset";
nd.addAttribute("name", ipsetname);
nd.addAttribute("size", numAt);
for (int i = 0; i < getNumTypes(); i++) {
xmlNode& groupNode = nd.addChild();
groupNode.name = "group";
const string atName = getAtName(i);
groupNode.addAttribute("name", atName);
groupNode.addParameterChild("charge", getCharge(atName));
groupNode.addParameterChild("valence", getValence(atName));
groupNode.addParameterChild("atomicnumber", getAtomicNumber(atName));
groupNode.addParameterChild("mass", getMass(atName));
if (isHybrid == 1) {
groupNode.addParameterChild("cutoff_radius", getCutoffRadius(atName));
groupNode.addParameterChild("spline_radius", getSplineRadius(atName));
groupNode.addParameterChild("spline_npoints", getSplinePts(atName));
groupNode.addParameterChild("lmax", getLmax(atName));
}
xmlNode& attribNode = groupNode.addChild();
attribNode.name = "attrib";
attribNode.addAttribute("name", "position");
attribNode.addAttribute("dataType", "posArray");
attribNode.addAttribute("condition", 1);
stringstream ss;
for (int j = 0; j < getPosVec(atName).size(); j++) {
double locx = getPosVec(atName)[j][0];
double locy = getPosVec(atName)[j][1];
double locz = getPosVec(atName)[j][2];
ss << locx << " " << locy << " " << locz << endl;
}
attribNode.value = ss.str();
}
return nd;
}
xmlNode qmcSysDescription::getElectronPtclSetNode() const {
xmlNode nd;
nd.name = "particleset";
nd.addAttribute("name", epsetname);
nd.addAttribute("random", "yes");
nd.addAttribute("randomsrc", ipsetname);
if (nelup > 0) {
xmlNode upNode = nd.addChild();
upNode.name = "group";
upNode.addAttribute("name", "u");
upNode.addAttribute("size", nelup);
upNode.addParameterChild("charge", -1);
upNode.addParameterChild("mass", 1);
}
if (neldn > 0) {
xmlNode& dnNode = nd.addChild();
nd.addChild(dnNode);
dnNode.name = "group";
dnNode.addAttribute("name", "d");
dnNode.addAttribute("size", neldn);
dnNode.addParameterChild("charge", -1);
dnNode.addParameterChild("mass", 1);
}
return nd;
}
xmlNode qmcSysDescription::getWfnNode(int twistnum, const location tw) const {
xmlNode nd;
nd.name = "wavefunction";
nd.addAttribute("name", wfnname);
nd.addAttribute("target", epsetname);
xmlNode& detsetNode = nd.addChild();
detsetNode.name = "determinantset";
detsetNode.addAttribute("type", "einspline");
detsetNode.addAttribute("href", h5name);
detsetNode.addAttribute("meshfactor", meshfactor);
detsetNode.addAttribute("source", ipsetname);
if (useDpCoeffs == 1) {
detsetNode.addAttribute("precision", "double");
} else {
detsetNode.addAttribute("precision", "single");
}
if (useGPU == 1) {
detsetNode.addAttribute("gpu", useGPU);
}
if (useTruncate == 1) {
detsetNode.addAttribute("truncate", useTruncate);
detsetNode.addAttribute("buffer", bufferSize);
}
detsetNode.addAttribute("twistnum", twistnum);
if (twistnum == -1) {
stringstream ss;
ss << tw[0] << " " << tw[1] << " " << tw[2];
detsetNode.addAttribute("twist", ss.str());
}
xmlNode& slaterNode = detsetNode.addChild();
slaterNode.name = "slaterdeterminant";
if (nelup > 0) {
xmlNode& detNode = slaterNode.addChild();
detNode.name = "determinant";
detNode.addAttribute("id", "updet");
detNode.addAttribute("size", nelup);
detNode.addAttribute("ref", "updet");
xmlNode& occNode = detNode.addChild();
occNode.name = "occupation";
occNode.addAttribute("spindataset", "0");
if (upExcit.size() == 0) {
occNode.addAttribute("mode", "ground");
} else {
occNode.addAttribute("mode", "excited");
stringstream ss2;
for (std::map<int,int>::const_iterator it = upExcit.begin(); it != upExcit.end(); ++it) {
ss2 << "-" << it->first << " ";
}
for (std::map<int,int>::const_iterator it = upExcit.begin(); it != upExcit.end(); ++it) {
ss2 << it->second << " ";
}
occNode.value = ss2.str();
}
}
if (neldn > 0) {
xmlNode& detNode = slaterNode.addChild();
detNode.name = "determinant";
detNode.addAttribute("id", "downdet");
detNode.addAttribute("size", neldn);
detNode.addAttribute("ref", "downdet");
xmlNode& occNode = detNode.addChild();
occNode.name = "occupation";
int sDataSetNum = 0;
if (isSpinDependent) {
sDataSetNum = 1;
}
occNode.addAttribute("spindataset", sDataSetNum);
if (downExcit.size() == 0) {
occNode.addAttribute("mode", "ground");
} else {
occNode.addAttribute("mode", "excited");
stringstream ss2;
for (std::map<int,int>::const_iterator it = downExcit.begin(); it != downExcit.end(); ++it) {
ss2 << "-" << it->first << " ";
}
for (std::map<int,int>::const_iterator it = downExcit.begin(); it != downExcit.end(); ++it) {
ss2 << it->second << " ";
}
occNode.value = ss2.str();
}
}
// add jastrow factors
for (int i = 0; i < jastrows.size(); i++) {
xmlNode jasNode = jastrows[i]->createXmlNode();
nd.addChild(jasNode);
}
return nd;
}
xmlNode qmcSysDescription::getSimulationCellNode() const {
xmlNode nd;
nd.name = "simulationcell";
stringstream ss;
ss << ptv[0] << " " << ptv[1] << " " << ptv[2] << endl;
ss << ptv[3] << " " << ptv[4] << " " << ptv[5] << endl;
ss << ptv[6] << " " << ptv[7] << " " << ptv[8] << endl;
nd.addParameterChild("lattice", ss.str());
stringstream ss2;
for (int i = 0; i < 3; i++) {
if (bconds[i] == 1) {
ss2 << "p ";
} else {
ss2 << "n ";
}
}
nd.addParameterChild("bconds", ss2.str());
nd.addParameterChild("LR_dim_cutoff", lr_dim_cutoff);
return nd;
}