crystalcell 0.0.5 → 0.0.6

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: 2ab1ca9023c434c254a2f47ef1daad5f5692399b
4
- data.tar.gz: 81e12f4dea37190c62b377d1ffa01a4c79507872
3
+ metadata.gz: 81bccc2d33dbb516c3cf706bc0d4967522482175
4
+ data.tar.gz: 75dae44df7dad2f8f1afb829aaf9c677d361db44
5
5
  SHA512:
6
- metadata.gz: 9b69e9a69caaceb60f47e112fd371902436dda5b4af4c06beddb426b6b78b3fe746dcf23191ce11eec062f47977145a6451a0bbe8d4c50967ced6130b648d3a8
7
- data.tar.gz: f3c9cfd9614fb65050c0c2ae04961e9a39ecaf50352f9ff5384473492dc8f9664190b534efa4c1e440a49c2ee89b329cb7447fb5bad0177144905866a30a83d3
6
+ metadata.gz: d1b841d618bf499652fcb37e96d594211aca99d962cbc6da58003129941c1a43c215b7f9b77e496d8c150eec09bbd37fed39e6fa0a8ec13cedf70f3e3c4ccaba
7
+ data.tar.gz: 0a267fe50ac4dc24993ee28a1826d38232a8dd4baf189fd7196f7c745a43db6d944a69bdc4160de706b3f176094cdce94c37523414e5afd2c305535b47287611
data/CHANGES CHANGED
@@ -1,6 +1,23 @@
1
1
  = crystalcell Changelog
2
2
 
3
- == Master (for 0.0.6)
3
+ == Master (for 0.0.7)
4
+
5
+ == Version 0.0.6 [2016-05-31] released
6
+
7
+ * Add methods to CrystalCell::Cell
8
+ * spgnum
9
+ * spg
10
+ * hallnum
11
+ * hall_symbol
12
+ * setting
13
+ * t_mat
14
+ * o_shift
15
+ * rotations
16
+ * translations
17
+ * wyckoffs
18
+ * brv_lattice
19
+ * brv_types
20
+ * brv_positions
4
21
 
5
22
  == Version 0.0.5 [2016-05-09] released
6
23
 
@@ -8,6 +25,7 @@
8
25
  * Delete meaningless codes
9
26
 
10
27
  == Version 0.0.4 [2016-03-11] released
28
+
11
29
  * LatticeAxes.axes is added.
12
30
  * LatticeAxes.* is added.
13
31
  * LatticeAxes.to_a is added.
@@ -28,13 +46,16 @@
28
46
  * CrystalCell::PeriodicCell.find_bonds returns preserved order of elements
29
47
 
30
48
  == Version 0.0.3 [2015-02-05] released
49
+
31
50
  * Add CrystalCell::LatticeAxes.new_lc
32
51
 
33
52
  == Version 0.0.2 [2014-08-30] released
53
+
34
54
  * Change cell.dump_poscar for vasp 5.
35
55
  * Update dependency on other gems.
36
56
 
37
57
  == Version 0.0.1 [2013-04-18] released
58
+
38
59
  * Change indent char from tab char to two spaces.
39
60
  * Introduce module CrystalCell as new namespace.
40
61
  * Add Cell#symmetry_operations and Cell#axis_independencies.
@@ -44,4 +65,5 @@
44
65
  * Adjust to builtinextension-0.1.0.
45
66
 
46
67
  == Version 0.0.0
68
+
47
69
  * Initial release.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
data/crystalcell.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: crystalcell 0.0.5 ruby lib
5
+ # stub: crystalcell 0.0.6 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "crystalcell"
9
- s.version = "0.0.5"
9
+ s.version = "0.0.6"
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-05-09"
14
+ s.date = "2016-05-31"
15
15
  s.description = "This gem provides Cell, LatticeAxes, Atom classes, and so on.\n And this provides simple treatment of a periodic boundary condition.\n "
16
16
  s.email = "ippei94da@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -44,7 +44,10 @@ class CrystalCell::Cell
44
44
  class NoSpglibError < Exception; end
45
45
 
46
46
  attr_reader :element_names, :atoms, :axes
47
- attr_accessor :comment
47
+ attr_accessor :comment, :symprec, :angle_tolerance
48
+
49
+ # @symprec indicates precision for symmetry check.
50
+ # @angle_tolerance indicates tolerance for angle to check symmetry.
48
51
 
49
52
  #Argument 'axes' must have :to_a method and expressed in 3x3 Array.
50
53
  def initialize(axes, atoms = [])
@@ -56,13 +59,14 @@ class CrystalCell::Cell
56
59
  end
57
60
 
58
61
  atoms.each do |atom|
59
- #pp atom
60
62
  unless atom.is_a?(CrystalCell::Atom)
61
63
  raise CellTypeError,
62
64
  "#{atom} is not a kind of CrystalCell::Atom."
63
65
  end
64
66
  end
65
67
  @atoms = atoms
68
+ @symprec = 1.0E-10
69
+ @angle_tolerance = -1.0
66
70
  end
67
71
 
68
72
  #セルに原子を追加する。
@@ -150,9 +154,10 @@ class CrystalCell::Cell
150
154
  #other: 他のセル
151
155
  #length_ratio: 長さ(a, b, c) の許容値を比で指定
152
156
  #angle_tolerance: 角度(alpha, beta, gamma) の許容値を角度の値で指定
153
- def equal_lattice_in_delta?( other, length_ratio, angle_tolerance )
157
+ #def equal_lattice_in_delta?( other, length_ratio, angle_tolerance )
158
+ def equal_lattice_in_delta?( other, length_ratio)
154
159
  @axes.equal_in_delta?(
155
- CrystalCell::LatticeAxes.new( other.axes.to_a ), length_ratio, angle_tolerance
160
+ CrystalCell::LatticeAxes.new( other.axes.to_a ), length_ratio, -@angle_tolerance
156
161
  )
157
162
  end
158
163
 
@@ -166,8 +171,9 @@ class CrystalCell::Cell
166
171
 
167
172
  #等価判定。
168
173
  #格子定数の長さの比率の許容値、格子定数の角度の許容値、原子座標の許容値。
169
- def equal_in_delta?( other, length_ratio, angle_tolerance, position_tolerance )
170
- return false unless equal_lattice_in_delta?(other, length_ratio, angle_tolerance)
174
+ #def equal_in_delta?( other, length_ratio, angle_tolerance, position_tolerance )
175
+ def equal_in_delta?( other, length_ratio, position_tolerance )
176
+ return false unless equal_lattice_in_delta?(other, length_ratio)
171
177
  return false unless equal_atoms_in_delta?(other, position_tolerance)
172
178
  return true
173
179
  end
@@ -419,78 +425,112 @@ class CrystalCell::Cell
419
425
  CrystalCell::Cell.new(@axes, new_atoms)
420
426
  end
421
427
 
