Skip to content

API reference

BosonicBath

Source code in nmm/utils/baths.py
 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
class BosonicBath:
    def __init__(self, T):
        self.T = T

    def bose(self, ν):
        r"""
        It computes the Bose-Einstein distribution

        $$ n(\omega)=\frac{1}{e^{\beta \omega}-1} $$

        Parameters:
        ----------
        ν: float
            The mode at which to compute the thermal population

        Returns:
        -------
        float
            The thermal population of mode ν
        """
        if self.T == 0:
            return 0
        if np.isclose(ν, 0).all():
            return 0
        return np.exp(-ν / self.T) / (1-np.exp(-ν / self.T))

    def spectral_density(self, w):
        return None

    def correlation_function(self, t):
        return None

    def power_spectrum(self, w):
        return 2*(self.bose(w)+1)*self.spectral_density(w)

bose(ν)

It computes the Bose-Einstein distribution

\[ n(\omega)=\frac{1}{e^{\beta \omega}-1} \]
Parameters:

ν: float The mode at which to compute the thermal population

Returns:

float The thermal population of mode ν

Source code in nmm/utils/baths.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
def bose(self, ν):
    r"""
    It computes the Bose-Einstein distribution

    $$ n(\omega)=\frac{1}{e^{\beta \omega}-1} $$

    Parameters:
    ----------
    ν: float
        The mode at which to compute the thermal population

    Returns:
    -------
    float
        The thermal population of mode ν
    """
    if self.T == 0:
        return 0
    if np.isclose(ν, 0).all():
        return 0
    return np.exp(-ν / self.T) / (1-np.exp(-ν / self.T))

OhmicBath

Bases: BosonicBath

Source code in nmm/utils/baths.py
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
class OhmicBath(BosonicBath):
    def __init__(self, T, coupling, cutoff):
        super().__init__(T)
        self.coupling = coupling
        self.cutoff = cutoff
        self.label = "ohmic"

    def spectral_density(self, w):
        r"""
        It describes the spectral density of an Ohmic spectral density given by

        $$ J(\omega)= \alpha \omega e^{-\frac{|\omega|}{\omega_{c}}} $$

        Parameters
        ----------
        """
        return self.coupling*w*np.exp(-abs(w)/self.cutoff)

    def correlation_function(self, t):
        return None

spectral_density(w)

It describes the spectral density of an Ohmic spectral density given by

\[ J(\omega)= \alpha \omega e^{-\frac{|\omega|}{\omega_{c}}} \]
Source code in nmm/utils/baths.py
49
50
51
52
53
54
55
56
57
58
def spectral_density(self, w):
    r"""
    It describes the spectral density of an Ohmic spectral density given by

    $$ J(\omega)= \alpha \omega e^{-\frac{|\omega|}{\omega_{c}}} $$

    Parameters
    ----------
    """
    return self.coupling*w*np.exp(-abs(w)/self.cutoff)

baths

BosonicBath

Source code in nmm/utils/baths.py
 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
class BosonicBath:
    def __init__(self, T):
        self.T = T

    def bose(self, ν):
        r"""
        It computes the Bose-Einstein distribution

        $$ n(\omega)=\frac{1}{e^{\beta \omega}-1} $$

        Parameters:
        ----------
        ν: float
            The mode at which to compute the thermal population

        Returns:
        -------
        float
            The thermal population of mode ν
        """
        if self.T == 0:
            return 0
        if np.isclose(ν, 0).all():
            return 0
        return np.exp(-ν / self.T) / (1-np.exp(-ν / self.T))

    def spectral_density(self, w):
        return None

    def correlation_function(self, t):
        return None

    def power_spectrum(self, w):
        return 2*(self.bose(w)+1)*self.spectral_density(w)

bose(ν)

It computes the Bose-Einstein distribution

\[ n(\omega)=\frac{1}{e^{\beta \omega}-1} \]
Parameters:

ν: float The mode at which to compute the thermal population

Returns:

float The thermal population of mode ν

Source code in nmm/utils/baths.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
def bose(self, ν):
    r"""
    It computes the Bose-Einstein distribution

    $$ n(\omega)=\frac{1}{e^{\beta \omega}-1} $$

    Parameters:
    ----------
    ν: float
        The mode at which to compute the thermal population

    Returns:
    -------
    float
        The thermal population of mode ν
    """
    if self.T == 0:
        return 0
    if np.isclose(ν, 0).all():
        return 0
    return np.exp(-ν / self.T) / (1-np.exp(-ν / self.T))

