显示伊辛格子规范模型链接上的自旋

问题描述 投票:0回答:1

我试图在“伊辛晶格规范理论”的位置上显示自旋,该理论将自旋放置在键上,而不是二维的通常位置(在伊辛理论的情况下)。基本上,这个想法是,旋转驻留在两个站点之间的链接上,而不是像“伊辛模型”那样位于站点上。 在 Python 中使用 PIL,通过将自旋视为 N x N 矩阵,可以轻松显示 2D Ising 模型的这些位点。这是 100 x 100 网格的示例。但我不确定在晶格规范理论的情况下如何做到这一点,其中自旋实际上在键上。有人能帮我吗?谢谢这是我第一次在这里发帖。

编辑:没有意识到 LaTex 不是这里的东西。

假设只有最近邻键(我不确定这是否准确),所有水平键都有一个 N x (N-1) 矩阵,垂直键有一个 (N - 1) x N 矩阵。

python jupyter simulation physics
1个回答
0
投票

要可视化此结构(使用 PIL),您可以使用以下脚本:

array = np.zeros((2 * N - 1, 2 * N - 1)) for i in range(N): for j in range(N): if j < (N - 1): array[2 * i, 2 * j + 1] = vert_bonds[i, j] if i < (N - 1): array[2 * i + 1, 2 * j] = hori_bonds[i, j]

然后我们可以使用 PIL 绘制

array
,但我实际上建议使用 
matplotlib

,因为它更适合处理此类数据。通过最小的修改,我们可以获得以下图像:

或者使用更大的系统:small ising lattice gauge model plot

这些数字的完整代码是:large ising lattice gauge model plot import numpy as np import matplotlib.pyplot as plt N = 10 if __name__ == "__main__": # Your input data vert_bonds = np.random.randint(2, size=(N, N - 1)) hori_bonds = np.random.randint(2, size=(N - 1, N)) # Make sure we differentiate spin-down from nodes vert_bonds[vert_bonds == 0] = -1 hori_bonds[hori_bonds == 0] = -1 array = np.zeros((2 * N - 1, 2 * N - 1)) for i in range(N): for j in range(N): if j < (N - 1): array[2 * i, 2 * j + 1] = vert_bonds[i, j] if i < (N - 1): array[2 * i + 1, 2 * j] = hori_bonds[i, j] # more customiyable plotting tool plt.imshow(array, cmap="seismic") plt.savefig("ising-lattice-gauge-small.png") plt.show()

请告诉我这是否回答了您的问题,或者您是否还有其他疑问!

编辑:更改大图的替代文本

© www.soinside.com 2019 - 2024. All rights reserved.