/* ************************************************************************ * Slit.java: Solves the time-dependent Schroedinger equation for a * * two-dimensional Gaussian wavepacket entering a slit * * * * From: "A SURVEY OF COMPUTATIONAL PHYSICS" by RH Landau, MJ Paez, and CC Bordeianu Copyright Princeton University Press, Princeton, 2007. Electronic Materials copyright: R Landau, Oregon State Univ, 2007; MJ Paez, Univ Antioquia, 2007; & CC Bordeianu, Univ Bucharest, 2007 Support by National Science Foundation * * * comment: Output data is saved in 3D grid format used by gnuplot. * * * ************************************************************************ */ import java.io.*; public class Slit{ public static void main(String[] argv) throws IOException, FileNotFoundException { PrintWriter w = new PrintWriter(new FileOutputStream("slit.dat"), true); double psr[][][]=new double[91][91][2]; double psi[][][]=new double[91][91][2]; double v[][]=new double[91][91]; double p2[][]=new double[91][91]; double a1,a2,dt,dx,k0x,k0y,x0,y0,x,y; int i,j,max,n,time; // Enter a positive integer from 1(initial time) //to 800 to get wave packet position at that time time=800; //initializes the constant values and the wave packet dx = 0.2; dt = 0.0025/(dx*dx); //initial momentum, position k0x = 0.0; k0y = 2.5; x0 = 0.0; y0 = -7.0; max = 90; //initial wave function y = -9.0; for( j=0;j=50))) v[i][j] = 0.5; else v[i][j] = 0.0; } } //propagate solution through time for(n=0;n