| 查看: 680 | 回复: 3 | ||
[求助]
python写的一个绝对对角化的一个程序跑出来能量是复数已有1人参与
|
用python写了一个一维相互作用0 disorder的自旋为1/2的费米子系统,basis用Fock空间来表示,可是算出来的能量总是为复数,而且,博后要我画transition energy和相互作用U的曲线,在L个晶格,总数为L个电子的时候,不同晶格数的曲线是相互交叉的,不管怎么样我都得不到这样的答案,这个问题已经困扰我一个月了。大神们能不能帮我看一下![]() ![]() ![]() ![]() ![]() ![]() |
» 猜你喜欢
真诚求助:手里的省社科项目结项要求主持人一篇中文核心,有什么渠道能发核心吗
已经有8人回复
寻求一种能扛住强氧化性腐蚀性的容器密封件
已经有5人回复
论文投稿,期刊推荐
已经有6人回复
请问哪里可以有青B申请的本子可以借鉴一下。
已经有4人回复
孩子确诊有中度注意力缺陷
已经有14人回复
请问下大家为什么这个铃木偶联几乎不反应呢
已经有5人回复
请问有评职称,把科研教学业绩算分排序的高校吗
已经有5人回复
2025冷门绝学什么时候出结果
已经有3人回复
天津工业大学郑柳春团队欢迎化学化工、高分子化学或有机合成方向的博士生和硕士生加入
已经有4人回复
康复大学泰山学者周祺惠团队招收博士研究生
已经有6人回复

2楼2015-03-17 00:21:45
|
def dim(L, Np, Nd): # number of basis states,Np denotes the number of spin up fermions and # Nd denote the spin-down fermions return ((math.factorial(L) * math.factorial(L)) / (math.factorial(Nd) * math.factorial(Np) * math.factorial(L - Np) * math.factorial(L - Nd))) def dim_compact(L, N): return (math.factorial(L)) / (math.factorial(N) * math.factorial(L - N)) def matglue(a, b): r = [] for i in a: for j in b: r.append(concatenate([i, j])) u = np.matrix(r) return u def NinL(L, N): # Ns=dim(L,N) Ns = dim_compact(L, N) # array that stores all basis states in terms of lattice occupation # numbers (list of occupation number states): nl = zeros((Ns, L), int) # first basis state with all particles ordered to the left: for l in range(N): nl[0, l] = 1 for a in range(Ns-1): if nl[a, L-1] != 1: for j in reversed(range(L-1)): if nl[a, j] == 1 and nl[a, j + 1] == 0: for i in range(j): nl[a + 1, i] = nl[a, i] nl[a+1, j] = 0 nl[a+1, j+1] = 1 break else: for j in reversed(range(L-1)): if nl[a, j] == 1 and nl[a, j+1] == 0: for i in range(j): nl[a+1, i] = nl[a, i] nl[a+1, j] = 0 nl[a+1, j+1] = 1 c = 0 for i in range(j+2, L): c += nl[a, i] for i in range(j+2, j+2+c): nl[a+1, i] = 1 break return nl def basis(L, Nd, Np): Mp = NinL(L, Np) Md = NinL(L, Nd) nl = matglue(Mp, Md) return nl # single-particle Hamiltonian definition: def H1(V, b, phi, j): return V * cos(2 * pi * b * j + phi) # doublon number of a configuration comprised of spinless-half fermions def doub(nl,L): conf = 0 nl = nl.tolist()[0] # check wether a site is occupied by a doublon for i in range(L): if nl == 1 and nl[i+L] == 1: conf += 1 return conf # adding hopping element in the Hamiltonian def new_hopmat(L, Nd, Np): nl = basis(L, Nd, Np) Ns = dim(L, Np, Nd) H = zeros((Ns, Ns)) L2 = 2 * L #N = 0 lookup = {} for a1 in range(Ns): m = nl[a1] l = m.tolist()[0] #print l k = ''.join(str(i) for i in l) lookup.setdefault(k, a1) #print lookup for a1 in range(Ns): for i in range(L2 - 1): if nl[a1, i] != nl[a1, i + 1]: tmp = [] + nl[a1].tolist()[0] tmp = 1 - nl[a1, i] tmp[i + 1] = 1 - nl[a1, i + 1] k = ''.join(str(j) for j in tmp) if lookup.has_key(k): a2 = lookup[k] if nl[a1, i] == 1: H[a1, a2] += -1. else: H[a1,a2] += 1. #N += -1. #print N #H[a2, a1] += -1. return H, Ns, nl # many-body Hamiltonian definition: def Hmany(L, Nd, Np, V, b, phi, U): #H, Ns, nl = Hopmat(L, Nd, Np) H, Ns, nl = new_hopmat(L, Nd, Np) for a in range(Ns): H[a, a] += U * doub(nl[a],L) #print(H[a,a], a) # sum over all particle and spin of single particle potential #for j in range(2 * L): #H[a, a] += H1(V, b, phi, j) * nl[a, j] return H |

3楼2015-03-17 03:26:48
4楼2015-03-17 17:02:53














回复此楼