vasputils 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/test/test_poscar.rb CHANGED
@@ -11,199 +11,199 @@ gem "crystalcell"
11
11
  require "crystalcell/cell.rb"
12
12
 
13
13
  class TC_Poscar < Test::Unit::TestCase
14
- $tolerance = 10 ** (-10)
14
+ $tolerance = 10 ** (-10)
15
15
 
16
- def test_dump
17
- # 例外ケース
18
- axes = LatticeAxes.new( [
19
- [1.0, 0.0, 0.0 ],
20
- [0.0, 1.0, 0.0 ],
21
- [0.0, 0.0, 1.0 ],
22
- ])
23
- atoms = [
24
- Atom.new(0, [0.1, 0.2, 0.3]),
25
- Atom.new(1, [0.2, 0.3, 0.4]),
26
- Atom.new(0, [0.3, 0.4, 0.5]),
27
- ]
28
- cell = Cell.new(axes, atoms)
29
- cell.comment = "test"
30
- io = StringIO.new
31
- assert_raises(Poscar::ElementMismatchError){
32
- Poscar.dump(cell, [0,1,2], io)}
16
+ def test_dump
17
+ # 例外ケース
18
+ axes = LatticeAxes.new( [
19
+ [1.0, 0.0, 0.0 ],
20
+ [0.0, 1.0, 0.0 ],
21
+ [0.0, 0.0, 1.0 ],
22
+ ])
23
+ atoms = [
24
+ Atom.new(0, [0.1, 0.2, 0.3]),
25
+ Atom.new(1, [0.2, 0.3, 0.4]),
26
+ Atom.new(0, [0.3, 0.4, 0.5]),
27
+ ]
28
+ cell = Cell.new(axes, atoms)
29
+ cell.comment = "test"
30
+ io = StringIO.new
31
+ assert_raises(Poscar::ElementMismatchError){
32
+ Poscar.dump(cell, [0,1,2], io)}
33
33
 
34
- # 生成
35
- axes = LatticeAxes.new( [
36
- [1.0, 0.0, 0.0 ],
37
- [0.0, 1.0, 0.0 ],
38
- [0.0, 0.0, 1.0 ],
39
- ])
40
- atoms = [
41
- Atom.new(0, [0.1, 0.2, 0.3]),
42
- Atom.new(1, [0.2, 0.3, 0.4]),
43
- Atom.new(0, [0.3, 0.4, 0.5]),
44
- ]
45
- cell = Cell.new(axes, atoms)
46
- cell.comment = "test"
47
- io = StringIO.new
48
- Poscar.dump(cell, [0,1], io)
49
- io.rewind
50
- corrects = [
51
- "test\n",
52
- "1.0\n",
53
- " 1.000000000000000 0.000000000000000 0.000000000000000\n",
54
- " 0.000000000000000 1.000000000000000 0.000000000000000\n",
55
- " 0.000000000000000 0.000000000000000 1.000000000000000\n",
56
- "2 1\n",
57
- "Direct\n",
58
- " 0.100000000000000 0.200000000000000 0.300000000000000\n",
59
- " 0.300000000000000 0.400000000000000 0.500000000000000\n",
60
- " 0.200000000000000 0.300000000000000 0.400000000000000\n",
61
- ]
62
- lines = io.readlines
63
- corrects.each_with_index do |cor, index|
64
- assert_equal(cor, lines[index], "line: #{index}")
65
- end
66
- assert_equal(corrects.size, lines.size)
34
+ # 生成
35
+ axes = LatticeAxes.new( [
36
+ [1.0, 0.0, 0.0 ],
37
+ [0.0, 1.0, 0.0 ],
38
+ [0.0, 0.0, 1.0 ],
39
+ ])
40
+ atoms = [
41
+ Atom.new(0, [0.1, 0.2, 0.3]),
42
+ Atom.new(1, [0.2, 0.3, 0.4]),
43
+ Atom.new(0, [0.3, 0.4, 0.5]),
44
+ ]
45
+ cell = Cell.new(axes, atoms)
46
+ cell.comment = "test"
47
+ io = StringIO.new
48
+ Poscar.dump(cell, [0,1], io)
49
+ io.rewind
50
+ corrects = [
51
+ "test\n",
52
+ "1.0\n",
53
+ " 1.000000000000000 0.000000000000000 0.000000000000000\n",
54
+ " 0.000000000000000 1.000000000000000 0.000000000000000\n",
55
+ " 0.000000000000000 0.000000000000000 1.000000000000000\n",
56
+ "2 1\n",
57
+ "Direct\n",
58
+ " 0.100000000000000 0.200000000000000 0.300000000000000\n",
59
+ " 0.300000000000000 0.400000000000000 0.500000000000000\n",
60
+ " 0.200000000000000 0.300000000000000 0.400000000000000\n",
61
+ ]
62
+ lines = io.readlines
63
+ corrects.each_with_index do |cor, index|
64
+ assert_equal(cor, lines[index], "line: #{index}")
65
+ end
66
+ assert_equal(corrects.size, lines.size)
67
67
 
68
- atoms = [
69
- Atom.new(0, [0.1, 0.2, 0.3], "atom0", [false, true , true ]),
70
- Atom.new(1, [0.2, 0.3, 0.4], "atom1", [false, false, true ]),
71
- Atom.new(0, [0.3, 0.4, 0.5], "atom2", [false, false, false]),
72
- ]
73
- cell = Cell.new(axes, atoms)
74
- cell.comment = "test"
75
- io = StringIO.new
76
- Poscar.dump(cell, [0,1], io)
77
- io.rewind
78
- corrects = [
79
- "test\n",
80
- "1.0\n",
81
- " 1.000000000000000 0.000000000000000 0.000000000000000\n",
82
- " 0.000000000000000 1.000000000000000 0.000000000000000\n",
83
- " 0.000000000000000 0.000000000000000 1.000000000000000\n",
84
- "2 1\n",
85
- "Selective dynamics\n",
86
- "Direct\n",
87
- " 0.100000000000000 0.200000000000000 0.300000000000000 F T T\n",
88
- " 0.300000000000000 0.400000000000000 0.500000000000000 F F F\n",
89
- " 0.200000000000000 0.300000000000000 0.400000000000000 F F T\n",
90
- ]
91
- lines = io.readlines
92
- corrects.each_with_index do |cor, index|
93
- assert_equal(cor, lines[index], "line: #{index}")
94
- end
95
- assert_equal(corrects.size, lines.size)
96
- end
68
+ atoms = [
69
+ Atom.new(0, [0.1, 0.2, 0.3], "atom0", [false, true , true ]),
70
+ Atom.new(1, [0.2, 0.3, 0.4], "atom1", [false, false, true ]),
71
+ Atom.new(0, [0.3, 0.4, 0.5], "atom2", [false, false, false]),
72
+ ]
73
+ cell = Cell.new(axes, atoms)
74
+ cell.comment = "test"
75
+ io = StringIO.new
76
+ Poscar.dump(cell, [0,1], io)
77
+ io.rewind
78
+ corrects = [
79
+ "test\n",
80
+ "1.0\n",
81
+ " 1.000000000000000 0.000000000000000 0.000000000000000\n",
82
+ " 0.000000000000000 1.000000000000000 0.000000000000000\n",
83
+ " 0.000000000000000 0.000000000000000 1.000000000000000\n",
84
+ "2 1\n",
85
+ "Selective dynamics\n",
86
+ "Direct\n",
87
+ " 0.100000000000000 0.200000000000000 0.300000000000000 F T T\n",
88
+ " 0.300000000000000 0.400000000000000 0.500000000000000 F F F\n",
89
+ " 0.200000000000000 0.300000000000000 0.400000000000000 F F T\n",
90
+ ]
91
+ lines = io.readlines
92
+ corrects.each_with_index do |cor, index|
93
+ assert_equal(cor, lines[index], "line: #{index}")
94
+ end
95
+ assert_equal(corrects.size, lines.size)
96
+ end
97
97
 
98
- def test_parse
99
- io = StringIO.new
100
- assert_raises(Poscar::ParseError){ Poscar.parse(io) }
98
+ def test_parse
99
+ io = StringIO.new
100
+ assert_raises(Poscar::ParseError){ Poscar.parse(io) }
101
101
 