OhmicBath

Bases: BosonicBath

Source code in nmm/utils/baths.py
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
class OhmicBath(BosonicBath):
    def __init__(self, T, coupling, cutoff):
        super().__init__(T)
        self.coupling = coupling
        self.cutoff = cutoff
        self.label = "ohmic"

    def spectral_density(self, w):
        r"""
        It describes the spectral density of an Ohmic spectral density given by

        $$ J(\omega)= \alpha \omega e^{-\frac{|\omega|}{\omega_{c}}} $$

        Parameters
        ----------
        """
        return self.coupling*w*np.exp(-abs(w)/self.cutoff)

    def correlation_function(self, t):
        return None

spectral_density(w)

It describes the spectral density of an Ohmic spectral density given by

\[ J(\omega)= \alpha \omega e^{-\frac{|\omega|}{\omega_{c}}} \]
Source code in nmm/utils/baths.py
49
50
51
52
53
54
55
56
57
58
def spectral_density(self, w):
    r"""
    It describes the spectral density of an Ohmic spectral density given by

    $$ J(\omega)= \alpha \omega e^{-\frac{|\omega|}{\omega_{c}}} $$

    Parameters
    ----------
    """
    return self.coupling*w*np.exp(-abs(w)/self.cutoff)

cumulant

csolve

Source code in nmm/cumulant/cumulant.py
 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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
