forked from lucaparisi91/pimc-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
observable.py
166 lines (129 loc) · 3.85 KB
/
observable.py
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
class magnetization:
def __init__(self, groups , label ):
self.setA,self.setB=groups
self.label=label
def toJson(self):
return {
"kind": "magnetization",
"label": self.label,
"groupA" : self.setA,
"groupB" : self.setB
}
class magnetizationSquared:
def __init__(self, groups , label ):
self.setA,self.setB=groups
self.label=label
def toJson(self):
return {
"kind": "magnetizationSquared",
"label": self.label,
"groupA" : self.setA,
"groupB" : self.setB
}
class pairCorrelation:
def __init__(self,groups,label,xRange,bins=100 ):
self.setA,self.setB=groups
self.label=label
self.bins=bins
self.xRange=xRange
def toJson(self):
return {
"kind": "pairCorrelation",
"label": self.label,
"setA" : self.setA,
"setB" : self.setB,
"bins" : self.bins,
"minx" : self.xRange[0],
"maxx" : self.xRange[1]
}
class oneBody:
def __init__(self,group,label,xRange,bins=100 ):
self.group=group
self.label=label
self.bins=bins
self.xRange=xRange
def toJson(self):
return {
"kind": "oneBody",
"label": self.label,
"set" : self.group,
"bins" : self.bins,
"minx" : self.xRange[0],
"maxx" : self.xRange[1]
}
class superfluidFraction:
def __init__(self,groups,label ):
self.groups=groups
self.label=label
def toJson(self):
return {
"kind": "superfluidFraction",
"label": self.label,
"size" : len(self.groups)
}
class angleEstimator:
def __init__(self,groups,label,bins=100 ):
self.setA,self.setB=groups
self.label=label
self.bins=bins
def toJson(self):
return {
"kind": "angleEstimator",
"label": self.label,
"setA" : self.setA,
"setB" : self.setB,
"bins" : self.bins,
"minx" : -1.0,
"maxx" : 1.0
}
class magnetizationDistribution:
def __init__(self,groups,label,magRange):
self.groups=groups
self.label=label
self.range=magRange
def toJson(self):
return {
"kind" : "magnetizationDistribution",
"label" : self.label,
"sets" : self.groups,
"min" : self.range[0],
"max" : self.range[1]
}
class thermodynamicEnergy:
def __init__(self,label,N=None, magnetizationDistribution=False):
self.label=label
self.magnetizationDistribution=magnetizationDistribution
self.N=N
def toJson(self):
if (self.magnetizationDistribution):
if self.N is None:
raise RuntimeError("N needs to be specified")
return {
"kind" : "thermodynamicEnergyMagnetization",
"label" : self.label,
"size" : self.N + 1
}
else:
return {
"kind" : "thermalEnergy",
"label" : self.label
}
class virialEnergy:
def __init__(self,label,N=None, magnetizationDistribution=False):
self.label=label
self.magnetizationDistribution=magnetizationDistribution
self.N=N
def toJson(self):
if (self.magnetizationDistribution):
if self.N is None:
raise RuntimeError("N needs to be specified")
return {
"kind" : "virialEnergyMagnetization",
"label" : self.label,
"size" : self.N + 1
}
else:
return {
"kind" : "virialEnergy",
"label" : self.label
}