forked from PedroMDuarte/hubbard-lda3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhtse.py
executable file
·290 lines (211 loc) · 10.3 KB
/
htse.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
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
"""
This file provides the HTSE solution to the Hubbard model. It gives only
the density, double occupancy and entropy
"""
import numpy as np
import numpy.ma as ma
minTt = 1.1
def check_valid( T, t, mu, U, ignoreLowT, verbose):
"""
This function is used to enforce the validity limits of the HTSE.
Near half filling we have that T/t should be > 1.5, but away from
half filling this does not matter so much.
When running the LDA in our small beam waist setup the local value
of t increases as one moves away from the center (the lattice depth
gets shallower). For fixed T this results in a very low T/t at
the edge.
Since the density is n<<1 at the edge then the temperature requirement
is not so important there.
What this function does is it gets the local T/t profile. Since the
lattice depth decreases monotinically from the center, T/t does also.
Usually the minimum T/t along the profile is compared to minTt
(defined below) to check if the HTSE is valid.
What this function does is it applies a function to the T/t profile
such that it is unchanged wherever the density is >=1 and it is
boosted up at low densities such that it has a better chance to be
higher than minTt
"""
minTt = 1.2
boostDelta = 0.9
boost = ma.asarray( boostDelta - \
boostDelta*np.exp( -np.abs( ( mu-U/2.)/(3.*U))) )
boost.mask = mu>U/2.
#print boost
boost = boost.filled ( 0. )
Tt = T/t
Tt_ = Tt + boost
# Make sure all quantities are arrays with the same dimension
if type(Tt) is float or len(np.atleast_1d(Tt))==1 :
Tt_arr = np.ones_like(Tt_)*Tt
else:
Tt_arr = Tt
if type(mu) is float or len(np.atleast_1d(mu))==1 :
mu_arr = np.ones_like(Tt_)*mu
else:
mu_arr = mu
if type(U) is float or len(np.atleast_1d(U))==1 :
U_arr = np.ones_like(Tt_)*U
else:
U_arr = U
np.savetxt('errlog', np.column_stack(( \
Tt_arr, \
boost, \
Tt_ ,\
np.ones_like(Tt_)*minTt, \
mu_arr,\
U_arr) ) )
nerror = np.sum( Tt_ < minTt )
if nerror > 0 :
msg = "HTSE ERROR: T/t < %.2f => min(T/t) = %.2f, max(T/t) = %.2f"% \
(minTt, Tt_.min(), Tt_.max())
msg = msg + '\nmu0 = %.2f'%mu.max()
if verbose:
print msg
if not ignoreLowT:
raise ValueError(msg)
def htse_dens( T, t, mu, U, ignoreLowT=False, verbose=True ):
check_valid( T, t, mu, U, ignoreLowT,verbose)
z0 = 2.*np.exp(mu/T) + np.exp(-U/T + 2.*mu/T) + 1.
term1 = ( 2.*np.exp(mu/T) + 2.*np.exp(-U/T + 2.*mu/T) ) / z0
term2 = 6.*((t/T)**2.)*(-4.*np.exp(mu/T) - 4.*np.exp(-U/T + 2.*mu/T) ) * \
( 2.*T*(1-np.exp(-U/t))*np.exp(2.*mu/T) / U \
+ np.exp( mu/T ) + np.exp( -U/T + 3.*mu/T)) \
/ z0**3.
term3 = 6.*((t/T)**2.)*(4.*T*(1-np.exp(-U/T))*np.exp(2.*mu/T)/U \
+ np.exp(mu/T) + 3.*np.exp( -U/T + 3.*mu/T) ) \
/ z0**2.
#print z0
#print term1
#print term2
#print term3
return term1 + term2 + term3
def htse_doub( T, t, mu, U, ignoreLowT=False, verbose=True):
check_valid( T, t, mu, U, ignoreLowT,verbose)
z0 = 2.*np.exp(mu/T) + np.exp(-U/T + 2.*mu/T) + 1.
term1 = np.exp(-U/T + 2.*mu/T) / z0
term2 = -6.*((t/T)**2.)*( -2.*(T**2.)*(1-np.exp(-U/T))\
*np.exp(2.*mu/T) / (U**2.) \
+ 2.*np.exp(-U/T+2.*mu/T)*T/U \
- np.exp(-U/T+3.*mu/T) ) \
/ z0**2.
term3 = -12.*((t/T)**2.)*( 2.*T*(1-np.exp(-U/T))*np.exp(2.*mu/T) / U \
+ np.exp(mu/T) + np.exp(-U/T+3.*mu/T) ) \
*np.exp(-U/T+2.*mu/T) \
/ z0**3.
#print z0
#print term1
#print term2
#print term3
return term1 + term2 + term3
def htse_entr( T, t, mu, U, ignoreLowT=False, verbose=True ):
check_valid( T, t, mu, U, ignoreLowT,verbose)
z0 = 2.*np.exp(mu/T) + np.exp(-U/T + 2.*mu/T) + 1.
term0 = ( U*np.exp(-U/T+2.*mu/T) - 2.*mu*np.exp(mu/T) \
- 2.*mu*np.exp(-U/T+2.*mu/T) ) / T / z0
term1 = np.log( z0 )
term2 = 6.*((t/T)**2.)*( -2.*U*np.exp(-U/T+2.*mu/T)/T \
+ 4.*mu*np.exp(mu/T)/T \
+ 4.*mu*np.exp(-U/T+2.*mu/T)/T ) \
* ( 2.*T*(1-np.exp(-U/T))*np.exp(2.*mu/T)/U \
+ np.exp(mu/T) + np.exp(-U/T+3.*mu/T) ) \
/ z0**3.
term3 = 6.*((t/T)**2.)*( 2.*(1-np.exp(-U/T))*np.exp(2.*mu/T)*T/U \
-2.*np.exp(-U/T+2.*mu/T) \
-4.*mu*(1-np.exp(-U/T))*np.exp(2.*mu/T)/U \
+U*np.exp(-U/T+3.*mu/T)/T \
-mu*np.exp(mu/T)/T \
-3.*mu*np.exp(-U/T+3.*mu/T)/T ) \
/ z0**2.
term4 = -6.*((t/T)**2.)*( 2.*T*(1-np.exp(-U/T))*np.exp(2.*mu/T)/U \
+ np.exp(mu/T) + np.exp(-U/T+3.*mu/T) ) \
/ z0**2.
#print z0
#print term0
#print term1
#print term2
#print term3
#print term4
return term0 + term1 + term2 + term3 + term4
#def htse_cmpr( T, t, mu, U, ignoreLowT=False, verbose=True ):
# dmu = 0.001
# n1 = htse_dens( T, t, mu+dmu, U, ignoreLowT=ignoreLowT, verbose=verbose)
# n0 = htse_dens( T, t, mu-dmu, U, ignoreLowT=ignoreLowT, verbose=verbose)
#
# dn = n1**(2./3.) - n0**(2./3.)
# return dn/(2.*dmu)
def htse_cmpr( T, t, mu, U, ignoreLowT=False, verbose=True ):
check_valid( T, t, mu, U, ignoreLowT,verbose)
term0 = 2.*np.exp(mu/T) + 1. + np.exp(-U/T)*np.exp(2.*mu/T)
term1 = (t/T) * (2*np.exp(mu/T) + 4.*np.exp(-U/T)*np.exp(2.*mu/T)) / term0
term2 = (t/T) * (-2.*np.exp(mu/T) - 2.*np.exp(-U/T)*np.exp(2.*mu/T) ) * \
( 2.*np.exp(mu/T) + 2.*np.exp(-U/T)*np.exp(2.*mu/T) ) / \
(term0**2.)
term3 = ((t/T)**3.) * 6.0 * \
(-4.*np.exp(mu/T) - 8.*np.exp(-U/T)*np.exp(2.*mu/T) ) * \
( 2.*(T/U)*(1. - np.exp(-U/T))*np.exp(2.*mu/T) + np.exp(mu/T) + \
np.exp(-U/T)*np.exp(3.*mu/T)) / (term0**3.)
term4 = ((t/T)**3.) * 6.0 * \
(-6.*np.exp(mu/T) - 6.*np.exp(-U/T)*np.exp(2.*mu/T)) * \
(-4.*np.exp(mu/T) - 4.*np.exp(-U/T)*np.exp(2.*mu/T)) * \
( 2.*(T/U)*(1 - np.exp(-U/T))*np.exp(2.*mu/T) + \
np.exp(mu/T) + np.exp(-U/T)*np.exp(3.*mu/T)) / ( term0**4.)
term5 = ((t/T)**3.) * 12.0 * \
(-4.*np.exp(mu/T) - 4.*np.exp(-U/T)*np.exp(2.*mu/T)) * \
( 4.*(T/U)*(1. - np.exp(-U/T))*np.exp(2.*mu/T) + np.exp(mu/T) + \
3.*np.exp(-U/T)*np.exp(3.*mu/T)) / ( term0**3.)
term6 = ((t/T)**3.) * 6.0 * \
( 8.*(T/U)*(1. - np.exp(-U/T))*np.exp(2.*mu/T) + \
np.exp(mu/T) + 9.*np.exp(-U/T)*np.exp(3.*mu/T) ) / ( term0**2.)
dn_dmu = term1 + term2 + term3 + term4 + term5 + term6
# Density :
z0 = 2.*np.exp(mu/T) + np.exp(-U/T + 2.*mu/T) + 1.
n_term1 = ( 2.*np.exp(mu/T) + 2.*np.exp(-U/T + 2.*mu/T) ) / z0
n_term2 = 6.*((t/T)**2.)*(-4.*np.exp(mu/T) - 4.*np.exp(-U/T + 2.*mu/T) ) * \
( 2.*T*(1-np.exp(-U/t))*np.exp(2.*mu/T) / U \
+ np.exp( mu/T ) + np.exp( -U/T + 3.*mu/T)) \
/ z0**3.
n_term3 = 6.*((t/T)**2.)*(4.*T*(1-np.exp(-U/T))*np.exp(2.*mu/T)/U \
+ np.exp(mu/T) + 3.*np.exp( -U/T + 3.*mu/T) ) \
/ z0**2.
n = n_term1 + n_term2 + n_term3
return (2./3.) / n**(1./3.) * dn_dmu * t
def htse_cmpb( T, t, mu, U, ignoreLowT=False, verbose=True ):
check_valid( T, t, mu, U, ignoreLowT,verbose)
term0 = 2.*np.exp(mu/T) + 1. + np.exp(-U/T)*np.exp(2.*mu/T)
term1 = (t/T) * (2*np.exp(mu/T) + 4.*np.exp(-U/T)*np.exp(2.*mu/T)) / term0
term2 = (t/T) * (-2.*np.exp(mu/T) - 2.*np.exp(-U/T)*np.exp(2.*mu/T) ) * \
( 2.*np.exp(mu/T) + 2.*np.exp(-U/T)*np.exp(2.*mu/T) ) / \
(term0**2.)
term3 = ((t/T)**3.) * 6.0 * \
(-4.*np.exp(mu/T) - 8.*np.exp(-U/T)*np.exp(2.*mu/T) ) * \
( 2.*(T/U)*(1. - np.exp(-U/T))*np.exp(2.*mu/T) + np.exp(mu/T) + \
np.exp(-U/T)*np.exp(3.*mu/T)) / (term0**3.)
term4 = ((t/T)**3.) * 6.0 * \
(-6.*np.exp(mu/T) - 6.*np.exp(-U/T)*np.exp(2.*mu/T)) * \
(-4.*np.exp(mu/T) - 4.*np.exp(-U/T)*np.exp(2.*mu/T)) * \
( 2.*(T/U)*(1 - np.exp(-U/T))*np.exp(2.*mu/T) + \
np.exp(mu/T) + np.exp(-U/T)*np.exp(3.*mu/T)) / ( term0**4.)
term5 = ((t/T)**3.) * 12.0 * \
(-4.*np.exp(mu/T) - 4.*np.exp(-U/T)*np.exp(2.*mu/T)) * \
( 4.*(T/U)*(1. - np.exp(-U/T))*np.exp(2.*mu/T) + np.exp(mu/T) + \
3.*np.exp(-U/T)*np.exp(3.*mu/T)) / ( term0**3.)
term6 = ((t/T)**3.) * 6.0 * \
( 8.*(T/U)*(1. - np.exp(-U/T))*np.exp(2.*mu/T) + \
np.exp(mu/T) + 9.*np.exp(-U/T)*np.exp(3.*mu/T) ) / ( term0**2.)
dn_dmu = term1 + term2 + term3 + term4 + term5 + term6
# Density :
z0 = 2.*np.exp(mu/T) + np.exp(-U/T + 2.*mu/T) + 1.
n_term1 = ( 2.*np.exp(mu/T) + 2.*np.exp(-U/T + 2.*mu/T) ) / z0
n_term2 = 6.*((t/T)**2.)*(-4.*np.exp(mu/T) - 4.*np.exp(-U/T + 2.*mu/T) ) * \
( 2.*T*(1-np.exp(-U/t))*np.exp(2.*mu/T) / U \
+ np.exp( mu/T ) + np.exp( -U/T + 3.*mu/T)) \
/ z0**3.
n_term3 = 6.*((t/T)**2.)*(4.*T*(1-np.exp(-U/T))*np.exp(2.*mu/T)/U \
+ np.exp(mu/T) + 3.*np.exp( -U/T + 3.*mu/T) ) \
/ z0**2.
n = n_term1 + n_term2 + n_term3
return 1. / (n**2.) * dn_dmu * t
if __name__ == "__main__":
print htse_dens( 2.4, 1., 10., 20.)
print htse_doub( 2.4, 1., 10., 20.)
print htse_entr( 2.4, 1., 10., 20.)