This page discusses how to run Monte Carlo modeling on your student account on the OGI computing facilities.
1 DOWNLOAD |
DOWNLOAD mcmain.c from this webpage.The program listing is at mcmain.c |
2 LOGON |
LOGON to your computer account at OGI.You all have an email account with a USERNAME and PASSWORD. That same account will provide you access to "spruce", the computer system in ECE available for student computations. Spruce operates under the Unix operating system. (1) FROM COMPUTER WITH ETHERNET CONNECTION: From OHSU or OGI, you have an ETHERNET connection to the OGI system. Use a telnet application on your personal computer to log onto "ece.ogi.edu" using your USERNAME and PASSWORD. When you have successfully connected, you will see the prompt "spruce%". The following shows how this might look on your screen: SunOS 5.6 login: sjacques Password: xxxxxx Last login: Fri Jan 25 09:33:54 from dialin-E.admin.o Sun Microsystems Inc. SunOS 5.6 Generic August 1997 You have new mail. spruce-(1)% (2) FROM A MODEM: Use your modem to call up 503-748-2929. Upon connection, you are asked for a USERNAME. Enter your username and hit return. Then you are asked for a PASSWORD. Enter your password and hit return. You will then see the prompt "gerbil(replaces ts2:) line2>" waiting for a command from you. Type "ppp" and hit return. This will elicit the setup of proper PPP protocols and connect you to the OGI system. Now you can use applications on your personal computer that route through spruce, such as a browser, email, FTP, or telnet application. Use a telnet application on your personal computer, as above, to log onto "ece.ogi.edu" and reenter your USERNAME and PASSWORD as requested. You will eventually have a prompt "spruce%". |
3 mkdir |
CREATE subdirectory for your Monte Carlo work.Type "mkdir mc" to create a subdirectory called "mc". Then type "cd mc" to move into that subdirectory. |
4 TRANSFER |
TRANSFER mcmain.c to your email account.You now must transfer mcmain.c from your personal computer to your subdirectory on the spruce computer. There is more than one way to accomplish this task. Here are 3 ways: (1) Use an FTP program on your personal computer. For Macintosh, the FETCH program is a good way to transfer files. For a PC, Microsoft Office should provide an FTP application. Use your FTP to send mcmain.c to your mc subdirectory on spruce. (2) For Macintosh, another approach is to use the editor called "BBEdit" to directly access the mc directory on your spruce account. You can open, modify and save files directly from and to your mc subdirectory. Essentially, this is an FTP function coupled with an editor. (3) You can use the "vi" editor facility on spruce. Here is the procedure:
|
5 COMPILE |
COMPILE the mcmain.c program using the cc compiler.Type "cc -L/usr/lib -lm -orunmc mcmain.c". This command will cause mcmain.c to be compiled and the executable program will be called "runmc". (You can name the executable by any name, eg., -oyahoo would cause "yahoo" to be the executable file.) Your screen should look like: spruce-(3)% ls mcmain.c spruce-(4)% cc -L/usr/lib -lm -orunmc mcmain.c spruce-(5)% ls mcmain.c mcrun |
6 RUN |
RUN the runmc program that was compiled.Type "./runmc". This command will cause runmc to be executed. The following printout will appear as mcrun is executed. spruce-(6)% ./runmc ||------------------------- || mcmain.c for class ||------------------------- Fri Jan 25 12:59:31 2002 ----- USER CHOICES ----- mua = 1.000 mus = 100.000 g = 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.0909 OTHER Nruns = 0.01 dr = 0.0100 dz = 0.0100 --------------- 1000 photons Specular = 0.020059 Absorbed = 0.636408 Escaped = 0.343535 total = 1.000002 2.017e-05 min/photon estimated completion times = 0.20 min 1000 photons 2000 photons 3000 photons 4000 photons 5000 photons 6000 photons 7000 photons 8000 photons 9000 photons 10000 photons Specular = 0.020059 Absorbed = 0.642552 Escaped = 0.337388 total = 0.999999 ------------------------------------------------------ -------------------------------------------------------------------- Elapsed Time for excitation = 0.22 min Fri Jan 25 12:59:44 2002 The program creates two output files "mcF0.dat" and "mcJ0.dat". If you type "ls", you will see a listing that looks like: spruce-(7)% ls mcF0.dat mcJ0.dat mcmain.c runmc |
7 TRANSFER |
TRANSFER the data files "mcF0.dat" and "mcJ0.dat" to your personal computer.You need to use your FTP application on your personal computer to download the two data files "mcF0.dat" and "mcJ0.dat" from spruce to your personal computer. |
8 MATLAB |
Use the MATLAB program "master.m" view data.Use the MATLAB program "master.m" to graph the data files "mcF0.dat" and "mcJ0.dat" for display on your personal computer. Your directory should contain: The figures generated will look like: |
FINALLY, you can MODIFY the parameters in mcmain.c and RESAVE to your mc directory on spruce. You can RECOMPILE mcmain.c to yield a new mcrun. You can RUN mcrun to yield a new mcJ0.dat and mcF0.dat. You can FTP these two files to your personal computer. You can run master.m in MATLAB to view the files.