vasputils 0.1.3 → 0.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f52945fb812c9793b9328e5651c2f00bcc7c3300
4
- data.tar.gz: 4df31bb7083393b265e7d032b6966228ff310dc3
3
+ metadata.gz: 01cd9553715d4619bb01ce5b2d31978c447cc03a
4
+ data.tar.gz: 45590fabd8de6c5f4bc669399d334c22f3c12936
5
5
  SHA512:
6
- metadata.gz: fd79defd449b5ba636e6209a406e17da9936559f6746c53ac3c77a97bc06fa01e2d5a756dd887c9158468abc7d9b9bff5a6ffb359cbd9b8548a1d3415534c162
7
- data.tar.gz: 5d346c052ba121a46d6edd97516b5d7ecb0d570caef21cce50ce17fc5c15390d618388fddf03afa721630adeaa65c334c3da633e9f1e53fcee6120e978ca9d47
6
+ metadata.gz: a934034c6cccf101adcc139a939b24585bf09ea6fd8b26cb8e67fe7788649012804ee2e0c82fef5c9585e7b4f9d79c13284c219a7ca6b1955404607553ed6042
7
+ data.tar.gz: b224b574ef436f651330ccb6eea3c9ef2b11b9b0649513552bd8adb9c2f12634cff73dbcd7418eb35d2eb1e26e54cde847c87e0b1ed82cff2c321f4759b73aad
data/CHANGES CHANGED
@@ -1,6 +1,10 @@
1
1
  = vasputils changelog
2
2
 
3
- == Master (for 0.1.4)
3
+ == Master (for 0.1.5)
4
+
5
+ == Version 0.1.4 [2016-05-09] released
6
+ * Refactoring of unused variables
7
+ * Add VasprunXml::calculation_energies
4
8
 
5
9
  == Version 0.1.3 [2016-04-20] released
6
10
  * Add 'incar generate --overwrite'
@@ -47,7 +51,7 @@
47
51
  * Add bin/poscar
48
52
  * Add bin/potcar
49
53
  * Add vaspspcond including subcommand 'vary', instead of varycondition.
50
- * Add VaspUtils::Vasprun_xml
54
+ * Add VaspUtils::VasprunXml
51
55
  * Add bin/geomoptposcar