102
- io = StringIO.new
103
- io.puts "sample0"
104
- io.puts "1.0"
105
- io.puts " 1.0 0.0 0.0"
106
- io.puts " 0.0 1.0 0.0"
107
- io.puts " 0.0 0.0 1.0"
108
- io.puts " 1 1 1"
109
- io.puts "Direct"
110
- io.puts " 0.0 0.0 0.0 #Li-001"
111
- io.puts " 0.5 0.0 0.0 #Ge-002"
112
- io.puts " 0.5 0.5 0.0 #O--003"
113
- io.rewind
114
- cell = Poscar.parse(io)
115
- assert_equal("sample0", cell.comment)
116
- assert_equal(
117
- LatticeAxes.new( [
118
- [1.0, 0.0, 0.0 ],
119
- [0.0, 1.0, 0.0 ],
120
- [0.0, 0.0, 1.0 ],
121
- ]),
122
- cell.axes
123
- )
124
- assert_equal(
125
- Atom.new(0, [0.0, 0.0, 0.0], "#Li-001"), cell.atoms[0])
126
- assert_equal(
127
- Atom.new(1, [0.5, 0.0, 0.0], "#Ge-002"), cell.atoms[1])
128
- assert_equal(
129
- Atom.new(2, [0.5, 0.5, 0.0], "#O--003"), cell.atoms[2])
102
+ io = StringIO.new
103
+ io.puts "sample0"
104
+ io.puts "1.0"
105
+ io.puts " 1.0 0.0 0.0"
106
+ io.puts " 0.0 1.0 0.0"
107
+ io.puts " 0.0 0.0 1.0"
108
+ io.puts " 1 1 1"
109
+ io.puts "Direct"
110
+ io.puts " 0.0 0.0 0.0 #Li-001"
111
+ io.puts " 0.5 0.0 0.0 #Ge-002"
112
+ io.puts " 0.5 0.5 0.0 #O--003"
113
+ io.rewind
114
+ cell = Poscar.parse(io)
115
+ assert_equal("sample0", cell.comment)
116
+ assert_equal(
117
+ LatticeAxes.new( [
118
+ [1.0, 0.0, 0.0 ],
119
+ [0.0, 1.0, 0.0 ],
120
+ [0.0, 0.0, 1.0 ],
121
+ ]),
122
+ cell.axes
123
+ )
124
+ assert_equal(
125
+ Atom.new(0, [0.0, 0.0, 0.0], "#Li-001"), cell.atoms[0])
126
+ assert_equal(
127
+ Atom.new(1, [0.5, 0.0, 0.0], "#Ge-002"), cell.atoms[1])
128
+ assert_equal(
129
+ Atom.new(2, [0.5, 0.5, 0.0], "#O--003"), cell.atoms[2])
130
130
 
131
- io = StringIO.new
132
- io.puts "sample1"
133
- io.puts "2.0"
134
- io.puts " 1.0 0.0 0.0"
135
- io.puts " 0.0 1.0 0.0"
136
- io.puts " 0.0 0.0 1.0"
137
- io.puts " 1 1 2"
138
- io.puts "Selective dynamics"
139
- io.puts "Direct"
140
- io.puts " 0.0 0.0 0.0 F F F #Li-001"
141
- io.puts " 0.5 0.0 0.0 F T F #Ge-002"
142
- io.puts " 0.5 0.5 0.0 T T T #O--003"
143
- io.puts " 0.5 0.5 0.5 T T T #O--004"
144
- io.rewind
145
- cell = Poscar.parse(io)
146
- assert_equal("sample1", cell.comment)
147
- assert_equal(
148
- LatticeAxes.new( [
149
- [2.0, 0.0, 0.0 ],
150
- [0.0, 2.0, 0.0 ],
151
- [0.0, 0.0, 2.0 ],
152
- ]),
153
- cell.axes
154
- )
155
- assert_equal(
156
- Atom.new(0, [0.0, 0.0, 0.0], "#Li-001", [false, false, false]),
157
- cell.atoms[0])
158
- assert_equal(
159
- Atom.new(1, [0.5, 0.0, 0.0], "#Ge-002", [false, true , false]),
160
- cell.atoms[1])
161
- assert_equal(
162
- Atom.new(2, [0.5, 0.5, 0.0], "#O--003", [true, true, true]),
163
- cell.atoms[2])
164
- assert_equal(
165
- Atom.new(2, [0.5, 0.5, 0.5], "#O--004", [true, true, true]),
166
- cell.atoms[3])
167
- end
131
+ io = StringIO.new
132
+ io.puts "sample1"
133
+ io.puts "2.0"
134
+ io.puts " 1.0 0.0 0.0"
135
+ io.puts " 0.0 1.0 0.0"
136
+ io.puts " 0.0 0.0 1.0"
137
+ io.puts " 1 1 2"
138
+ io.puts "Selective dynamics"
139
+ io.puts "Direct"
140
+ io.puts " 0.0 0.0 0.0 F F F #Li-001"
141
+ io.puts " 0.5 0.0 0.0 F T F #Ge-002"
142
+ io.puts " 0.5 0.5 0.0 T T T #O--003"
143
+ io.puts " 0.5 0.5 0.5 T T T #O--004"
144
+ io.rewind
145
+ cell = Poscar.parse(io)
146
+ assert_equal("sample1", cell.comment)
147
+ assert_equal(
148
+ LatticeAxes.new( [
149
+ [2.0, 0.0, 0.0 ],
150
+ [0.0, 2.0, 0.0 ],
151
+ [0.0, 0.0, 2.0 ],
152
+ ]),
153
+ cell.axes
154
+ )
155
+ assert_equal(
156
+ Atom.new(0, [0.0, 0.0, 0.0], "#Li-001", [false, false, false]),
157
+ cell.atoms[0])
158
+ assert_equal(
159
+ Atom.new(1, [0.5, 0.0, 0.0], "#Ge-002", [false, true , false]),
160
+ cell.atoms[1])
161
+ assert_equal(
162
+ Atom.new(2, [0.5, 0.5, 0.0], "#O--003", [true, true, true]),
163
+ cell.atoms[2])
164
+ assert_equal(
165
+ Atom.new(2, [0.5, 0.5, 0.5], "#O--004", [true, true, true]),
166
+ cell.atoms[3])
167
+ end
168
168
 
