75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
# File 'bin/vaspdir', line 75
def show(* args)
tgt_properties = []
show_dir_states = []
show_dir_states << :finished if options[:finished]
show_dir_states << :yet if options[:yet]
show_dir_states << :terminated if options[:terminated]
show_dir_states << :started if options[:started]
tgt_properties << :state if options[:state]
tgt_properties << :toten if options[:toten]
tgt_properties << :ionic_steps if options[:ionic_steps]
tgt_properties << :last_update if options[:last_update]
tgt_properties << :encut if options[:encut]
tgt_properties << :kpoints if options[:kpoints]
dirs = args
dirs = ["."] if args.empty?
if options[:all_items]
tgt_properties = INSPECT_ALL_ITEMS
elsif options[:dirs_with_matches]
tgt_properties = [:dir]
elsif tgt_properties == nil || tgt_properties.empty?
tgt_properties = INSPECT_DEFAULT_ITEMS
else
tgt_properties = tgt_properties.push :dir
end
unless options[:dirs_with_matches]
results = {
:klass_name => "TYPE",
:kpoints => "KPOINTS",
:encut => "ENCUT",
:state => "STATE",
:toten => "TOTEN",
:i_step => "I_S", :e_step => "E_S", :time => "LAST_UPDATE_AGO",
:dir => "DIR"
}
show_items(results, tgt_properties)
end
dirs.each do |dir|
next unless File.directory? dir
begin
klass_name = "VaspDir"
calc = VaspUtils::VaspDir.new(dir)
state = calc.state
begin
outcar = calc.outcar
toten = sprintf("%9.6f", outcar[:totens][-1].to_f)
i_step = outcar[:ionic_steps]
e_step = outcar[:electronic_steps]
time = form_time(Time.now - calc.latest_modified_time)
kp = calc.kpoints
if kp.scheme == :automatic
k_str = kp.mesh.join("x")
else
k_str = kp.points.size.to_s
end
encut = calc.incar["ENCUT"]
rescue
toten = i_step = e_step = time = k_str = encut = ""
end
rescue VaspUtils::VaspDir::InitializeError
klass_name = "-------"
end
results = {
:klass_name => klass_name,
:kpoints => k_str,
:encut => encut,
:state => state,
:toten => toten,
:i_step => i_step,
:e_step => e_step,
:time => time,
:dir => dir,
}
if show_dir_states.empty?
show_items(results, tgt_properties)
else
if show_dir_states.include? results[:state]
show_items(results, tgt_properties)
end
end
end
end
|