source: trunk/examples/fermi_fortran/fermi_example.f @ 30

Last change on this file since 30 was 30, checked in by dkearney, 19 years ago

adding fermi_fortran as an example of a working app

File size: 2.1 KB
Line 
1c   file fermi_example.f
2
3        program fermi_example
4            IMPLICIT NONE
5
6            integer rp_lib
7            real*8 rp_lib_get_double
8           
9            CHARACTER*100 inFile, outFile
10            character*100 T_path, Ef_path, outPath
11            character*40 xy
12            integer handle
13            real*8 T,Ef,kT,Emin,Emax,dE,f,E,kTconstExp
14
15            ! inFile = "driver.xml"
16            call getarg(1,inFile)
17            outFile = "run.xml"
18
19            handle = 0
20
21            handle = rp_lib(inFile)
22
23            T_path = "input.(ambient).(temperature).current"
24            Ef_path = "input.number(Ef).default"
25
26            T = rp_lib_get_double(handle,T_path)
27            Ef = rp_lib_get_double(handle,Ef_path)
28
29
30c            kT = 8.61734e-5 * T
31            kTconstExp = (10.0)**(-5.0)
32            kT = (8.61734*kTconstExp) * T
33
34            Emin = (Ef - (10*kT))
35            Emax = (Ef + (10*kT))
36
37            dE = (0.005)*(Emax - Emin)
38
39            outPath = "output.curve(f12).xaxis.label"
40            call rp_lib_put_str(handle,outPath,"f12 x label",1)
41            outPath = "output.curve(f12).yaxis.label"
42            call rp_lib_put_str(handle,outPath,"f12 y label",1)
43
44            outPath = "output.curve(f12).component.xy"
45
46            do 15,E = Emin,Emax,dE
47                f = 1.0/(1.0+exp((E-Ef)/kT))
48                write(xy,'(E20.12,F13.9,A)')f,E,char(10)
49                call rp_lib_put_str(handle,outPath,xy,1)
50 15         continue
51
52            outPath = "output.curve(f13).xaxis.label"
53            call rp_lib_put_str(handle,outPath,"f13 x label",1)
54            outPath = "output.curve(f13).yaxis.label"
55            call rp_lib_put_str(handle,outPath,"f13 y label",1)
56
57            outPath = "output.curve(f13).component.xy"
58
59            do 16,E = Emin,Emax,dE
60                f = -1.0/(1.0+exp((E-Ef)/kT))
61                write(xy,'(E20.12,F13.9,A)')f,E,char(10)
62                call rp_lib_put_str(handle,outPath,xy,1)
63 16         continue
64
65           
66            call rp_lib_write_xml(handle, outFile)
67            call rp_quit()
68
69            print *,"=RAPPTURE-RUN=>"//outFile
70
71        end program fermi_example
Note: See TracBrowser for help on using the repository browser.