vasputils 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. data/VERSION +1 -1
  2. data/bin/checkvasp +6 -5
  3. data/bin/latticeconstants +13 -8
  4. data/bin/qsubvasp +5 -5
  5. data/bin/rmvaspout +40 -0
  6. data/bin/runvasp +5 -6
  7. data/bin/symposcar +38 -28
  8. data/lib/vasputils.rb +11 -0
  9. data/lib/vasputils/incar.rb +3 -1
  10. data/lib/vasputils/kpoints.rb +3 -1
  11. data/lib/vasputils/outcar.rb +46 -31
  12. data/lib/vasputils/poscar.rb +3 -1
  13. data/lib/vasputils/potcar.rb +3 -1
  14. data/lib/vasputils/vaspdir.rb +8 -11
  15. data/lib/vasputils/{vaspgeomopt.rb → vaspgeometryoptimizer.rb} +6 -5
  16. data/memo.txt +9 -1
  17. data/test/test_incar.rb +5 -4
  18. data/test/test_kpoints.rb +7 -6
  19. data/test/test_outcar.rb +25 -24
  20. data/test/test_poscar.rb +11 -10
  21. data/test/test_potcar.rb +7 -6
  22. data/test/test_vaspdir.rb +10 -10
  23. data/test/{test_vaspgeomopt.rb → test_vaspgeometryoptimizer.rb} +21 -20
  24. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try00/CONTCAR +0 -0
  25. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try00/INCAR +0 -0
  26. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try00/KPOINTS +0 -0
  27. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try00/OUTCAR +0 -0
  28. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try00/POSCAR +0 -0
  29. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try00/POTCAR +0 -0
  30. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try01/INCAR +0 -0
  31. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try01/KPOINTS +0 -0
  32. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try01/OUTCAR +0 -0
  33. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try01/POSCAR +0 -0
  34. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter1/try01/POTCAR +0 -0
  35. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try00/CONTCAR +0 -0
  36. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try00/INCAR +0 -0
  37. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try00/KPOINTS +0 -0
  38. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try00/OUTCAR +0 -0
  39. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try00/POSCAR +0 -0
  40. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try00/POTCAR +0 -0
  41. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try01/INCAR +0 -0
  42. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try01/KPOINTS +0 -0
  43. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try01/OUTCAR +0 -0
  44. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try01/POSCAR +0 -0
  45. data/test/{vaspgeomopt → vaspgeometryoptimizer}/ended-Iter2/try01/POTCAR +0 -0
  46. data/test/{vaspgeomopt → vaspgeometryoptimizer}/not-yet/try00/INCAR +0 -0
  47. data/test/{vaspgeomopt → vaspgeometryoptimizer}/not-yet/try00/KPOINTS +0 -0
  48. data/test/{vaspgeomopt → vaspgeometryoptimizer}/not-yet/try00/POSCAR +0 -0
  49. data/test/{vaspgeomopt → vaspgeometryoptimizer}/not-yet/try00/POTCAR +0 -0
  50. data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/CHG +0 -0
  51. data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/CHGCAR +0 -0
  52. data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/CONTCAR +0 -0
  53. data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/DOSCAR +0 -0
  54. data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/EIGENVAL +0 -0
  55. data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/INCAR +0 -0
  56. data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/KPOINTS +0 -0
  57. data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/OSZICAR +0 -0
  58. data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/OUTCAR +0 -0
  59. data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/PCDAT +0 -0
  60. data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/POSCAR +0 -0
  61. data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/POTCAR +0 -0
  62. data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/WAVECAR +0 -0
  63. data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/XDATCAR +0 -0
  64. data/test/{vaspgeomopt → vaspgeometryoptimizer}/prepare_next/try00/vasprun.xml +0 -0
  65. data/test/{vaspgeomopt → vaspgeometryoptimizer}/started/try00/INCAR +0 -0
  66. data/test/{vaspgeomopt → vaspgeometryoptimizer}/started/try00/KPOINTS +0 -0
  67. data/test/{vaspgeomopt → vaspgeometryoptimizer}/started/try00/POSCAR +0 -0
  68. data/test/{vaspgeomopt → vaspgeometryoptimizer}/started/try00/POTCAR +0 -0
  69. data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try00/CONTCAR +0 -0
  70. data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try00/INCAR +0 -0
  71. data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try00/KPOINTS +0 -0
  72. data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try00/OUTCAR +0 -0
  73. data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try00/POSCAR +0 -0
  74. data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try00/POTCAR +0 -0
  75. data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try01/INCAR +0 -0
  76. data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try01/KPOINTS +0 -0
  77. data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try01/POSCAR +0 -0
  78. data/test/{vaspgeomopt → vaspgeometryoptimizer}/till01/try01/POTCAR +0 -0
  79. data/vasputils.gemspec +61 -63
  80. metadata +82 -84
  81. data/bin/addVolumeToten.rb +0 -19
  82. data/lib/vasputils/calcinspector.rb +0 -24
  83. data/test/test_calcinspector.rb +0 -53
