Last change
on this file since 10 was
10,
checked in by mmc, 19 years ago
|
Added an "examples" directory with the bits and pieces that
make up app-fermi. This is very much a work in progress.
|
File size:
894 bytes
|
Line | |
---|
1 | # ---------------------------------------------------------------------- |
---|
2 | # FERMI STATISTICS |
---|
3 | # |
---|
4 | # This simple example shows how you can use the Rappture toolkit |
---|
5 | # to handle I/O for a simple simulator--in this case, one that |
---|
6 | # computes Fermi-Dirac statistics. |
---|
7 | # ====================================================================== |
---|
8 | # AUTHOR: Michael McLennan, Purdue University |
---|
9 | # Copyright (c) 2005 Purdue Research Foundation, West Lafayette, IN |
---|
10 | # ====================================================================== |
---|
11 | |
---|
12 | from math import * |
---|
13 | import sys |
---|
14 | import Rappture |
---|
15 | |
---|
16 | import fermi_io |
---|
17 | from fermi_io import * |
---|
18 | |
---|
19 | # do this right at the start, to handle command line args |
---|
20 | Rappture.interface(sys.argv, fermi_io) |
---|
21 | |
---|
22 | kT = 8.61734e-5 * T |
---|
23 | Emin = Ef - 10*kT |
---|
24 | Emax = Ef + 10*kT |
---|
25 | |
---|
26 | E = Emin; dE = 0.005*(Emax-Emin) |
---|
27 | |
---|
28 | while E < Emax: |
---|
29 | f = 1.0/(1.0 + exp((E - Ef)/kT)) |
---|
30 | result.append( [E,f] ) |
---|
31 | E += dE |
---|
Note: See
TracBrowser
for help on using the repository browser.