169
- def test_load_file
170
- cell = Poscar.load_file("test/poscar/POSCAR.00")
171
- assert_equal("sample0", cell.comment)
172
- assert_equal(
173
- LatticeAxes.new( [
174
- [1.0, 0.0, 0.0 ],
175
- [0.0, 1.0, 0.0 ],
176
- [0.0, 0.0, 1.0 ],
177
- ]),
178
- cell.axes
179
- )
180
- assert_equal(
181
- Atom.new(0, [0.0, 0.0, 0.0], "#Li-001"), cell.atoms[0])
182
- assert_equal(
183
- Atom.new(1, [0.5, 0.0, 0.0], "#Ge-002"), cell.atoms[1])
184
- assert_equal(
185
- Atom.new(2, [0.5, 0.5, 0.0], "#O--003"), cell.atoms[2])
169
+ def test_load_file
170
+ cell = Poscar.load_file("test/poscar/POSCAR.00")
171
+ assert_equal("sample0", cell.comment)
172
+ assert_equal(
173
+ LatticeAxes.new( [
174
+ [1.0, 0.0, 0.0 ],
175
+ [0.0, 1.0, 0.0 ],
176
+ [0.0, 0.0, 1.0 ],
177
+ ]),
178
+ cell.axes
179
+ )
180
+ assert_equal(
181
+ Atom.new(0, [0.0, 0.0, 0.0], "#Li-001"), cell.atoms[0])
182
+ assert_equal(
183
+ Atom.new(1, [0.5, 0.0, 0.0], "#Ge-002"), cell.atoms[1])
184
+ assert_equal(
185
+ Atom.new(2, [0.5, 0.5, 0.0], "#O--003"), cell.atoms[2])
186
186
 
187
- #cell = Poscar.load_file("test/poscar/POSCAR.02")
188
- #assert_equal("sample0", cell.comment)
189
- #assert_in_delta( 7.1028554188641708, cell.axes[0][0], $tolerance)
190
- #assert_in_delta(-0.0000000169534433, cell.axes[0][1], $tolerance)
191
- #assert_in_delta(-0.0000000169534428, cell.axes[0][2], $tolerance)
192
- #assert_in_delta( 0.0000001136137521, cell.axes[1][0], $tolerance)
193
- #assert_in_delta( 7.1028554188641725, cell.axes[1][1], $tolerance)
194
- #assert_in_delta(-0.0000000169534433, cell.axes[1][2], $tolerance)
195
- #assert_in_delta( 0.0000001136137521, cell.axes[2][0], $tolerance)
196
- #assert_in_delta( 0.0000001136137521, cell.axes[2][1], $tolerance)
197
- #assert_in_delta( 7.1028554188641725, cell.axes[2][2], $tolerance)
198
- #assert_equal(0, cell.atoms[0].element)
199
- #assert_equal(0.0395891220708791, cell.atoms[0].position[0])
200
- #assert_equal(0.0395891220708791, cell.atoms[0].position[1])
201
- #assert_equal(0.0395891220708791, cell.atoms[0].position[2])
187
+ #cell = Poscar.load_file("test/poscar/POSCAR.02")
188
+ #assert_equal("sample0", cell.comment)
189
+ #assert_in_delta( 7.1028554188641708, cell.axes[0][0], $tolerance)
190
+ #assert_in_delta(-0.0000000169534433, cell.axes[0][1], $tolerance)
191
+ #assert_in_delta(-0.0000000169534428, cell.axes[0][2], $tolerance)
192
+ #assert_in_delta( 0.0000001136137521, cell.axes[1][0], $tolerance)
193
+ #assert_in_delta( 7.1028554188641725, cell.axes[1][1], $tolerance)
194
+ #assert_in_delta(-0.0000000169534433, cell.axes[1][2], $tolerance)
195
+ #assert_in_delta( 0.0000001136137521, cell.axes[2][0], $tolerance)
196
+ #assert_in_delta( 0.0000001136137521, cell.axes[2][1], $tolerance)
197
+ #assert_in_delta( 7.1028554188641725, cell.axes[2][2], $tolerance)
198
+ #assert_equal(0, cell.atoms[0].element)
199
+ #assert_equal(0.0395891220708791, cell.atoms[0].position[0])
200
+ #assert_equal(0.0395891220708791, cell.atoms[0].position[1])
201
+ #assert_equal(0.0395891220708791, cell.atoms[0].position[2])
202
202
 
