logo

mcsubfluor.c


NOTE: All files updated Sep. 25, 2015. slj. Now, Tex (Fig.3) and Tem (Fig.4) are shown as different. Thanks to Mehdi Azimipour for flagging the error.


The program mcfluor.c is a C program that will call the subroutine mcsubLIB.c, which executes Monte Carlo simulations using the parameters supplied by mcfluor.c.

The program is basically the same as published in Jacques SL, Monte Carlo simulations of fluorescence in turbid media, Ch. 6 in Handbook of Biomedical Fluorescence, M.A. Mycek, B.W. Pogue, publ. Marcel-Dekker, New York, NY, 2003. There are some minor changes, some because the mcsubLIB.c has been updated, for example, to allow for a mismatched boundary condition or to launch a beam at a subsurface location (to simulate a submerged optical fiber), and some changes cleaning up the code.

The run parameters are selected in the program. In the example shown here, the product of extinction coefficient and concentration is εC = 1 cm-1 = (cm-1 M-1)(M), and the energy yield is Y = 1 = 1 [J fluorescence per J excitation absorbed by fluorophore]. The results can be scaled by the actual values of eC and Y. To compile the program for execution, one simply types:

cc -o gomcsub mcsubLIB.c mcfluor.c

that yields the executable gomcsub*. Sometimes one might need to type

cc -lm -o gomcsub mcsubLIB.c mcfluor.c

to help the compiler find the math library. The details of compilation using your compiler may differ slightly. Once compiled, simply typing ./gomcsub on a Unix machine will execute the program from within the same directory where the program resides. Again, calling the program differs with the operating system being used.

The program files are

The output files are

  1. mcOUT101.dat = excitation files
  2. mcOUT102.dat = emission files for background uniform fluorescence
  3. mcOUT103.dat = emission files for positive-x half of asymmetric heterogeneous source
  4. mcOUT104.dat = emission files for negative-x half of asymmetric heterogeneous source

A MATLAB program will read these files and create the figures 1 through 6 shown below.
lookmcsubfluor.m creates the figures, and uses the following routines:
getmcsub.m reads the mcOUTxxx.dat files.
makec2f.m creates a colormap used in plotting.

Example Run
Running the compiled C program yields the 4 output files and the following printout on the console. This was a short run (controlled by selecting Nruns = 1 such that Nruns*1e6 photons are launched) which only required 1.5 min to complete, so the data is a little noisy. The MATLAB-generated figures from the output files are shown, then the printout is listed after the figures.


Fig. 1: Escaping fluxes Ex and Em

Fig. 2: Ratio of escaping Ex/Em

Fig. 3: Excitation

Fig. 4: Background fluorescence

Fig. 5: Off-center local fluorophore

Fig. 6: Off-center local fluorophore

Output to console from example run

$ gomcsub
Thu Sep 25 02:15:59 2014

----- USER CHOICES -----
EXCITATION
muax = 1.000
musx = 100.000
gx = 0.900
n1 = 1.330
n2 = 1.000
mcflag = 0
radius = 0.0000
waist = 0.0000
zfocus = 0.0000
xs = 0.0000
ys = 0.0000
zs = 0.0000
BACKGROUND FLUORESCENCE
muaf = 5.000
musf = 50.000
gf = 0.000
eC = 1.000
Y = 1.000
FLUORESCENT HETEROGENEITY
xh = 0.2000
yh = 0.0000
zh = 0.3000
heC = 0.1000
hY = 1.0000
hrad = 0.0100
OTHER
Nruns = 1.0 @1e6 photons/run
dr = 0.0100
dz = 0.0100
---------------

1.128e-06 min/EX photon 
2.474e-07 min/EM photon

Total estimated completion time =  1.63 min

EXCITATION
est. completion time =  1.13 min

100     photons
200     photons
300     photons
400     photons
500     photons
600     photons
700     photons
800     photons
900     photons
1000     photons
2000     photons
3000     photons
4000     photons
5000     photons
6000     photons
7000     photons
8000     photons
9000     photons
10000    photons
20000    photons
30000    photons
40000    photons
50000    photons
60000    photons
70000    photons
80000    photons
90000    photons
100000   photons
200000   photons
300000   photons
400000   photons
500000   photons
600000   photons
700000   photons
800000   photons
900000   photons
1000000  photons
------------------------------------------------------
------------------------------------------------------
Elapsed Time for excitation = 1.032 min
Thu Sep 25 02:17:01 2014

BACKGROUND FLUORESCENCE
est. completion time =  0.25 min

10000 fluor photons 	@ ir = 1 	 total = 10000
10000 fluor photons 	@ ir = 2 	 total = 20000
10000 fluor photons 	@ ir = 3 	 total = 30000
10000 fluor photons 	@ ir = 4 	 total = 40000
10000 fluor photons 	@ ir = 5 	 total = 50000
10000 fluor photons 	@ ir = 6 	 total = 60000
10000 fluor photons 	@ ir = 7 	 total = 70000
10000 fluor photons 	@ ir = 8 	 total = 80000
10000 fluor photons 	@ ir = 9 	 total = 90000
10000 fluor photons 	@ ir = 10 	 total = 100000
10000 fluor photons 	@ ir = 20 	 total = 200000
10000 fluor photons 	@ ir = 30 	 total = 300000
10000 fluor photons 	@ ir = 40 	 total = 400000
10000 fluor photons 	@ ir = 50 	 total = 500000
10000 fluor photons 	@ ir = 60 	 total = 600000
10000 fluor photons 	@ ir = 70 	 total = 700000
10000 fluor photons 	@ ir = 80 	 total = 800000
10000 fluor photons 	@ ir = 90 	 total = 900000
10000 fluor photons 	@ ir = 100 	 total = 1000000
10000 fluor photons 	@ ir = 101 	 total = 1000000
1000000 fluorescent photons total
Elapsed Time for background fluorescence = 0.251 min
------------------------------------------------------
FLUORESCENT HETEROGENEITY
est. completion time = 0.247 min

100     photons
200     photons
300     photons
400     photons
500     photons
600     photons
700     photons
800     photons
900     photons
1000     photons
2000     photons
3000     photons
4000     photons
5000     photons
6000     photons
7000     photons
8000     photons
9000     photons
10000    photons
20000    photons
30000    photons
40000    photons
50000    photons
60000    photons
70000    photons
80000    photons
90000    photons
100000   photons
200000   photons
300000   photons
400000   photons
500000   photons
600000   photons
700000   photons
800000   photons
900000   photons
1000000  photons
Elapsed Time for fluorescent heterogeneity = 0.231 min
------------------------------------------------------
------------------------------------------------------
Thu Sep 25 02:17:30 2014


Estimated total completion time =  1.63 min

Actual total elapsed time =  1.51 min