422
- #Return information of axes symmetry.
423
- #E.g.,
424
- # [true , true , true ] when a = b = c, like cubic
425
- # [true , false, false] when a = b != c, like hexagonal, trigonal, tetragonal
426
- # [false, true , false] (same as above)
427
- # [false, false, true ] (same as above)
428
- # [false, false, false] when a != b != c, like triclinic, monoclinic, orthorhombic
429
- def axis_independencies(symprec, angle_tolerance)
430
- rotations = symmetry_operations(symprec, angle_tolerance).map {|oper| oper[:rotation]}
428
+ ##Return information of axes symmetry.
429
+ ##E.g.,
430
+ ## [true , true , true ] when a = b = c, like cubic
431
+ ## [true , false, false] when a = b != c, like hexagonal, trigonal, tetragonal
432
+ ## [false, true , false] (same as above)
433
+ ## [false, false, true ] (same as above)
434
+ ## [false, false, false] when a != b != c, like triclinic, monoclinic, orthorhombic
435
+ #def axis_independencies(symprec, angle_tolerance)
436
+ # rotations = symmetry_operations(symprec, angle_tolerance).map {|oper| oper[:rotation]}
437
+
438
+ # results = [true, true, true]
439
+ # rotations.each do |rot|
440
+ # 3.times do |i|
441
+ # 3.times do |j|
442
+ # next if rot[i][j] == 0
443
+ # next if i == j
444
+ # results[i] = false
445
+ # results[j] = false
446
+ # end
447
+ # end
448
+ # end
449
+ # return results
450
+ #end
431
451
 
432
- results = [true, true, true]
433
- rotations.each do |rot|
434
- 3.times do |i|
435
- 3.times do |j|
436
- next if rot[i][j] == 0
437
- next if i == j
438
- results[i] = false
439
- results[j] = false
440
- end
441
- end
452
+ #Return rotations and translation of symmetry operations.
453
+ def symmetry_operations
454
+ #dataset = get_spg_dataset(symprec, angle_tolerance)
455
+
456
+ #pp dataset;exit
457
+
458
+ results = []
459
+ rotations.size.times do |index|
460
+ results << {
461
+ :rotation => rotations[index],
462
+ :translation => translations[index]
463
+ }
442
464
  end
443
465
  return results
444
466
  end
445
467
 
446
- private
468
+ def spgnum
469
+ get_spg_dataset[0]
470
+ end
447
471
 
448
- #Return rotations and translation of symmetry operations.
449
- def symmetry_operations(symprec, angle_tolerance)
450
- #begin
451
- # require "getspg.so"
452
- #rescue LoadError
453
- # raise LoadError,
454
- # "LoadError: 'spglib' seems not to be installed into the system."
455
- #end
456
-
457
- unless defined? Getspg
458
- raise NoSpglibError, "symmetry_operations() is called without spglib."
459
- end
472
+ def spg
473
+ get_spg_dataset[1]
474
+ end
460
475
 
461
- #pp lattice # => [[2.0, 0.0, 0.0], [1.2246063538223773e-16, 2.0, 0.0], [1.2246063538223773e-16, 1.2246063538223773e-16, 2.0]]
462
- ##vasp の lattice 行と比べて転置しているのに注意。
463
- #pp position #=>[[0.0, 0.0, 0.0], [0.5, 0.0, 0.0], [0.5, 0.5, 0.0], [0.5, 0.5, 0.5]]
464
- #pp types #=>[1, 2, 3, 3]
465
- #pp symprec #=>1.0e-05
466
- #pp angle_tolerance #=>-1.0
467
- axes_t = @axes.to_a.transpose
476
+ def hallnum
477
+ get_spg_dataset[2]
478
+ end
468
479
 
469
- poss = positions.map {|pos| pos.to_a}
480
+ def hall_symbol
481
+ get_spg_dataset[3]
482
+ end
483
+
484
+ def setting
485
+ get_spg_dataset[4]
486
+ end
487
+
488
+ def t_mat
489
+ get_spg_dataset[5]
490
+ end
491
+
492
+ def o_shift
493
+ get_spg_dataset[6]
494
+ end
470
495
 
496
+ def rotations
497
+ get_spg_dataset[7]
498
+ end
499
+
500
+ def translations
501
+ get_spg_dataset[8]
502
+ end
503
+
504
+ def wyckoffs
505
+ get_spg_dataset[9]
506
+ end
507
+
508
+ def brv_lattice
509
+ get_spg_dataset[10]
510
+ end
511
+
512
+ def brv_types
513
+ get_spg_dataset[11]
514
+ end
515
+
516
+ def brv_positions
517
+ get_spg_dataset[12]
518
+ end
519
+
520
+ #ptg_symbol, ptg_num, trans_mat = getptg(rotations)
521
+
522
+ private
523
+
524
+ def get_spg_dataset
525
+ axes_t = @axes.to_a.transpose
526
+ poss = positions.map {|pos| pos.to_a}
471
527
  table = {}
472
528
  types = elements.map do |elem|
473
529
  table[elem] = ((table.size) +1) unless table.keys.include? elem
474
530
  table[elem]
475
531
  end
476
-
477
- #pp axes_t, poss, types, symprec, angle_tolerance
478
-
479
- #spgnum, spg, hallnum, hall_symbol, t_mat, o_shift,
480
- #rotations, translations, wyckoffs =
481
- # get_dataset(axes_t, poss, types, symprec, angle_tolerance)
482
- dataset = get_dataset(axes_t, poss, types, symprec, angle_tolerance)
483
- rotations = dataset[6]
484
- translations = dataset[7]
485
-
486
- results = []
487
- rotations.size.times do |index|
488
- results << {
489
- :rotation => rotations[index],
490
- :translation => translations[index]
491
- }
492
- end
493
- return results
532
+ hall_num= 0
533
+ dataset = get_dataset(axes_t, poss, types, hall_num, @symprec, @angle_tolerance)
494
534
  end
495
535
 
496
536
  #POSCAR の内容の文字列を生成。
data/test/test_cell.rb CHANGED
@@ -4,16 +4,16 @@
4
4
  require "helper"
5
5
  require 'stringio'
6
6
 
7
- class CrystalCell::Cell
8
- public :symmetry_operations
9
- end
7
+ #class CrystalCell::Cell
8
+ # public :symmetry_operations
9
+ #end
10
10
 
11
11
  class FooCell < CrystalCell::Cell; end
12
12
 
13
13
  class TC_Cell < Test::Unit::TestCase
14
14
  $tolerance = 10 ** (-10)
15
- $symprec = 1.0e-05
16
- $angle_tolerance = -1.0
15
+ #$symprec = 1.0e-05
16
+ #$angle_tolerance = -1.0
17
17
 
18
18
  def setup
19
19
  # 原子のないセル。
@@ -419,15 +419,15 @@ class TC_Cell < Test::Unit::TestCase
419
419
  end
420
420
 
421
421
  def test_equal_lattice_in_delta?
422
- assert_equal( true , @c00.equal_lattice_in_delta?(@c00, 0.001, 0.1) )
423
- assert_equal( true , @c00.equal_lattice_in_delta?(@c02, 0.001, 0.1) )
424
- assert_equal( true , @c00.equal_lattice_in_delta?(@c01, 0.001, 0.1) )
425
- assert_equal( true , @c02.equal_lattice_in_delta?(@c00, 0.001, 0.1) )
426
- assert_equal( true , @c02.equal_lattice_in_delta?(@c02, 0.001, 0.1) )
427
- assert_equal( true , @c02.equal_lattice_in_delta?(@c01, 0.001, 0.1) )
428
- assert_equal( true , @c01.equal_lattice_in_delta?(@c00, 0.001, 0.1) )
429
- assert_equal( true , @c01.equal_lattice_in_delta?(@c02, 0.001, 0.1) )
430
- assert_equal( true , @c01.equal_lattice_in_delta?(@c01, 0.001, 0.1) )
422
+ assert_equal( true , @c00.equal_lattice_in_delta?(@c00, 0.001) )
423
+ assert_equal( true , @c00.equal_lattice_in_delta?(@c02, 0.001) )
424
+ assert_equal( true , @c00.equal_lattice_in_delta?(@c01, 0.001) )
425
+ assert_equal( true , @c02.equal_lattice_in_delta?(@c00, 0.001) )
426
+ assert_equal( true , @c02.equal_lattice_in_delta?(@c02, 0.001) )
427
+ assert_equal( true , @c02.equal_lattice_in_delta?(@c01, 0.001) )
428
+ assert_equal( true , @c01.equal_lattice_in_delta?(@c00, 0.001) )
429
+ assert_equal( true , @c01.equal_lattice_in_delta?(@c02, 0.001) )
430
+ assert_equal( true , @c01.equal_lattice_in_delta?(@c01, 0.001) )
431
431
 
