Demo entry 6347862
Submitted by anonymous
on Feb 17, 2017 at 16:44
Language: Python. Code size: 473 Bytes.
# di1 and di2, indices of spin to be manipulated # L: The size of square lattice edge, spin: A 2D numpy array if i == 0: di1 = L - 1 di2 = 1 elif i == L - 1: di1 = L - 2 di2 = 0 else: di1 = i - 1 di2 = i + 1 # spin[di1, j] will be the previous neighbor of spin[i, j] # spin[di2, j] will be the next neighbor of spin[i, j]
This snippet took 0.00 seconds to highlight.