@@ -1,7 +1,9 @@
1
+ require "vasputils.rb"
2
+
1
3
  #
2
4
  # Class for dealing with POTCAR.
3
5
  #
4
- module Potcar
6
+ module VaspUtils::Potcar
5
7
  def self.load_file(file)
6
8
  results = {}
7
9
  results[:name] = file
@@ -11,15 +11,12 @@ gem "comana"
11
11
  require "comana/computationmanager.rb"
12
12
  require "comana/machineinfo.rb"
13
13
 
14
- require "vasputils/incar.rb"
15
- require "vasputils/outcar.rb"
16
- require "vasputils/poscar.rb"
17
- require "vasputils/kpoints.rb"
14
+ require "vasputils.rb"
18
15
 
19
16
  # Class for VASP executable directory,
20
17
  # including input and output files.
21
18
  #
22
- class VaspDir < ComputationManager
19
+ class VaspUtils::VaspDir < ComputationManager
23
20
  class InitializeError < Exception; end
24
21
  class NoVaspBinaryError < Exception; end
25
22
  class PrepareNextError < Exception; end
@@ -37,19 +34,19 @@ class VaspDir < ComputationManager
37
34
  # 配下の OUTCAR を Outcar インスタンスにして返す。
38
35
  # 存在しなければ例外 Errno::ENOENT を返す。
39
36
  def outcar
40
- Outcar.load_file("#{@dir}/OUTCAR")
37
+ VaspUtils::Outcar.load_file("#{@dir}/OUTCAR")
41
38
  end
42
39
 
43
40
  # 配下の POSCAR を Cell2 インスタンスにして返す。
44
41
  # 存在しなければ例外 Errno::ENOENT を返す。
45
42
  def poscar
46
- Poscar.load_file("#{@dir}/POSCAR")
43
+ VaspUtils::Poscar.load_file("#{@dir}/POSCAR")
47
44
  end
48
45
 
49
46
  # 配下の CONTCAR を Cell2 インスタンスにして返す。
50
47
  # 存在しなければ例外 Errno::ENOENT を返す。
51
48
  def contcar
52
- Poscar.load_file("#{@dir}/CONTCAR")
49
+ VaspUtils::Poscar.load_file("#{@dir}/CONTCAR")
53
50
  end
54
51
 
55
52
  # 配下の KPOINTS を読み込んだ結果をハッシュにして返す。
@@ -57,12 +54,12 @@ class VaspDir < ComputationManager
57
54
  # 存在しなければ例外 Errno::ENOENT を返す筈だが、
58
55
  # vasp dir の判定を incar でやっているので置こる筈がない。
59
56
  def incar
60
- Incar.load_file("#{@dir}/INCAR")
57
+ VaspUtils::Incar.load_file("#{@dir}/INCAR")
61
58
  end
62
59
 
63
60
  # 配下の KPOINTS を読み込んだ結果をハッシュにして返す。
64
61
  def kpoints
65
- Kpoints.load_file("#{@dir}/KPOINTS")
62
+ VaspUtils::Kpoints.load_file("#{@dir}/KPOINTS")
66
63
  end
67
64
 
68
65
  # 正常に終了していれば true を返す。
@@ -72,7 +69,7 @@ class VaspDir < ComputationManager
72
69
  # PI12345 ファイルは実行中のみ存在し、終了後 vasp (mpi?) に自動的に削除される。
73
70
  def finished?
74
71
  begin
