/*********************************************************/ /* One-dimensional time dependent Schoedinger Equation. */ /* The scattering of a wavepack on a square barrier. */ /* Use Crank-Nicholson/Caylay algorithm... */ /* Stable, Norm Conserving. Li Ju. March.28,1995 */ /*********************************************************/ #include #include #define MESH 1000 /* # of points from 0-1 */ #define TSTEP 2E-6 /* Time inteval */ float buffer[6*MESH]; float *a2,*b2,*a1,*b1,*a0,*b0; /* buffer is where wavefunctions are kept */ /* (a0,b0)/(a1,b1) are the real and imaginery */ /* part of wave function */ /* ** Potential function */ float V(int i) { if (abs(i-500)<32) return (100); else return(0); } /* ** Initialize the wave pack. */ void InitWave() { int i; float module; for (i=1;i=0;i--) { } return(); } int main() { long Steps; float Width,Height; /* Total time step,Barrier width,height */ scanf ("%ld %f %f",&Steps,&Width,&Height); a0 = buffer; b0 = a0+MESH; a1 = b0+MESH; b1 = a1+MESH; a2 = b1+MESH; b2 = a2+MESH; InitWave();