28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'bin/incar', line 28
def generate(*args)
incar = VaspUtils::Incar.new
if options[:load] || options[:overwrite]
incar = VaspUtils::Incar.load_file(options[:load] || options[:overwrite])
end
args.each do |str|
if /(.*)=(.*)/ =~ str
key = $1.strip
val = $2.strip
incar[key] = val
else
setting = VaspUtils::Setting.new
begin
setting["incar"][str].each do |key,val|
incar[key] = val
end
rescue
puts "No entry in #{setting.filename}: #{str}"
puts "Exit"
exit
end
end
end
if options[:enmax]
potcar = VaspUtils::Potcar.load_file(options[:enmax])
incar['ENCUT'] = potcar.enmaxes.max
end
if options[:enmax130]
potcar = VaspUtils::Potcar.load_file(options[:enmax130])
incar['ENCUT'] = potcar.enmaxes.max * 1.3
end
if options[:overwrite]
io = File.open( options[:overwrite], 'w')
else
io = STDOUT
end
incar.dump(io)
end
|