-
Notifications
You must be signed in to change notification settings - Fork 3
/
dethubbardparams.cpp
77 lines (67 loc) · 2.46 KB
/
dethubbardparams.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
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. See the enclosed file LICENSE for a copy or if
* that was not distributed with this file, You can obtain one at
* http://mozilla.org/MPL/2.0/.
*
* Copyright 2017 Max H. Gerlach
*
* */
#include "dethubbardparams.h"
#include <vector>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wshadow"
#include "boost/assign/std/vector.hpp" // 'operator+=()' for vectors
#pragma GCC diagnostic pop
void ModelParams<DetHubbard>::check() {
//check parameters: passed all that are necessary
using namespace boost::assign;
std::vector<std::string> neededModelPars;
neededModelPars += "t", "U", "mu", "L", "d", "checkerboard";
for (auto p = neededModelPars.cbegin(); p != neededModelPars.cend(); ++p) {
if (specified.count(*p) == 0) {
throw_ParameterMissing(*p);
}
}
if (model != "hubbard") {
throw_ParameterWrong_message("Parameters specify model: " + model + " instead of hubbard");
}
if (checkerboard and L % 2 != 0) {
throw_ParameterWrong_message("Checker board decomposition only supported for even linear lattice sizes");
}
if (checkerboard and d != 2) {
throw_ParameterWrong_message("Checker board decomposition only supported for 2d lattices");
}
if (bc != "pbc") {
throw_ParameterWrong_message("Boundary conditions " + bc + " not supported for Hubbard model (only pbc)");
}
//check that only positive values are passed for certain parameters
#define IF_NOT_POSITIVE(x) if (specified.count(#x) > 0 and x <= 0)
#define CHECK_POSITIVE(x) { \
IF_NOT_POSITIVE(x) { \
throw_ParameterWrong(#x, x); \
} \
}
CHECK_POSITIVE(L);
CHECK_POSITIVE(d);
#undef CHECK_POSITIVE
#undef IF_NOT_POSITIVE
}
MetadataMap ModelParams<DetHubbard>::prepareMetadataMap() const {
MetadataMap meta;
meta["model"] = "hubbard";
meta["checkerboard"] = (checkerboard ? "true" : "false");
// meta["timedisplaced"] = (timedisplaced ? "true" : "false");
#define META_INSERT(VAR) {meta[#VAR] = numToString(VAR);}
META_INSERT(t);
META_INSERT(U);
META_INSERT(mu);
META_INSERT(L);
META_INSERT(d);
META_INSERT(beta);
META_INSERT(m);
META_INSERT(dtau);
META_INSERT(s);
#undef META_INSERT
return meta;
}