Changeset 2780 for trunk/examples/app-fermi/R
- Timestamp:
- Feb 5, 2012, 8:44:38 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/app-fermi/R/fermi.R
r2709 r2780 1 1 # ---------------------------------------------------------------------- 2 # EXAMPLE: Fermi-Dirac function in Tcl.2 # EXAMPLE: Fermi-Dirac function in R. 3 3 # 4 4 # This simple example shows how to use Rappture within a simulator 5 # written in Tcl.5 # written in R. 6 6 # ====================================================================== 7 7 # AUTHOR: Derrick Kearney, Purdue University … … 30 30 driver <- rp_lib(args[7]) 31 31 32 rp_utils_progress(10,"reading inputs") 33 32 34 T <- rp_lib_get_string(driver,"input.number(temperature).current") 33 35 T <- rp_units_convert_double(T,"K") 34 36 Ef <- rp_lib_get_string(driver,"input.number(Ef).current") 35 37 Ef <- rp_units_convert_double(Ef,"eV") 38 39 rp_utils_progress(30,"performing calculations") 36 40 37 41 kT <- 8.61734e-5 * T … … 41 45 dE <- 0.005*(Emax-Emin) 42 46 47 rp_utils_progress(60,"performing calculations") 48 43 49 y <- seq(Emin,Emax,by=dE) 44 50 x <- sapply(y,function(E) 1.0/(1.0 + exp((E - Ef)/kT))) 51 52 rp_utils_progress(80,"storing results") 45 53 46 54 # Label output graph with title, x-axis label, … … 51 59 rp_lib_put_string(driver,"output.curve(f12).yaxis.units","eV",FALSE) 52 60 61 rp_utils_progress(90,"storing results") 62 53 63 # coerce our arrays into a string of the form: 54 64 # "x1 y1 \n x2 y2 \n x3 y3\n"... … … 58 68 59 69 70 rp_utils_progress(100,"preparing graphs") 71 60 72 # save the updated XML describing the run... 61 73 rp_lib_result(driver)
Note: See TracChangeset
for help on using the changeset viewer.