class csolve:
    def __init__(self, Hsys, t, baths, Qs, eps=1e-4, cython=False, limit=50,
                 matsubara=True,ls=False):
        self.Hsys = Hsys
        self.t = t
        self.eps = eps
        self.limit = limit
        self.dtype = Hsys.dtype
        self.ls=ls

        if isinstance(Hsys, qutip_Qobj):
            self._qutip = True
        else:
            self._qutip = False
        if cython:
            self.baths = [bath_csolve(b.T, eps, b.coupling, b.cutoff, b.label)
                          for b in baths]
        else:
            self.baths = baths
        self.Qs = Qs
        self.cython = cython
        self.matsubara = matsubara

    def _tree_flatten(self):
        children = (self.Hsys, self.t, self.eps,
                    self.limit, self.baths, self.dtype)
        aux_data = {}
        return (children, aux_data)

    @classmethod
    def _tree_unflatten(cls, aux_data, children):
        return cls(*children, **aux_data)
    def bose(self,w,bath):
        r"""
        It computes the Bose-Einstein distribution

        $$ n(\omega)=\frac{1}{e^{\beta \omega}-1} $$

        Parameters:
        ----------
        nu: float
            The mode at which to compute the thermal population

        Returns:
        -------
        float
            The thermal population of mode nu
        """
        if bath.T == 0:
            return 0
        if np.isclose(w, 0).all():
            return 0
        return np.exp(-w / bath.T) / (1-np.exp(-w / bath.T))

    def gamma_fa(self, bath, w, w1, t):
        r"""
        It describes the decay rates for the Filtered Approximation of the
        cumulant equation

        $$\gamma(\omega,\omega^\prime,t)= 2\pi t e^{i \frac{\omega^\prime
        -\omega}{2}t}\mathrm{sinc} \left(\frac{\omega^\prime-\omega}{2}t\right)
         \left(J(\omega^\prime) (n(\omega^\prime)+1)J(\omega) (n(\omega)+1)
         \right)^{\frac{1}{2}}$$

        Parameters
        ----------

        w : float or numpy.ndarray

        w1 : float or numpy.ndarray

        t : float or numpy.ndarray

        Returns
        -------
        float or numpy.ndarray
            It returns a value or array describing the decay between the levels
            with energies w and w1 at time t

        """
        var = (2 * t * np.exp(1j * (w1 - w) * t / 2)
               * np.sinc((w1 - w) * t / (2 * np.pi))
               * np.sqrt(bath.spectral_density(w1) * (self.bose(w1,bath) + 1))
               * np.sqrt(bath.spectral_density(w) * (self.bose(w,bath) + 1)))
        return var

    def _gamma_(self, nu, bath, w, w1, t):
        r"""
        It describes the Integrand of the decay rates of the cumulant equation
        for bosonic baths

        $$\Gamma(w,w',t)=\int_{0}^{t} dt_1 \int_{0}^{t} dt_2
        e^{i (w t_1 - w' t_2)} \mathcal{C}(t_{1},t_{2})$$

        Parameters:
        ----------

        w: float or numpy.ndarray

        w1: float or numpy.ndarray

        t: float or numpy.ndarray

        Returns:
        --------
        float or numpy.ndarray
            It returns a value or array describing the decay between the levels
            with energies w and w1 at time t

        """

        self._mul = 1/np.pi
        var = (
            np.exp(1j * (w - w1) / 2 * t)
            * bath.spectral_density(nu)
            * (np.sinc((w - nu) / (2 * np.pi) * t)
               * np.sinc((w1 - nu) / (2 * np.pi) * t))
            * (self.bose(nu,bath) + 1)
        )
        var += (
            np.exp(1j * (w - w1) / 2 * t)
            * bath.spectral_density(nu)
            * (np.sinc((w + nu) / (2 * np.pi) * t)
               * np.sinc((w1 + nu) / (2 * np.pi) * t))
            * self.bose(nu,bath)
        )

        var = var*self._mul

        return var

    def gamma_gen(self, bath, w, w1, t, approximated=False):
        r"""
        It describes the the decay rates of the cumulant equation
        for bosonic baths

        $$\Gamma(\omega,\omega',t) = t^{2}\int_{0}^{\infty} d\omega 
        e^{i\frac{\omega-\omega'}{2} t} J(\omega) \left[ (n(\omega)+1) 
        sinc\left(\frac{(\omega-\omega)t}{2}\right)
        sinc\left(\frac{(\omega'-\omega)t}{2}\right)+ n(\omega) 
        sinc\left(\frac{(\omega+\omega)t}{2}\right) 
        sinc\left(\frac{(\omega'+\omega)t}{2}\right)   \right]$$

        Parameters
        ----------

        w : float or numpy.ndarray
        w1 : float or numpy.ndarray
        t : float or numpy.ndarray

        Returns
        -------
        float or numpy.ndarray
            It returns a value or array describing the decay between the levels
            with energies w and w1 at time t

        """
        if isinstance(t, type(jnp.array([2]))):
            t = np.array(t.tolist())
        if isinstance(t, list):
            t = np.array(t)
        if approximated:
            return self.gamma_fa(bath, w, w1, t)
        if self.matsubara:
            if w == w1:
                return self.decayww(bath, w, t)
            else:
                return self.decayww2(bath, w, w1, t)
        if self.cython:
            return bath.gamma(np.real(w), np.real(w1), t, limit=self.limit)

        else:
            integrals = quad_vec(
                self._gamma_,
                0,
                np.inf,
                args=(bath, w, w1, t),
                epsabs=self.eps,
                epsrel=self.eps,
                quadrature="gk21"
            )[0]
            return t*t*integrals

    def sparsify(self, vectors, tol=10):
        dims = vectors[0].dims
        new = []
        for vector in vectors:
            top = np.max(np.abs(vector.full()))
            vector = (vector/top).full().round(tol)*top
            vector = qutip_Qobj(vector).to("CSR")
            vector.dims = dims

            new.append(vector)
        return new

    def jump_operators(self, Q):
        evals, all_state = self.Hsys.eigenstates()
        N = len(all_state)
        collapse_list = []
        ws = []
        for j in range(N):
            for k in range(j + 1, N):
                Deltajk = evals[k] - evals[j]
                ws.append(Deltajk)
                collapse_list.append(
                    (
                        all_state[j]
                        * all_state[j].dag()
                        * Q
                        * all_state[k]
                        * all_state[k].dag()
                    )
                )  # emission
                ws.append(-Deltajk)
                collapse_list.append(
                    (
                        all_state[k]
                        * all_state[k].dag()
                        * Q
                        * all_state[j]
                        * all_state[j].dag()
                    )
                )  # absorption
        collapse_list.append(Q - sum(collapse_list))  # Dephasing
        ws.append(0)
        output = defaultdict(list)
        for k, key in enumerate(ws):
            output[jnp.round(key, 12).item()].append(collapse_list[k])
        eldict = {x: sum(y) for x, y in output.items()}
        dictrem = {}
        empty = 0*self.Hsys
        for keys, values in eldict.items():
            if not (values == empty):
                if isinstance(values,qutip_Qobj):
                    dictrem[keys] = values.to("CSR")
                else:
                    dictrem[keys] = values
        return dictrem

    def decays(self, combinations, bath, approximated):
        rates = {}
        done = []
        for i in tqdm(combinations, desc='Calculating Integrals ...',
                      dynamic_ncols=True):
            done.append(i)
            j = (i[1], i[0])
            if (j in done) & (i != j):
                rates[i] = np.conjugate(rates[j])
            else:
                rates[i] = self.gamma_gen(bath, i[0], i[1], self.t,
                                          approximated)
        return rates

    def matrix_form(self, jumps, combinations):
        matrixform = {}
        lsform={}
        for i in tqdm(
                combinations, desc='Calculating time independent matrices...',
                dynamic_ncols=True):
            ada=jumps[i[0]].dag() * jumps[i[1]]
            matrixform[i] = (
                spre(jumps[i[1]]) * spost(jumps[i[0]].dag()) - 1 *
                (0.5 *
                 (spre(ada) +spost(ada))))
            lsform[i]= -1j*(spre(ada)-spost(ada))

        return matrixform,lsform

    def generator(self, approximated=False):
        generators = []
        for Q, bath in zip(self.Qs, self.baths):
            jumps = self.jump_operators(Q)
            ws = list(jumps.keys())
            combinations = list(itertools.product(ws, ws))
            rates = self.decays(combinations, bath, approximated)
            matrices,lsform = self.matrix_form(jumps, combinations)
            if self.ls is False:
                superop = sum(
                    (rates[i] * np.array(matrices[i])
                    for i in tqdm(
                        combinations,
                        desc="Calculating time dependent generators")))
            else:
                LS= self.LS(combinations,bath,self.t)            
                superop = sum(
                    (LS[i]*np.array(lsform[i])+rates[i] * np.array(matrices[i])
                    for i in tqdm(
                        combinations,
                        desc="Calculating time dependent generators")))
            generators.extend(superop)
            del superop
        self.generators = self._reformat(generators)

    def _reformat(self, generators):
        if len(generators) == len(self.t):
            return generators
        else:
            one_list_for_each_bath = [
                generators
                [i * len(self.t): (i + 1) * len(self.t)]
                for i in range(
                    0, int(
                        len(generators) / len(self.t)))]
            composed = list(map(sum, zip(*one_list_for_each_bath)))
            return composed

    def evolution(self, rho0, approximated=False):
        r"""
        This function computes the evolution of the state $\rho(0)$

        Parameters
        ----------

        rho0 : numpy.ndarray or qutip.Qobj
            The initial state of the quantum system under consideration.

        approximated : bool
            When False the full cumulant equation/refined weak coupling is
            computed, when True the Filtered Approximation (FA is computed),
            this greatly reduces computational time, at the expense of
            diminishing accuracy particularly for the populations of the system
            at early times.

        Returns
        -------
        list
            a list containing all of the density matrices, at all timesteps of
            the evolution
        """
        self.generator(approximated)
        states = [
            (i).expm()(rho0)
            for k,i in tqdm(
                enumerate(self.generators),
                desc='Computing Exponential of Generators . . . .')]  # this counts time incorrectly
        return states
    def _decayww(self,bath, w, t):
        cks=np.array([i.coefficient for i in bath.exponents])
        vks=np.array([i.exponent for i in bath.exponents])
        result=[]
        for i in range(len(cks)):
            term1 =(vks[i]*t-1j*w*t-1)+np.exp(-(vks[i]-1j*w)*t)
            term1=term1*cks[i]/(vks[i]-1j*w)**2
            result.append(term1)
        return 2*np.real(sum(result))

    def _decayww2(self,bath ,w, w1, t):
        cks=np.array([i.coefficient for i in bath.exponents])
        vks=np.array([i.exponent for i in bath.exponents])
        result=[]
        for i in range(len(cks)):
            a=(vks[i]-1j*w1)
            b=(vks[i]-1j*w)
            term1=cks[i]*np.exp(-b*t)/(a*b)
            term2=np.conjugate(cks[i])*np.exp(-np.conjugate(a)*t)/(np.conjugate(a)*np.conjugate(b))
            term3=cks[i]*((1/b)-(np.exp(1j*(w-w1)*t)/a))
            term4=np.conjugate(cks[i])*((1/np.conjugate(a))-(np.exp(1j*(w-w1)*t)/np.conjugate(b)))
            actual=term1+term2+(1j*(term3+term4)/(w-w1))
            result.append(actual)
        return sum(result)


    def decayww2(self, bath, w, w1, t):
        t_array = np.asarray(t)
        result = self._decayww2(bath, w,w1, t_array)
        zero_indices = np.where(t_array == 0)
        result[zero_indices] = 0
        return result

    def decayww(self, bath, w, t):
        t_array = np.asarray(t)
        result = self._decayww(bath, w, t_array)
        zero_indices = np.where(t_array == 0)
        result[zero_indices] = 0
        return result

    def _LS(self, bath, w,w1, t):
        if w!=w1:
            cks=np.array([i.coefficient for i in bath.exponents])
            vks=np.array([i.exponent for i in bath.exponents])
            mask = np.imag(cks) >= 0
            cks=cks[mask]
            vks=vks[mask]
            result=[]
            for i in range(len(cks)):
                a=(vks[i]-1j*w1)
                b=(vks[i]-1j*w)
                term1=cks[i]*np.exp(-b*t)/(a*b)
                term2=np.conjugate(cks[i])*np.exp(-np.conjugate(a)*t)/(np.conjugate(a)*np.conjugate(b))
                term3=cks[i]*((1/b)-(np.exp(1j*(w-w1)*t)/a))
                term4=np.conjugate(cks[i])*((1/np.conjugate(a))-(np.exp(1j*(w-w1)*t)/np.conjugate(b)))
                actual=term1-term2+(1j*(term3-term4)/(w-w1))
                result.append(actual)
            return sum(result)/2j
        else:
            cks=np.array([i.coefficient for i in bath.exponents])
            vks=np.array([i.exponent for i in bath.exponents])
            result=[]
            for i in range(len(cks)):
                term1 =(vks[i]*t-1j*w*t-1)+np.exp(-(vks[i]-1j*w)*t)
                term1=term1*cks[i]/(vks[i]-1j*w)**2
                result.append(term1)
            return np.imag(sum(result))/2
    def LS(self, combinations, bath, t):
        rates = {}
        done = []
        for i in combinations:
            done.append(i)
            j = (i[1], i[0])
            if (j in done) & (i != j):
                rates[i] = np.conjugate(rates[j])
            else:
                rates[i] = self._LS(bath, i[0], i[1], t)
        return rates

