CoreShellX User's Guide

A Work In Progress!!

Charles Rohde

Deutsch Group

University of Oregon, 
Physics Department and 
Oregon Center for Optics

Web: www.mo.uoregon.edu
Email: 

Oct 16, 2006

Abstract

This manual shows how to get, build, and use the multilayer core-shell Mie scattering program CoreShellX.


1. Obtaining CoreShellX
1. Requirements
2. Obtaining latest version from the web with SVN
2. Building and Installing
1. Building from the command line
3. Quick Start
1. Calculating the Forward Extinction Cross-section.
2. Calculating the Forward Scattering Cross-section.
3. Calculating the Absorption Cross-section.
4. Compiling and Linking Source Code.
4. Tutorial: calculating electromagnetic fields
5. CoreShellX and Mathematica
6. Details and Synopses of CoreShellX classes

Chapter 1. Obtaining CoreShellX

1. Requirements

  • 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.

2. Obtaining latest version from the web with SVN

  1. 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/
  2. 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.

  3. Follow the below instructions to build and use CoreShellX.

Chapter 2. Building and Installing

1. Building from the command line

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.

  1. 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

    Note

    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.

  2. 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.

  3. 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.

Chapter 3. Quick Start

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:

  1. Particle size parameters ( x = k r )

  2. Dielectric values at your incident wavelength ( these can be complex )

  3. Error tolerance in the result (this is approximate)

1. Calculating the Forward Extinction Cross-section.

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.

Caution

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);

2. Calculating the Forward Scattering Cross-section.

#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:

3. Calculating the Absorption Cross-section.

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);

4. Compiling and Linking Source Code.

Not written yet.

Chapter 4. Tutorial: calculating electromagnetic fields

Coming soon!

Chapter 5. CoreShellX and Mathematica

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}]

Chapter 6. Details and Synopses of CoreShellX classes

Lots and lots of info about structure.