Ising dual 4x4.py

From Werner KRAUTH

(Difference between revisions)
Jump to: navigation, search

Revision as of 21:28, 19 October 2015

This page presents the program Ising_dual_4x4.py, that checks the Kramers-Wannier duality for a finite 4x4 Ising model with periodic boundary conditions.


Contents

Reference

This program is discussed in Lecture 4 of my ICFP course 2015 on Statistical physics. The Lectures is called "Exact computations in the two-dimensional Ising model (Kac-Ward)".

Description

The program inputs the density of states of the 4x4 lattice with periodic boundary conditions (that can be computed by the enumerate-Ising program. For any beta it computes a beta_tilde, and then compares Z and Z_tilde. At low temperature, where only short loops come up, everything is OK, but at higher temperature, the winding paths create a problem. This is discussed in the lecture notes.

Program

import math

N = 16
dos = { -32: 2, -24: 32, -20: 64, -16: 424, -12: 1728, -8: 6688,
-4: 13568, 0: 20524, 4: 13568, 8: 6688, 12: 1728, 16: 424, 20: 64, 24: 32, 32: 2}
list_T = [0.1 + 0.1 * i for i in range(80)]
for T in list_T:
    beta = 1.0 / T
    beta_tilde = math.atanh(math.exp(-2 * beta))
    Z = 0.0
    Z_tilde = 0.0
    factor = 2 ** (N - 1) * (math.cosh(beta_tilde)) ** (2 * N) * \
            (math.tanh(beta_tilde)) ** N
    for E in dos.keys():
        weight = math.exp(- beta * E) * dos[E]
        weight_tilde = math.exp(- beta_tilde * E) * dos[E]
        Z += weight
        Z_tilde += weight_tilde
    print T, (Z * factor) / Z_tilde, ' Temperature, Z * factor / Z_tilde'


Version

See history for version information.

Personal tools