vasputils 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/bin/checkvasp +6 -5
- data/bin/latticeconstants +13 -8
- data/bin/qsubvasp +5 -5
- data/bin/rmvaspout +40 -0
- data/bin/runvasp +5 -6
- data/bin/symposcar +38 -28
- data/lib/vasputils.rb +11 -0
- data/lib/vasputils/incar.rb +3 -1
- data/lib/vasputils/kpoints.rb +3 -1
- data/lib/vasputils/outcar.rb +46 -31
- data/lib/vasputils/poscar.rb +3 -1
- data/lib/vasputils/potcar.rb +3 -1
- data/lib/vasputils/vaspdir.rb +8 -11
- data/lib/vasputils/{vaspgeomopt.rb → vaspgeometryoptimizer.rb} +6 -5
- data/memo.txt +9 -1
- data/test/test_incar.rb +5 -4
- data/test/test_kpoints.rb +7 -6
- data/test/test_outcar.rb +25 -24
- data/test/test_poscar.rb +11 -10
- data/test/test_potcar.rb +7 -6
- data/test/test_vaspdir.rb +10 -10
- data/test/{test_vaspgeomopt.rb → test_vaspgeometryoptimizer.rb} +21 -20
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try00/CONTCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try00/INCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try00/KPOINTS +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try00/OUTCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try00/POSCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try00/POTCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try01/INCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try01/KPOINTS +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try01/OUTCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try01/POSCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try01/POTCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try00/CONTCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try00/INCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try00/KPOINTS +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try00/OUTCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try00/POSCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try00/POTCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try01/INCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try01/KPOINTS +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try01/OUTCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try01/POSCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try01/POTCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/not-yet/try00/INCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/not-yet/try00/KPOINTS +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/not-yet/try00/POSCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/not-yet/try00/POTCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/CHG +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/CHGCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/CONTCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/DOSCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/EIGENVAL +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/INCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/KPOINTS +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/OSZICAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/OUTCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/PCDAT +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/POSCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/POTCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/WAVECAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/XDATCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/vasprun.xml +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/started/try00/INCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/started/try00/KPOINTS +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/started/try00/POSCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/started/try00/POTCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try00/CONTCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try00/INCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try00/KPOINTS +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try00/OUTCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try00/POSCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try00/POTCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try01/INCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try01/KPOINTS +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try01/POSCAR +0 -0
- data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try01/POTCAR +0 -0
- data/vasputils.gemspec +61 -63
- metadata +82 -84
- data/bin/addVolumeToten.rb +0 -19
- data/lib/vasputils/calcinspector.rb +0 -24
- data/test/test_calcinspector.rb +0 -53
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.10
|
data/bin/checkvasp
CHANGED
|
@@ -6,14 +6,15 @@
|
|
|
6
6
|
#require "vasputils/calcseries.rb"
|
|
7
7
|
require "rubygems"
|
|
8
8
|
gem "vasputils"
|
|
9
|
+
require "vasputils.rb"
|
|
9
10
|
|
|
10
|
-
require "vasputils/vaspgeomopt.rb"
|
|
11
|
-
require "vasputils/vaspdir.rb"
|
|
11
|
+
#require "vasputils/vaspgeomopt.rb"
|
|
12
|
+
#require "vasputils/vaspdir.rb"
|
|
12
13
|
require "pp"
|
|
13
14
|
#require "optparse"
|
|
14
15
|
|
|
15
16
|
LONGEST_STATE = :terminated.size
|
|
16
|
-
KLASSES = [VaspDir,
|
|
17
|
+
KLASSES = [VaspUtils::VaspDir, VaspUtils::VaspGeometryOptimizer]
|
|
17
18
|
|
|
18
19
|
dirs = ARGV
|
|
19
20
|
dirs = Dir.glob("*").sort if ARGV.empty?
|
|
@@ -42,7 +43,7 @@ dirs.each do |dir|
|
|
|
42
43
|
printf "%-11s ", klass_name
|
|
43
44
|
|
|
44
45
|
case klass_name
|
|
45
|
-
when "VaspDir"
|
|
46
|
+
when "VaspUtils::VaspDir"
|
|
46
47
|
calc = klass.new(dir)
|
|
47
48
|
printf "%-10s ", calc.state
|
|
48
49
|
#pp calc.outcar
|
|
@@ -55,7 +56,7 @@ dirs.each do |dir|
|
|
|
55
56
|
printf "%8s %3s (%3s) ", " "*8, " "*3, " "*3
|
|
56
57
|
end
|
|
57
58
|
|
|
58
|
-
when "
|
|
59
|
+
when "VaspUtils::VaspGeometryOptimizer"
|
|
59
60
|
calc = klass.new(dir)
|
|
60
61
|
printf "%-10s ", calc.state
|
|
61
62
|
|
data/bin/latticeconstants
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
#! /usr/bin/env ruby
|
|
2
2
|
|
|
3
|
-
require "
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
require "rubygems"
|
|
4
|
+
|
|
5
|
+
gem "vasputils"
|
|
6
|
+
require "vasputils.rb"
|
|
7
|
+
|
|
8
|
+
gem "crystalcell"
|
|
9
|
+
require "crystalcell/latticeaxes.rb"
|
|
10
|
+
require "crystalcell/cell.rb"
|
|
6
11
|
|
|
7
12
|
puts " a, b, c, alpha, beta, gamma, volume, file"
|
|
8
13
|
ARGV.each do |file|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
axes = VaspUtils::Poscar.load_file(file).axes
|
|
15
|
+
printf("%8.5f, %8.5f, %8.5f, %6.2f, %6.2f, %6.2f, ",
|
|
16
|
+
*(axes.get_lattice_constants))
|
|
17
|
+
printf("%10.5f, ", Cell.new(axes).calc_volume) # show volume
|
|
18
|
+
puts file
|
|
14
19
|
end
|
data/bin/qsubvasp
CHANGED
|
@@ -25,8 +25,8 @@ gem "comana"
|
|
|
25
25
|
require "comana/queuesubmitter.rb"
|
|
26
26
|
require "comana/machineinfo.rb"
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
require "vasputils
|
|
28
|
+
gem "vasputils"
|
|
29
|
+
require "vasputils.rb"
|
|
30
30
|
|
|
31
31
|
opts = {}
|
|
32
32
|
|
|
@@ -61,15 +61,15 @@ def condition_check(opts)
|
|
|
61
61
|
begin
|
|
62
62
|
conds["target"] = VaspGeomOpt.new(File.expand_path(ARGV[0]))
|
|
63
63
|
conds["command"] = "runvasp -g"
|
|
64
|
-
rescue
|
|
64
|
+
rescue VaspUtils::VaspGeometryOptimizer::NoVaspDirError
|
|
65
65
|
puts "Seem not to be a directory for VaspGeomOpt #{ARGV}"
|
|
66
66
|
exit
|
|
67
67
|
end
|
|
68
68
|
else
|
|
69
69
|
begin
|
|
70
|
-
conds["target"] = VaspDir.new(File.expand_path(ARGV[0]))
|
|
70
|
+
conds["target"] = VaspUtils::VaspDir.new(File.expand_path(ARGV[0]))
|
|
71
71
|
conds["command"] = "runvasp"
|
|
72
|
-
rescue VaspDir::InitializeError
|
|
72
|
+
rescue VaspUtils::VaspDir::InitializeError
|
|
73
73
|
puts "Seem not to be a directory for VaspDir #{ARGV}"
|
|
74
74
|
exit
|
|
75
75
|
end
|
data/bin/rmvaspout
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#! /usr/bin/env ruby
|
|
2
|
+
# coding: utf-8
|
|
3
|
+
|
|
4
|
+
require "optparse"
|
|
5
|
+
|
|
6
|
+
require "fileutils"
|
|
7
|
+
#require "rubygems"
|
|
8
|
+
#gem "vasputils"
|
|
9
|
+
require "vasputils"
|
|
10
|
+
|
|
11
|
+
## option analysis
|
|
12
|
+
OPTIONS = {}
|
|
13
|
+
op = OptionParser.new
|
|
14
|
+
op.on("-f" , "--force" , "Force to remove finished calc."){ OPTIONS[:force] = true}
|
|
15
|
+
op.parse!(ARGV)
|
|
16
|
+
|
|
17
|
+
ARGV.each do |tgt|
|
|
18
|
+
# Checking directory for normal VASP.
|
|
19
|
+
begin
|
|
20
|
+
vd = VaspUtils::VaspDir.new(tgt)
|
|
21
|
+
rescue VaspUtils::VaspDir.InitializeError
|
|
22
|
+
puts "Not VaspDir: #{tgt}"
|
|
23
|
+
next
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Delete
|
|
27
|
+
if OPTIONS[:force] || (! vd.finished?)
|
|
28
|
+
Dir.glob(tgt + "/*").each do |file|
|
|
29
|
+
next if file == tgt + "/INCAR"
|
|
30
|
+
next if file == tgt + "/KPOINTS"
|
|
31
|
+
next if file == tgt + "/POSCAR"
|
|
32
|
+
next if file == tgt + "/POTCAR"
|
|
33
|
+
puts "Deleting #{file}"
|
|
34
|
+
FileUtils.remove_entry_secure file
|
|
35
|
+
end
|
|
36
|
+
else
|
|
37
|
+
puts "Leave finished calc: #{tgt}"
|
|
38
|
+
next
|
|
39
|
+
end
|
|
40
|
+
end
|
data/bin/runvasp
CHANGED
|
@@ -6,8 +6,7 @@ gem "comana"
|
|
|
6
6
|
require "comana/computationmanager.rb"
|
|
7
7
|
|
|
8
8
|
#gem "vasputils"
|
|
9
|
-
require "vasputils
|
|
10
|
-
require "vasputils/vaspgeomopt.rb"
|
|
9
|
+
require "vasputils.rb"
|
|
11
10
|
|
|
12
11
|
require "optparse"
|
|
13
12
|
|
|
@@ -27,8 +26,8 @@ end
|
|
|
27
26
|
|
|
28
27
|
if opts[:geom]
|
|
29
28
|
begin
|
|
30
|
-
calc_dir = VaspGeomOpt.new(dir)
|
|
31
|
-
rescue
|
|
29
|
+
calc_dir = VaspUtils::VaspGeomOpt.new(dir)
|
|
30
|
+
rescue VaspUtils::VaspGeometryOptimizer::NoVaspDirError
|
|
32
31
|
puts "Not suitable for VaspGeomOpt: #{dir}"
|
|
33
32
|
exit
|
|
34
33
|
end
|
|
@@ -36,8 +35,8 @@ elsif opts[:cond]
|
|
|
36
35
|
TODO
|
|
37
36
|
else
|
|
38
37
|
begin
|
|
39
|
-
calc_dir = VaspDir.new(dir)
|
|
40
|
-
rescue VaspDir::InitializeError
|
|
38
|
+
calc_dir = VaspUtils::VaspDir.new(dir)
|
|
39
|
+
rescue VaspUtils::VaspDir::InitializeError
|
|
41
40
|
puts "Not VaspDir: #{dir}"
|
|
42
41
|
exit
|
|
43
42
|
end
|
data/bin/symposcar
CHANGED
|
@@ -1,35 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
#
|
|
3
|
-
#
|
|
2
|
+
# Original version, Copyright (C) 2008 Atsushi Togo, togo.atsushi@gmail.com
|
|
3
|
+
# Little modified by Ippei Kishida. [2012-06-12]
|
|
4
4
|
#
|
|
5
|
-
#
|
|
5
|
+
# This program is free software; you can redistribute it and/or
|
|
6
|
+
# modify it under the terms of the GNU General Public License
|
|
7
|
+
# as published by the Free Software Foundation; either version 2
|
|
8
|
+
# of the License, or (at your option) any later version.
|
|
6
9
|
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
# You should have received a copy of the GNU General Public License
|
|
18
|
-
# along with this program; if not, write to
|
|
19
|
-
# the Free Software Foundation, Inc., 51 Franklin Street,
|
|
20
|
-
# Fifth Floor, Boston, MA 02110-1301, USA, or see
|
|
21
|
-
# http://www.gnu.org/copyleft/gpl.html
|
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
# GNU General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU General Public License
|
|
16
|
+
# along with this program; if not, write to
|
|
17
|
+
# the Free Software Foundation, Inc., 51 Franklin Street,
|
|
18
|
+
# Fifth Floor, Boston, MA 02110-1301, USA, or see
|
|
19
|
+
# http://www.gnu.org/copyleft/gpl.html
|
|
22
20
|
#
|
|
23
21
|
# Usage: symPoscar.rb [OPTION] [structure]
|
|
24
22
|
# OPTION: -s, --symprec= : Symmetry check precision
|
|
25
23
|
|
|
24
|
+
require 'pp'
|
|
26
25
|
require 'optparse'
|
|
27
26
|
require 'getspg.so'
|
|
28
|
-
require 'poscar'
|
|
29
|
-
require 'pp'
|
|
30
27
|
include Getspg
|
|
31
28
|
|
|
29
|
+
#require 'rubygems'
|
|
30
|
+
#gem 'vasputils'
|
|
31
|
+
#require 'vasputils/poscar'
|
|
32
|
+
require 'vasputils.rb'
|
|
33
|
+
|
|
34
|
+
|
|
32
35
|
symprec = 1e-5
|
|
36
|
+
angle_tolerance = -1.0
|
|
33
37
|
nonewline = false
|
|
34
38
|
pos_shift = [0,0,0]
|
|
35
39
|
shift_string = false
|
|
@@ -38,6 +42,7 @@ is_operations = false
|
|
|
38
42
|
is_dataset = false
|
|
39
43
|
opt = OptionParser.new
|
|
40
44
|
opt.on('-s', '--symprec=', 'Symmetry check precision') {|tmp| symprec = tmp.to_f}
|
|
45
|
+
opt.on('-a', '--angle_tolerance=', 'Symmetry check precision for angle between lattice vectors in degrees') {|tmp| angle_tolerance = tmp.to_f}
|
|
41
46
|
opt.on('-d', '--shift=', 'uniform shift of internal atomic positions') {|shift_string|}
|
|
42
47
|
opt.on('-n', '--nonewline', 'Do not output the trailing newline') {nonewline = true}
|
|
43
48
|
opt.on('-l', '--long', 'Long output') {is_long_output = true}
|
|
@@ -46,16 +51,18 @@ opt.on('-d', '--dataset', 'Dataset') {is_dataset = true}
|
|
|
46
51
|
opt.parse!(ARGV)
|
|
47
52
|
|
|
48
53
|
unless ARGV.size == 1
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
puts "Indicate only 1 POSCAR or CONTCAR. Exit."
|
|
55
|
+
exit
|
|
51
56
|
end
|
|
52
57
|
|
|
53
58
|
if shift_string
|
|
54
59
|
pos_shift = []
|
|
55
60
|
shift_string.split.each {|val| pos_shift << val.to_f }
|
|
56
61
|
end
|
|
57
|
-
|
|
58
|
-
|
|
62
|
+
|
|
63
|
+
cell = VaspUtils::Poscar.load_file(ARGV.shift)
|
|
64
|
+
lattice = cell.axes.to_a.transpose
|
|
65
|
+
|
|
59
66
|
names = (cell.atoms.collect {|atom| atom.name}).uniq
|
|
60
67
|
position = []
|
|
61
68
|
types = []
|
|
@@ -73,14 +80,16 @@ end
|
|
|
73
80
|
|
|
74
81
|
if is_long_output
|
|
75
82
|
spg, brv_lattice, brv_positions, brv_types, spgnum =
|
|
76
|
-
refine_cell(types.size, lattice, position, types, symprec)
|
|
83
|
+
refine_cell(types.size, lattice, position, types, symprec, angle_tolerance)
|
|
77
84
|
end
|
|
78
85
|
|
|
79
86
|
spgnum, spg, hall_symbol, t_mat, o_shift,
|
|
80
87
|
rotations, translations, wyckoffs = get_dataset( lattice,
|
|
81
88
|
position,
|
|
82
89
|
types,
|
|
83
|
-
symprec
|
|
90
|
+
symprec,
|
|
91
|
+
angle_tolerance)
|
|
92
|
+
ptg_symbol, ptg_num, trans_mat = getptg(rotations)
|
|
84
93
|
|
|
85
94
|
if spgnum > 0
|
|
86
95
|
if nonewline
|
|
@@ -136,11 +145,12 @@ if is_operations
|
|
|
136
145
|
lattice,
|
|
137
146
|
position,
|
|
138
147
|
types,
|
|
139
|
-
symprec
|
|
148
|
+
symprec,
|
|
149
|
+
angle_tolerance)
|
|
140
150
|
end
|
|
141
151
|
|
|
142
152
|
|
|
143
|
-
if is_operations
|
|
153
|
+
if is_operations or is_dataset
|
|
144
154
|
rotations.size.times do |i|
|
|
145
155
|
puts "- # ----#{i+1}----"
|
|
146
156
|
puts " rotation:"
|
data/lib/vasputils.rb
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module VaspUtils; end
|
|
2
|
+
|
|
3
|
+
require "vasputils/incar.rb"
|
|
4
|
+
require "vasputils/kpoints.rb"
|
|
5
|
+
require "vasputils/outcar.rb"
|
|
6
|
+
require "vasputils/poscar.rb"
|
|
7
|
+
require "vasputils/potcar.rb"
|
|
8
|
+
require "vasputils/vaspdir.rb"
|
|
9
|
+
require "vasputils/vaspgeometryoptimizer.rb"
|
|
10
|
+
require "vasputils/vaspkpointsfinder.rb"
|
|
11
|
+
|
data/lib/vasputils/incar.rb
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
#! /usr/bin/env ruby
|
|
2
2
|
# coding: utf-8
|
|
3
3
|
|
|
4
|
+
require "vasputils.rb"
|
|
5
|
+
|
|
4
6
|
# see http://cms.mpi.univie.ac.at/vasp/vasp/INCAR_File.html
|
|
5
7
|
#
|
|
6
8
|
# INCAR のフォーマット
|
|
@@ -17,7 +19,7 @@
|
|
|
17
19
|
# Class to utilize INCAR file of VASP.
|
|
18
20
|
# まず、自分で使う範囲だけ作る。
|
|
19
21
|
# あとで余力があれば精密化する。
|
|
20
|
-
module Incar
|
|
22
|
+
module VaspUtils::Incar
|
|
21
23
|
#
|
|
22
24
|
#def initialize()
|
|
23
25
|
#end
|
data/lib/vasputils/kpoints.rb
CHANGED
data/lib/vasputils/outcar.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require "vasputils.rb"
|
|
2
|
+
|
|
1
3
|
# OUTCAR をパースする。
|
|
2
4
|
# 精確には行わず、必要な情報だけをピックアップする感じ。
|
|
3
5
|
#
|
|
@@ -9,50 +11,63 @@
|
|
|
9
11
|
#
|
|
10
12
|
# 基本的に終了した計算から情報を取り出すには vasprun.xml を読む。
|
|
11
13
|
# OUTCAR は終了する前も含めてなんか簡単に見るために使う、という位置付けで。
|
|
12
|
-
|
|
13
|
-
module Outcar
|
|
14
|
+
module VaspUtils::Outcar
|
|
14
15
|
#toten は全 electronic and ionic steps のを flat に並べただけのもの。
|
|
15
16
|
#必要なら構造化するが、現状その予定はない。
|
|
16
17
|
#attr_reader :name
|
|
17
18
|
#attr_reader :ionic_steps, :electronic_steps, :totens, :volumes, :elapsed_time
|
|
18
19
|
|
|
19
20
|
def self.load_file(file)
|
|
21
|
+
raise Errno::ENOENT unless File.exist?(file)
|
|
22
|
+
|
|
20
23
|
results = {}
|
|
21
24
|
results[:name] = file
|
|
22
|
-
results[:irreducible_kpoints] = nil
|
|
23
|
-
results[:electronic_steps ] = 0
|
|
24
|
-
results[:ionic_steps ] = 0
|
|
25
|
-
results[:totens ] = []
|
|
26
|
-
results[:volumes ] = []
|
|
25
|
+
#results[:irreducible_kpoints] = nil
|
|
26
|
+
#results[:electronic_steps ] = 0
|
|
27
|
+
#results[:ionic_steps ] = 0
|
|
28
|
+
#results[:totens ] = []
|
|
29
|
+
#results[:volumes ] = []
|
|
27
30
|
results[:elapsed_time ] = nil
|
|
28
31
|
results[:normal_ended ] = false
|
|
29
32
|
|
|
30
|
-
lines = File.readlines(file)
|
|
31
|
-
lines.each do |line|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
33
|
+
#lines = File.readlines(file)
|
|
34
|
+
#lines.each do |line|
|
|
35
|
+
# #if /Found\s+(\d+)\s+irreducible k-points/i =~ line
|
|
36
|
+
# # results[:irreducible_kpoints] = $1.to_i
|
|
37
|
+
# #end
|
|
38
|
+
|
|
39
|
+
# #if /^-* Iteration\s+(\d+)/ =~ line
|
|
40
|
+
# # results[:ionic_steps ] = $1.to_i
|
|
41
|
+
# # results[:electronic_steps] += 1
|
|
42
|
+
# #end
|
|
43
|
+
|
|
44
|
+
# ##if /free\s+energy\s+TOTEN\s+=\s(.*)\s+eV/ =~ line
|
|
45
|
+
# #if /TOTEN\s+=\s(.*)\s+eV/ =~ line
|
|
46
|
+
# # results[:totens] << $1.to_f
|
|
47
|
+
# #end
|
|
48
|
+
|
|
49
|
+
# #if /volume of cell :\s+(\d+\.\d+)$/ =~ line
|
|
50
|
+
# # results[:volumes] << $1.to_f
|
|
51
|
+
# #end
|
|
52
|
+
#end
|
|
53
|
+
|
|
54
|
+
lines = `grep Iteration #{file}`.split("\n")
|
|
55
|
+
results[:electronic_steps] = lines.size
|
|
56
|
+
/^-* Iteration\s+(\d+)/ =~ lines[-1]
|
|
57
|
+
results[:ionic_steps ] = $1.to_i
|
|
58
|
+
|
|
59
|
+
results[:totens] = `grep TOTEN #{file}`.split("\n").map do |line|
|
|
60
|
+
/TOTEN\s+=\s(.*)\s+eV/ =~ line
|
|
61
|
+
$1.to_f
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
line = `tail -q -n 8 #{file}| head -n 1`
|
|
65
|
+
if (/Elapsed time \(sec\):\s+(\d+\.\d+)/ =~ line)
|
|
66
|
+
results[:elapsed_time] = $1.to_f
|
|
53
67
|
end
|
|
54
68
|
|
|
55
|
-
|
|
69
|
+
line = `tail -q -n 1 #{file}`
|
|
70
|
+
results[:normal_ended] = true if (/Voluntary context switches:/ =~ line)
|
|
56
71
|
|
|
57
72
|
results
|
|
58
73
|
end
|
data/lib/vasputils/poscar.rb
CHANGED
|
@@ -4,6 +4,8 @@ require "rubygems"
|
|
|
4
4
|
gem "crystalcell"
|
|
5
5
|
require "crystalcell/cell.rb"
|
|
6
6
|
|
|
7
|
+
require "vasputils.rb"
|
|
8
|
+
|
|
7
9
|
# Class to manage POSCAR format of VASP.
|
|
8
10
|
#
|
|
9
11
|
# parse と dump のどちらかだけでなく、両方を統括して扱うクラス。
|
|
@@ -16,7 +18,7 @@ require "crystalcell/cell.rb"
|
|
|
16
18
|
# こうしておくことで POTCAR がない環境でも POSCAR を扱うことができる。
|
|
17
19
|
#
|
|
18
20
|
# VASP 5 系を使うようになれば事情が変わるだろう。
|
|
19
|
-
class Poscar
|
|
21
|
+
class VaspUtils::Poscar
|
|
20
22
|
|
|
21
23
|
class ElementMismatchError < Exception; end
|
|
22
24
|
class ParseError < Exception; end
|