75
- return Outcar.load_file("#{@dir}/OUTCAR")[:normal_ended]
72
+ return VaspUtils::Outcar.load_file("#{@dir}/OUTCAR")[:normal_ended]
76
73
  rescue Errno::ENOENT
77
74
  return false
78
75
  end
@@ -8,12 +8,13 @@ require "rubygems"
8
8
  gem "comana"
9
9
  require "comana/computationmanager.rb"
10
10
 
11
- require "vasputils/vaspdir.rb"
11
+ require "vasputils.rb"
12
+ #require "vasputils/vaspdir.rb"
12
13
 
13
14
  #
14
15
  #
15
16
  #
16
- class VaspGeomOpt < ComputationManager
17
+ class VaspUtils::VaspGeometryOptimizer < ComputationManager
17
18
  class NoVaspDirError < Exception; end
18
19
  class LatestDirStartedError < Exception; end
19
20
  class NoIntegerEndedNameError < Exception; end
@@ -80,9 +81,9 @@ class VaspGeomOpt < ComputationManager
80
81
  def latest_dir
81
82
  Dir.glob("#{@dir}/*").sort.reverse.find do |dir|
82
83
  begin
83
- vd = VaspDir.new(dir)
84
+ vd = VaspUtils::VaspDir.new(dir)
84
85
  return vd
85
- rescue VaspDir::InitializeError
86
+ rescue VaspUtils::VaspDir::InitializeError
86
87
  next
87
88
  end
88
89
  end
@@ -108,7 +109,7 @@ class VaspGeomOpt < ComputationManager
108
109
  FileUtils.cp("#{latest_dir.dir}/XDATCAR" , "#{new_dir}/XDATCAR" )
109
110
  FileUtils.cp("#{latest_dir.dir}/CONTCAR" , "#{new_dir}/POSCAR" ) # change name
110
111
  # without POSCAR, OUTCAR, vasprun.xml
111
- VaspDir.new(new_dir)
112
+ VaspUtils::VaspDir.new(new_dir)
112
113
  end
113
114
 
114
115
  end
data/memo.txt CHANGED
@@ -1,12 +1,20 @@
1
1
  #
2
2
 
3
+ 0.0.10 release
4
+ Delete Outcar.volume
5
+ Delete Outcar.irreducible_kpoints
6
+ Accelerate Outcar, using UNIX commands: grep, tail and head
7
+ Modify bin/symposcar
8
+ Add bin/rmvaspout
9
+ Change name space for classes
10
+
3
11
  0.0.9 release
4
12
  Add VaspDir.poscar
5
13
  Add bin/checkvasp
6
14
  Delete bin/lsvasp, bin/lsvaspdir, bin/lsvaspseries
7
15
 
8
16
  0.0.8 release
9
- Modified bin/qsubvasp, add -g option.
17
+ Modified bin/qsubvasp, add -g option
10
18
 
11
19
  0.0.7 release
12
20
  Modified bin/qsubvasp
data/test/test_incar.rb CHANGED
@@ -2,6 +2,7 @@
2
2
  # coding: utf-8
3
3
 
4
4
  require "test/unit"
5
+ require "vasputils.rb"
5
6
  require "vasputils/incar.rb"
6
7
  require "stringio"
7
8
 
@@ -74,12 +75,12 @@ class TC_Incar < Test::Unit::TestCase
74
75
  io.puts " NGY = 36"
75
76
  io.puts " NGZ = 42"
76
77
  io.rewind
77
- pairs = Incar.parse(io)
78
+ pairs = VaspUtils::Incar.parse(io)
78
79
  assert_equal(SAMPLE_PAIRS, pairs)
79
80
  end
80
81
 
81
82
  def test_self_load_file
82
- pairs = Incar.load_file "test/incar/INCAR.00"
83
+ pairs = VaspUtils::Incar.load_file "test/incar/INCAR.00"
83
84
  assert_equal(SAMPLE_PAIRS, pairs)
84
85
 
85
86
  corrects = {
@@ -109,11 +110,11 @@ class TC_Incar < Test::Unit::TestCase
109
110
  "NGY" => "36",
110
111
  "NGZ" => "42",
111
112
  }
112
- pairs = Incar.load_file "test/incar/INCAR.01"
113
+ pairs = VaspUtils::Incar.load_file "test/incar/INCAR.01"
113
114
  assert_equal(corrects, pairs)
114
115
 
