//****************************************************************************** //** SCATMECH: Polarized Light Scattering C++ Class Library //** //** File: oasphere.cpp //** //** Thomas A. Germer //** Sensor Science Division, National Institute of Standards and Technology //** 100 Bureau Dr. Stop 8443; Gaithersburg, MD 20899-8443 //** Phone: (301) 975-2876 //** Email: thomas.germer@nist.gov //** //****************************************************************************** #include "scatmech.h" #include "oasphere.h" #include "bobvlieg.h" #include "askuser.h" using namespace std; namespace SCATMECH { Optically_Active_Sphere_Scatterer:: Optically_Active_Sphere_Scatterer() { NSTOP=0; NMX=0; } void Optically_Active_Sphere_Scatterer:: setup() { Free_Space_Scatterer::setup(); int N; COMPLEX cI(0.,1.); if (imag(COMPLEX(medium.index(lambda)))!=0) error("medium must be non-absorbing"); double nmed = real(COMPLEX(medium.index(lambda))); COMPLEX nL = COMPLEX(materialleft.index(lambda)); COMPLEX nR = COMPLEX(materialright.index(lambda)); COMPLEX mL = nL/nmed; COMPLEX mR = nR/nmed; COMPLEX m = 2./(1./mR+1./mL); k = 2.*pi*nmed/lambda; x = k*radius; double absmL = abs(mL); double absmR = abs(mR); double ymod=x*(absmL > absmR ? absmL : absmR); //C //C*** Series expansion terminated after NSTOP terms //C double XSTOP=x+4.*pow(x,0.3333)+2.; NMX=(int)(((XSTOP>ymod)? XSTOP : ymod )+50); NSTOP=(int)(XSTOP); COMPLEX mLx = mL*x; COMPLEX mRx = mR*x; // The logarithmic derivatives... vector DmLx(NMX); vector DmRx(NMX); for (N=NMX-1; N>=0; --N) { DmLx[N] = BobVlieg_Supp::psi_(N,mLx)/BobVlieg_Supp::psi(N,mLx); DmRx[N] = BobVlieg_Supp::psi_(N,mRx)/BobVlieg_Supp::psi(N,mRx); } // The Ricatti-Bessel functions.... vector psix(NMX); vector xix(NMX); for (N=NMX-1; N>=0; --N) { psix[N] = BobVlieg_Supp::psi(N,x); xix[N] = BobVlieg_Supp::zeta(N,x); } a.resize(NSTOP); b.resize(NSTOP); c.resize(NSTOP); E.resize(NSTOP); F.resize(NSTOP); for (N=0; N1.) costheta=1; if (costheta<-1.) costheta=-1; double theta = acos(costheta); COMPLEX S1=0.; COMPLEX S2=0.; COMPLEX S3=0.; double PI0=0.; double PI1=1.; double AMU=cos(theta); int N; for (N=0; N