00001 #ifndef __INCLUDE_PARTWAVE_CC__
00002 #define __INCLUDE_PARTWAVE_CC__
00003 #include "wavefunction.h"
00004
00005 CPlaneWave::CPlaneWave(double etaset,int Q1Q2,double qset){
00006 complex<double> a,b,a0,b0;
00007 complex<double> c1top1,c2top2,bot;
00008 complex<double> c1top2,c2top1;
00009 double xmax;
00010 int j,ix;
00011 ci=complex<double>(0.0,1.0);
00012 eta=etaset;
00013 q1q2=Q1Q2;
00014 q=qset;
00015 delx=0.02;
00016
00017 xmax=50.0;
00018 if((q*30.0/HBARC) > xmax) xmax=delx*(floor(1.0+(q*30.0/HBARC)/delx));
00019 nxmax=int(floor(xmax/delx));
00020 hyperarray=new complex<double> [nxmax+1];
00021
00022 if(q1q2!=0){
00023 couly=CoulWave::cgamma(1.0+ci*eta);
00024 couly=couly*exp(-0.5*eta*PI);
00025 a=-ci*eta;
00026 b=1.0;
00027 a0=a;
00028 b0=b;
00029 for(j=1;j<=60;j++){
00030 chype[j]=a/(b*double(j));
00031 a=a+1.0;
00032 b=b+1.0;
00033 }
00034 c1top1=1.0;
00035 c2top1=1.0;
00036 c1top2=1.0;
00037 c2top2=1.0;
00038 bot=1.0;
00039 for(j=1;j<=10;j++){
00040 c1top1=c1top1*(double(j)+a0-1.0);
00041 c2top1=c2top1*(double(j)-a0);
00042 c1top2=c1top2*(double(j)-b0+a0);
00043 c2top2=c2top2*(double(j)+b0-a0-1.0);
00044 bot=bot*double(j);
00045 chype1[j]=(c1top1*c1top2)/(bot);
00046 chype2[j]=(c2top1*c2top2)/(bot);
00047 }
00048 cfact1=1.0/(CoulWave::cgamma(b0-a0));
00049 cfact2=1.0/(CoulWave::cgamma(a0));
00050 }
00051 for(ix=0;ix<=nxmax;ix++)
00052 hyperarray[ix]=hyper(-ci*eta,1.0,ci*(delx*(ix+0.5)));
00053 }
00054
00055 complex<double> CPlaneWave::planewave(double r,double ctheta){
00056 complex<double> answer;
00057 double zq,arg,x,wlow,whigh;
00058 int ixlow;
00059
00060
00061
00062
00063
00064
00065 if(q1q2!=0){
00066 zq=-r*ctheta;
00067
00068 x=q*(r-zq)/HBARC;
00069 ixlow=int(floor(-0.5+x/delx));
00070 if(x>delx && ixlow<nxmax){
00071 wlow=(delx*(ixlow+1)-x)/delx;
00072 whigh=(x-delx*ixlow)/delx;
00073 answer=couly*(wlow*hyperarray[ixlow]+whigh*hyperarray[ixlow+1]);
00074 }
00075 else{
00076 answer=couly*hyper(-ci*eta,1.0,ci*x);
00077 }
00078 arg=zq*q/HBARC;
00079 arg=arg-2.0*PI*floor(arg/(2.0*PI));
00080 answer=answer*(cos(arg)+ci*sin(arg));
00081 answer=conj(answer);
00082 }
00083 else{
00084 arg=q*r*ctheta/HBARC;
00085 answer=cos(arg)+ci*sin(arg);
00086 }
00087
00088 return answer;
00089 }
00090
00091
00092
00093
00094 complex<double> CPlaneWave::hyper(complex<double> a,complex<double> b,complex<double> cz){
00095 complex<double> cw1,cw2,cf1,cf2,czarg,czstarj,answer,delcf1,delcf2;
00096 double realcz,imagcz;
00097 const double rcrit=12.0;
00098 double dmag;
00099 int j;
00100 realcz=real(cz); imagcz=imag(cz);
00101 dmag=fabs(sqrt(realcz*realcz+imagcz*imagcz));
00102 if(dmag<rcrit){
00103 cf1=1.0;
00104 czstarj=1.0;
00105 for(j=1;j<=60;j++){
00106 czstarj=czstarj*cz*chype[j];
00107 cf1=cf1+czstarj;
00108 realcz=real(czstarj); imagcz=imag(czstarj);
00109 if(fabs(sqrt(realcz*realcz+imagcz*imagcz))<1.0E-6) goto GOOD_ENOUGH;
00110 }
00111 printf("hyper not coverging!.\n");
00112 GOOD_ENOUGH:
00113 answer=cf1;
00114 }
00115 else{
00116 cf1=1.0;
00117 cf2=1.0;
00118 delcf1=delcf2=1.0;
00119 for(j=1;j<=10;j++){
00120 delcf1=delcf1*(-cz);
00121 cf1=cf1+chype1[j]/delcf1;
00122 delcf2=delcf2*cz;
00123 cf2=cf2+chype2[j]/delcf2;
00124 }
00125 cw1=cf1*cfact1*(Misc::cpow(-cz,-a));
00126 czarg=cz-ci*2.0*PI*floor(real(-ci*cz/(2.0*PI)));
00127 cw2=cf2*cfact2*Misc::cpow(cz,a-b)*Misc::cexp(czarg);
00128 answer=cw1+cw2;
00129 }
00130 return answer;
00131 }
00132
00133 #endif