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/ } } } 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 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 "Starting VASP at [clock format [clock seconds]]" ::VASP::execute -out VASP.out after 100 } file copy -force INCAR VASP_INCAR file rename -force OUTCAR VASP_OUTCAR file rename -force OSZICAR VASP_OSZICAR file rename -force EIGENVAL VASP_EIGENVAL file copy -force IBZKPT VASP_IBZKPT file copy -force KPOINTS VASP_KPOINTS file copy -force CONTCAR VASP_CONTCAR file copy -force CONTCAR POSCAR if {$SaveWAVECAR && [file exists WAVECAR] && [file size WAVECAR] > 0} { package require Translate WAVECARtoASCII WAVECAR VASP_WAVECAR.txt } catch {file delete -force WAVECAR} puts "Finished VASP! [clock format [clock seconds]]" listFiles } msg]} { puts "Error executing VASP [clock format [clock seconds]]: $msg\n\n$::errorInfo" catch {file copy -force INCAR VASP_INCAR} catch {file rename -force OUTCAR VASP_OUTCAR} catch {file rename -force OSZICAR VASP_OSZICAR} catch {file rename -force EIGENVAL VASP_EIGENVAL} catch {file copy -force IBZKPT VASP_IBZKPT} catch {file copy -force KPOINTS VASP_KPOINTS} catch {file copy -force CONTCAR VASP_CONTCAR} global errorInfo puts "" puts $errorInfo listFiles return }