Oct 16, 2006
Abstract
This manual shows how to get, build, and use the multilayer core-shell Mie scattering program CoreShellX.
A subversion client, wget, or web browser.
An ANSI compliant C++ complier (tested with GCC3.3)
A 64-bit Processor if you wish to calculate the electromagnetic fields around metallic shells. This is not required to calculate scattered field coefficients, or scattering cross sections, or EM fields near completely dielectric particles.
Mathematica, if you intend to use the Mathematica Frontend (duh...)
CoreShellX is not explicitly supported on any OS (I'm a gradstudent with no time). But, it has been shown to complie under MacOS X, Linux 32/64, and Windows XP.
CoreShellX has been tested and found to work with:
Red Hat Fedora Core 4 & 5 ( 32 and 64 bit ).
Mac OS X 10.3.x and higher
Windows XP
It has been developed on Mac OS X v10.3/4.
The latest version of CoreShellX can be gotten from our subversion repository. If you have an svn client:
$ svn co http://www.mo.uoregon.edu/CodeRepo/CoreShellX/current/
If you don't have an svn client, you can use wget or other web capable program (including a browser) to down load it from the above URL.
Follow the below instructions to build and use CoreShellX.
Building the linkable static library libCrShll.a is a straightforward task, if you are using one of the OS's mentioned above. Others will work, if they have a C++ complier, but the Makefile might require some customization.
There are several OS specific makefiles in <PROJECT_DIR>/current/distributions. These will automatically be included by the toplevel Makefile. These contain system specific commands and paths. For instance, if you are not running mathematica 5.2, you will need to (at least) change the VERSION varible in the system Makefile.
$ uname Darwin
If the command uname doesn't result in one of the directories under <PROJECT_DIR>/current/distributions, you will have to create your own system level makefile.
Once you have verified that you are using a supported OS type build the CoreShellX library with make:
$ cd <PROJECT_DIR>/current/ $ make lib $ make libinstall
This will build and install the static library (lib/*.a) and coreshell.h header file into system level directories. If you don't have root access, just copy them to your own private location and ignore the last make statement.
If you have Mathematica, and wish to interface with CoreShellX using my frontend:
$ make Xsections (ignore insuing complaints from make about Xsectionstm.o file not existing) $ make XSections $ make install
Yes, you have to run make twice. For instructions on how to use the Mathematica frontend look at the CoreShellX and Mathematica section of this document.
For those of you who ( like me ) just want an example to start from, the following code snippets will get you started using the CoreShellX library. CoreShellX uses an iterative algorithm (equivalent to a T-Matrix approach) to calculate the scattered field expansion coefficients produced by a spherical particle scattering a plane wave. This spherical particle can be composed of an arbitrary (>= 1) number of concentric shells on a spherical core:
Things to know about your particle before you begin:
Particle size parameters ( x = k r )
Dielectric values at your incident wavelength ( these can be complex )
Error tolerance in the result (this is approximate)
The following is the simplest use of the ScatteredFieldAmplitude class to calculate the particle's far-field extinction cross-section. This outputs the extinction cross-section of a silver coated sillica sphere in water.
Do no try to use CoreShellX to calculate the cross-section of a single interface particle. However, if you insist on being inefficient, you can cheat and make the inner core radius very small ( DBL_EPSILON is fine ).
#include <coreshellx>
#include <complex>
#include <cmath>
#include <iostream>
int main(int argc, void*argv[])
{
int numLayers = 2;
double lambda = 0.523;
double radius = {0.1, 0.15};
double errorTolerance = 1e-4;
complex<double> index = {complex<double>(1.46,0),complex<double>(.13,-3.2),complex<double>(1.33,0)};
//Calculate the outter most size parameter. This will determine the number of
//modes needed to meet the speicifed error tolerance (default 10^-3) during class initalization.
double sizeParm = 2 * M_PI * radius[numLayers - 1] / lambda;
ScatteredFieldAmplitude ScatFieldAmp(numLayers, sizeParm, errorTolerance);
ScatFieldAmp.calc(lambda, radius, index);
cout << ScatFieldAmp.Cext(lambda);
}Let's break this down line by line.
Includes:
#include <coreshellx> #include <complex> #include <cmath> #include <iostream>
Particle Parameters:
int numLayers = 2;
double lambda = 0.523;
double radius = {0.1, 0.15};
double errorTolerance = 1e-4;
complex<double> index = {complex<double>(1.46,0),complex<double>(.13,-3.2),complex<double>(1.33,0)};
double sizeParm = 2 * M_PI * radius[numLayers - 1] / lambda; Class Initialization:
ScatteredFieldAmplitude ScatFieldAmp(numLayers, sizeParm, errorTolerance);
Cross-section calculation and output:
ScatFieldAmp.calc(lambda, radius, index); cout << ScatFieldAmp.Cext(lambda);
#include <coreshellx>
#include <complex>
#include <cmath>
#include <iostream>
int main(int argc, void*argv[])
{
int numLayers = 2;
double lambda = 0.523;
double radius = {0.1, 0.15};
double errorTolerance = 1e-4;
complex<double> index = {complex<double>(1.46,0),complex<double>(.13,-3.2),complex<double>(1.33,0)};
//Calculate the outter most size parameter. This will determine the number of
//modes needed to meet the speicifed error tolerance (default 10^-3) during class initalization.
double sizeParm = 2 * M_PI * radius[numLayers - 1] / lambda;
ScatteredFieldAmplitude ScatFieldAmp(numLayers, sizeParm, errorTolerance);
ScatFieldAmp.calc(lambda, radius, index);
cout << ScatFieldAmp.Csca(lambda);
}The only line that has changed is the last one.
cout << ScatFieldAmp.Csca(lambda);The scattering cross-section is calculated from:
The absorption cross-section is simply the difference between the extinction and scattering, thus the only change needed is:
cout << ScatFieldAmp.Cext(lambda) - ScatFieldAmp.Csca(lambda);Here you can learn how to use the Mathematica functions (well, eventually)
NLayerCExtML[lambda, {Radii}, {Indicies}, {Options]] : returns the extinction cross section of a Layered Core-Shell sphere. Radii is an ordered list of L layer radii from the core (smallest) to the outermost layer (largest). Indicies is a coresponding list of L+1 indicies of refraction for the L layers, and the Lth+1 exteranl medium. The medium must be nonabsorbing (real) for the calculation to be valid. Currently the only option is ErrorTolerance->0.001. Set this option to the amount of precision you wish in CExt.
NLayerCScaML[lambda, {Radii}, {Indicies}, {Options]] returns the extinction cross section of a Layered Core-Shell sphere. Radii is an ordered list of L layer radii from the core (smallest) to the outermost layer (largest). Indicies is a corresponding list of L+1 indicies of refraction for the L \layers, and the Lth+1 external medium. The medium must be non-absorbing (real) for the calculation to be valid. Set ReturnModes->True if you want a list of individual mode scattering cross sections. By default ErrorTolerance->0.001. Set this option to the amount of precision you wish in CSca. NOTE:The precision setting doesn't work yet. You are going to get 4 significant figures if you like it or not.
NLayerFieldCoefficientsML[lambda, {Radii}, {Indicies}, {Options}] returns a complex list of length (Modes x Layers) in the order (a, b, c, d).
NLayerScatteredFieldCoefficientsML[lambda, {Radii}, {Indicies}, {Options}]