next up previous contents
Next: Packaging a new subroutine Up: ``schint'': outward Schrödinger integrator Previous: Integrating outward

Trapping bugs

The Runge-Kutta algorithm always advances the solution two points at a time (dk=2). Thus, k2-k1 should always be an even number. Also, we are designing ``schint'' to integrate outward so that k2-k1 should also always be positive. It is clear that we are making these assumptions now. However, in a few weeks ``schint'' will be buried deep in the heart of our code, and we are likely to forget about these restrictions and produce code with bugs which are quite difficult to track.

To avoid such problem well designed routine will, under all possible circumstances, either work appropriately or print a message as to the nature of the problem (including the values of the offending variables so that you'll know what the problem is) and then exit (``stop'' in Fortran) the program.

In this case, you should test than k2-k1 is a positive, even number, and, if not, print very explicit messages such as ``Error in schint: k2-k1 must be even in routine schint, but k1=999 and k2=0.''



Tomas Arias
Wed Feb 16 12:12:49 EST 2000