next up previous contents
Next: Fixing ``zriddrp480'' Up: ``getEs'' Previous: ``getEs''

New routine

void getEs(double *E,
           int nmax, double Elower, double Veff[],
           double r[], double dr[], int N)
Output:

Input:

Write a routine of the above prototype to return the energies of the electronic states with zero through nmax nodes in the potential Veff[]. Your routine should use ``rtbisp480'' in conjunction with ``func_SchrodingerNodes'' to first locate appropriate bounding energies (as discussed in lecture), and then use zriddrp480 to find the solution to high precision.

A workable code fragment (but not the most efficient) is

  /* Loop to get states */
  for (n=0; n<=nmax; n++) {
    /* Get E1 as an energy with n nodes */
    E1=rtbisp480(func_SchrodingerNodes,Elower,0.,1e-12,n,Veff,r,dr,N);

    /* Get E2 as an energy with n+1 nodes */
    E2=rtbisp480(func_SchrodingerNodes,Elower,0.,1e-12,n+1,Veff,r,dr,N);

    /* Now, get the solution, which is in between! */
    E[n]=zriddrp480(func_Schrodinger,E1,E2,1e-12,0,Veff,r,dr,N);  
  }
Note: All solutions will have E<0, so using [Elower,0.] as the bounds for the ``rtbisp480'' searches is guaranteed to work!



Tomas Arias
Tue Feb 22 15:12:08 EST 2000