432
432
  end
433
433
 
@@ -471,47 +471,47 @@ class TC_Cell < Test::Unit::TestCase
471
471
  end
472
472
 
473
473
  def test_equal_in_delta?
474
- assert_equal(true , @c00.equal_in_delta?( @c00, 0.001, 0.1, 0.01 ) )
475
- assert_equal(false, @c00.equal_in_delta?( @c01, 0.001, 0.1, 0.01 ) )
476
- assert_equal(false, @c00.equal_in_delta?( @c02, 0.001, 0.1, 0.01 ) )
477
- assert_equal(false, @c00.equal_in_delta?( @c03, 0.001, 0.1, 0.01 ) )
478
- assert_equal(false, @c00.equal_in_delta?( @c04, 0.001, 0.1, 0.01 ) )
479
- assert_equal(false, @c00.equal_in_delta?( @c05, 0.001, 0.1, 0.01 ) )
480
-
481
- assert_equal(false, @c02.equal_in_delta?( @c00, 0.001, 0.1, 0.01 ) )
482
- assert_equal(false, @c02.equal_in_delta?( @c01, 0.001, 0.1, 0.01 ) )
483
- assert_equal(true , @c02.equal_in_delta?( @c02, 0.001, 0.1, 0.01 ) )
484
- assert_equal(true , @c02.equal_in_delta?( @c03, 0.001, 0.1, 0.01 ) )
485
- assert_equal(false, @c02.equal_in_delta?( @c04, 0.001, 0.1, 0.01 ) )
486
- assert_equal(false, @c02.equal_in_delta?( @c05, 0.001, 0.1, 0.01 ) )
487
-
488
- assert_equal(false, @c01.equal_in_delta?( @c00, 0.001, 0.1, 0.01 ) )
489
- assert_equal(true , @c01.equal_in_delta?( @c01, 0.001, 0.1, 0.01 ) )
490
- assert_equal(false, @c01.equal_in_delta?( @c02, 0.001, 0.1, 0.01 ) )
491
- assert_equal(false, @c01.equal_in_delta?( @c03, 0.001, 0.1, 0.01 ) )
492
- assert_equal(false, @c01.equal_in_delta?( @c04, 0.001, 0.1, 0.01 ) )
493
- assert_equal(false, @c01.equal_in_delta?( @c05, 0.001, 0.1, 0.01 ) )
494
-
495
- assert_equal(false, @c03.equal_in_delta?( @c00, 0.001, 0.1, 0.01 ) )
496
- assert_equal(false, @c03.equal_in_delta?( @c01, 0.001, 0.1, 0.01 ) )
497
- assert_equal(true , @c03.equal_in_delta?( @c02, 0.001, 0.1, 0.01 ) )
498
- assert_equal(true , @c03.equal_in_delta?( @c03, 0.001, 0.1, 0.01 ) )
499
- assert_equal(false, @c03.equal_in_delta?( @c04, 0.001, 0.1, 0.01 ) )
500
- assert_equal(false, @c03.equal_in_delta?( @c05, 0.001, 0.1, 0.01 ) )
501
-
502
- assert_equal(false, @c04.equal_in_delta?( @c00, 0.001, 0.1, 0.01 ) )
503
- assert_equal(false, @c04.equal_in_delta?( @c01, 0.001, 0.1, 0.01 ) )
504
- assert_equal(false, @c04.equal_in_delta?( @c02, 0.001, 0.1, 0.01 ) )
505
- assert_equal(false, @c04.equal_in_delta?( @c03, 0.001, 0.1, 0.01 ) )
506
- assert_equal(true , @c04.equal_in_delta?( @c04, 0.001, 0.1, 0.01 ) )
507
- assert_equal(false, @c04.equal_in_delta?( @c05, 0.001, 0.1, 0.01 ) )
508
-
509
- assert_equal(false, @c05.equal_in_delta?( @c00, 0.001, 0.1, 0.01 ) )
510
- assert_equal(false, @c05.equal_in_delta?( @c01, 0.001, 0.1, 0.01 ) )
511
- assert_equal(false, @c05.equal_in_delta?( @c02, 0.001, 0.1, 0.01 ) )
512
- assert_equal(false, @c05.equal_in_delta?( @c03, 0.001, 0.1, 0.01 ) )
513
- assert_equal(false, @c05.equal_in_delta?( @c04, 0.001, 0.1, 0.01 ) )
514
- assert_equal(true , @c05.equal_in_delta?( @c05, 0.001, 0.1, 0.01 ) )
474
+ assert_equal(true , @c00.equal_in_delta?( @c00, 0.001, 0.01 ) )
475
+ assert_equal(false, @c00.equal_in_delta?( @c01, 0.001, 0.01 ) )
476
+ assert_equal(false, @c00.equal_in_delta?( @c02, 0.001, 0.01 ) )
477
+ assert_equal(false, @c00.equal_in_delta?( @c03, 0.001, 0.01 ) )
478
+ assert_equal(false, @c00.equal_in_delta?( @c04, 0.001, 0.01 ) )
479
+ assert_equal(false, @c00.equal_in_delta?( @c05, 0.001, 0.01 ) )
480
+
481
+ assert_equal(false, @c02.equal_in_delta?( @c00, 0.001, 0.01 ) )
482
+ assert_equal(false, @c02.equal_in_delta?( @c01, 0.001, 0.01 ) )
483
+ assert_equal(true , @c02.equal_in_delta?( @c02, 0.001, 0.01 ) )
484
+ assert_equal(true , @c02.equal_in_delta?( @c03, 0.001, 0.01 ) )
485
+ assert_equal(false, @c02.equal_in_delta?( @c04, 0.001, 0.01 ) )
486
+ assert_equal(false, @c02.equal_in_delta?( @c05, 0.001, 0.01 ) )
487
+
488
+ assert_equal(false, @c01.equal_in_delta?( @c00, 0.001, 0.01 ) )
489
+ assert_equal(true , @c01.equal_in_delta?( @c01, 0.001, 0.01 ) )
490
+ assert_equal(false, @c01.equal_in_delta?( @c02, 0.001, 0.01 ) )
491
+ assert_equal(false, @c01.equal_in_delta?( @c03, 0.001, 0.01 ) )
492
+ assert_equal(false, @c01.equal_in_delta?( @c04, 0.001, 0.01 ) )
493
+ assert_equal(false, @c01.equal_in_delta?( @c05, 0.001, 0.01 ) )
494
+
495
+ assert_equal(false, @c03.equal_in_delta?( @c00, 0.001, 0.01 ) )
496
+ assert_equal(false, @c03.equal_in_delta?( @c01, 0.001, 0.01 ) )
497
+ assert_equal(true , @c03.equal_in_delta?( @c02, 0.001, 0.01 ) )
498
+ assert_equal(true , @c03.equal_in_delta?( @c03, 0.001, 0.01 ) )
499
+ assert_equal(false, @c03.equal_in_delta?( @c04, 0.001, 0.01 ) )
500
+ assert_equal(false, @c03.equal_in_delta?( @c05, 0.001, 0.01 ) )
501
+
502
+ assert_equal(false, @c04.equal_in_delta?( @c00, 0.001, 0.01 ) )
503
+ assert_equal(false, @c04.equal_in_delta?( @c01, 0.001, 0.01 ) )
504
+ assert_equal(false, @c04.equal_in_delta?( @c02, 0.001, 0.01 ) )
505
+ assert_equal(false, @c04.equal_in_delta?( @c03, 0.001, 0.01 ) )
506
+ assert_equal(true , @c04.equal_in_delta?( @c04, 0.001, 0.01 ) )
507
+ assert_equal(false, @c04.equal_in_delta?( @c05, 0.001, 0.01 ) )
508
+
509
+ assert_equal(false, @c05.equal_in_delta?( @c00, 0.001, 0.01 ) )
510
+ assert_equal(false, @c05.equal_in_delta?( @c01, 0.001, 0.01 ) )
511
+ assert_equal(false, @c05.equal_in_delta?( @c02, 0.001, 0.01 ) )
512
+ assert_equal(false, @c05.equal_in_delta?( @c03, 0.001, 0.01 ) )
513
+ assert_equal(false, @c05.equal_in_delta?( @c04, 0.001, 0.01 ) )
514
+ assert_equal(true , @c05.equal_in_delta?( @c05, 0.001, 0.01 ) )
515
515
  end