115
116
  # not exist
116
- assert_raise(Errno::ENOENT){Incar.load_file("")}
117
+ assert_raise(Errno::ENOENT){VaspUtils::Incar.load_file("")}
117
118
  end
118
119
 
119
120
  #def test_dump
data/test/test_kpoints.rb CHANGED
@@ -3,6 +3,7 @@
3
3
 
4
4
  require "test/unit"
5
5
  require "stringio"
6
+ require "vasputils.rb"
6
7
  require "vasputils/kpoints.rb"
7
8
 
8
9
  class TC_Kpoints < Test::Unit::TestCase
@@ -17,7 +18,7 @@ class TC_Kpoints < Test::Unit::TestCase
17
18
  io.puts " 1 2 3"
18
19
  io.puts " 0.4 0.5 0.6"
19
20
  io.rewind
20
- k00 = Kpoints.parse(io)
21
+ k00 = VaspUtils::Kpoints.parse(io)
21
22
  assert_equal("Automatic mesh", k00[:comment])
22
23
  assert_equal(:monkhorst, k00[:type])
23
24
  assert_equal([1, 2, 3], k00[:mesh])
@@ -33,7 +34,7 @@ class TC_Kpoints < Test::Unit::TestCase
33
34
  io.puts " 1 2 3"
34
35
  io.puts " 0.4 0.5 0.6"
35
36
  io.rewind
36
- k01 = Kpoints.parse(io)
37
+ k01 = VaspUtils::Kpoints.parse(io)
37
38
  assert_equal("Automatic mesh", k01[:comment])
38
39
  assert_equal(:gamma_center, k01[:type])
39
40
  assert_equal([1, 2, 3], k01[:mesh])
@@ -43,7 +44,7 @@ class TC_Kpoints < Test::Unit::TestCase
43
44
  end
44
45
 
45
46
  def test_self_load_file
46
- k00 = Kpoints.load_file("test/kpoints/m123-456")
47
+ k00 = VaspUtils::Kpoints.load_file("test/kpoints/m123-456")
47
48
  assert_equal("Automatic mesh", k00[:comment])
48
49
  assert_equal(:monkhorst, k00[:type])
49
50
  assert_equal([1, 2, 3], k00[:mesh])
@@ -51,7 +52,7 @@ class TC_Kpoints < Test::Unit::TestCase
51
52
  assert_in_delta(0.5, k00[:shift][1])
52
53
  assert_in_delta(0.6, k00[:shift][2])
53
54
 
54
- k01 = Kpoints.load_file("test/kpoints/g123-456")
55
+ k01 = VaspUtils::Kpoints.load_file("test/kpoints/g123-456")
55
56
  assert_equal("Automatic mesh", k01[:comment])
56
57
  assert_equal(:gamma_center, k01[:type])
57
58
  assert_equal([1, 2, 3], k01[:mesh])
@@ -68,7 +69,7 @@ class TC_Kpoints < Test::Unit::TestCase
68
69
  :shift => [0.4, 0.5, 0.6],
69
70
  }
70
71
  io = StringIO.new
71
- Kpoints.dump(hash, io)
72
+ VaspUtils::Kpoints.dump(hash, io)
72
73
  io.rewind
73
74
  results = io.readlines
74
75
  corrects = [
@@ -90,7 +91,7 @@ class TC_Kpoints < Test::Unit::TestCase
90
91
  :shift => [0.4, 0.5, 0.6],
91
92
  }
92
93
  io = StringIO.new
93
- Kpoints.dump(hash, io)
94
+ VaspUtils::Kpoints.dump(hash, io)
94
95
  io.rewind
95
96
  results = io.readlines
