vasputils 0.0.8 → 0.0.9
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 +79 -0
- data/bin/runvasp +23 -5
- data/lib/vasputils/vaspdir.rb +6 -0
- data/lib/vasputils/vaspgeomopt.rb +19 -19
- data/lib/vasputils/vaspkpointsfinder.rb +72 -0
- data/memo.txt +5 -0
- data/test/test_calcinspector.rb +29 -29
- data/test/test_incar.rb +109 -109
- data/test/test_kpoints.rb +92 -92
- data/test/test_outcar.rb +154 -154
- data/test/test_poscar.rb +184 -184
- data/test/test_potcar.rb +52 -52
- data/test/test_vaspdir.rb +10 -0
- data/test/test_vaspkpointsfinder.rb +25 -0
- data/test/vaspkpointsfinder/01-01-01/try00/INCAR +17 -0
- data/test/vaspkpointsfinder/01-01-01/try00/KPOINTS +6 -0
- data/test/vaspkpointsfinder/01-01-01/try00/POSCAR +8 -0
- data/test/vaspkpointsfinder/01-01-01/try00/POTCAR +0 -0
- data/vasputils.gemspec +10 -6
- metadata +31 -29
- data/bin/lsvasp +0 -95
- data/bin/lsvaspdir +0 -63
- data/bin/lsvaspseries +0 -95
data/test/test_kpoints.rb
CHANGED
@@ -7,104 +7,104 @@ require "vasputils/kpoints.rb"
|
|
7
7
|
|
8
8
|
class TC_Kpoints < Test::Unit::TestCase
|
9
9
|
|
10
|
-
|
10
|
+
$tolerance = 1E-10
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
12
|
+
def test_self_parse
|
13
|
+
io = StringIO.new
|
14
|
+
io.puts "Automatic mesh"
|
15
|
+
io.puts "0"
|
16
|
+
io.puts "Monkhorst Pack"
|
17
|
+
io.puts " 1 2 3"
|
18
|
+
io.puts " 0.4 0.5 0.6"
|
19
|
+
io.rewind
|
20
|
+
k00 = Kpoints.parse(io)
|
21
|
+
assert_equal("Automatic mesh", k00[:comment])
|
22
|
+
assert_equal(:monkhorst, k00[:type])
|
23
|
+
assert_equal([1, 2, 3], k00[:mesh])
|
24
|
+
#pp k00
|
25
|
+
assert_in_delta(0.4, k00[:shift][0], $tolerance)
|
26
|
+
assert_in_delta(0.5, k00[:shift][1], $tolerance)
|
27
|
+
assert_in_delta(0.6, k00[:shift][2], $tolerance)
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
29
|
+
io = StringIO.new
|
30
|
+
io.puts "Automatic mesh"
|
31
|
+
io.puts "0"
|
32
|
+
io.puts "Gamma-Center"
|
33
|
+
io.puts " 1 2 3"
|
34
|
+
io.puts " 0.4 0.5 0.6"
|
35
|
+
io.rewind
|
36
|
+
k01 = Kpoints.parse(io)
|
37
|
+
assert_equal("Automatic mesh", k01[:comment])
|
38
|
+
assert_equal(:gamma_center, k01[:type])
|
39
|
+
assert_equal([1, 2, 3], k01[:mesh])
|
40
|
+
assert_in_delta(0.4, k01[:shift][0])
|
41
|
+
assert_in_delta(0.5, k01[:shift][1])
|
42
|
+
assert_in_delta(0.6, k01[:shift][2])
|
43
|
+
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
def test_self_load_file
|
46
|
+
k00 = Kpoints.load_file("test/kpoints/m123-456")
|
47
|
+
assert_equal("Automatic mesh", k00[:comment])
|
48
|
+
assert_equal(:monkhorst, k00[:type])
|
49
|
+
assert_equal([1, 2, 3], k00[:mesh])
|
50
|
+
assert_in_delta(0.4, k00[:shift][0])
|
51
|
+
assert_in_delta(0.5, k00[:shift][1])
|
52
|
+
assert_in_delta(0.6, k00[:shift][2])
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
54
|
+
k01 = Kpoints.load_file("test/kpoints/g123-456")
|
55
|
+
assert_equal("Automatic mesh", k01[:comment])
|
56
|
+
assert_equal(:gamma_center, k01[:type])
|
57
|
+
assert_equal([1, 2, 3], k01[:mesh])
|
58
|
+
assert_in_delta(0.4, k01[:shift][0])
|
59
|
+
assert_in_delta(0.5, k01[:shift][1])
|
60
|
+
assert_in_delta(0.6, k01[:shift][2])
|
61
|
+
end
|
62
62
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
63
|
+
def test_dump
|
64
|
+
hash = {
|
65
|
+
:comment => "Automatic mesh",
|
66
|
+
:type => :monkhorst,
|
67
|
+
:mesh => [1, 2, 3],
|
68
|
+
:shift => [0.4, 0.5, 0.6],
|
69
|
+
}
|
70
|
+
io = StringIO.new
|
71
|
+
Kpoints.dump(hash, io)
|
72
|
+
io.rewind
|
73
|
+
results = io.readlines
|
74
|
+
corrects = [
|
75
|
+
"Automatic mesh\n",
|
76
|
+
"0\n",
|
77
|
+
"Monkhorst\n",
|
78
|
+
"1 2 3\n",
|
79
|
+
"0.4 0.5 0.6\n",
|
80
|
+
]
|
81
|
+
corrects.each_with_index do |line, index|
|
82
|
+
assert_equal(line, results[index], "line #{index + 1}")
|
83
|
+
end
|
84
|
+
assert_equal(corrects.size, results.size)
|
85
85
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
86
|
+
hash = {
|
87
|
+
:comment => "Automatic mesh",
|
88
|
+
:type => :gamma_center,
|
89
|
+
:mesh => [1, 2, 3],
|
90
|
+
:shift => [0.4, 0.5, 0.6],
|
91
|
+
}
|
92
|
+
io = StringIO.new
|
93
|
+
Kpoints.dump(hash, io)
|
94
|
+
io.rewind
|
95
|
+
results = io.readlines
|
96
|
+
corrects = [
|
97
|
+
"Automatic mesh\n",
|
98
|
+
"0\n",
|
99
|
+
"Gamma_center\n",
|
100
|
+
"1 2 3\n",
|
101
|
+
"0.4 0.5 0.6\n",
|
102
|
+
]
|
103
|
+
corrects.each_with_index do |line, index|
|
104
|
+
assert_equal(line, results[index], "line #{index + 1}")
|
105
|
+
end
|
106
|
+
assert_equal(corrects.size, results.size)
|
107
|
+
end
|
108
108
|
|
109
109
|
end
|
110
110
|
|
data/test/test_outcar.rb
CHANGED
@@ -4,159 +4,159 @@ require 'test/unit'
|
|
4
4
|
require 'vasputils/outcar.rb'
|
5
5
|
|
6
6
|
class TC_Outcar < Test::Unit::TestCase
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
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
|
-
|
7
|
+
$tolerance = 10**(-10)
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@o01 = Outcar.load_file( "test/outcar/01-13-FIN.OUTCAR" )
|
11
|
+
@o01int = Outcar.load_file( "test/outcar/01-03-INT.OUTCAR" )
|
12
|
+
@o02 = Outcar.load_file( "test/outcar/02-05-FIN.OUTCAR" )
|
13
|
+
@o03 = Outcar.load_file( "test/outcar/03-05-FIN.OUTCAR" )
|
14
|
+
@o04 = Outcar.load_file( "test/outcar/10-01-FIN.OUTCAR" )
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_self_load_file
|
18
|
+
assert_raise(Errno::ENOENT){Outcar.load_file( "" )}
|
19
|
+
end
|
20
|
+
|
21
|
+
#def test_nsw
|
22
|
+
# assert_equal(100, @o01.nsw )
|
23
|
+
# assert_equal(100, @o01int.nsw )
|
24
|
+
# assert_equal( 2, @o02.nsw )
|
25
|
+
# assert_equal(100, @o03.nsw )
|
26
|
+
#end
|
27
|
+
|
28
|
+
def test_normal_ended?
|
29
|
+
assert_equal(true , @o01 [:normal_ended])
|
30
|
+
assert_equal(false, @o01int[:normal_ended])
|
31
|
+
assert_equal(true , @o02 [:normal_ended])
|
32
|
+
assert_equal(true , @o03 [:normal_ended])
|
33
|
+
assert_equal(true , @o04 [:normal_ended])
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_ionic_steps
|
37
|
+
assert_equal( 1, @o01 [:ionic_steps])
|
38
|
+
assert_equal( 1, @o01int[:ionic_steps])
|
39
|
+
assert_equal( 2, @o02 [:ionic_steps])
|
40
|
+
assert_equal( 3, @o03 [:ionic_steps])
|
41
|
+
assert_equal(10, @o04 [:ionic_steps])
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_electronic_steps
|
45
|
+
assert_equal(13, @o01 [:electronic_steps])
|
46
|
+
assert_equal( 3, @o01int[:electronic_steps])
|
47
|
+
assert_equal(18, @o02 [:electronic_steps])
|
48
|
+
assert_equal(23, @o03 [:electronic_steps])
|
49
|
+
assert_equal(30, @o04 [:electronic_steps])
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_totens
|
53
|
+
assert_in_delta( 64.17161363, @o01int[:totens][ 0], $tolerance )
|
54
|
+
assert_in_delta( -11.78292768, @o01int[:totens][ 1], $tolerance )
|
55
|
+
assert_in_delta( -19.56675908, @o01int[:totens][ 2], $tolerance )
|
56
|
+
|
57
|
+
assert_in_delta( 64.17161363, @o01 [:totens][ 0], $tolerance)
|
58
|
+
assert_in_delta( -11.78292768, @o01 [:totens][ 1], $tolerance)
|
59
|
+
assert_in_delta( -19.56675908, @o01 [:totens][ 2], $tolerance)
|
60
|
+
assert_in_delta( -19.74290414, @o01 [:totens][ 3], $tolerance)
|
61
|
+
assert_in_delta( -19.74509430, @o01 [:totens][ 4], $tolerance)
|
62
|
+
assert_in_delta( -15.85257458, @o01 [:totens][ 5], $tolerance)
|
63
|
+
assert_in_delta( -15.67846403, @o01 [:totens][ 6], $tolerance)
|
64
|
+
assert_in_delta( -15.65919488, @o01 [:totens][ 7], $tolerance)
|
65
|
+
assert_in_delta( -15.64209986, @o01 [:totens][ 8], $tolerance)
|
66
|
+
assert_in_delta( -15.64268703, @o01 [:totens][ 9], $tolerance)
|
67
|
+
assert_in_delta( -15.64251873, @o01 [:totens][10], $tolerance)
|
68
|
+
assert_in_delta( -15.64251991, @o01 [:totens][11], $tolerance)
|
69
|
+
assert_in_delta( -15.64251763, @o01 [:totens][12], $tolerance)
|
70
|
+
assert_in_delta( -15.642518 , @o01 [:totens][13], $tolerance)
|
71
|
+
|
72
|
+
assert_in_delta( 64.17161363, @o02 [:totens][ 0], $tolerance )
|
73
|
+
assert_in_delta( -11.78292768, @o02 [:totens][ 1], $tolerance )
|
74
|
+
assert_in_delta( -19.56675908, @o02 [:totens][ 2], $tolerance )
|
75
|
+
assert_in_delta( -19.74290414, @o02 [:totens][ 3], $tolerance )
|
76
|
+
assert_in_delta( -19.74509430, @o02 [:totens][ 4], $tolerance )
|
77
|
+
assert_in_delta( -15.85257458, @o02 [:totens][ 5], $tolerance )
|
78
|
+
assert_in_delta( -15.67846403, @o02 [:totens][ 6], $tolerance )
|
79
|
+
assert_in_delta( -15.65919488, @o02 [:totens][ 7], $tolerance )
|
80
|
+
assert_in_delta( -15.64209986, @o02 [:totens][ 8], $tolerance )
|
81
|
+
assert_in_delta( -15.64268703, @o02 [:totens][ 9], $tolerance )
|
82
|
+
assert_in_delta( -15.64251873, @o02 [:totens][10], $tolerance )
|
83
|
+
assert_in_delta( -15.64251991, @o02 [:totens][11], $tolerance )
|
84
|
+
assert_in_delta( -15.64251763, @o02 [:totens][12], $tolerance )
|
85
|
+
assert_in_delta( -15.642518 , @o02 [:totens][13], $tolerance )
|
86
|
+
assert_in_delta( -15.65990112, @o02 [:totens][14], $tolerance )
|
87
|
+
assert_in_delta( -15.64955447, @o02 [:totens][15], $tolerance )
|
88
|
+
assert_in_delta( -15.64799040, @o02 [:totens][16], $tolerance )
|
89
|
+
assert_in_delta( -15.64765795, @o02 [:totens][17], $tolerance )
|
90
|
+
assert_in_delta( -15.64765312, @o02 [:totens][18], $tolerance )
|
91
|
+
assert_in_delta( -15.647653 , @o02 [:totens][19], $tolerance )
|
92
|
+
|
93
|
+
assert_in_delta( 64.17161363, @o03 [:totens][ 0], $tolerance )
|
94
|
+
assert_in_delta( -11.78292768, @o03 [:totens][ 1], $tolerance )
|
95
|
+
assert_in_delta( -19.56675908, @o03 [:totens][ 2], $tolerance )
|
96
|
+
assert_in_delta( -19.74290414, @o03 [:totens][ 3], $tolerance )
|
97
|
+
assert_in_delta( -19.74509430, @o03 [:totens][ 4], $tolerance )
|
98
|
+
assert_in_delta( -15.85257458, @o03 [:totens][ 5], $tolerance )
|
99
|
+
assert_in_delta( -15.67846403, @o03 [:totens][ 6], $tolerance )
|
100
|
+
assert_in_delta( -15.65919488, @o03 [:totens][ 7], $tolerance )
|
101
|
+
assert_in_delta( -15.64209986, @o03 [:totens][ 8], $tolerance )
|
102
|
+
assert_in_delta( -15.64268703, @o03 [:totens][ 9], $tolerance )
|
103
|
+
assert_in_delta( -15.64251873, @o03 [:totens][10], $tolerance )
|
104
|
+
assert_in_delta( -15.64251991, @o03 [:totens][11], $tolerance )
|
105
|
+
assert_in_delta( -15.64251763, @o03 [:totens][12], $tolerance )
|
106
|
+
assert_in_delta( -15.642518 , @o03 [:totens][13], $tolerance )
|
107
|
+
assert_in_delta( -15.65990112, @o03 [:totens][14], $tolerance )
|
108
|
+
assert_in_delta( -15.64955447, @o03 [:totens][15], $tolerance )
|
109
|
+
assert_in_delta( -15.64799040, @o03 [:totens][16], $tolerance )
|
110
|
+
assert_in_delta( -15.64765795, @o03 [:totens][17], $tolerance )
|
111
|
+
assert_in_delta( -15.64765312, @o03 [:totens][18], $tolerance )
|
112
|
+
assert_in_delta( -15.647653 , @o03 [:totens][19], $tolerance )
|
113
|
+
assert_in_delta( -15.65100443, @o03 [:totens][20], $tolerance )
|
114
|
+
assert_in_delta( -15.64889598, @o03 [:totens][21], $tolerance )
|
115
|
+
assert_in_delta( -15.64857840, @o03 [:totens][22], $tolerance )
|
116
|
+
assert_in_delta( -15.64849678, @o03 [:totens][23], $tolerance )
|
117
|
+
assert_in_delta( -15.64849543, @o03 [:totens][24], $tolerance )
|
118
|
+
assert_in_delta( -15.648495 , @o03 [:totens][25], $tolerance )
|
119
|
+
|
120
|
+
#assert_in_delta( Iter1-Nsw0/OUTCAR:549: free energy TOTEN = -51450.70587600
|
121
|
+
#assert_in_delta( Iter1-Nsw0/OUTCAR:585: free energy TOTEN = -52760.43385845
|
122
|
+
#assert_in_delta( Iter1-Nsw0/OUTCAR:621: free energy TOTEN = -52974.33537688
|
123
|
+
#assert_in_delta( Iter1-Nsw0/OUTCAR:657: free energy TOTEN = -53114.51699744
|
124
|
+
#assert_in_delta( Iter1-Nsw0/OUTCAR:693: free energy TOTEN = -53178.90296722
|
125
|
+
#assert_in_delta( Iter1-Nsw0/OUTCAR:729: free energy TOTEN = -53226.44533651
|
126
|
+
#assert_in_delta( Iter1-Nsw0/OUTCAR:772: free energy TOTEN = -53233.03344036
|
127
|
+
#assert_in_delta( Iter1-Nsw0/OUTCAR:821: free energy TOTEN = -53232.27944261
|
128
|
+
#assert_in_delta( Iter1-Nsw0/OUTCAR:870: free energy TOTEN = -53232.72830304
|
129
|
+
#assert_in_delta( Iter1-Nsw0/OUTCAR:919: free energy TOTEN = -53232.71484487
|
130
|
+
#assert_in_delta( Iter1-Nsw0/OUTCAR:968: free energy TOTEN = -53232.70895409
|
131
|
+
#assert_in_delta( Iter1-Nsw0/OUTCAR:1017: free energy TOTEN = -53232.70751179
|
132
|
+
#assert_in_delta( Iter1-Nsw0/OUTCAR:1055: free energy TOTEN = -53232.70759898
|
133
|
+
#assert_in_delta( Iter1-Nsw0/OUTCAR:1463: free energy TOTEN = -53232.707599
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_volume
|
137
|
+
assert_in_delta( 44.88, @o01 [:volumes][0], $tolerance )
|
138
|
+
assert_in_delta( 44.88, @o01 [:volumes][1], $tolerance )
|
139
|
+
assert_in_delta( 44.88, @o01int[:volumes][0], $tolerance )
|
140
|
+
assert_in_delta( 44.88, @o02 [:volumes][0], $tolerance )
|
141
|
+
assert_in_delta( 44.88, @o02 [:volumes][1], $tolerance )
|
142
|
+
assert_in_delta( 44.16, @o02 [:volumes][2], $tolerance )
|
143
|
+
assert_in_delta( 44.88, @o03 [:volumes][0], $tolerance )
|
144
|
+
assert_in_delta( 44.88, @o03 [:volumes][1], $tolerance )
|
145
|
+
assert_in_delta( 44.16, @o03 [:volumes][2], $tolerance )
|
146
|
+
assert_in_delta( 43.84, @o03 [:volumes][3], $tolerance )
|
147
|
+
|
148
|
+
#assert_in_delta( Iter1-Nsw0/OUTCAR:343: volume of cell : 1258.66
|
149
|
+
#assert_in_delta( Iter1-Nsw0/OUTCAR:1488: volume of cell : 1258.66
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
def test_elapsed_time
|
154
|
+
assert_equal(nil, @o01int[:elapsed_time])
|
155
|
+
assert_in_delta(164.134, @o04[:elapsed_time], $tolerance )
|
156
|
+
end
|
157
|
+
|
158
|
+
def test_irreducible_kpoints
|
159
|
+
assert_equal(15, @o01[:irreducible_kpoints])
|
160
|
+
end
|
161
161
|
|
162
162
|
end
|