void getEs(double E[],int nmax,double Elower,double V[],
double r[],double dr[],int N)
Output:
Input:
Write a routine of the above prototype in ``physics.c'' to return the energies of the electronic states with zero through nmax nodes in the potential V[] to a precision of TOL, which you should set at the top of ``physics.c'' with a statement like
#define TOL (1.e-12)The purpose of doing this is that you should never bury ``magic constants'' in your code, but rather define them in a single, centralized location where they are easily identified and changed.
Your routine should use rtbisp480() in conjunction with func_SchrodingerNodes() to first locate appropriate bounding energies, and then use zriddrp480 to find the solution to high precision.
A workable code fragment (but not the most efficient - you should try to do better) 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.,TOL,n,V,r,dr,N);
/* Get E2 as an energy with n+1 nodes */
E2=rtbisp480(func_SchrodingerNodes,Elower,0.,TOL,n+1,V,r,dr,N);
/* Now, get the solution, which is in between! */
E[n]=zriddrp480(func_Schrodinger,E1,E2,TOL,0,V,r,dr,N);
}
Note: All solutions will have ETomas Arias 2004-02-27