cd /share/apps/medea/MD/TaskServer/Tasks/v-hpc-medea.nwu.ac.za-32000-task42132
package require starkit
source /state/partition1/apps/medea/MD/bin/generic/TaskServer.kit
source /state/partition1/apps/medea/MD/bin/generic/tcllib.kit
lappend auto_path /state/partition1/apps/medea/MD/TaskServer/Tools
namespace eval ::task {variable id 42132.v-hpc-medea.nwu.ac.za-32000}
namespace eval ::JobServer {variable JobServer http://v-hpc-medea.nwu.ac.za:32000}
namespace eval ::TaskServer {variable InstallDir /state/partition1/apps/medea/MD}
array set Options {finishedtasks 41613.v-hpc-medea.nwu.ac.za-32000 -remote 0 -ntasks 6 -id http://mufasa.nwu.ac.za:23000/taskserver -port 23000 wd /share/apps/medea/MD/TaskServer -batch_queue chem-2 -delay 0 interval 60 -core_limit_type 0 -machines {} -ruser {} -rdir {} -css {SmallFontSizePixels 12 FontFamily {"Palatino Linotype", "Book Antiqua", "Palatino", "Georgia", "serif"} BannerHighlightColor #A0B01E AdminBannerColor #0A4A54 BackgroundColor #FFFFFF AdminHighlightColor #3B8993 SmallestFontSizePixels 10 BannerColor #202020 FontColor #202020 TableColor #202020 TaskServerBannerColor #3D2527 FontSizePixels 14} InstallDir /state/partition1/apps/medea/MD tasks {42102.v-hpc-medea.nwu.ac.za-32000 42126.v-hpc-medea.nwu.ac.za-32000} -control_type 1 -path {} -queue_type PBS -batch_project {} -usehttps 0 -displayloglevel debug -rhost {} -rwdir {} -nprocessors 128 -webmaster Support@MaterialsDesign.com -type {} -loglevel notice}
set Options(taskdir) /share/apps/medea/MD/TaskServer/Tasks/v-hpc-medea.nwu.ac.za-32000-task42132
set Options(-nprocessors) 64
#
# The MedeA environment
#
set ::MedeA::platform Linux-x86_64
set ::MDPriv {logfile /share/apps/medea/MD/TaskServer/logs/mufasa.nwu.ac.za.log}
array set ::MedeA::Directory {bin /state/partition1/apps/medea/MD/bin/Linux-x86_64 TaskServer /state/partition1/apps/medea/MD/bin/generic/TaskServer.kit user_medea /home/medea/MedeA tcllib /state/partition1/apps/medea/MD/bin/generic/tcllib.kit wd /share/apps/medea/MD/TaskServer generic /state/partition1/apps/medea/MD/bin/generic flowcharts /state/partition1/apps/medea/MD/data/Flowcharts.kit tmp /home/medea/MedeA/tmp data /state/partition1/apps/medea/MD/data medealib /state/partition1/apps/medea/MD/bin/generic/MedeALib.kit binarylib /state/partition1/apps/medea/MD/bin/Linux-x86_64/Linux-x86_64.kit MedeA /home/medea/MedeA root /state/partition1/apps/medea/MD platform /state/partition1/apps/medea/MD/bin/Linux-x86_64/Linux-x86_64.kit realbin /state/partition1/apps/medea/MD/bin/Linux-x86_64 binarykit /state/partition1/apps/medea/MD/bin/Linux-x86_64/Linux-x86_64.kit forcefields /state/partition1/apps/medea/MD/data/Forcefields.kit user /home/medea}
namespace eval job {
	variable id 596
	variable url http://v-hpc-medea.nwu.ac.za:32000
	variable dir /home/medea/MD/Jobs/dir500/596
	variable useSecurity 0
}
set SaveWAVECAR 0
set SaveWAVEDER 0
set SaveOPTIC 0

	    proc listFiles {} {
		puts "\nFiles:"
		foreach file [lsort [glob -nocomplain *]] {
		    if {[catch {file mtime $file} T]} {
			set T "--- -- --:--:--"
		    } else {
			set T [clock format $T -format "%b %d %T"]
		    }
		    puts [format "%15d %s %s" [file size $file] $T $file]
		}
		puts ""
	    }
	    proc saveFiles {dir} {
		file mkdir $dir
		foreach file {INCAR POSCAR POTCAR KPOINTS WAVECAR CHGCAR} {
		    if {[file exists $file]} {
			file copy -force $file Initial/
		    }
		}
	    }
	
		    package require JobServer
		    package require Translate
			::JobServer::getFile 596 "Stage_1/WAVECAR.txt" WAVECAR.txt

		    WAVECARtoBinary
		    catch {file delete -force WAVECAR.txt}
			set nsteps 1
	package require VASP 5.0
	    if {[catch {
		listFiles

		if {$nsteps > 1} {

		    for {set nstep 0} {$nstep <= $nsteps} {incr nstep} {
			file copy -force INCAR$nstep INCAR
			file copy -force mdlicense$nstep.txt mdlicense.txt
			puts "Starting VASP step $nstep for the DOS calculation at [clock format [clock seconds]]"
			::VASP::execute -out VASP.out
			after 100
			file rename -force VASP.out VASP$nstep.out
		    }
		    set fd [open VASP.out a]
		    for {set nstep 0} {$nstep <= $nsteps} {incr nstep} {
			if {[file exists VASP$nstep.out]} {
			    set fdnstep [open VASP$nstep.out r]
			    puts $fd [read $fdnstep]
			    close $fdnstep
			}
		    } 
		    close $fd

		} else {

		    puts "Running the DOS calculation"
		    ::VASP::execute -out VASP.out
		    after 100

		}

		if {$SaveWAVECAR && [file exists WAVECAR] && [file size WAVECAR] > 0} {
		    package require Translate
		    WAVECARtoASCII WAVECAR VASP_WAVECAR.txt
		}
		catch {file delete -force WAVECAR}
		if {$SaveOPTIC && [file exists OPTIC] && [file size OPTIC] > 0} {
		    package require Translate
		    OPTICtoASCII OPTIC OPTIC.txt
		}
		puts "Finished the DOS!"
		listFiles
	    } msg]} {
		puts "Error with the DOS: $msg"
		puts ""
		puts $::errorInfo
		listFiles
	    }
	
	    # Temporarily delete WAVECAR until Job server changes propagate through
	    if {[file exists VASP_WAVECAR.txt] && [file exists WAVECAR]} {
		file delete -force WAVECAR
	    }
	
exit