|- (x) + V(x)(x) = E(x) .||(1)|
The input fields (from top to bottom) are:
The floating point numbers , Xmin , Xmax , the energy scaling factor, and any numbers in the potential can be specified either in fixed point (e.g. 1.0 or 7.678, etc.) or by using scientific notation as in Fortran, (e.g. 1.0e-5, or 1.0e4, etc., where the integer after the e is the exponent).
While the user may specify any input field, the applet also provides an ``Example Inputs'' bar. Clicking the bar, located at the top of the right side, will produce a menu of sample inputs to be selected. Choosing an item from the list will write a set of values in the input boxes that will allow you to calculate that system by clicking the Solve button. This list merely provides a survey of the types of problems which the user can examine and some examples for the potential parser. Go to Sec. 3 to explore the examples in detail.
Next to the Solve button is a button marked Stop normally this button will be disabled and will be ``greyed out.'' When you click Solve, the Stop button will be enabled and by clicking it, you can stop the calculation. This can be useful if you have inadvertently typed in input data that will cause the integrator to run for a long time, e.g. by using an enormous number of grid points.
Below the plotting area are three buttons labeled Print, Read, and Write. The Print button will bring up a dialog that will allow you to print the current applet appearance. The preferred method of printing is to use the Browser's print function for those Browsers that support printing applets (e.g. Netscape 4.05 preview release 1 (AWT1.1.5)). This applet Print button will allow printing on some other browsers, and when the applet is being run as a Java application or in a separate Window. The quality of the printing is platform dependent. Printing the applet in Landscape orientation normally provides the best quality.
The Read and Write buttons bring up file dialogs. Selecting Write and giving a file name will write a file with the values of the 7 input fields of the applet, the calculated energy, followed by the values of x , the wave function, and the potential. The file is a standard ASCII text file. Here is the start of a file generated for a double harmonic oscillator:
# 0.5 hbar^2/(2m) # -10.0 xmin # 10.0 xmax # 1000 ngrid # 0 nnode # 0.1 vscale # 0.49977564535774377 Energy #a = 3 #0.5*min((x-a)^2,(x+a)^2) -10.0 0.0 0.0 -9.97997997997998 6.367057436351622E-12 24.36006026046066 -9.95995995995996 1.2855968537246738E-11 24.220521322122924 -9.93993993993994 1.9589595863550545E-11 24.081383184986787 . . .The first 6 lines contain the first 6 input fields from the applet, the next line is the computed energy, followed by the potential definition. All of these lines begin with a # character. The remaining lines are x , (x) , and v(x) , at the grid points. The plotting package gnuplot views the # character as a comment, so these files can be directly plotted using gnuplot. These files allow users to save cases of interest, with numerical tables of wave functions that can be used to calculate matrix elements etc. in other programs.
Clicking the Read button, and then selecting a previously saved file, will read the 7 input fields from the file. You need to click Solve to recalculate and display the results of this input.
These three buttons are the only parts of the applet that use Java 1.1 features and will require you to use one of the latest browsers. Early browsers such as Netscape 2.0 or 3.0 will run the rest of the applet, but will not allow printing or file manipulation. For more information, see section 2.7
L=0 D0=3145 alpha=2.352709 r0=2.413683 ex=exp(-alpha*(x-r0)) D0*ex*(ex-2.)+.96415129*L*(L+1)/x^2which defines a Morse potential for a pair of Cl atoms.
The operators that are recognized are + , - , * , / , ^ , and ** . Both ^ and ** can be used as the exponent operator. In addition, the functions sin, cos, exp, log, max, min, atan, sqrt, abs, H, and pulse are recognized.
The max, min and pulse functions have 2 arguments, and the rest take just one. H is the Heaviside function; H(y) is zero when y is negative and 1 when y is positive. The pulse(y,z) function is 1 when |y| < |z| and zero otherwise.
Since the potential panel is editable, as are the other input panels, the arrow, insert, delete, home, end, etc. keys, as well as text selection with the mouse, provide simple editing features.
The plotting routines are from ptplot by Edward A. Lee and Christopher Hylands, copyright University of California.
When the results have been displayed, the user can zoom, by using the mouse to click and pull down and to the right to produce a small square of the plot, which will be expanded into the full plotting region. You can do this repeatedly. This feature is extremely useful for viewing fine details of a wave function. You can restore the plot to its original form by clicking Solve again.
|H = - + mx 2||(2)|
|Energy Unit = (Mass Unit)(Length Unit)2(Time Unit)- 2 = ,||(4)|
|n(x) = En(x)||(5)|
Similar tests can be done to make sure that the boundaries are not influencing the results for cases where the original problem's solution extends to infinity.
The parser, Sec. 2.2, accepts simple algebraic expressions and requires a fairly rigid syntax. If there is an input or parsing error, a message will be written to the energy panel.
The numerical integration may fail because its searching procedure (integrating inward from the two end points) cannot match the the solutions at the midpoint. If the integration fails, an ``Integration failed'' message will be written to the energy panel. Generally this is caused by Xmin and Xmax chosen too far apart so that the wave function overflows or underflows during the calculation. It can also be caused by too few grid points. Adjusting the grid points or range specified for the solution usually fixes the problem unless a pathological potential is being solved.
Java is an evolving language. We have tested the applet using various versions of sun's appletviewer, Netscape and Internet Explorer. In addition the applet can be run as an application if you have a Java runtime environment installed. For full functionality, the applet requires Java version 1.1. The Print, Read, and Write buttons will not work under version 1.0, but the rest of the applet should. Browsers that support the Java 1.1 features we use include Internet Explorer 4.0 and Netscape 4.05 preview release 1 (AWT1.1.5). The standard Netscape 4.05 will not work properly. It must support Java 1.1, so you must use one of the preview releases that have JDK1.1 installed. Currently, these are freely available at http://developer.netscape.com/software/jdk/download.html To reiterate, Browsers that don't or only partially support Java 1.1 may not recognize the print, read and write functions, but everything else will likely work fine.
The method begins by rewriting the Schrödinger equation as an expression for the second derivative in terms of the value of the wave function,
|''(x) = (x) (x)(x) .||(6)|
The Numerov method is derived by writing the Taylor series expansions
|(x ) = (x) '(x) + ''(x) '''(x) + ''''(x) O()||(7)|
|''(x ) = ''(x) '''(x) + ''''(x) O().||(8)|
|''''(x) = + O().||(9)|
|(x + ) + (x - ) = 2(x) + ''(x) +||(10)|
We haven't used the differential equation yet. Substituting Eq. 6 for '' gives the Numerov three term recursion relation
|(x + )[1 - (x + )] + (x - )[1 - (x - )] = (x)[2 + (x)].||(11)|
The code enforces the boundary conditions that = 0 at Xmin and Xmax . You can think of the system as being placed in an infinite square well potential that forces the wave function to zero at these points. The values are chosen by you. Other input that you need to provide are the value of , the number of grid points which sets the step size , the number of nodes (zero crossings) that you want in the wave function, which determines the corresponding eigenstate, and the potential.
Since = 0 at the end points, the value at the neighbor grid point is arbitrary since it varies with the normalization. The code uses zero at the end points and an arbitrary small value at the neighboring points to start the Numerov recursion relation to generate the value of the wave function everywhere. The code integrates from Xmin to a point near the center, and from Xmax to just beyond the same point. The logarithmic derivative from the left and from the right at the match point are approximately calculated. These use the same Taylor series expressions above, but you subtract rather than add them to get a formula for the derivative. If the E value initially guessed is exactly right the two approximate derivatives from the left and right will be equal, and there will be exactly the correct number of nodes. If the energy is too high, there will either be too many nodes found, or the correct number of nodes and the difference of the approximate logarithmic derivatives will be positive. If the energy is too low, there will be either too few nodes, or the correct number of nodes and the difference in the approximate logarithmic derivatives will be negative. Therefore, we always know if the guessed energy is too high or too low. The integrator starts out with an energy of approximately the energy of an infinite square well from Xmin to Xmax with the same number of nodes as the solution we want, and doubles this energy until it is too high. It then uses an energy that is the negative of the infinite square well energy and doubles it until it is too low. The actual starting values are unimportant as long as the order of magnitude is sensible. Once the correct energy is bracketed, a binary chop is used to home in on the correct energy. The average of the upper and lower bounds is used, and after integrating this value replaces either the old upper or lower bound. This method by itself gives 1 binary place per iteration, so typically around 50 iterations would give machine accuracy. To speed this up, when both the upper and lower bounds have the correct number of nodes, Newton's method is used to predict the new energy. Typically the energy converges within 10 or 20 iterations.