source: trunk/examples/app-fermi/fermi @ 55

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

adding fermi_fortran as an example of a working app

  • Property svn:executable set to *
File size: 1.6 KB
Line 
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#\
11exec tclsh "$0" "$*"
12# ----------------------------------------------------------------------
13# tclsh executes everything from here on...
14
15package require Rappture
16
17# open the XML file containing the run parameters
18set driver [Rappture::library [lindex $argv 0]]
19
20set T [$driver get input.(temperature).current]
21set T [Rappture::Units::convert $T -to K -units off]
22set Ef [$driver get input.(Ef).current]
23set Ef [Rappture::Units::convert $Ef -to eV -units off]
24
25set kT [expr {8.61734e-5 * $T}]
26set Emin [expr {$Ef - 10*$kT}]
27set Emax [expr {$Ef + 10*$kT}]
28
29set xy ""
30set E $Emin
31set dE [expr {0.005*($Emax-$Emin)}]
32while {$E < $Emax} {
33    set f [expr {1.0/(1.0 + exp(($E - $Ef)/$kT))}]
34    append xy "$f $E\n"
35    set E [expr {$E + $dE}]
36}
37
38$driver put output.curve(f12).about.label "Fermi-Dirac Factor"
39$driver put output.curve(f12).xaxis.label "Energy"
40$driver put output.curve(f12).xaxis.units "eV"
41$driver put output.curve(f12).component.xy $xy
42
43#
44# Save the updated XML describing the run...
45# Be sure to do this back in the original directory
46#
47set rfile "run[clock seconds].xml"
48set fid [open $rfile w]
49puts $fid "<?xml version=\"1.0\"?>"
50puts $fid [$driver xml]
51close $fid
52
53puts "=RAPPTURE-RUN=>$rfile"
Note: See TracBrowser for help on using the repository browser.