bose(w, bath)

It computes the Bose-Einstein distribution

\[ n(\omega)=\frac{1}{e^{\beta \omega}-1} \]
Parameters:

nu: float The mode at which to compute the thermal population

Returns:

float The thermal population of mode nu

Source code in nmm/cumulant/cumulant.py
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
def bose(self,w,bath):
    r"""
    It computes the Bose-Einstein distribution

    $$ n(\omega)=\frac{1}{e^{\beta \omega}-1} $$

    Parameters:
    ----------
    nu: float
        The mode at which to compute the thermal population

    Returns:
    -------
    float
        The thermal population of mode nu
    """
    if bath.T == 0:
        return 0
    if np.isclose(w, 0).all():
        return 0
    return np.exp(-w / bath.T) / (1-np.exp(-w / bath.T))

evolution(rho0, approximated=False)

This function computes the evolution of the state \(\rho(0)\)

Parameters:

Name Type Description Default
rho0 ndarray or Qobj

The initial state of the quantum system under consideration.

required
approximated bool

When False the full cumulant equation/refined weak coupling is computed, when True the Filtered Approximation (FA is computed), this greatly reduces computational time, at the expense of diminishing accuracy particularly for the populations of the system at early times.

False

Returns:

Type Description
list

a list containing all of the density matrices, at all timesteps of the evolution

