from scipy.ndimage import convolve import matplotlib.pylab as plt from tqdm import tqdm from saveobject import save_obj plt.rc('text', usetex=True) plt.rc('font', family='serif') dT = 0.05 T = np.arange(dT, 6, dT) betas = 1 / T mus = np.logspace(-4.0, 0, num=10) size = 4**4 samples = 1024 fig, axs = plt.subplots(3, 2, figsize=(6.3, 4.2)) values = {} values["betas"] = betas values["mu"] = mus for beta in tqdm(betas): for mu in mus: dist = IsingDist(size, beta, mu) dist.sample(samples) dist.calcEV() values[(beta, mu)] = [dist.energy, dist.magnet] del dist save_obj(values, "values")
B = np.arange(b1, b2, res) B = B[B != 0] B = 1 / B M = np.array([0]) ensemble = Ensemble(N, B, M, steps, repeat, False) ensemble.getStats() beta = ensemble.beta mu = ensemble.mu stats = ensemble.stats save_obj(stats, "stats8") # keys = ["energy","magnetization","population","entropy"] # def calcStats(size,beta,mu,steps,times): # global keys # stats = {} # arr = {} # for key in keys: # arr[key]=[] # for i in range(times): # model = ising(size,beta,mu) # model.evolve(steps) # for key in keys: # prop=model.thermofuncs(key) # arr[key].append(prop) # del model
def pickle(self): save_obj(self, self.name)