203
- end
203
+ end
204
204
 
205
- #def setup
206
- # #@pp02 = Poscar.new("test/poscar/POSCAR.shirai")
207
- #end
205
+ #def setup
206
+ # #@pp02 = Poscar.new("test/poscar/POSCAR.shirai")
207
+ #end
208
208
 
209
209
  end
data/test/test_potcar.rb CHANGED
@@ -5,61 +5,61 @@ require "vasputils/potcar.rb"
5
5
 
6
6
  class TC_Potcar < Test::Unit::TestCase
7
7
 
8
- def setup
9
- @p0 = Potcar.load_file("test/potcar/POTCAR" )
10
- @p1 = Potcar.load_file("test/potcar/POTCAR.dummy" )
11
- @p2 = Potcar.load_file("test/potcar/POTCAR.allElement")
12
- end
8
+ def setup
9
+ @p0 = Potcar.load_file("test/potcar/POTCAR" )
10
+ @p1 = Potcar.load_file("test/potcar/POTCAR.dummy" )
11
+ @p2 = Potcar.load_file("test/potcar/POTCAR.allElement")
12
+ end
13
13
 
14
- def test_get_filename
15
- assert_equal("test/potcar/POTCAR" , @p0[:name])
16
- assert_equal("test/potcar/POTCAR.dummy" , @p1[:name])
17
- assert_equal("test/potcar/POTCAR.allElement", @p2[:name])
18
- end
14
+ def test_get_filename
15
+ assert_equal("test/potcar/POTCAR" , @p0[:name])
16
+ assert_equal("test/potcar/POTCAR.dummy" , @p1[:name])
17
+ assert_equal("test/potcar/POTCAR.allElement", @p2[:name])
18
+ end
19
19
 
