//////////////////////////////////////////////////////////////////////////////// // // // Path-Integral Quantum Monte Carlo Simulations of Cold Atoms // // // // Tao Pang // // // // Last modified December 16, 2016 // // // // This program is for carrying out path-integral quantum Monte Carlo // // simulation of cold atoms modeled as hard-sphere bosons trapped in a // // three-dimensional harmonic potential well. // // // //////////////////////////////////////////////////////////////////////////////// import java.lang.*; import java.io.*; import java.util.*; public class Atoms { final static int N = 200, M = 100, K = 100; static int seed, iq, ic, step, l, n, m, lm, np, ng, nf, ns, nr; static double dx0, dy0, dz0, d, dd, r, t, tn, b, bh; static double u1, u2, usum, c1, ac1, ac2, rj1, rj2; static int ip[] = new int[N]; static double x[][] = new double[N][M]; static double y[][] = new double[N][M]; static double z[][] = new double[N][M]; static double ec[] = new double[K]; ////////////////////////////////////////////////////////////////////////// // Main method to create object of the simulation public static void main(String argv[]) throws IOException { // Initialize the simulation initiate(); // Perform the simulation simulate(); // Save the data for a continuation run if desired if (iq != 0) save(); } ////////////////////////////////////////////////////////////////////////// // Method to initialize the simulation public static void initiate() throws IOException { int ir[] = new int[N]; double x0[][] = new double[N][M]; double y0[][] = new double[N][M]; double z0[][] = new double[N][M]; // Initialize the random-number seed from the current time GregorianCalendar time = new GregorianCalendar(); int t1 = time.get(Calendar.SECOND); int t2 = time.get(Calendar.MINUTE); int t3 = time.get(Calendar.HOUR_OF_DAY); int t4 = time.get(Calendar.DAY_OF_MONTH); int t5 = time.get(Calendar.MONTH)+1; int t6 = time.get(Calendar.YEAR); seed = t6+70*(t5+12*(t4+31*(t3+23*(t2+59*t1)))); if ((seed%2) == 0) --seed; // Read in control and system parameters try { BufferedReader rx = new BufferedReader (new InputStreamReader(new FileInputStream("fort.15"))); StringTokenizer sx = new StringTokenizer(rx.readLine()); iq = Integer.parseInt(sx.nextToken()); ic = Integer.parseInt(sx.nextToken()); sx = new StringTokenizer(rx.readLine()); n = Integer.parseInt(sx.nextToken()); m = Integer.parseInt(sx.nextToken()); np = Integer.parseInt(sx.nextToken()); lm = Integer.parseInt(sx.nextToken()); sx = new StringTokenizer(rx.readLine()); ng = Integer.parseInt(sx.nextToken()); ns = Integer.parseInt(sx.nextToken()); nf = Integer.parseInt(sx.nextToken()); nr = Integer.parseInt(sx.nextToken()); sx = new StringTokenizer(rx.readLine()); d = Double.parseDouble(sx.nextToken()); r = Double.parseDouble(sx.nextToken()); dx0 = Double.parseDouble(sx.nextToken()); dy0 = Double.parseDouble(sx.nextToken()); dz0 = Double.parseDouble(sx.nextToken()); tn = Double.parseDouble(sx.nextToken()); } catch (Exception ex) { System.out.println("Exception error: " + ex.toString()); } // Set up constants and some of their combinations double tpm = 2*Math.PI/m; dd = d*d; double an3 = Math.pow(n,1.0/3); t = tn*0.9405*(an3-0.7275); b = 1.0/(m*t); bh = 1.0/(2*b); double an3h = an3/2; int ns1 = 1+(int)an3; int ns2 = ns1*ns1; // Print out control and system parameters System.out.println("Path-Integral Quantum Monte Carlo Simulation"); System.out.println("of Hard-Sphere Bosons in a Harmonic Trap"); System.out.println(""); System.out.println("Control and System Parameters:"); System.out.println("Temperature of the system: " + t); System.out.println("Random number initial seed: " + seed); System.out.println("I_Q = " + iq); System.out.println("I_C = " + ic); System.out.println("N = " + n); System.out.println("M = " + m); System.out.println("N_P = " + np); System.out.println("L_M = " + lm); System.out.println("N_G = " + ng); System.out.println("N_S = " + ns); System.out.println("N_F = " + nf); System.out.println("N_R = " + nr); System.out.println("D = " + d); System.out.println("R = " + r); System.out.println("DX0 = " + dx0); System.out.println("DY0 = " + dy0); System.out.println("DZ0 = " + dz0); System.out.println("TN = " + tn); // Create an initial configuration int counter = 0; double rr = 0; int ncmx = 5; double tiny = 1.0e-6; while ((rr