516
516
 
517
517
  def test_equal
@@ -1284,93 +1284,61 @@ class TC_Cell < Test::Unit::TestCase
1284
1284
  assert_in_delta(0.0, result.atoms[1].position[2], $tolerance)
1285
1285
  end
1286
1286
 
1287
- def test_axis_independencies
1288
- unless defined? Getspg
1289
- puts
1290
- puts "test_axis_independencies() is ignored because spglib is not installed."
1291
- return
1292
- end
1293
-
1294
- assert_equal([false, false, false],
1295
- @c10 .axis_independencies($symprec, $angle_tolerance))
1296
- assert_equal([false, false, true ],
1297
- @c11 .axis_independencies($symprec, $angle_tolerance))
1298
- assert_equal([true , true , true ],
1299
- @c12 .axis_independencies($symprec, $angle_tolerance))
1300
- assert_equal([true , true , true ],
1301
- @c13 .axis_independencies($symprec, $angle_tolerance))
1302
- assert_equal([false, false, true ],
1303
- @c14 .axis_independencies($symprec, $angle_tolerance))
1304
- assert_equal([false, true , false],
1305
- @c14b.axis_independencies($symprec, $angle_tolerance))
1306
- assert_equal([true , true , true ],
1307
- @c15 .axis_independencies($symprec, $angle_tolerance))
1308
- assert_equal([false, false, true ],
1309
- @c16 .axis_independencies($symprec, $angle_tolerance))
1310
- end
1311
-
1312
1287
  def test_symmetry_operations
1313
- unless defined? Getspg
1314
- puts
1315
- puts "test_symmetry_operations() is ignored because spglib is not installed."
1316
- return
1317
- end
1318
-
1319
1288
  f13 = 1.0/3.0
1320
1289
 
1321
1290
  #cubic/POSCAR #Pm-3m (221) / m-3m / -P 4 2 3 (517)