20
- def test_elements
21
- assert_equal([ "Li", "Ge", "O" ], @p0[:elements])
22
- assert_equal([ "Li", "Ge", "O" ], @p1[:elements])
23
- correct = [
24
- "Ac", "Ac", "Ag", "Al", "Al", "Ar", "As", "Au", "B", "B", "B", "Ba",
25
- "Be", "Be", "Bi", "Bi", "Br", "C", "C", "C", "Ca", "Ca", "Cd", "Ce",
26
- "Ce", "Cl", "Cl", "Co", "Cr", "Cr", "Cs", "Cu", "Cu", "Dy",
27
- "Er", "Er", "Eu", "Eu", "F", "F", "F", "Fe", "Fe", "Ga", "Ga", "Ga",
28
- "Gd", "Gd", "Ge", "Ge", "Ge", "H", "H", "H", "H", "H", "H", "He",
29
- "Hf", "Hf", "Hg", "Ho", "I", "In", "In", "Ir", "K", "K", "Kr",
30
- "La", "La", "Li", "Li", "Lu", "Lu", "Mg", "Mg", "Mn", "Mn",
31
- "Mo", "Mo", "N", "N", "N", "Na", "Na", "Na", "Nb", "Nb", "Nd", "Nd",
32
- "Ne", "Ni", "Ni", "Np", "Np", "O", "O", "O", "Os", "Os", "P", "P",
33
- "Pa", "Pa", "Pb", "Pb", "Pd", "Pd", "Pm", "Pm", "Pr", "Pr", "Pt",
34
- "Pu", "Pu", "Rb", "Rb", "Re", "Re", "Rh", "Rh", "Ru", "Ru", "S", "S",
35
- "Sb", "Sc", "Se", "Si", "Si", "Sm", "Sm", "Sn", "Sn", "Sr",
36
- "Ta", "Ta", "Tb", "Tc", "Tc", "Te", "Th", "Th", "Ti", "Ti", "Ti",
37
- "Tl", "Tl", "Tm", "Tm", "U", "U", "V", "V", "V", "W", "W", "X", "Y",
38
- "Yb", "Yb", "Zn", "Zr", "Zr"]
39
- assert_equal( correct, @p2[:elements])
40
- end
20
+ def test_elements
21
+ assert_equal([ "Li", "Ge", "O" ], @p0[:elements])
22
+ assert_equal([ "Li", "Ge", "O" ], @p1[:elements])
23
+ correct = [
24
+ "Ac", "Ac", "Ag", "Al", "Al", "Ar", "As", "Au", "B", "B", "B", "Ba",
25
+ "Be", "Be", "Bi", "Bi", "Br", "C", "C", "C", "Ca", "Ca", "Cd", "Ce",
26
+ "Ce", "Cl", "Cl", "Co", "Cr", "Cr", "Cs", "Cu", "Cu", "Dy",
27
+ "Er", "Er", "Eu", "Eu", "F", "F", "F", "Fe", "Fe", "Ga", "Ga", "Ga",
28
+ "Gd", "Gd", "Ge", "Ge", "Ge", "H", "H", "H", "H", "H", "H", "He",
29
+ "Hf", "Hf", "Hg", "Ho", "I", "In", "In", "Ir", "K", "K", "Kr",
30
+ "La", "La", "Li", "Li", "Lu", "Lu", "Mg", "Mg", "Mn", "Mn",
31
+ "Mo", "Mo", "N", "N", "N", "Na", "Na", "Na", "Nb", "Nb", "Nd", "Nd",
32
+ "Ne", "Ni", "Ni", "Np", "Np", "O", "O", "O", "Os", "Os", "P", "P",
33
+ "Pa", "Pa", "Pb", "Pb", "Pd", "Pd", "Pm", "Pm", "Pr", "Pr", "Pt",
34
+ "Pu", "Pu", "Rb", "Rb", "Re", "Re", "Rh", "Rh", "Ru", "Ru", "S", "S",
35
+ "Sb", "Sc", "Se", "Si", "Si", "Sm", "Sm", "Sn", "Sn", "Sr",
36
+ "Ta", "Ta", "Tb", "Tc", "Tc", "Te", "Th", "Th", "Ti", "Ti", "Ti",
37
+ "Tl", "Tl", "Tm", "Tm", "U", "U", "V", "V", "V", "W", "W", "X", "Y",
38
+ "Yb", "Yb", "Zn", "Zr", "Zr"]
39
+ assert_equal( correct, @p2[:elements])
40
+ end
41
41
 
