next up previous contents
Next: Debugging Up: Complete and normalized wave Previous: interpolate()

getPsi()

void getPsi(double Psi[], double E, int l,
            double V[], double r[], double dr[], int N)
Output:

Input:

Write a routine getPsi() of the above prototype in ``physics.c'', which produces the values on the grid r[] of the wave function with energy E and angular momentum l, properly normalized so that tex2html_wrap_inline452 . Your routine will consist of several steps:

First, you should construct the appropriate effective potential,

displaymath454

Next, you need to determine an appropriate point, kmatch, for matching the inward and outward solutions. An appropriate value is the boundary between the exponential and oscillatory solutions, the so-called ``classical turning point'' where V(r)=E. To find the outermost point where V(r)<E, you may use the following fragment:

                        .
                        .
  kmatch=0;
  for (k=0; k<=N; k++)
    if (Veff[k]<E) kmatch=k;
  if (kmatch==0) {
    printf("Veff never below E=%f in getPsi.\n",E);
    exit(1);
  }
                        .
                        .
(This is the so-called ``classical turning point''.) Then, you should perform the inward (k=0..kmatch) and outward (k=N..kmatch) integrations using schint(), scaling both solutions to match so that tex2html_wrap_inline460 .

Next, interpolate your result to include values at the odd points using your new routine interpolate().

Finally, normalize the result using the formula

displaymath462

where you perform the integral using simpint().



Tomas Arias
Sun Feb 24 18:36:39 EST 2002