52
56
  * Add subcommand `povray' to bin/poscar
53
57
  * Add element order to Poscar.dump
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -46,7 +46,7 @@ class VaspUtils::Poscar
46
46
  axes = []
47
47
  3.times do |i| #each axis of a, b, c.
48
48
  vec = io.readline.strip.split(/\s+/) #in x,y,z directions
49
- axes << vec.collect! { |i| i.to_f * scale } #multiply scaling factor
49
+ axes << vec.collect! { |j| j.to_f * scale } #multiply scaling factor
50
50
  end
51
51
 
52
52
  # Element symbol (vasp 5). Nothing in vasp 4.
@@ -220,7 +220,7 @@ class VaspUtils::Poscar
220
220
  end
221
221
  end
222
222
 
223
- cell = klass.new(axes, atoms)
223
+ klass.new(axes, atoms)
224
224
  end
225
225
 
226
226
  # selective_dynamics は常に on にする。
@@ -270,8 +270,8 @@ class VaspUtils::Poscar
270
270
  :direct => true,
271
271
  :positions => new_positions
272
272
  }
273
- correct = VaspUtils::Poscar.new(hash)
274
273
 
274
+ VaspUtils::Poscar.new(hash)
275
275
  end
276
276
 
277
277
  #
@@ -379,13 +379,11 @@ class VaspUtils::Poscar
379
379
  def sprint_position(i)
380
380
  str = sprintf(" % 18.15f % 18.15f % 18.15f", * @positions[i])
381
381
  if @selective_dynamics
382
- if @movable_flags
383
- @movable_flags[i].each do |flag|
384
- (flag == true) ? str += " T" : str += " F"
385
- end
386
- else
387
- str += " T T T"
382
+ @selective_dynamics[i].each do |flag|
383
+ (flag == true) ? str += " T" : str += " F"
388
384
  end
385
+ else
386
+ #str += " T T T"
389
387
  end
390
388
  str
391
389
  end
@@ -15,7 +15,7 @@ class VaspUtils::Potcar
15
15
 
16
16
  def self.load_file(path)
17
17
  result = self.new
18
- elements = Array.new
18
+ #elements = Array.new
19
19
  File.open( path, "r" ).each do |line|
20
20
  if line =~ /VRHFIN\s*=\s*([A-Za-z]*)/
21
21
  result.elements << $1
@@ -79,7 +79,7 @@ class VaspUtils::VaspGeometryOptimizer < Comana::ComputationManager
79
79
  #Keep 'geomopt00/{POSCAR,POTCAR,INCAR,POTCAR}', remove others.
80
80
  def reset_initialize
81
81
  poscars = Dir.glob("#{@dir}/#{PREFIX}*/POSCAR").sort
82
- poscar = nil
82
+ #poscar = nil
83
83
  path = nil
84
84
 
85
85
  # Find the first geometory optimization
@@ -34,6 +34,7 @@ class VaspUtils::VasprunXml
34
34
  axis.text.strip.split.map {|i| i.to_f}
35
35
  end
36
36
  end
37
+ results
37
38
  end
38
39
 
39
40
  def positions_list
@@ -105,5 +106,10 @@ class VaspUtils::VasprunXml
105
106
  def num_spins
106
107
  @data.xpath("/modeling/parameters/separator[@name='electronic']/separator[@name='electronic spin']/i[@name='ISPIN']").children.to_s.to_i
107
108
  end
109
+
110
+ # energies of each ionic step
111
+ def calculation_energies
112
+ @data.xpath("/modeling/calculation/energy/i[@name='e_fr_energy']").children.to_a.map{|i| i.to_s.to_f}
113
+ end
108
114
  end
109
115
 
@@ -43,7 +43,7 @@ class VaspUtils::Xdatcar
43
43
  axes = []
44
44
  3.times do |i| #each axis of a, b, c.
45
45
  vec = io.readline.strip.split(/\s+/) #in x,y,z directions
46
- axes << vec.collect! { |i| i.to_f * scale } #multiply scaling factor
46
+ axes << vec.collect! { |j| j.to_f * scale } #multiply scaling factor
47
47
  end
48
48
 
49
49
  vals = io.readline.strip.split(/\s+/)
data/test/test_poscar.rb CHANGED
@@ -255,7 +255,12 @@ class TC_Poscar < Test::Unit::TestCase
255
255
  ],
256
256
  :elements => %w(Li Ge O),
257
257
  :nums_elements => [1,1,2],
258
- :selective_dynamics => true,
258
+ :selective_dynamics => [
259
+ [true , true , true ],
260
+ [true , true , false],
261
+ [true , false, false],
262
+ [false, false, false],
263
+ ],
259
264
  :direct => true,
260
265
  :positions => [
261
266
  [0.0, 0.0, 0.0],
@@ -277,9 +282,9 @@ class TC_Poscar < Test::Unit::TestCase
277
282
  "Selective dynamics\n",
278
283
  "Direct\n",
279
284
  " 0.000000000000000 0.000000000000000 0.000000000000000 T T T\n",
280
- " 0.500000000000000 0.000000000000000 0.000000000000000 T T T\n",
281
- " 0.500000000000000 0.500000000000000 0.000000000000000 T T T\n",
282
- " 0.500000000000000 0.500000000000000 0.500000000000000 T T T\n",
285
+ " 0.500000000000000 0.000000000000000 0.000000000000000 T T F\n",
286
+ " 0.500000000000000 0.500000000000000 0.000000000000000 T F F\n",
287
+ " 0.500000000000000 0.500000000000000 0.500000000000000 F F F\n",
283
288
  ]
284
289
  lines = io.readlines
285
290
  corrects.each_with_index do |cor, index|
@@ -59,7 +59,7 @@ class TC_VaspGeometryOptimizer < Test::Unit::TestCase
59
59
 
60
60
  def test_prepare_next
61
61
  dir = TEST_DIR + "/prepare_next/normal"
62
- old_number_dir = dir + "/geomopt00"
62
+ #old_number_dir = dir + "/geomopt00"
63
63
  new_number_dir = dir + "/geomopt01"
64
64
 
65
65
  if Dir.exist?(new_number_dir)
@@ -133,6 +133,17 @@ class TC_VasprunXml < Test::Unit::TestCase
133
133
  assert_raise(error){ @v00.partial_dos(5, 1)}
134
134
  end
135
135
 
136
+ def test_calculation_energies
137
+ results = @v01.calculation_energies
138
+ assert_equal(5 , results.size)
139
+ assert_equal(-4.21361453, results[0])
140
+ assert_equal(-4.31607186, results[1])
141
+ assert_equal(-4.39832854, results[2])
142
+ assert_equal(-4.40043741, results[3])
143
+ assert_equal(-4.40063677, results[4])
144
+ end
145
+
146
+
136
147
 
137
148
  end
138
149
 
data/vasputils.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: vasputils 0.1.3 ruby lib
5
+ # stub: vasputils 0.1.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "vasputils"
9
- s.version = "0.1.3"
9
+ s.version = "0.1.4"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["ippei94da"]
14
- s.date = "2016-04-20"
14
+ s.date = "2016-05-09"
15
15
  s.description = "This gem provides parsers for some of input and output files for VASP.\n This will provide support command for computations."
16
16
  s.email = "ippei94da@gmail.com"
17
17
  s.executables = ["incar", "kpoints", "poscar", "potcar", "vaspdir", "vaspgeomopt", "vasprunxml"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vasputils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ippei94da
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-20 00:00:00.000000000 Z
11
+ date: 2016-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit