コード例 #1
0
import numpy as np
import matplotlib.pyplot as plt
import ising

temps = np.arange(0.1, 5, 0.1)
itr = 10
relax = 50

solve = ising.IsingSolver(1, grid_type='square', dim=200, initial_state='hot')
solve.run(num_itr=itr, T=1)
plt.figure(1)
solve.print_system(solve.moments)
コード例 #2
0
import numpy as np
import matplotlib.pyplot as plt
import ising

temps = np.arange(0.1, 5, 0.1)
itr = 50
relax = 50
plot_elements = 4

a = []
for i in range(plot_elements):
    solve = ising.IsingSolver(1,
                              grid_type='hexagon',
                              dim=20,
                              initial_state='cold')

    ene_list = np.zeros(len(temps))
    #heat_cap = np.zeros(len(temps))
    i = 0
    for t in temps:
        solve.avenglist = []
        solve.run(num_itr=itr + relax, T=t)

        ene_list[i] = np.mean(solve.avenglist[relax:])
        #heat_cap[i] = (1/t**2)*np.var(solve.avenglist[relax:])
        i += 1
    a.append(ene_list)

    plt.plot(temps, ene_list, alpha=0.3)

f = np.mean(a, axis=0)
コード例 #3
0
#    solve = ising.IsingSolver(1, grid_type='line', dim=10, initial_state='hot', J=[10])
#    solve.run(num_itr = itr, T=1)
#    a.append(solve.maglist)
#    plt.plot(x, solve.maglist)

#f = np.mean(a, axis=0)
#g = np.std(a, axis=0)
#plt.plot(x, f, color='k', label='Average Magnetisation (%d runs), $T=1$' % plot_elements)
#plt.fill_between(x, f+g,f-g,  color='grey', alpha=0.4)

#plt.title("Steps to Reach Equilibrium for 20x20 lattice")
#plt.xlabel("Number of Iterations")
#plt.ylabel("Average Magnetisation (Per Spin)")
#plt.legend()

solve = ising.IsingSolver(1, grid_type='line', dim=20, initial_state='cold', J=[1])

mag_list = np.zeros(len(temps))
mag_sus = np.zeros(len(temps))
i = 0

for t in temps:
    solve.maglist = []
    solve.run(num_itr = itr+relax, T=t)
    
    mag_list[i] = np.mean(np.abs(solve.maglist[relax:]))
    mag_sus[i] = (1/t)*np.var(np.abs(solve.maglist[relax:]))
    i += 1

plt.plot(temps, mag_list)
#plt.plot(temps, mag_sus)
コード例 #4
0
#    plt.plot(x, np.abs(solve.maglist), alpha=0.2)

#f = np.mean(a, axis=0)
#g = np.std(a, axis=0)
#plt.plot(x, f, color='k', label='Average Magnetisation (%d runs), $T=1$' % plot_elements)
#plt.fill_between(x, f+g,f-g,  color='grey', alpha=0.4)

#plt.title("Steps to Reach Equilibrium for 20x20 lattice")
#plt.xlabel("Number of Iterations")
#plt.ylabel("Average Magnetisation (Per Spin)")
#plt.legend()

solve = ising.IsingSolver(1,
                          grid_type='square',
                          intr='nextnn',
                          dim=20,
                          initial_state='cold',
                          H=0,
                          J=[1, 70])
a = []
for i in range(plot_elements):
    mag_list = np.zeros(len(temps))
    #mag_sus = np.zeros(len(temps))
    i = 0

    for t in temps:
        solve.maglist = []
        solve.run(num_itr=itr + relax, T=t)

        mag_list[i] = np.mean(np.abs(solve.maglist[relax:]))
        #mag_sus[i] = (1/t)*np.var(np.abs(solve.maglist[relax:]))
コード例 #5
0
import numpy as np
import matplotlib.pyplot as plt
import ising

temps = np.arange(0.1, 5, 0.1)
itr = 100
relax = 50
plot_elements = 4

solve = ising.IsingSolver(1,
                          grid_type='line',
                          dim=30,
                          initial_state='cold',
                          intr='decay',
                          a=10)

a = []
for i in range(plot_elements):
    mag_list = np.zeros(len(temps))
    mag_sus = np.zeros(len(temps))
    i = 0

    for t in temps:
        solve.maglist = []
        solve.run(num_itr=itr + relax, T=t)

        mag_list[i] = np.mean(np.abs(solve.maglist[relax:]))
        #mag_sus[i] = (1/t)*np.var(np.abs(solve.maglist[relax:]))

        i += 1