Schroedinger Equation and InterCall
- To: mathgroup at yoda.physics.unc.edu
- Subject: Schroedinger Equation and InterCall
- From: TDR at vaxc.cc.monash.edu.au
- Date: 26 Feb 1993 15:49:52 +1100
Dear Mathgroup, >Date: 20 Feb 1993 21:45:04 -0600 >From: gmk at pegasos.ccsr.uiuc.edu (Gottfried Mayer-Kress) >Subject: MathLink and Integration of Schroedinger Equation > >We want to use mathlink to integrate the one-dimensional >time-dependent Schroedinger equation with arbitrary potential. >We think about using the numerical recipe algorithm (pg 851 of the >most recent edition). Has anybody implemented that or can recommend >some other package? I've dusted off one of my old Crank-Nicholson solvers (written in fortran) and adjusted it so that it can solve Schroedinger-type equations of the form: I*D[psi,t] == -D[psi,{x,2}] + V[x,t]*psi where psi[x,t], a<x<b, t>0 is the complex wave-function, and the equation is solved subject to some initial condition: psi[x,0]==psi0[x] for a<x<b, and some linear time-dependent boundary conditions, ie. a0[t]*psi[a,t]+a1[t]*psi'[a,t] == ac[t], b0[t]*psi[b,t]+b1[t]*psi'[b,t] == bc[t]. By importing the fortran subroutine (named SCHROED) into Mathematica using InterCall I was able to do a few experiments involving shooting a wave-packet at a potential barrier, and watching an animation of the packet being mostly reflected but also partially tunnelling through the wall. I could supply the potential function V[x,t] (required by the fortran SCHROED routine) by writing it as a Mathematica function which gave me a lot of flexibility. Typically V=Function[{x,t}, If[x<4 || x>6,0,40]] for a potential wall, but I could set it to any Mathematica expression. Also the initial condition for a wave-packet was computed in Mathematica too. The fortran subroutine SCHROED just advanced the solution an amount dt of time per call, and so I simply called the routine inside a Mathematica loop and did a ListPlot of the evolution. I used 400 points to represent the solution, and the rendering of each plot was the slow part. Calling SCHROED from within Mathematica using InterCall was very fast. If anyone is interested in the details, I'll put a Notebook at MathSource about how easy it was to do using the InterCall package. Terry. ################################################################### Dr Terry Robb Email: tdr at vaxc.cc.monash.edu.au Department of Mathematics Phone: +61 (3) 565-5666 Monash University Fax : +61 (3) 565-4403 Clayton 3168, Melbourne, AUSTRALIA. ###################################################################