42
- #def test_self_elements
43
- # assert_equal([ "Li", "Ge", "O" ], Potcar.elements( @p0 ))
44
- # assert_equal([ "Li", "Ge", "O" ], Potcar.elements( @p1 ))
45
- # correct = [
46
- # "Ac", "Ac", "Ag", "Al", "Al", "Ar", "As", "Au", "B", "B", "B", "Ba",
47
- # "Be", "Be", "Bi", "Bi", "Br", "C", "C", "C", "Ca", "Ca", "Cd", "Ce",
48
- # "Ce", "Cl", "Cl", "Co", "Cr", "Cr", "Cs", "Cu", "Cu", "Dy",
49
- # "Er", "Er", "Eu", "Eu", "F", "F", "F", "Fe", "Fe", "Ga", "Ga", "Ga",
50
- # "Gd", "Gd", "Ge", "Ge", "Ge", "H", "H", "H", "H", "H", "H", "He",
51
- # "Hf", "Hf", "Hg", "Ho", "I", "In", "In", "Ir", "K", "K", "Kr",
52
- # "La", "La", "Li", "Li", "Lu", "Lu", "Mg", "Mg", "Mn", "Mn",
53
- # "Mo", "Mo", "N", "N", "N", "Na", "Na", "Na", "Nb", "Nb", "Nd", "Nd",
54
- # "Ne", "Ni", "Ni", "Np", "Np", "O", "O", "O", "Os", "Os", "P", "P",
55
- # "Pa", "Pa", "Pb", "Pb", "Pd", "Pd", "Pm", "Pm", "Pr", "Pr", "Pt",
56
- # "Pu", "Pu", "Rb", "Rb", "Re", "Re", "Rh", "Rh", "Ru", "Ru", "S", "S",
57
- # "Sb", "Sc", "Se", "Si", "Si", "Sm", "Sm", "Sn", "Sn", "Sr",
58
- # "Ta", "Ta", "Tb", "Tc", "Tc", "Te", "Th", "Th", "Ti", "Ti", "Ti",
59
- # "Tl", "Tl", "Tm", "Tm", "U", "U", "V", "V", "V", "W", "W", "X", "Y",
60
- # "Yb", "Yb", "Zn", "Zr", "Zr"]
61
- # assert_equal( correct, Potcar.elements( @p2 ))
62
- #end
42
+ #def test_self_elements
43
+ # assert_equal([ "Li", "Ge", "O" ], Potcar.elements( @p0 ))
44
+ # assert_equal([ "Li", "Ge", "O" ], Potcar.elements( @p1 ))
45
+ # correct = [
46
+ # "Ac", "Ac", "Ag", "Al", "Al", "Ar", "As", "Au", "B", "B", "B", "Ba",
47
+ # "Be", "Be", "Bi", "Bi", "Br", "C", "C", "C", "Ca", "Ca", "Cd", "Ce",
48
+ # "Ce", "Cl", "Cl", "Co", "Cr", "Cr", "Cs", "Cu", "Cu", "Dy",
49
+ # "Er", "Er", "Eu", "Eu", "F", "F", "F", "Fe", "Fe", "Ga", "Ga", "Ga",
50
+ # "Gd", "Gd", "Ge", "Ge", "Ge", "H", "H", "H", "H", "H", "H", "He",
51
+ # "Hf", "Hf", "Hg", "Ho", "I", "In", "In", "Ir", "K", "K", "Kr",
52
+ # "La", "La", "Li", "Li", "Lu", "Lu", "Mg", "Mg", "Mn", "Mn",
53
+ # "Mo", "Mo", "N", "N", "N", "Na", "Na", "Na", "Nb", "Nb", "Nd", "Nd",
54
+ # "Ne", "Ni", "Ni", "Np", "Np", "O", "O", "O", "Os", "Os", "P", "P",
55
+ # "Pa", "Pa", "Pb", "Pb", "Pd", "Pd", "Pm", "Pm", "Pr", "Pr", "Pt",
56
+ # "Pu", "Pu", "Rb", "Rb", "Re", "Re", "Rh", "Rh", "Ru", "Ru", "S", "S",
57
+ # "Sb", "Sc", "Se", "Si", "Si", "Sm", "Sm", "Sn", "Sn", "Sr",
58
+ # "Ta", "Ta", "Tb", "Tc", "Tc", "Te", "Th", "Th", "Ti", "Ti", "Ti",
59
+ # "Tl", "Tl", "Tm", "Tm", "U", "U", "V", "V", "V", "W", "W", "X", "Y",
60
+ # "Yb", "Yb", "Zn", "Zr", "Zr"]
61
+ # assert_equal( correct, Potcar.elements( @p2 ))
62
+ #end
63
63
 
64
64
  end
65
65
 
data/test/test_vaspdir.rb CHANGED
@@ -111,6 +111,16 @@ class TC_VaspDir < Test::Unit::TestCase
111
111
  assert_equal("test/vaspdir/finished/OUTCAR", @vd03.outcar[:name])
112
112
  end
113
113
 
114
+ def test_poscar
115
+ t = @vd03.poscar
116
+ assert_equal(Cell, t.class)
117
+ assert_in_delta(3.8879999999999999, t.axes[2][2])
118
+
119
+ t = @vd00.poscar
120
+ assert_equal(Cell, t.class)
121
+ assert_in_delta(3.8879999999999999, t.axes[2][2])
122
+ end
123
+
114
124
  def test_contcar
115
125
  t = @vd03.contcar
116
126
  assert_equal(Cell, t.class)
