[66] | 1 | c ---------------------------------------------------------------------- |
---|
| 2 | c EXAMPLE: Fermi-Dirac function in Fortran. |
---|
| 3 | c |
---|
| 4 | c This simple example shows how to use Rappture within a simulator |
---|
| 5 | c written in Fortran. |
---|
[115] | 6 | c |
---|
[66] | 7 | c ====================================================================== |
---|
| 8 | c AUTHOR: Michael McLennan, Purdue University |
---|
| 9 | c AUTHOR: Derrick Kearney, Purdue University |
---|
[115] | 10 | c Copyright (c) 2004-2005 Purdue Research Foundation |
---|
| 11 | c |
---|
| 12 | c See the file "license.terms" for information on usage and |
---|
| 13 | c redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
[66] | 14 | c ====================================================================== |
---|
[115] | 15 | |
---|
[66] | 16 | program fermi |
---|
| 17 | IMPLICIT NONE |
---|
| 18 | |
---|
[119] | 19 | integer rp_lib, rp_units_convert_dbl |
---|
[66] | 20 | |
---|
[83] | 21 | integer driver, ok |
---|
[66] | 22 | double precision T, Ef, kT, Emin, Emax, dE, f, E |
---|
[83] | 23 | CHARACTER*100 inFile, strVal |
---|
[66] | 24 | character*40 xy |
---|
| 25 | |
---|
| 26 | call getarg(1,inFile) |
---|
| 27 | driver = rp_lib(inFile) |
---|
| 28 | |
---|
[83] | 29 | call rp_lib_get(driver, |
---|
| 30 | + "input.number(temperature).current", strVal) |
---|
| 31 | ok = rp_units_convert_dbl(strVal,"K",T) |
---|
| 32 | |
---|
| 33 | call rp_lib_get(driver, |
---|
| 34 | + "input.number(Ef).current", strVal) |
---|
| 35 | ok = rp_units_convert_dbl(strVal,"K",Ef) |
---|
| 36 | |
---|
[66] | 37 | kT = 8.61734e-5 * T |
---|
| 38 | Emin = Ef - 10*kT |
---|
| 39 | Emax = Ef + 10*kT |
---|
| 40 | |
---|
| 41 | dE = 0.005*(Emax - Emin) |
---|
| 42 | |
---|
[555] | 43 | c Label out graph with a title, x-axis label, |
---|
| 44 | c y-axis label and y-axis units |
---|
| 45 | |
---|
| 46 | call rp_lib_put_str (driver,"output.curve(f12).about.label", |
---|
| 47 | + "Fermi-Dirac Factor",0) |
---|
| 48 | call rp_lib_put_str (driver,"output.curve(f12).xaxis.label", |
---|
| 49 | + "Fermi-Dirac Factor",0) |
---|
| 50 | call rp_lib_put_str (driver,"output.curve(f12).yaxis.label", |
---|
| 51 | + "Energy",0) |
---|
| 52 | call rp_lib_put_str (driver,"output.curve(f12).yaxis.units", |
---|
| 53 | + "eV",0) |
---|
| 54 | |
---|
[66] | 55 | do 10 E=Emin,Emax,dE |
---|
| 56 | f = 1.0/(1.0+exp((E-Ef)/kT)) |
---|
| 57 | write(xy,'(E20.12,F13.9,A)') f, E, char(10) |
---|
[555] | 58 | call rp_lib_put_str (driver, |
---|
| 59 | + "output.curve(f12).component.xy", xy, 1) |
---|
[66] | 60 | 10 continue |
---|
| 61 | |
---|
| 62 | call rp_result(driver) |
---|
| 63 | end program fermi |
---|