我在 anaconda 下使用qutip包。我只是mcsolve
在我的脚本中调用该函数。现在,当在Jupyter
笔记本下运行时,脚本在几秒钟内就可以正常运行并产生结果。但是当在 内运行时Spyder
,它会卡住并且永远不会完成。我在qutip中的其他功能从未遇到过这个问题。
在 Spyder 中运行它会打印 'aa' 然后是 'bb' 但永远不会到达 'cc' 行:
import qutip as qt
import numpy as np
import matplotlib.pyplot as plt
# Some constants
g = 100
delta = 10
Ka = g/2.5
Gamma = g/200
Gammap = g/50
Nu = 2*g
Delta_a = -4.12*g
Delta_c = Delta_a +delta*g
N = 4
sm = qt.tensor(qt.qeye(N),qt.sigmam())
sp = sm.dag()
a = qt.tensor(qt.destroy(N),qt.qeye(2))
adag = a.dag()
H = Delta_aspsm + Delta_cadaga + g*(adagsm+spa)+Nu*(sp+sm)
sz = qt.tensor(qt.qeye(N),qt.sigmaz())
C1 = np.sqrt(2*Ka)*a C2 = np.sqrt(Gamma)*sm
C3 = np.sqrt(Gammap/4.0)*(spsm-smsp)
rhoss = qt.steadystate(H,[C1,C2,C3])
print('aa')
times = np.linspace(0,10,1000)
IC = qt.tensor(qt.basis(N,0),qt.basis(2,1))
print('bb')
data = qt.mcsolve(H,IC,times,[C1,C2,C3],[adaga,spsm],ntraj = 1)
print('cc')