Source code in nmm/cumulant/cumulant.py
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
def evolution(self, rho0, approximated=False):
    r"""
    This function computes the evolution of the state $\rho(0)$

    Parameters
    ----------

    rho0 : numpy.ndarray or qutip.Qobj
        The initial state of the quantum system under consideration.

    approximated : bool
        When False the full cumulant equation/refined weak coupling is
        computed, when True the Filtered Approximation (FA is computed),
        this greatly reduces computational time, at the expense of
        diminishing accuracy particularly for the populations of the system
        at early times.

    Returns
    -------
    list
        a list containing all of the density matrices, at all timesteps of
        the evolution
    """
    self.generator(approximated)
    states = [
        (i).expm()(rho0)
        for k,i in tqdm(
            enumerate(self.generators),
            desc='Computing Exponential of Generators . . . .')]  # this counts time incorrectly
    return states

gamma_fa(bath, w, w1, t)

It describes the decay rates for the Filtered Approximation of the cumulant equation

\[\gamma(\omega,\omega^\prime,t)= 2\pi t e^{i \frac{\omega^\prime -\omega}{2}t}\mathrm{sinc} \left(\frac{\omega^\prime-\omega}{2}t\right) \left(J(\omega^\prime) (n(\omega^\prime)+1)J(\omega) (n(\omega)+1) \right)^{\frac{1}{2}}\]