1322
1291
  corrects = [
1323
- {:rotation => [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----01----
1324
- {:rotation => [[-1, 0, 0], [ 0, -1, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----02----
1325
- {:rotation => [[ 0, -1, 0], [ 1, 0, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----03----
1326
- {:rotation => [[ 0, 1, 0], [-1, 0, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----04----
1327
- {:rotation => [[-1, 0, 0], [ 0, -1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----05----
1328
- {:rotation => [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----06----
1329
- {:rotation => [[ 0, 1, 0], [-1, 0, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----07----
1330
- {:rotation => [[ 0, -1, 0], [ 1, 0, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----08----
1331
- {:rotation => [[ 1, 0, 0], [ 0, -1, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----09----
1332
- {:rotation => [[-1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----10----
1333
- {:rotation => [[ 0, -1, 0], [-1, 0, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----11----
1334
- {:rotation => [[ 0, 1, 0], [ 1, 0, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----12----
1335
- {:rotation => [[-1, 0, 0], [ 0, 1, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----13----
1336
- {:rotation => [[ 1, 0, 0], [ 0, -1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----14----
1337
- {:rotation => [[ 0, 1, 0], [ 1, 0, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----15----
1338
- {:rotation => [[ 0, -1, 0], [-1, 0, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----16----
1339
- {:rotation => [[ 0, 0, 1], [ 1, 0, 0], [ 0, 1, 0]], :translation => [0.0, 0.0, 0.0]}, #----17----
1340
- {:rotation => [[ 0, 0, -1], [-1, 0, 0], [ 0, -1, 0]], :translation => [0.0, 0.0, 0.0]}, #----18----
1341
- {:rotation => [[ 0, 0, 1], [ 0, -1, 0], [ 1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----19----
1342
- {:rotation => [[ 0, 0, -1], [ 0, 1, 0], [-1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----20----
1343
- {:rotation => [[ 0, 0, 1], [-1, 0, 0], [ 0, -1, 0]], :translation => [0.0, 0.0, 0.0]}, #----21----
1344
- {:rotation => [[ 0, 0, -1], [ 1, 0, 0], [ 0, 1, 0]], :translation => [0.0, 0.0, 0.0]}, #----22----
1345
- {:rotation => [[ 0, 0, 1], [ 0, 1, 0], [-1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----23----
1346
- {:rotation => [[ 0, 0, -1], [ 0, -1, 0], [ 1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----24----
1347
- {:rotation => [[ 0, 0, -1], [ 1, 0, 0], [ 0, -1, 0]], :translation => [0.0, 0.0, 0.0]}, #----25----
1348
- {:rotation => [[ 0, 0, 1], [-1, 0, 0], [ 0, 1, 0]], :translation => [0.0, 0.0, 0.0]}, #----26----
1349
- {:rotation => [[ 0, 0, -1], [ 0, -1, 0], [-1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----27----
1350
- {:rotation => [[ 0, 0, 1], [ 0, 1, 0], [ 1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----28----
1351
- {:rotation => [[ 0, 0, -1], [-1, 0, 0], [ 0, 1, 0]], :translation => [0.0, 0.0, 0.0]}, #----29----
1352
- {:rotation => [[ 0, 0, 1], [ 1, 0, 0], [ 0, -1, 0]], :translation => [0.0, 0.0, 0.0]}, #----30----
1353
- {:rotation => [[ 0, 0, -1], [ 0, 1, 0], [ 1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----31----
1354
- {:rotation => [[ 0, 0, 1], [ 0, -1, 0], [-1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----32----
1355
- {:rotation => [[ 0, 1, 0], [ 0, 0, 1], [ 1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----33----
1356
- {:rotation => [[ 0, -1, 0], [ 0, 0, -1], [-1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----34----
1357
- {:rotation => [[ 1, 0, 0], [ 0, 0, 1], [ 0, -1, 0]], :translation => [0.0, 0.0, 0.0]}, #----35----
1358
- {:rotation => [[-1, 0, 0], [ 0, 0, -1], [ 0, 1, 0]], :translation => [0.0, 0.0, 0.0]}, #----36----
1359
- {:rotation => [[ 0, -1, 0], [ 0, 0, 1], [-1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----37----
1360
- {:rotation => [[ 0, 1, 0], [ 0, 0, -1], [ 1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----38----
1361
- {:rotation => [[-1, 0, 0], [ 0, 0, 1], [ 0, 1, 0]], :translation => [0.0, 0.0, 0.0]}, #----39----
1362
- {:rotation => [[ 1, 0, 0], [ 0, 0, -1], [ 0, -1, 0]], :translation => [0.0, 0.0, 0.0]}, #----40----
1363
- {:rotation => [[ 0, -1, 0], [ 0, 0, -1], [ 1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----41----
1364
- {:rotation => [[ 0, 1, 0], [ 0, 0, 1], [-1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----42----
1365
- {:rotation => [[-1, 0, 0], [ 0, 0, -1], [ 0, -1, 0]], :translation => [0.0, 0.0, 0.0]}, #----43----
1366
- {:rotation => [[ 1, 0, 0], [ 0, 0, 1], [ 0, 1, 0]], :translation => [0.0, 0.0, 0.0]}, #----44----
1367
- {:rotation => [[ 0, 1, 0], [ 0, 0, -1], [-1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----45----
1368
- {:rotation => [[ 0, -1, 0], [ 0, 0, 1], [ 1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----46----
1369
- {:rotation => [[ 1, 0, 0], [ 0, 0, -1], [ 0, 1, 0]], :translation => [0.0, 0.0, 0.0]}, #----47----
1370
- {:rotation => [[-1, 0, 0], [ 0, 0, 1], [ 0, -1, 0]], :translation => [0.0, 0.0, 0.0]}, #----48----
1292
+ {:rotation => [[ 1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [ 0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----01----
1293
+ {:rotation => [[-1.0, 0.0, 0.0], [ 0.0, -1.0, 0.0], [ 0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----02----
1294
+ {:rotation => [[ 0.0, -1.0, 0.0], [ 1.0, 0.0, 0.0], [ 0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----03----
1295
+ {:rotation => [[ 0.0, 1.0, 0.0], [-1.0, 0.0, 0.0], [ 0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----04----
1296
+ {:rotation => [[-1.0, 0.0, 0.0], [ 0.0, -1.0, 0.0], [ 0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----05----
1297
+ {:rotation => [[ 1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [ 0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----06----
1298
+ {:rotation => [[ 0.0, 1.0, 0.0], [-1.0, 0.0, 0.0], [ 0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----07----
1299
+ {:rotation => [[ 0.0, -1.0, 0.0], [ 1.0, 0.0, 0.0], [ 0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----08----
1300
+ {:rotation => [[ 1.0, 0.0, 0.0], [ 0.0, -1.0, 0.0], [ 0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----09----
1301
+ {:rotation => [[-1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [ 0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----10----
1302
+ {:rotation => [[ 0.0, -1.0, 0.0], [-1.0, 0.0, 0.0], [ 0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----11----
1303
+ {:rotation => [[ 0.0, 1.0, 0.0], [ 1.0, 0.0, 0.0], [ 0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----12----
1304
+ {:rotation => [[-1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [ 0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----13----
1305
+ {:rotation => [[ 1.0, 0.0, 0.0], [ 0.0, -1.0, 0.0], [ 0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----14----
1306
+ {:rotation => [[ 0.0, 1.0, 0.0], [ 1.0, 0.0, 0.0], [ 0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----15----
1307
+ {:rotation => [[ 0.0, -1.0, 0.0], [-1.0, 0.0, 0.0], [ 0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----16----
1308
+ {:rotation => [[ 0.0, 0.0, 1.0], [ 1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----17----
1309
+ {:rotation => [[ 0.0, 0.0, -1.0], [-1.0, 0.0, 0.0], [ 0.0, -1.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----18----
1310
+ {:rotation => [[ 0.0, 0.0, 1.0], [ 0.0, -1.0, 0.0], [ 1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----19----
1311
+ {:rotation => [[ 0.0, 0.0, -1.0], [ 0.0, 1.0, 0.0], [-1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----20----
1312
+ {:rotation => [[ 0.0, 0.0, 1.0], [-1.0, 0.0, 0.0], [ 0.0, -1.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----21----
1313
+ {:rotation => [[ 0.0, 0.0, -1.0], [ 1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----22----
1314
+ {:rotation => [[ 0.0, 0.0, 1.0], [ 0.0, 1.0, 0.0], [-1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----23----
1315
+ {:rotation => [[ 0.0, 0.0, -1.0], [ 0.0, -1.0, 0.0], [ 1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----24----
1316
+ {:rotation => [[ 0.0, 0.0, -1.0], [ 1.0, 0.0, 0.0], [ 0.0, -1.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----25----
1317
+ {:rotation => [[ 0.0, 0.0, 1.0], [-1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----26----
1318
+ {:rotation => [[ 0.0, 0.0, -1.0], [ 0.0, -1.0, 0.0], [-1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----27----
1319
+ {:rotation => [[ 0.0, 0.0, 1.0], [ 0.0, 1.0, 0.0], [ 1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----28----
1320
+ {:rotation => [[ 0.0, 0.0, -1.0], [-1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----29----
1321
+ {:rotation => [[ 0.0, 0.0, 1.0], [ 1.0, 0.0, 0.0], [ 0.0, -1.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----30----
1322
+ {:rotation => [[ 0.0, 0.0, -1.0], [ 0.0, 1.0, 0.0], [ 1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----31----
1323
+ {:rotation => [[ 0.0, 0.0, 1.0], [ 0.0, -1.0, 0.0], [-1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----32----
1324
+ {:rotation => [[ 0.0, 1.0, 0.0], [ 0.0, 0.0, 1.0], [ 1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----33----
1325
+ {:rotation => [[ 0.0, -1.0, 0.0], [ 0.0, 0.0, -1.0], [-1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----34----
1326
+ {:rotation => [[ 1.0, 0.0, 0.0], [ 0.0, 0.0, 1.0], [ 0.0, -1.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----35----
1327
+ {:rotation => [[-1.0, 0.0, 0.0], [ 0.0, 0.0, -1.0], [ 0.0, 1.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----36----
1328
+ {:rotation => [[ 0.0, -1.0, 0.0], [ 0.0, 0.0, 1.0], [-1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----37----
1329
+ {:rotation => [[ 0.0, 1.0, 0.0], [ 0.0, 0.0, -1.0], [ 1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----38----
1330
+ {:rotation => [[-1.0, 0.0, 0.0], [ 0.0, 0.0, 1.0], [ 0.0, 1.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----39----
1331
+ {:rotation => [[ 1.0, 0.0, 0.0], [ 0.0, 0.0, -1.0], [ 0.0, -1.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----40----
1332
+ {:rotation => [[ 0.0, -1.0, 0.0], [ 0.0, 0.0, -1.0], [ 1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----41----
1333
+ {:rotation => [[ 0.0, 1.0, 0.0], [ 0.0, 0.0, 1.0], [-1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----42----
1334
+ {:rotation => [[-1.0, 0.0, 0.0], [ 0.0, 0.0, -1.0], [ 0.0, -1.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----43----
1335
+ {:rotation => [[ 1.0, 0.0, 0.0], [ 0.0, 0.0, 1.0], [ 0.0, 1.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----44----
1336
+ {:rotation => [[ 0.0, 1.0, 0.0], [ 0.0, 0.0, -1.0], [-1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----45----
1337
+ {:rotation => [[ 0.0, -1.0, 0.0], [ 0.0, 0.0, 1.0], [ 1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----46----
1338
+ {:rotation => [[ 1.0, 0.0, 0.0], [ 0.0, 0.0, -1.0], [ 0.0, 1.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----47----
1339
+ {:rotation => [[-1.0, 0.0, 0.0], [ 0.0, 0.0, 1.0], [ 0.0, -1.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----48----
1371
1340
  ]
1372
-
1373
- results = @c10 .symmetry_operations($symprec, $angle_tolerance)
1341
+ results = @c10 .symmetry_operations
1374
1342
  assert_equal(corrects.size, results.size)
1375
1343
  corrects.size.times do |index|
1376
1344
  assert_equal(corrects[index], results[index])
@@ -1378,126 +1346,211 @@ class TC_Cell < Test::Unit::TestCase
1378
1346
 
1379
1347
  #monoclinic/POSCAR #P2/m (10) / 2/m / -P 2y (57)
1380
1348
  corrects = [
1381
- {:rotation => [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----01----
1382
- {:rotation => [[-1, 0, 0], [ 0, -1, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----02----
1383
- {:rotation => [[-1, 0, 0], [ 0, -1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----03----
1384
- {:rotation => [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----04----
1349
+ {:rotation => [[ 1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [ 0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----01----
1350
+ {:rotation => [[-1.0, 0.0, 0.0], [ 0.0, -1.0, 0.0], [ 0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----02----
1351
+ {:rotation => [[-1.0, 0.0, 0.0], [ 0.0, -1.0, 0.0], [ 0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----03----
1352
+ {:rotation => [[ 1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [ 0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----04----
1385
1353
  ]
1386
- #pp @c12
1387
- assert_equal(corrects, @c12 .symmetry_operations($symprec, $angle_tolerance)) #monoclinic
1354
+ #pp @c1.02
1355
+ assert_equal(corrects, @c12 .symmetry_operations) #monoclinic
1356
+
1357
+ ## 以下、assert_in_delta に作り変えるのがめんどい。
1358
+ ##orthorhombic/POSCAR #Pmmm (47) / mmm / -P 2 2 (227)
1359
+ #corrects = [
1360
+ # {:rotation => [[ 1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [ 0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----01----
1361
+ # {:rotation => [[-1.0, 0.0, 0.0], [ 0.0, -1.0, 0.0], [ 0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----02----
1362
+ # {:rotation => [[-1.0, 0.0, 0.0], [ 0.0, -1.0, 0.0], [ 0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----03----
1363
+ # {:rotation => [[ 1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [ 0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----04----
1364
+ # {:rotation => [[ 1.0, 0.0, 0.0], [ 0.0, -1.0, 0.0], [ 0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----05----
1365
+ # {:rotation => [[-1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [ 0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----06----
1366
+ # {:rotation => [[-1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [ 0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----07----
1367
+ # {:rotation => [[ 1.0, 0.0, 0.0], [ 0.0, -1.0, 0.0], [ 0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----08----
1368
+ #]
1369
+ #assert_equal(corrects, @c13 .symmetry_operations) #orthorhombic
1370
+
1371
+ ##tetragonal-b/POSCAR #P4/mmm (1.023) / 4/mmm/ -P 4 2 (400)
1372
+ #corrects = [
1373
+ # {:rotation => [[ 1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----01----
1374
+ # {:rotation => [[-1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----02----
1375
+ # {:rotation => [[ 0.0, 0.0, 1.0], [0.0, 1.0, 0.0], [-1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----03----
1376
+ # {:rotation => [[ 0.0, 0.0, -1.0], [0.0, -1.0, 0.0], [ 1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----04----
1377
+ # {:rotation => [[-1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----05----
1378
+ # {:rotation => [[ 1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----06----
1379
+ # {:rotation => [[ 0.0, 0.0, -1.0], [0.0, 1.0, 0.0], [ 1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----07----
1380
+ # {:rotation => [[ 0.0, 0.0, 1.0], [0.0, -1.0, 0.0], [-1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----08----
1381
+ # {:rotation => [[-1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----09----
1382
+ # {:rotation => [[ 1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----10----
1383
+ # {:rotation => [[ 0.0, 0.0, -1.0], [0.0, -1.0, 0.0], [-1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----11----
1384
+ # {:rotation => [[ 0.0, 0.0, 1.0], [0.0, 1.0, 0.0], [ 1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----12----
1385
+ # {:rotation => [[ 1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----13----
1386
+ # {:rotation => [[-1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----14----
1387
+ # {:rotation => [[ 0.0, 0.0, 1.0], [0.0, -1.0, 0.0], [ 1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----15----
1388
+ # {:rotation => [[ 0.0, 0.0, -1.0], [0.0, 1.0, 0.0], [-1.0, 0.0, 0.0]], :translation => [0.0, 0.0, 0.0]}, #----16----
1389
+ #]
1390
+ #assert_equal(corrects, @c14b .symmetry_operations) #tetragonal
1391
+
1392
+ ##tetragonal/POSCAR #P4/mmm (1.023) / 4/mmm/ -P 4 2 (400)
1393
+ #corrects = [
1394
+ # {:rotation => [[ 1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----01----
1395
+ # {:rotation => [[-1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----02----
1396
+ # {:rotation => [[ 0.0, -1.0, 0.0], [ 1.0, 0.0, 0.0], [0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----03----
1397
+ # {:rotation => [[ 0.0, 1.0, 0.0], [-1.0, 0.0, 0.0], [0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----04----
1398
+ # {:rotation => [[-1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----05----
1399
+ # {:rotation => [[ 1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----06----
1400
+ # {:rotation => [[ 0.0, 1.0, 0.0], [-1.0, 0.0, 0.0], [0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----07----
1401
+ # {:rotation => [[ 0.0, -1.0, 0.0], [ 1.0, 0.0, 0.0], [0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----08----
1402
+ # {:rotation => [[ 1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----09----
1403
+ # {:rotation => [[-1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----10----
1404
+ # {:rotation => [[ 0.0, -1.0, 0.0], [-1.0, 0.0, 0.0], [0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----11----
1405
+ # {:rotation => [[ 0.0, 1.0, 0.0], [ 1.0, 0.0, 0.0], [0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----12----
1406
+ # {:rotation => [[-1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----13----
1407
+ # {:rotation => [[ 1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----14----
1408
+ # {:rotation => [[ 0.0, 1.0, 0.0], [ 1.0, 0.0, 0.0], [0.0, 0.0, -1.0]], :translation => [0.0, 0.0, 0.0]}, #----15----
1409
+ # {:rotation => [[ 0.0, -1.0, 0.0], [-1.0, 0.0, 0.0], [0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----16----
1410
+ #]
1411
+ #assert_equal(corrects, @c104.symmetry_operations) #tetragonal-b
1412
+
1413
+ ##triclinic/POSCAR #P1.0 (1.0) / 1.0 / P 1.0 (1.0)
1414
+ #corrects = [
1415
+ # {:rotation => [[ 1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----01----
1416
+ #]
1417
+ #assert_equal(corrects, @c15 .symmetry_operations) #triclinic
1418
+
1419
+ ##trigonal/POSCAR #P-3m1 (164) / -3m / -P 3 2= (456)
1420
+ #corrects = [
1421
+ # {:rotation => [[ 1.0, 0.0, 0], [ 0.0, 1.0, 0], [ 0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 0.0]}, #----01----
1422
+ # {:rotation => [[-1.0, 0.0, 0], [ 0.0, -1.0, 0], [ 0.0, 0.0, -1.0]], :translation => [f13, f13, f13]}, #----02----
1423
+ # {:rotation => [[-1.0, -1.0, 0], [ 1.0, 0.0, 0], [ 0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 1.0]}, #----03----
1424
+ # {:rotation => [[ 1.0, 1.0, 0], [-1.0, 0.0, 0], [ 0.0, 0.0, -1.0]], :translation => [f13, f13, f13]}, #----04----
1425
+ # {:rotation => [[ 0.0, 1.0, 0], [-1.0, -1.0, 0], [ 0.0, 0.0, 1.0]], :translation => [1.0, 0.0, 1.0]}, #----05----
1426
+ # {:rotation => [[ 0.0, -1.0, 0], [ 1.0, 1.0, 0], [ 0.0, 0.0, -1.0]], :translation => [f13, f13, f13]}, #----06----
1427
+ # {:rotation => [[ 0.0, -1.0, 0], [-1.0, 0.0, 0], [ 0.0, 0.0, -1.0]], :translation => [f13, f13, f13]}, #----07----
1428
+ # {:rotation => [[ 0.0, 1.0, 0], [ 1.0, 0.0, 0], [ 0.0, 0.0, 1.0]], :translation => [1.0, 0.0, 1.0]}, #----08----
1429
+ # {:rotation => [[-1.0, 0.0, 0], [ 1.0, 1.0, 0], [ 0.0, 0.0, -1.0]], :translation => [f13, f13, f13]}, #----09----
1430
+ # {:rotation => [[ 1.0, 0.0, 0], [-1.0, -1.0, 0], [ 0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 1.0]}, #----10----
1431
+ # {:rotation => [[ 1.0, 1.0, 0], [ 0.0, -1.0, 0], [ 0.0, 0.0, -1.0]], :translation => [f13, f13, f13]}, #----11----
1432
+ # {:rotation => [[-1.0, -1.0, 0], [ 0.0, 1.0, 0], [ 0.0, 0.0, 1.0]], :translation => [0.0, 0.0, 1.0]}, #----12----
1433
+ #]
1434
+ #results = @c16.symmetry_operations
1435
+ #corrects.size.times do |i|
1436
+ # 3.times do |x|
1437
+ # 3.times do |y|
1438
+ # assert_in_delta(corrects[i][:rotation][x][y], results[i][:rotation][x][y], $tolerance)
1439
+ # end
1440
+ # end
1441
+ # 3.times do |xyz|
1442
+ # assert_in_delta(corrects[i][:translation][xyz], results[i][:translation][xyz], $tolerance)
1443
+ # end
1444
+ #end
1445
+ end
1388
1446
 
1389
- #orthorhombic/POSCAR #Pmmm (47) / mmm / -P 2 2 (227)
1390
- corrects = [
1391
- {:rotation => [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----01----
1392
- {:rotation => [[-1, 0, 0], [ 0, -1, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----02----
1393
- {:rotation => [[-1, 0, 0], [ 0, -1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----03----
1394
- {:rotation => [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----04----
1395
- {:rotation => [[ 1, 0, 0], [ 0, -1, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----05----
1396
- {:rotation => [[-1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----06----
1397
- {:rotation => [[-1, 0, 0], [ 0, 1, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----07----
1398
- {:rotation => [[ 1, 0, 0], [ 0, -1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----08----
1399
- ]
1400
- assert_equal(corrects, @c13 .symmetry_operations($symprec, $angle_tolerance)) #orthorhombic
1447
+ def test_spgnum
1448
+ assert_equal(1, @c01.spgnum)
1449
+ assert_equal(221,@c10.spgnum)
1450
+ end
1401
1451
 
1402
- #tetragonal-b/POSCAR #P4/mmm (123) / 4/mmm/ -P 4 2 (400)
1403
- corrects = [
1404
- {:rotation => [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----01----
1405
- {:rotation => [[-1, 0, 0], [ 0, -1, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----02----
1406
- {:rotation => [[ 0, 0, 1], [ 0, 1, 0], [-1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----03----
1407
- {:rotation => [[ 0, 0, -1], [ 0, -1, 0], [ 1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----04----
1408
- {:rotation => [[-1, 0, 0], [ 0, 1, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----05----
1409
- {:rotation => [[ 1, 0, 0], [ 0, -1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----06----
1410
- {:rotation => [[ 0, 0, -1], [ 0, 1, 0], [ 1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----07----
1411
- {:rotation => [[ 0, 0, 1], [ 0, -1, 0], [-1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----08----
1412
- {:rotation => [[-1, 0, 0], [ 0, -1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----09----
1413
- {:rotation => [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----10----
1414
- {:rotation => [[ 0, 0, -1], [ 0, -1, 0], [-1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----11----
1415
- {:rotation => [[ 0, 0, 1], [ 0, 1, 0], [ 1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----12----
1416
- {:rotation => [[ 1, 0, 0], [ 0, -1, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----13----
1417
- {:rotation => [[-1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----14----
1418
- {:rotation => [[ 0, 0, 1], [ 0, -1, 0], [ 1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----15----
1419
- {:rotation => [[ 0, 0, -1], [ 0, 1, 0], [-1, 0, 0]], :translation => [0.0, 0.0, 0.0]}, #----16----
1420
- ]
1421
- assert_equal(corrects, @c14b .symmetry_operations($symprec, $angle_tolerance)) #tetragonal
1452
+ def test_spg
1453
+ assert_equal('P1', @c01.spg)
1454
+ assert_equal('Pm-3m', @c10.spg)
1455
+ end
1422
1456
 
1423
- #tetragonal/POSCAR #P4/mmm (123) / 4/mmm/ -P 4 2 (400)
1424
- corrects = [
1425
- {:rotation => [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----01----
1426
- {:rotation => [[-1, 0, 0], [ 0, -1, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----02----
1427
- {:rotation => [[ 0, -1, 0], [ 1, 0, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----03----
1428
- {:rotation => [[ 0, 1, 0], [-1, 0, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----04----
1429
- {:rotation => [[-1, 0, 0], [ 0, -1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----05----
1430
- {:rotation => [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----06----
1431
- {:rotation => [[ 0, 1, 0], [-1, 0, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----07----
1432
- {:rotation => [[ 0, -1, 0], [ 1, 0, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----08----
1433
- {:rotation => [[ 1, 0, 0], [ 0, -1, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----09----
1434
- {:rotation => [[-1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----10----
1435
- {:rotation => [[ 0, -1, 0], [-1, 0, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----11----
1436
- {:rotation => [[ 0, 1, 0], [ 1, 0, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----12----
1437
- {:rotation => [[-1, 0, 0], [ 0, 1, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----13----
1438
- {:rotation => [[ 1, 0, 0], [ 0, -1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----14----
1439
- {:rotation => [[ 0, 1, 0], [ 1, 0, 0], [ 0, 0, -1]], :translation => [0.0, 0.0, 0.0]}, #----15----
1440
- {:rotation => [[ 0, -1, 0], [-1, 0, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----16----
1441
- ]
1442
- assert_equal(corrects, @c14.symmetry_operations($symprec, $angle_tolerance)) #tetragonal-b
1457
+ def test_hallnum
1458
+ assert_equal(1, @c01.hallnum)
1459
+ assert_equal(517, @c10.hallnum)
1460
+ end
1443
1461
 
1444
- #triclinic/POSCAR #P1 (1) / 1 / P 1 (1)
1445
- corrects = [
1446
- {:rotation => [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----01----
1447
- ]
1448
- assert_equal(corrects, @c15 .symmetry_operations($symprec, $angle_tolerance)) #triclinic
1462
+ def test_hall_symbol
1463
+ assert_equal('P 1', @c01.hall_symbol)
1464
+ assert_equal('-P 4 2 3', @c10.hall_symbol)
1465
+ end
1449
1466
 
1450
- #trigonal/POSCAR #P-3m1 (164) / -3m / -P 3 2= (456)
1451
- corrects = [
1452
- {:rotation => [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 0.0]}, #----01----
1453
- {:rotation => [[-1, 0, 0], [ 0, -1, 0], [ 0, 0, -1]], :translation => [f13, f13, f13]}, #----02----
1454
- {:rotation => [[-1, -1, 0], [ 1, 0, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 1.0]}, #----03----
1455
- {:rotation => [[ 1, 1, 0], [-1, 0, 0], [ 0, 0, -1]], :translation => [f13, f13, f13]}, #----04----
1456
- {:rotation => [[ 0, 1, 0], [-1, -1, 0], [ 0, 0, 1]], :translation => [1.0, 0.0, 1.0]}, #----05----
1457
- {:rotation => [[ 0, -1, 0], [ 1, 1, 0], [ 0, 0, -1]], :translation => [f13, f13, f13]}, #----06----
1458
- {:rotation => [[ 0, -1, 0], [-1, 0, 0], [ 0, 0, -1]], :translation => [f13, f13, f13]}, #----07----
1459
- {:rotation => [[ 0, 1, 0], [ 1, 0, 0], [ 0, 0, 1]], :translation => [1.0, 0.0, 1.0]}, #----08----
1460
- {:rotation => [[-1, 0, 0], [ 1, 1, 0], [ 0, 0, -1]], :translation => [f13, f13, f13]}, #----09----
1461
- {:rotation => [[ 1, 0, 0], [-1, -1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 1.0]}, #----10----
1462
- {:rotation => [[ 1, 1, 0], [ 0, -1, 0], [ 0, 0, -1]], :translation => [f13, f13, f13]}, #----11----
1463
- {:rotation => [[-1, -1, 0], [ 0, 1, 0], [ 0, 0, 1]], :translation => [0.0, 0.0, 1.0]}, #----12----
1464
- ]
1465
- results = @c16.symmetry_operations($symprec, $angle_tolerance)
1466
- corrects.size.times do |i|
1467
- 3.times do |x|
1468
- 3.times do |y|
1469
- assert_in_delta(corrects[i][:rotation][x][y], results[i][:rotation][x][y], $tolerance)
1470
- end
1471
- end
1472
- 3.times do |xyz|
1473
- assert_in_delta(corrects[i][:translation][xyz], results[i][:translation][xyz], $tolerance)
1474
- end
1475
- end
1467
+ #def test_setting
1468
+ # pp @c01.setting
1469
+ # pp @c10.setting
1470
+ #end
1476
1471
 
1477
- #corrects.size.times do |index|
1478
- # 3.times do |i|
1479
- # 3.times do |j|
1480
- # assert_in_delta(
1481
- # corrects[index][:rotation][i][j] %1.0,
1482
- # results[index][:rotation][i][j] %1.0,
1483
- # $tolerance
1484
- # )
1485
- # end
1486
- # end
1472
+ def test_t_mat
1473
+ assert_equal([[-1.0, -1.0, -1.0], [-1.0, 0.0, 0.0], [1.0, 1.0, 0.0]],
1474
+ @c01.t_mat )
1475
+ assert_equal([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]],
1476
+ @c10.t_mat )
1477
+ end
1487
1478
 
1488
- # 3.times do |i|
1489
- # assert_in_delta(
1490
- # corrects[index][:translation][i] % 1.0,
1491
- # results[index][:translation][i] %1.0,
1492
- # $tolerance
1493
- # )
1494
- # end
1495
- #end
1479
+ def test_o_shift
1480
+ assert_equal([0.0, 0.0, 0.0], @c01.o_shift)
1481
+ assert_equal([0.0, 0.0, 0.0], @c10.o_shift)
1482
+ end
1483
+
1484
+ def test_rotations
1485
+ assert_equal([[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]],@c01.rotations)
1486
+ assert_equal(48,@c10.rotations.size)
1487
+ assert_equal([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]],
1488
+ @c10.rotations[0])
1489
+ assert_equal( [[-1.0, 0.0, 0.0], [0.0, 0.0, 1.0], [0.0, -1.0, 0.0]],
1490
+ @c10.rotations[47])
1491
+ end
1492
+
1493
+ def test_translations
1494
+ assert_equal([[0.0, 0.0, 0.0]], @c01.translations)
1495
+ assert_equal(48,@c10.translations.size)
1496
+ assert_equal([0.0, 0.0, 0.0],
1497
+ @c10.translations[0])
1498
+ assert_equal( [ 0.0, 0.0, 0.0],
1499
+ @c10.translations[47])
1496
1500
  end
1497
1501
 
1498
- def dump_povray
1499
- #pp @c01
1500
- ##TODO
1502
+ def test_wyckoffs
1503
+ assert_equal([0,0], @c01.wyckoffs)
1504
+ assert_equal([0], @c10.wyckoffs)
1505
+ end
1506
+
1507
+ def test_brv_lattice
1508
+ result = @c01.brv_lattice
1509
+ assert_in_delta(2.0, result[0][0], $tolerance)
1510
+ assert_in_delta(0.0, result[0][1], $tolerance)
1511
+ assert_in_delta(0.0, result[0][2], $tolerance)
1512
+ assert_in_delta(0.0, result[1][0], $tolerance)
1513
+ assert_in_delta(2.0, result[1][1], $tolerance)
1514
+ assert_in_delta(0.0, result[1][2], $tolerance)
1515
+ assert_in_delta(0.0, result[2][0], $tolerance)
1516
+ assert_in_delta(0.0, result[2][1], $tolerance)
1517
+ assert_in_delta(2.0, result[2][2], $tolerance)
1518
+
1519
+ result = @c10.brv_lattice
1520
+ assert_in_delta(1.0, result[0][0], $tolerance)
1521
+ assert_in_delta(0.0, result[0][1], $tolerance)
1522
+ assert_in_delta(0.0, result[0][2], $tolerance)
1523
+ assert_in_delta(0.0, result[1][0], $tolerance)
1524
+ assert_in_delta(1.0, result[1][1], $tolerance)
1525
+ assert_in_delta(0.0, result[1][2], $tolerance)
1526
+ assert_in_delta(0.0, result[2][0], $tolerance)
1527
+ assert_in_delta(0.0, result[2][1], $tolerance)
1528
+ assert_in_delta(1.0, result[2][2], $tolerance)
1529
+
1501
1530
  end
1502
1531
 
1532
+ def test_brv_types
1533
+ assert_equal([1,2], @c01.brv_types)
1534
+ assert_equal([1 ], @c10.brv_types)
1535
+ end
1536
+
1537
+ def test_brv_positions
1538
+ result = @c01.brv_positions
1539
+ assert_in_delta(0.0, result[0][0], $tolerance)
1540
+ assert_in_delta(0.0, result[0][1], $tolerance)
1541
+ assert_in_delta(0.0, result[0][2], $tolerance)
1542
+ assert_in_delta(0.4, result[1][0], $tolerance)
1543
+ assert_in_delta(0.9, result[1][1], $tolerance)
1544
+ assert_in_delta(0.3, result[1][2], $tolerance)
1545
+
1546
+ result = @c10.brv_positions
1547
+ assert_in_delta(0.0, result[0][0], $tolerance)
1548
+ assert_in_delta(0.0, result[0][1], $tolerance)
1549
+ assert_in_delta(0.0, result[0][2], $tolerance)
1550
+ end
1551
+
1552
+ #def dump_povray
1553
+ # #pp @c01
1554
+ # ##TODO
1555
+ #end
1503
1556
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crystalcell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - ippei94da
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-09 00:00:00.000000000 Z
11
+ date: 2016-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit