int schint(double *Psi, double *Psip, double Psiout[], int k1, int k2, double Veff[], double E, double r[], double dr[], int N);Return value:
- number of nodes in solution between r[k1] and r[k2]
Output:
- Psi, Psip (passed by reference): values of
and
![]()
- Psiout[]: values of
generated by ``rk4p480''
Input:
- Psi, Psip (passed by reference): values of
and
![]()
- k1, k2: indices of initial and final integration points (r[k1]
r[k2])
- Veff[]: effective potential on grid
- E: proposed electron energy
- r[], dr[], N: standard grid information
Modify your ``schint'' routine to return the solution for
for all points k=k1..k2. This involves two steps.
.
.
for (k=k1; k!=k2; k+=dk) {
x=0.5*k*fabs(h);
if (Psiout!=NULL) Psiout[k]=*Psi;
derivs_Schrodinger(x,y,dydx,k,T,r,dr,N);
rk4p480(y,dydx,2,x,h,y,derivs_Schrodinger,k,dk,T,r,dr,N);
.
.
}
if (Psiout!=NULL) Psiout[k]=*Psi;
.
.
Note that because we record the initial value of Psi before
``rk4p480'' makes each step, we require one final assignment after the
completion of the loop. if (fabs(*Psi)>SQRTBIG) {
y[1]=SMALL*y[1];
y[2]=SMALL*y[2];
if (Psiout!=NULL) { /* If filling array, need to repair */
for (kp=k; kp!=k1; kp-=dk)
Psiout[kp]=SMALL*Psiout[kp];
Psiout[kp]=SMALL*Psiout[kp];
}
}