Parameters:

Name Type Description Default
w float or ndarray
required
w1 float or ndarray
required
t float or ndarray
required

Returns:

Type Description
float or ndarray

It returns a value or array describing the decay between the levels with energies w and w1 at time t

Source code in nmm/cumulant/cumulant.py
 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
def gamma_fa(self, bath, w, w1, t):
    r"""
    It describes the decay rates for the Filtered Approximation of the
    cumulant equation

    $$\gamma(\omega,\omega^\prime,t)= 2\pi t e^{i \frac{\omega^\prime
    -\omega}{2}t}\mathrm{sinc} \left(\frac{\omega^\prime-\omega}{2}t\right)
     \left(J(\omega^\prime) (n(\omega^\prime)+1)J(\omega) (n(\omega)+1)
     \right)^{\frac{1}{2}}$$

    Parameters
    ----------

    w : float or numpy.ndarray

    w1 : float or numpy.ndarray

    t : float or numpy.ndarray

    Returns
    -------
    float or numpy.ndarray
        It returns a value or array describing the decay between the levels
        with energies w and w1 at time t

    """
    var = (2 * t * np.exp(1j * (w1 - w) * t / 2)
           * np.sinc((w1 - w) * t / (2 * np.pi))
           * np.sqrt(bath.spectral_density(w1) * (self.bose(w1,bath) + 1))
           * np.sqrt(bath.spectral_density(w) * (self.bose(w,bath) + 1)))
    return var

gamma_gen(bath, w, w1, t, approximated=False)

It describes the the decay rates of the cumulant equation for bosonic baths

\[\Gamma(\omega,\omega',t) = t^{2}\int_{0}^{\infty} d\omega e^{i\frac{\omega-\omega'}{2} t} J(\omega) \left[ (n(\omega)+1) sinc\left(\frac{(\omega-\omega)t}{2}\right) sinc\left(\frac{(\omega'-\omega)t}{2}\right)+ n(\omega) sinc\left(\frac{(\omega+\omega)t}{2}\right) sinc\left(\frac{(\omega'+\omega)t}{2}\right) \right]\]

Parameters:

Name Type Description Default
w float or ndarray
required
w1 float or ndarray
required
t float or ndarray
required

Returns:

Type Description
float or ndarray

It returns a value or array describing the decay between the levels with energies w and w1 at time t

Source code in nmm/cumulant/cumulant.py
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
def gamma_gen(self, bath, w, w1, t, approximated=False):
    r"""
    It describes the the decay rates of the cumulant equation
    for bosonic baths

    $$\Gamma(\omega,\omega',t) = t^{2}\int_{0}^{\infty} d\omega 
    e^{i\frac{\omega-\omega'}{2} t} J(\omega) \left[ (n(\omega)+1) 
    sinc\left(\frac{(\omega-\omega)t}{2}\right)
    sinc\left(\frac{(\omega'-\omega)t}{2}\right)+ n(\omega) 
    sinc\left(\frac{(\omega+\omega)t}{2}\right) 
    sinc\left(\frac{(\omega'+\omega)t}{2}\right)   \right]$$

    Parameters
    ----------

    w : float or numpy.ndarray
    w1 : float or numpy.ndarray
    t : float or numpy.ndarray

    Returns
    -------
    float or numpy.ndarray
        It returns a value or array describing the decay between the levels
        with energies w and w1 at time t

    """
    if isinstance(t, type(jnp.array([2]))):
        t = np.array(t.tolist())
    if isinstance(t, list):
        t = np.array(t)
    if approximated:
        return self.gamma_fa(bath, w, w1, t)
    if self.matsubara:
        if w == w1:
            return self.decayww(bath, w, t)
        else:
            return self.decayww2(bath, w, w1, t)
    if self.cython:
        return bath.gamma(np.real(w), np.real(w1), t, limit=self.limit)

    else:
        integrals = quad_vec(
            self._gamma_,
            0,
            np.inf,
            args=(bath, w, w1, t),
            epsabs=self.eps,
            epsrel=self.eps,
            quadrature="gk21"
        )[0]
        return t*t*integrals