public void run() { L1 = (int) params.fget("L1"); L2 = (int) params.fget("L2"); M = L1 * L2; R = (int) params.fget("R"); NJ = params.fget("NJ"); percent = params.fget("percent"); biaspercent = params.fget("biaspercent"); Dseed = 1; // (int)params.fget("Dseed"); Bseed = 1; // (int)params.fget("Bseed"); Sseed = 1; // (int)params.fget("Sseed"); ISaf = new IsingStructure(L1, L2, R, NJ, percent, biaspercent, "square"); ISaf.Dinitialization(Dseed, Bseed, 10, 10); params.set("deadsites", ISaf.deadsites); ISaf.Sinitialization(0, Sseed); T = params.fget("Ti"); H = params.fget("Hi"); IBaf = new IsingBasic(ISaf, T, H, 1); IBaf.QuenchT = params.fget("Tf"); IBaf.QuenchH = params.fget("Hf"); Job.animate(); params.set("T", IBaf.InitialT); params.set("H", IBaf.InitialH); for (int prestep = 0; prestep < 50000; prestep++) { IBaf.T = params.fget("T"); IBaf.H = params.fget("H"); IBaf.IS.MCS(IBaf.T, IBaf.H, IBaf.flip, 1); Job.animate(); params.set("MCS", 50 - prestep); params.set("magnetization", IBaf.IS.totalspin / IBaf.IS.M); } params.set("T", IBaf.QuenchT); params.set("H", IBaf.QuenchH); for (int step = 0; step < 1000000; step++) { IBaf.T = params.fget("T"); IBaf.H = params.fget("H"); IBaf.IS.MCS(IBaf.T, IBaf.H, IBaf.flip, 1); Job.animate(); params.set("MCS", step); params.set("magnetization", IBaf.IS.totalspin / IBaf.IS.M); if (step / 10 == 0) movie(grid1, step, 0); } }
public void Singlerun(IsingStructure Ising, int R, int L, double Tq, int steplimit, double q) { int run = 0; double dilution = Ising.percent; String path = "/Users/liukang2002507/Desktop/simulation/LRDIP/singlerun-R=" + fmt.format(R) + "-L=" + fmt.format(L) + "-q=0." + qmt.format(dilution * 1000000) + ".txt"; String overall = "/Users/liukang2002507/Desktop/simulation/LRDIP/L=" + fmt.format(L) + ".txt"; for (run = 1; run <= 1; run++) { Ising.Dinitialization(run, run, R, R); params.set("copies", run); params.set("deadsites", Ising.deadsites); Ising.Sinitialization(0, run); Istemp = Ising.clone(); double mag = 0; int positive = 0; int negative = 0; Job.animate(); int presteplimit = 50; params.set("T", 99); Random heat = new Random(run); Random flip = new Random(run); for (int prestep = 0; prestep < presteplimit; prestep++) { T = params.fget("T"); H = params.fget("H"); Istemp.MCS(T, H, heat, 1); params.set("MCS", prestep - presteplimit); Job.animate(); mag = Istemp.Magnetization(); reducedM = mag / (1 - Istemp.percent); PrintUtil.printlnToFile(path, prestep - presteplimit, mag, reducedM); params.set("magnetization", mag); params.set("reduced M", reducedM); } params.set("T", Tq); for (int step = 0; step < steplimit; step++) { T = params.fget("T"); H = params.fget("H"); Istemp.MCS(T, H, flip, 1); params.set("MCS", step); mag = Istemp.Magnetization(); reducedM = mag / (1 - Istemp.percent); params.set("magnetization", mag); params.set("reduced M", reducedM); Job.animate(); PrintUtil.printlnToFile(path, step, mag, reducedM); if (steplimit - step <= (steplimit / 2)) { if (reducedM < 0) negative++; if (reducedM > 0) positive++; } } PrintUtil.printlnToFile(overall, q, mag, Math.abs(reducedM), positive, negative); } }