@@ -38,7 +38,7 @@ function chaincoeffs_finiteT(nummodes, β, ohmic=true; α=1, s=1, J=nothing, ωc
38
38
else
39
39
throw (ArgumentError (" An interval AB with mc = $mc components should have been provided." ))
40
40
end
41
- elseif length (AB) != 2 * mc
41
+ elseif size (AB)[ 1 ] != mc
42
42
throw (ArgumentError (" AB has a different number of intervals than mc = $mc ." ))
43
43
end
44
44
@@ -118,7 +118,7 @@ function chaincoeffs_finiteT(nummodes, β, ohmic=true; α=1, s=1, J=nothing, ωc
118
118
end
119
119
120
120
"""
121
- chaincoeffs_fermionic(nummodes, β, chain; ϵ=nothing, J=nothing , ωc=1, mc=4, mp=0, AB=nothing, iq=1, idelta=2, procedure=:Lanczos, Mmax=5000, save=true)
121
+ chaincoeffs_fermionic(nummodes, β, chain; ϵ=x , ωc=1, mc=4, mp=0, AB=nothing, iq=1, idelta=2, procedure=:Lanczos, Mmax=5000, save=true)
122
122
123
123
Generate chain coefficients ``[[ϵ_0,ϵ_1,...],[t_0,t_1,...],c_0]`` for a fermionic bath at the inverse temperature β.
124
124
@@ -148,7 +148,7 @@ function chaincoeffs_fermionic(nummodes, β, chain; ϵ=nothing, J=nothing, ωc=1
148
148
else
149
149
throw (ArgumentError (" An interval AB with mc = $mc components should have been provided." ))
150
150
end
151
- elseif length (AB) != 2 * mc
151
+ elseif size (AB)[ 1 ] != mc
152
152
throw (ArgumentError (" AB has a different number of intervals than mc = $mc ." ))
153
153
end
154
154
@@ -208,3 +208,89 @@ function chaincoeffs_fermionic(nummodes, β, chain; ϵ=nothing, J=nothing, ωc=1
208
208
209
209
return [jacerg[:,1 ], jacerg[1 : N- 1 ,2 ],jacerg[N,2 ]]
210
210
end
211
+
212
+
213
+ """
214
+ chaincoeffs_finiteT_discrete(β, ωdiscrete, Jωdiscrete; procedure=:Lanczos, Mmax=5000, save=true)
215
+
216
+ Generate chain coefficients ``[[ϵ_0,ϵ_1,...],[t_0,t_1,...],c_0]`` for a discrete harmonic bath at the inverse temperature β.
217
+
218
+ # Arguments
219
+ * β: inverse temperature. For 0 Kelvin, put Inf as β
220
+ * ωdiscrete: discrete frequency corresponding to the Jωdiscrete values
221
+ * Jωdiscrete: amplitude of the spectral density at the corresponding ωdiscrete
222
+ * procedure: choice between the Stieltjes and the Lanczos procedure
223
+ * Mmax: maximum number of integration points
224
+ * save: if true the coefficients are saved
225
+ """
226
+ function chaincoeffs_finiteT_discrete (β, ωdiscrete, Jωdiscrete; procedure= :Lanczos , Mmax= 5000 , save= true )
227
+
228
+ ω = ωdiscrete
229
+ Jω = Jωdiscrete
230
+ length (ω)== length (Jω) || throw (ErrorException (" J(ω) has $(length (Jω)) values while there is $(length (ω)) frequecencies" ))
231
+ N= length (ω) # Number of bath modes
232
+ if β != Inf
233
+ ω_pos = ω
234
+ Jω_pos = Jω .* (coth .((β/ 2 ). * ω_pos[:]) .+ 1 ) ./ 2
235
+
236
+ ω_neg = - ω
237
+ Jω_neg = - Jω .* (coth .((β/ 2 ). * ω_neg[:]) .+ 1 ) ./ 2
238
+
239
+ ω = vcat (ω_neg,ω_pos)
240
+ Jω = vcat (Jω_neg,Jω_pos)
241
+ end
242
+ mp= length (ω) # the number of points in the discrete part of the measure
243
+
244
+ DM = Array {Float64} (undef,mp,2 )
245
+ for i= 1 : mp
246
+ DM[i,1 ] = ω[i]
247
+ DM[i,2 ] = Jω[i]
248
+ end
249
+
250
+ eps0= 1e7 * eps (Float64)
251
+
252
+ jacerg = zeros (N,2 )
253
+
254
+ ab = Array {Float64} (undef, N, 2 )
255
+ ab[:,2 ] = zeros (N,1 )
256
+
257
+ if procedure== :Lanczos # choice between the Stieltjes and the Lanczos procedure
258
+ ab = lanczos (N,DM)
259
+ elseif procedure== :Stieltjes
260
+ ab = stieltjes (N,DM)
261
+ else
262
+ throw (ArgumentError (" Procedure should be either Lanczos or Stieltjes." ))
263
+ end
264
+
265
+ for m = 1 : N- 1
266
+ jacerg[m,1 ] = ab[m,1 ] # site energy
267
+ jacerg[m,2 ] = sqrt (ab[m+ 1 ,2 ]) # hopping parameter
268
+ end
269
+ jacerg[N,1 ] = ab[N,1 ]
270
+
271
+ eta = sum (Jω)
272
+
273
+ jacerg[N,2 ] = sqrt (eta) # coupling coeficient
274
+
275
+ if save== true
276
+ # Write a HDF5 file
277
+ # curdir = @__DIR__
278
+ dir = @__DIR__
279
+ curdir = abspath (joinpath (dir, " ../ChainOhmT" ))
280
+
281
+ Nstr = string (N)
282
+ bstr = string (β)
283
+ # the "path" to the data inside of the h5 file is N -> ωc -> beta -> data (e, t or c)
284
+
285
+ # Write onsite energies
286
+ h5write (" $curdir /discreteT/chaincoeffs.h5" , string (" /" , Nstr, " /" , bstr, " /e" ), jacerg[1 : N,1 ])
287
+ # Write opping energies
288
+ h5write (" $curdir /discreteT/chaincoeffs.h5" , string (" /" , Nstr, " /" , bstr," /t" ), jacerg[1 : N- 1 ,2 ])
289
+ # Write coupling coefficient
290
+ h5write (" $curdir /discreteT/chaincoeffs.h5" , string (" /" , Nstr, " /" , bstr," /c" ), jacerg[N,2 ])
291
+
292
+ end
293
+
294
+ return [jacerg[:,1 ], jacerg[1 : N- 1 ,2 ],jacerg[N,2 ]]
295
+ end
296
+
0 commit comments