@@ -0,0 +1,25 @@
1
+ #! /usr/bin/env ruby
2
+ # coding: utf-8
3
+
4
+ require "test/unit"
5
+ require "vasputils/vaspkpointsfinder.rb"
6
+
7
+ class VaspKpointsFinder
8
+ end
9
+
10
+ class TC_VaspKpointsFinder < Test::Unit::TestCase
11
+ def setup
12
+ @vcf00 = VaspKpointsFinder.new "test/vaspkpointsfinder"
13
+ end
14
+
15
+ def test_kpoints
16
+ corrects = [1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64]
17
+ #assert_equal(corrects, @vcf00.list_encuts)
18
+ end
19
+
20
+ end
21
+
22
+ # def test_lowest_encut
23
+ # assert_equal(200, @vcf00.lowest_encut)
24
+ # end
25
+
@@ -0,0 +1,17 @@
1
+ SYSTEM = Untitled (VASP)
2
+ PREC = High
3
+ IBRION = 2
4
+ NSW = 100
5
+ ISIF = 3
6
+ ENCUT = 200
7
+ NELM = 60
8
+ NELMIN = 2
9
+ EDIFF = 1.0e-05
10
+ EDIFFG = -0.02
11
+ ISPIN = 2
12
+ LWAVE = .FALSE.
13
+ LCHARG = .FALSE.
14
+ ISMEAR = 0
15
+ SIGMA = 0.1
16
+ IALGO = 38
17
+ LREAL = Auto
@@ -0,0 +1,6 @@
1
+ Automatic mesh
2
+ 0
3
+ Monkhorst
4
+ 1 1 1
5
+ 0. 0. 0.
6
+
@@ -0,0 +1,8 @@
1
+ (Li)2 (I222) ~ Untitled (VASP)
2
+ 1.00000000000000
3
+ -1.6954338738674965 -1.6954338738674965 1.6954338738674965
4
+ -1.6954338738674965 1.6954338738674965 -1.6954338738674965
5
+ 1.6954338738674965 -1.6954338738674965 -1.6954338738674965
6
+ 1
7
+ Direct
8
+ 0.0000000000000000 0.0000000000000000 0.0000000000000000
File without changes
data/vasputils.gemspec CHANGED
@@ -5,14 +5,14 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "vasputils"
8
- s.version = "0.0.8"
8
+ s.version = "0.0.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["ippei94da"]
12
- s.date = "2012-05-29"
12
+ s.date = "2012-06-06"
13
13
  s.description = "This gem provides parsers for some of input and output files for VASP.\n This will provide support command for computations."
14
14
  s.email = "ippei94da@gmail.com"
15
- s.executables = ["addVolumeToten.rb", "latticeconstants", "lsvasp", "lsvaspdir", "lsvaspseries", "qsubvasp", "runvasp", "symposcar"]
15
+ s.executables = ["addVolumeToten.rb", "checkvasp", "latticeconstants", "qsubvasp", "runvasp", "symposcar"]
16
16
  s.extra_rdoc_files = [
17
17
  "LICENSE.txt",
18
18
  "README.rdoc"
@@ -25,10 +25,8 @@ Gem::Specification.new do |s|
25
25
  "Rakefile",
26
26
  "VERSION",
27
27
  "bin/addVolumeToten.rb",
28
+ "bin/checkvasp",
28
29
  "bin/latticeconstants",
29
- "bin/lsvasp",
30
- "bin/lsvaspdir",
31
- "bin/lsvaspseries",
32
30
  "bin/qsubvasp",
33
31
  "bin/runvasp",
34
32
  "bin/symposcar",
@@ -41,6 +39,7 @@ Gem::Specification.new do |s|
41
39
  "lib/vasputils/potcar.rb",
42
40
  "lib/vasputils/vaspdir.rb",
43
41
  "lib/vasputils/vaspgeomopt.rb",
42
+ "lib/vasputils/vaspkpointsfinder.rb",
44
43
  "memo.txt",
45
44
  "test/calcseries/dup_finished/try00/CONTCAR",
46
45
  "test/calcseries/dup_finished/try00/INCAR",
@@ -108,6 +107,7 @@ Gem::Specification.new do |s|
108
107
  "test/test_potcar.rb",
109
108
  "test/test_vaspdir.rb",
110
109
  "test/test_vaspgeomopt.rb",
110
+ "test/test_vaspkpointsfinder.rb",
111
111
  "test/vaspdir/finished/CONTCAR",
112
112
  "test/vaspdir/finished/INCAR",
113
113
  "test/vaspdir/finished/KPOINTS",
@@ -195,6 +195,10 @@ Gem::Specification.new do |s|
195
195
  "test/vaspgeomopt/till01/try01/KPOINTS",
196
196
  "test/vaspgeomopt/till01/try01/POSCAR",
197
197
  "test/vaspgeomopt/till01/try01/POTCAR",
198
+ "test/vaspkpointsfinder/01-01-01/try00/INCAR",
199
+ "test/vaspkpointsfinder/01-01-01/try00/KPOINTS",
200
+ "test/vaspkpointsfinder/01-01-01/try00/POSCAR",
201
+ "test/vaspkpointsfinder/01-01-01/try00/POTCAR",
198
202
  "vasputils.gemspec"
199
203
  ]
200
204
  s.homepage = "http://github.com/ippei94da/vasputils"