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

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.

  • Property svn:executable set to *
File size: 1.3 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 driver.xml]
19
20set T 300
21set Ef -5.5
22
23set kT [expr {8.61734e-5 * $T}]
24set Emin [expr {$Ef - 10*$kT}]
25set Emax [expr {$Ef + 10*$kT}]
26
27set xy ""
28set E $Emin
29set dE [expr {0.005*($Emax-$Emin)}]
30while {$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#
43set fid [open run.xml w]
44puts $fid "<?xml version=\"1.0\"?>"
45puts $fid [$driver xml]
46close $fid
Note: See TracBrowser for help on using the repository browser.