strings
strings

Reputation: 1

Plotting Eigen-energies using QuTip

I am trying to plot the eigen-energies of the following Hamiltonian

$$ H = 2\tau \cos(\frac{eA}{hc} \sin(\omega t) + k) $$

Here \tau value is set to 1. A is the amplitude. e,h,c are electron charge, Planck's constant and speed of light respectively. k varies from -\pi to +\pi.

It is showing the error : return arrays must be of ArrayType .

The error is in the H term.

What does it mean?

Here is the code which I used to plot the eigen-energies but it showing error in the Hamiltonian (P.S: I am new here so please excuse any error in asking the question. I will improve it eventually)

import matplotlib.pyplot as plt
import numpy as np
from qutip import (about, expect, FloquetBasis,
                   num, plot_wigner, ket, sesolve, sigmax, sigmaz)

th=1
e=1.602*10**(-19)
A=2.5 * 2 * np.pi
h=6.626*10**(-34)
c=3*10**8
omega = 1.0 * 2 * np.pi
T = 2 * np.pi / omega
k=np.linspace(-np.pi,np.pi)

H= [
    2*th*np.cos(k,[e*A/h*c, "sin({w}*t)".format(w=omega)],)
   ]

A_list = np.linspace(1.0 * omega, 4.5 * omega, 20)
quasienergies1, quasienergies2 = [], []
for A_temp in A_list:
# temporary Hamiltonian
    H_temp= [
        2*th*np.cos(k,[e*A_temp/h*c, "sin({w}*t)".format(w=omega)],)
        ]
# floquet modes and quasienergies
    e1, e2 = FloquetBasis(H_temp, T, sort=True).e_quasi
    quasienergies1.append(e1), quasienergies2.append(e2)

plt.scatter(A_list / omega, quasienergies1, label="e1")
plt.scatter(A_list / omega, quasienergies2, label="e2")
plt.xlabel("A / w"), plt.ylabel("Quasienergies")
plt.legend();

Upvotes: 0

Views: 80

Answers (1)

Artem Frenk
Artem Frenk

Reputation: 1

QuTip wants Hamiltonians to be matrices or time-dependent functions. The way you're adding the trig terms and k which is a np.linspace lead to issues. Please check here and here for more details on implementation.

Upvotes: 0

Related Questions