96
97
  corrects = [
data/test/test_outcar.rb CHANGED
@@ -1,21 +1,22 @@
1
1
  #! /usr/bin/ruby
2
2
 
3
3
  require 'test/unit'
4
+ require "vasputils.rb"
4
5
  require 'vasputils/outcar.rb'
5
6
 
6
7
  class TC_Outcar < Test::Unit::TestCase
7
8
  $tolerance = 10**(-10)
8
9
 
9
10
  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" )
11
+ @o01 = VaspUtils::Outcar.load_file( "test/outcar/01-13-FIN.OUTCAR" )
12
+ @o01int = VaspUtils::Outcar.load_file( "test/outcar/01-03-INT.OUTCAR" )
13
+ @o02 = VaspUtils::Outcar.load_file( "test/outcar/02-05-FIN.OUTCAR" )
14
+ @o03 = VaspUtils::Outcar.load_file( "test/outcar/03-05-FIN.OUTCAR" )
15
+ @o04 = VaspUtils::Outcar.load_file( "test/outcar/10-01-FIN.OUTCAR" )
15
16
  end
16
17
 
17
18
  def test_self_load_file
18
- assert_raise(Errno::ENOENT){Outcar.load_file( "" )}
19
+ assert_raise(Errno::ENOENT){VaspUtils::Outcar.load_file( "" )}
19
20
  end
20
21
 
21
22
  #def test_nsw
@@ -133,30 +134,30 @@ class TC_Outcar < Test::Unit::TestCase
133
134
  #assert_in_delta( Iter1-Nsw0/OUTCAR:1463: free energy TOTEN = -53232.707599
134
135
  end
135
136
 
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
137
+ #def test_volume
138
+ # assert_in_delta( 44.88, @o01 [:volumes][0], $tolerance )
139
+ # assert_in_delta( 44.88, @o01 [:volumes][1], $tolerance )
140
+ # assert_in_delta( 44.88, @o01int[:volumes][0], $tolerance )
141
+ # assert_in_delta( 44.88, @o02 [:volumes][0], $tolerance )
142
+ # assert_in_delta( 44.88, @o02 [:volumes][1], $tolerance )
143
+ # assert_in_delta( 44.16, @o02 [:volumes][2], $tolerance )
144
+ # assert_in_delta( 44.88, @o03 [:volumes][0], $tolerance )
145
+ # assert_in_delta( 44.88, @o03 [:volumes][1], $tolerance )
146
+ # assert_in_delta( 44.16, @o03 [:volumes][2], $tolerance )
147
+ # assert_in_delta( 43.84, @o03 [:volumes][3], $tolerance )
148
+
149
+ # #assert_in_delta( Iter1-Nsw0/OUTCAR:343: volume of cell : 1258.66
150
+ # #assert_in_delta( Iter1-Nsw0/OUTCAR:1488: volume of cell : 1258.66
150
151
 
151
- end
152
+ #end
152
153
 
153
154
  def test_elapsed_time
154
155
  assert_equal(nil, @o01int[:elapsed_time])
155
156
  assert_in_delta(164.134, @o04[:elapsed_time], $tolerance )
156
157
  end
157
158
 
158
- def test_irreducible_kpoints
159
- assert_equal(15, @o01[:irreducible_kpoints])
160
- end
159
+ #def test_irreducible_kpoints
160
+ # assert_equal(15, @o01[:irreducible_kpoints])
161
+ #end
161
162
 
162
163
  end
data/test/test_poscar.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "test/unit"
4
4
  require "stringio"
5
+ require "vasputils.rb"
5
6
  require "vasputils/poscar.rb"
6
7
 
7
8
  require "rubygems"
@@ -28,8 +29,8 @@ class TC_Poscar < Test::Unit::TestCase
28
29
  cell = Cell.new(axes, atoms)
29
30
  cell.comment = "test"
30
31
  io = StringIO.new
31
- assert_raises(Poscar::ElementMismatchError){
32
- Poscar.dump(cell, [0,1,2], io)}
32
+ assert_raises(VaspUtils::Poscar::ElementMismatchError){
33
+ VaspUtils::Poscar.dump(cell, [0,1,2], io)}
33
34
 
34
35
  # 生成
35
36
  axes = LatticeAxes.new( [
@@ -45,7 +46,7 @@ class TC_Poscar < Test::Unit::TestCase
45
46
  cell = Cell.new(axes, atoms)
46
47
  cell.comment = "test"
47
48
  io = StringIO.new
48
- Poscar.dump(cell, [0,1], io)
49
+ VaspUtils::Poscar.dump(cell, [0,1], io)
49
50
  io.rewind
50
51
  corrects = [
51
52
  "test\n",
@@ -73,7 +74,7 @@ class TC_Poscar < Test::Unit::TestCase
73
74
  cell = Cell.new(axes, atoms)
74
75
  cell.comment = "test"
75
76
  io = StringIO.new
76
- Poscar.dump(cell, [0,1], io)
77
+ VaspUtils::Poscar.dump(cell, [0,1], io)
77
78
  io.rewind
78
79
  corrects = [
79
80
  "test\n",
@@ -97,7 +98,7 @@ class TC_Poscar < Test::Unit::TestCase
97
98
 
98
99
  def test_parse
99
100
  io = StringIO.new
100
- assert_raises(Poscar::ParseError){ Poscar.parse(io) }
101
+ assert_raises(VaspUtils::Poscar::ParseError){ VaspUtils::Poscar.parse(io) }
101
102
 
102
103
  io = StringIO.new
103
104
  io.puts "sample0"
@@ -111,7 +112,7 @@ class TC_Poscar < Test::Unit::TestCase
111
112
  io.puts " 0.5 0.0 0.0 #Ge-002"
112
113
  io.puts " 0.5 0.5 0.0 #O--003"
113
114
  io.rewind
114
- cell = Poscar.parse(io)
115
+ cell = VaspUtils::Poscar.parse(io)
115
116
  assert_equal("sample0", cell.comment)
116
117
  assert_equal(
117
118
  LatticeAxes.new( [
@@ -142,7 +143,7 @@ class TC_Poscar < Test::Unit::TestCase
142
143
  io.puts " 0.5 0.5 0.0 T T T #O--003"
143
144
  io.puts " 0.5 0.5 0.5 T T T #O--004"
144
145
  io.rewind
145
- cell = Poscar.parse(io)
146
+ cell = VaspUtils::Poscar.parse(io)
146
147
  assert_equal("sample1", cell.comment)
147
148
  assert_equal(
148
149
  LatticeAxes.new( [
@@ -167,7 +168,7 @@ class TC_Poscar < Test::Unit::TestCase
167
168
  end
168
169
 
169
170
  def test_load_file
170
- cell = Poscar.load_file("test/poscar/POSCAR.00")
171
+ cell = VaspUtils::Poscar.load_file("test/poscar/POSCAR.00")
171
172
  assert_equal("sample0", cell.comment)
172
173
  assert_equal(
173
174
  LatticeAxes.new( [
@@ -184,7 +185,7 @@ class TC_Poscar < Test::Unit::TestCase
184
185
  assert_equal(
185
186
  Atom.new(2, [0.5, 0.5, 0.0], "#O--003"), cell.atoms[2])
186
187
 
187
- #cell = Poscar.load_file("test/poscar/POSCAR.02")
188
+ #cell = VaspUtils::Poscar.load_file("test/poscar/POSCAR.02")
188
189
  #assert_equal("sample0", cell.comment)
189
190
  #assert_in_delta( 7.1028554188641708, cell.axes[0][0], $tolerance)
190
191
  #assert_in_delta(-0.0000000169534433, cell.axes[0][1], $tolerance)
@@ -203,7 +204,7 @@ class TC_Poscar < Test::Unit::TestCase
203
204
  end
204
205
 
205
206
  #def setup
206
- # #@pp02 = Poscar.new("test/poscar/POSCAR.shirai")
207
+ # #@pp02 = VaspUtils::Poscar.new("test/poscar/POSCAR.shirai")
207
208
  #end
208
209
 
209
210
  end
data/test/test_potcar.rb CHANGED
@@ -1,14 +1,15 @@
1
1
  #! /usr/bin/ruby
2
2
 
3
3
  require "test/unit"
4
+ require "vasputils.rb"
4
5
  require "vasputils/potcar.rb"
5
6
 
6
7
  class TC_Potcar < Test::Unit::TestCase
7
8
 
8
9
  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")
10
+ @p0 = VaspUtils::Potcar.load_file("test/potcar/POTCAR" )
11
+ @p1 = VaspUtils::Potcar.load_file("test/potcar/POTCAR.dummy" )
12
+ @p2 = VaspUtils::Potcar.load_file("test/potcar/POTCAR.allElement")
12
13
  end
13
14
 
14
15
  def test_get_filename
@@ -40,8 +41,8 @@ class TC_Potcar < Test::Unit::TestCase
40
41
  end
41
42
 
42
43
  #def test_self_elements
43
- # assert_equal([ "Li", "Ge", "O" ], Potcar.elements( @p0 ))
44
- # assert_equal([ "Li", "Ge", "O" ], Potcar.elements( @p1 ))
44
+ # assert_equal([ "Li", "Ge", "O" ], VaspUtils::Potcar.elements( @p0 ))
45
+ # assert_equal([ "Li", "Ge", "O" ], VaspUtils::Potcar.elements( @p1 ))
45
46
  # correct = [
46
47
  # "Ac", "Ac", "Ag", "Al", "Al", "Ar", "As", "Au", "B", "B", "B", "Ba",
47
48
  # "Be", "Be", "Bi", "Bi", "Br", "C", "C", "C", "Ca", "Ca", "Cd", "Ce",
@@ -58,7 +59,7 @@ class TC_Potcar < Test::Unit::TestCase
58
59
  # "Ta", "Ta", "Tb", "Tc", "Tc", "Te", "Th", "Th", "Ti", "Ti", "Ti",
59
60
  # "Tl", "Tl", "Tm", "Tm", "U", "U", "V", "V", "V", "W", "W", "X", "Y",
60
61
  # "Yb", "Yb", "Zn", "Zr", "Zr"]
61
- # assert_equal( correct, Potcar.elements( @p2 ))
62
+ # assert_equal( correct, VaspUtils::Potcar.elements( @p2 ))
62
63
  #end
63
64
 
64
65
  end
data/test/test_vaspdir.rb CHANGED
@@ -8,13 +8,13 @@ gem "comana"
8
8
  require "comana/computationmanager.rb"
9
9
 
10
10
  require "test/unit"
11
- require "vasputils/vaspdir.rb"
11
+ require "vasputils.rb"
12
12
 
13
13
  # assert_equal( cor, data)
14
14
  # assert_in_delta( cor, data, $tolerance )
15
15
  # assert_raise( RuntimeError ){}
16
16
 
17
- class VaspDir < ComputationManager
17
+ class VaspUtils::VaspDir < ComputationManager
18
18
  attr_reader :mode
19
19
 
20
20
  def calculate
@@ -60,10 +60,10 @@ class TC_VaspDir < Test::Unit::TestCase
60
60
  ]
61
61
 
62
62
  def setup
63
- @vd00 = VaspDir.new("test/vaspdir/not-yet")
64
- @vd01 = VaspDir.new("test/vaspdir/locked")
65
- @vd02 = VaspDir.new("test/vaspdir/started")
66
- @vd03 = VaspDir.new("test/vaspdir/finished")
63
+ @vd00 = VaspUtils::VaspDir.new("test/vaspdir/not-yet")
64
+ @vd01 = VaspUtils::VaspDir.new("test/vaspdir/locked")
65
+ @vd02 = VaspUtils::VaspDir.new("test/vaspdir/started")
66
+ @vd03 = VaspUtils::VaspDir.new("test/vaspdir/finished")
67
67
 
68
68
  GENERATED_FILES_VD00.each do |file|
69
69
  FileUtils.rm file if File.exist? file
@@ -74,10 +74,10 @@ class TC_VaspDir < Test::Unit::TestCase
74
74
  end
75
75
 
76
76
  def test_initialize
77
- assert_raise(VaspDir::InitializeError){VaspDir.new("test/vaspdir/lack-INCAR" )}
78
- assert_raise(VaspDir::InitializeError){VaspDir.new("test/vaspdir/lack-KPOINTS")}
79
- assert_raise(VaspDir::InitializeError){VaspDir.new("test/vaspdir/lack-POSCAR" )}
80
- assert_raise(VaspDir::InitializeError){VaspDir.new("test/vaspdir/lack-POTCAR" )}
77
+ assert_raise(VaspUtils::VaspDir::InitializeError){VaspUtils::VaspDir.new("test/vaspdir/lack-INCAR" )}
78
+ assert_raise(VaspUtils::VaspDir::InitializeError){VaspUtils::VaspDir.new("test/vaspdir/lack-KPOINTS")}
79
+ assert_raise(VaspUtils::VaspDir::InitializeError){VaspUtils::VaspDir.new("test/vaspdir/lack-POSCAR" )}
80
+ assert_raise(VaspUtils::VaspDir::InitializeError){VaspUtils::VaspDir.new("test/vaspdir/lack-POTCAR" )}
81
81
  end
82
82
 
83
83
  def test_finished?