Sha256: 6e554a016131a82c571dcc15853d5167616cced632437097563d1efd69751d73
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
#! /usr/bin/env ruby # coding: utf-8 # Show state of vasp geometry optimization calculations. #require "vasputils/calcseries.rb" require "rubygems" gem "vasputils" require "vasputils/vaspgeomopt.rb" require "vasputils/vaspdir.rb" require "pp" #require "optparse" LONGEST_STATE = :terminated.size KLASSES = [VaspDir, VaspGeomOpt] dirs = ARGV dirs = Dir.glob("*").sort if ARGV.empty? def guess(dir) KLASSES.each do |klass| begin vd = klass.new(dir) return klass rescue klass::InitializeError end end raise "Cannot identify class for directory #{dir}." end dirs.each do |dir| next unless File.directory? dir begin klass = guess(dir) klass_name = klass.to_s rescue klass_name = "UnknownDir" end printf "%-11s ", klass_name case klass_name when "VaspDir" calc = klass.new(dir) printf "%-10s ", calc.state #pp calc.outcar printf "%5s ", "" begin outcar = calc.outcar printf "%8.3f %3d (%3d) ", outcar[:totens][-1], outcar[:ionic_steps], outcar[:electronic_steps] rescue printf "%8s %3s (%3s) ", " "*8, " "*3, " "*3 end when "VaspGeomOpt" calc = klass.new(dir) printf "%-10s ", calc.state ld = calc.latest_dir printf "%5s ", ld.dir.sub(/.*try/, "try") begin outcar = ld.outcar printf "%8.3f %3d (%3d) ", outcar[:totens][-1], outcar[:ionic_steps], outcar[:electronic_steps] rescue printf "%8s %3s (%3s) ", " "*8, " "*3, " "*3 end when "UnknownDir" printf "-" * 35 printf " " end puts dir end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vasputils-0.0.9 | bin/checkvasp |