Last change
on this file since 21 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.
|
-
Property svn:executable set to
*
|
File size:
1.3 KB
|
Rev | Line | |
---|
[10] | 1 | #!/bin/sh |
---|
| 2 | # ---------------------------------------------------------------------- |
---|
| 3 | # Energy Levels WRAPPER |
---|
| 4 | # |
---|
| 5 | # This wrapper computes the energy levels of an isolated molecule. |
---|
| 6 | # ====================================================================== |
---|
| 7 | # AUTHOR: Michael McLennan, Purdue University |
---|
| 8 | # Copyright (c) 2004 Purdue Research Foundation, West Lafayette, IN |
---|
| 9 | # ====================================================================== |
---|
| 10 | #\ |
---|
| 11 | exec tclsh "$0" "*$" |
---|
| 12 | # ---------------------------------------------------------------------- |
---|
| 13 | # tclsh executes everything from here on... |
---|
| 14 | |
---|
| 15 | package require Rappture |
---|
| 16 | |
---|
| 17 | # open the XML file containing the run parameters |
---|
| 18 | set driver [Rappture::library driver.xml] |
---|
| 19 | |
---|
| 20 | set T 300 |
---|
| 21 | set Ef -5.5 |
---|
| 22 | |
---|
| 23 | set kT [expr {8.61734e-5 * $T}] |
---|
| 24 | set Emin [expr {$Ef - 10*$kT}] |
---|
| 25 | set Emax [expr {$Ef + 10*$kT}] |
---|
| 26 | |
---|
| 27 | set xy "" |
---|
| 28 | set E $Emin |
---|
| 29 | set dE [expr {0.005*($Emax-$Emin)}] |
---|
| 30 | while {$E < $Emax} { |
---|
| 31 | set f [expr {1.0/(1.0 + exp(($E - $Ef)/$kT))}] |
---|
| 32 | append xy "$f $E\n" |
---|
| 33 | set E [expr {$E + $dE}] |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | $driver put output.curve(f12).label "Fermi-Dirac Factor" |
---|
| 37 | $driver put output.curve(f12).component.xy $xy |
---|
| 38 | |
---|
| 39 | # |
---|
| 40 | # Save the updated XML describing the run... |
---|
| 41 | # Be sure to do this back in the original directory |
---|
| 42 | # |
---|
| 43 | set fid [open run.xml w] |
---|
| 44 | puts $fid "<?xml version=\"1.0\"?>" |
---|
| 45 | puts $fid [$driver xml] |
---|
| 46 | close $fid |
---|
Note: See
TracBrowser
for help on using the repository browser.