crysna 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/CHANGES +24 -0
- data/Gemfile +26 -0
- data/Gemfile.lock +91 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/bin/checkmodel +66 -0
- data/bin/collectcell +92 -0
- data/bin/fitframe +68 -0
- data/bin/occupiedpolyhedralsite +96 -0
- data/bin/occupiedscattersite +77 -0
- data/bin/site2poscar +66 -0
- data/bin/site2pov +30 -0
- data/bin/sitecombination +69 -0
- data/bin/sitemigration +80 -0
- data/bin/sitemigrationdistance +87 -0
- data/bin/siteoperation +109 -0
- data/bin/sitesingle +36 -0
- data/bin/siteuniq +32 -0
- data/bin/symidsite +65 -0
- data/bin/transitcell +46 -0
- data/crysna.gemspec +219 -0
- data/lib/crysna.rb +26 -0
- data/lib/crysna/atom.rb +97 -0
- data/lib/crysna/cell.rb +314 -0
- data/lib/crysna/frameatom.rb +13 -0
- data/lib/crysna/frameinterstitialcell.rb +309 -0
- data/lib/crysna/interstitialatom.rb +13 -0
- data/lib/crysna/modelstructure.rb +333 -0
- data/lib/crysna/optionmanager.rb +177 -0
- data/lib/crysna/site.rb +35 -0
- data/lib/crysna/siteconfiguration.rb +26 -0
- data/lib/crysna/sitenamelabeledcell.rb +220 -0
- data/lib/crysna/siteoperation.rb +56 -0
- data/lib/crysna/sitewithposition.rb +24 -0
- data/lib/crysna/transitionfinder.rb +448 -0
- data/lib/crysna/transitionfinder/cell.rb +144 -0
- data/lib/crysna/transitionfinder/cellmanager.rb +129 -0
- data/lib/crysna/transitionfinder/edge.rb +54 -0
- data/test/.gitignore +1 -0
- data/test/cell_orig/POSCAR +17 -0
- data/test/cell_orig/model.yaml +122 -0
- data/test/collectcells/.gitignore +2 -0
- data/test/collectcells/model.yaml +154 -0
- data/test/collectcells/nooutcar/minexpconfiguration.yaml +22 -0
- data/test/collectcells/normal-higher/OUTCAR +2406 -0
- data/test/collectcells/normal-higher/minexpconfiguration.yaml +22 -0
- data/test/collectcells/normal-lower/OUTCAR +2406 -0
- data/test/collectcells/normal-lower/minexpconfiguration.yaml +22 -0
- data/test/collectcells/normal/OUTCAR +2406 -0
- data/test/collectcells/normal/minexpconfiguration.yaml +22 -0
- data/test/collectcells/normalB/OUTCAR +2406 -0
- data/test/collectcells/normalB/minexpconfiguration.yaml +22 -0
- data/test/collectcells/unfinished/OUTCAR +40702 -0
- data/test/collectcells/unfinished/minexpconfiguration.yaml +22 -0
- data/test/collectcells/unidentified/OUTCAR +3541 -0
- data/test/collectcells/unidentified/minexpconfiguration.yaml +2 -0
- data/test/fitmodelstructure/.gitignore +1 -0
- data/test/fitmodelstructure/AgI/CONTCAR +17 -0
- data/test/fitmodelstructure/AgI/fitmodelstructure.log +1161 -0
- data/test/fitmodelstructure/AgI/model.yaml +45 -0
- data/test/fitmodelstructure/normal/CONTCAR +17 -0
- data/test/fitmodelstructure/normal/fitmodelstructure.log +5063 -0
- data/test/fitmodelstructure/normal/model.yaml +122 -0
- data/test/fitmodelstructure/unidentified/CONTCAR +44 -0
- data/test/fitmodelstructure/unidentified/fitmodelstructure.log +8833 -0
- data/test/fitmodelstructure/unidentified/model.yaml +154 -0
- data/test/helper.rb +17 -0
- data/test/identifypolyhedralsites/.gitignore +1 -0
- data/test/identifypolyhedralsites/identifyatomsites.log +333 -0
- data/test/identifypolyhedralsites/normal/fitmodelstructure.yaml +60 -0
- data/test/identifypolyhedralsites/normal/model.yaml +122 -0
- data/test/identifypolyhedralsites/unidentified/fitmodelstructure.yaml +2 -0
- data/test/identifypolyhedralsites/unidentified/model.yaml +154 -0
- data/test/identifypolyhedralsites/volumemismatch/fitmodelstructure.yaml +101 -0
- data/test/identifypolyhedralsites/volumemismatch/model.yaml +154 -0
- data/test/identifyscattersites/CONTCAR +17 -0
- data/test/identifyscattersites/POSCAR +12 -0
- data/test/identifyscattersites/fitmodelstructure.log +1 -0
- data/test/identifyscattersites/fitmodelstructure.yaml +0 -0
- data/test/identifyscattersites/identifyscattersites.yaml +5 -0
- data/test/identifyscattersites/model.yaml +45 -0
- data/test/minexpconfiguration/.gitignore +1 -0
- data/test/minexpconfiguration/collective/AgI/.gitignore +2 -0
- data/test/minexpconfiguration/collective/AgI/siteoperations.yaml +51265 -0
- data/test/minexpconfiguration/collective/AgI/sitesingle.yaml +15 -0
- data/test/minexpconfiguration/collective/AgI/test.sh +2 -0
- data/test/minexpconfiguration/normal/identifysites.yaml +22 -0
- data/test/minexpconfiguration/normal/minexpconfiguration.log +0 -0
- data/test/minexpconfiguration/normal/siteoperations.yaml +1793 -0
- data/test/minexpconfiguration/unidentified/identifysites.yaml +2 -0
- data/test/minexpconfiguration/unidentified/siteoperations.yaml +1793 -0
- data/test/sitecombination/initsites.yaml +7 -0
- data/test/sitecombination/initsites_test2.yaml +8 -0
- data/test/sitecombination/sitecombination.yaml +29 -0
- data/test/siteconfiguration/elements-sitenames.yaml +2 -0
- data/test/siteconfiguration/latticeaxes.yaml +3 -0
- data/test/siteconfiguration/sitenames-coordinates.yaml +4 -0
- data/test/sitemigrationsdistance/model.yaml +45 -0
- data/test/siteoperations/.gitignore +2 -0
- data/test/siteoperations/model.yaml +43 -0
- data/test/siteoperations/symmetryoperations.yaml +1441 -0
- data/test/sitesingle/.gitignore +1 -0
- data/test/sitesingle/sitecombination.yaml +29 -0
- data/test/siteuniq/minexpconfiguration.yaml +15 -0
- data/test/siteuniq/siteuniq.yaml +8 -0
- data/test/test_atom.rb +206 -0
- data/test/test_cell.rb +604 -0
- data/test/test_commands.rb +340 -0
- data/test/test_crystana.rb +7 -0
- data/test/test_frameatom.rb +22 -0
- data/test/test_frameinterstitialcell.rb +939 -0
- data/test/test_interstitialatom.rb +22 -0
- data/test/test_modelstructure.rb +807 -0
- data/test/test_optionmanager.rb +172 -0
- data/test/test_site.rb +40 -0
- data/test/test_siteconfiguration.rb +29 -0
- data/test/test_sitenamelabeledcell.rb +528 -0
- data/test/test_siteoperation.rb +79 -0
- data/test/test_sitewithposition.rb +20 -0
- data/test/test_transitionfinder.rb +432 -0
- data/test/transitcell/.gitignore +2 -0
- data/test/transitcell/collectcells.yaml +51 -0
- data/test/transitcell/sitemigrations.yaml +8 -0
- data/test/transitcell/siteoperations.yaml +17 -0
- data/test/transitcell/transitcell.log +1342 -0
- data/test/transitionfinder/collectcells.yaml +81 -0
- data/test/transitionfinder/sitemigrations.yaml +33 -0
- data/test/transitionfinder/siteoperations.yaml +16 -0
- data/test/transitionfinder/test_cell.rb +287 -0
- data/test/transitionfinder/test_cellmanager.rb +185 -0
- data/test/transitionfinder/test_edge.rb +49 -0
- data/test/uniquesitesgenerator/elements-sitenames.yaml +1 -0
- data/test/uniquesitesgenerator/siteoperations.yaml +9 -0
- metadata +406 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
require "helper"
|
5
|
+
#require "test/unit"
|
6
|
+
#require "crysna/interstitialatom.rb"
|
7
|
+
|
8
|
+
# assert_equal( cor, data)
|
9
|
+
# assert_in_delta( cor, data, $tolerance )
|
10
|
+
# assert_raise( RuntimeError ){}
|
11
|
+
|
12
|
+
class TC_InterstitialAtom < Test::Unit::TestCase
|
13
|
+
def setup
|
14
|
+
@fa00 = InterstitialAtom.new(0, [0.0, 0.0, 0.0])
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_is_a?
|
18
|
+
assert_equal(true, @fa00.is_a?(CrystalCell::Atom))
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,807 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
require "helper"
|
5
|
+
#require "fileutils"
|
6
|
+
#require "test/unit"
|
7
|
+
#require "crysna/modelcell.rb"
|
8
|
+
|
9
|
+
$tolerance = 1.0E-10
|
10
|
+
|
11
|
+
class Crysna::ModelStructure
|
12
|
+
public :to_coord
|
13
|
+
#public :tetrahedra
|
14
|
+
#public :octahedra
|
15
|
+
public :polyhedra
|
16
|
+
#public :periodically_include?
|
17
|
+
public :choose_zyx
|
18
|
+
end
|
19
|
+
|
20
|
+
class TC_ModelStructureCell < Test::Unit::TestCase
|
21
|
+
|
22
|
+
TMP_MODEL_YAML = "test/tmp_model.yaml"
|
23
|
+
|
24
|
+
FRAME_ELEMENTS = [ 0 ]
|
25
|
+
FRAME_SITES = {
|
26
|
+
"FS_000" => [ 0.50, 0.50, 0.50],
|
27
|
+
"FS_001" => [ 0.50, 0.50, 0.51],
|
28
|
+
"FS_003" => [ 0.50, 0.50, 0.53],
|
29
|
+
"FS_020" => [ 0.50, 0.52, 0.50],
|
30
|
+
"FS_060" => [ 0.50, 0.56, 0.50],
|
31
|
+
"FS_300" => [ 0.53, 0.50, 0.50],
|
32
|
+
"FS_900" => [ 0.59, 0.50, 0.50],
|
33
|
+
}
|
34
|
+
SYMMETRY_OPERATIONS = [
|
35
|
+
{ "rotation" => [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]],
|
36
|
+
"translation" => [ 0.0, 0.0, 0.0]
|
37
|
+
},
|
38
|
+
{ "rotation" => [[-1, 0, 0], [ 0,-1, 0], [ 0, 0,-1]],
|
39
|
+
"translation" => [ 0.0, 0.0, 0.0]
|
40
|
+
}
|
41
|
+
]
|
42
|
+
TETRAHEDRAL_SITES = {
|
43
|
+
"Te_000"=> [
|
44
|
+
["FS_000", [0, 0, 0]],
|
45
|
+
["FS_000", [0, 0, 1]],
|
46
|
+
["FS_000", [0, 1, 0]],
|
47
|
+
["FS_000", [1, 0, 0]]
|
48
|
+
],
|
49
|
+
"Te_001"=> [
|
50
|
+
["FS_000", [ 0, 0, 0]],
|
51
|
+
["FS_000", [ 0, 0,-1]],
|
52
|
+
["FS_000", [ 0,-1, 0]],
|
53
|
+
["FS_000", [-1, 0, 0]]
|
54
|
+
]
|
55
|
+
}
|
56
|
+
OCTAHEDRAL_SITES = {
|
57
|
+
"Oc_000"=> [
|
58
|
+
[["FS_000", [-1,-1, 0]], ["FS_000", [ 0, 0,-1]]],
|
59
|
+
[["FS_000", [-1, 0,-1]], ["FS_000", [ 0,-1, 0]]],
|
60
|
+
[["FS_000", [ 0,-1,-1]], ["FS_000", [-1, 0, 0]]]
|
61
|
+
]
|
62
|
+
}
|
63
|
+
|
64
|
+
TE000_000 = Crysna::SiteWithPosition.new("Te_000", [ 0, 0, 0], [ 0.25, 0.25, 0.25])
|
65
|
+
TE000_001 = Crysna::SiteWithPosition.new("Te_000", [ 0, 0, 1], [ 0.25, 0.25, 0.25])
|
66
|
+
TE000_00M = Crysna::SiteWithPosition.new("Te_000", [ 0, 0,-1], [ 0.25, 0.25, 0.25])
|
67
|
+
TE000_010 = Crysna::SiteWithPosition.new("Te_000", [ 0, 1, 0], [ 0.25, 0.25, 0.25])
|
68
|
+
TE000_011 = Crysna::SiteWithPosition.new("Te_000", [ 0, 1, 1], [ 0.25, 0.25, 0.25])
|
69
|
+
TE000_01M = Crysna::SiteWithPosition.new("Te_000", [ 0, 1,-1], [ 0.25, 0.25, 0.25])
|
70
|
+
TE000_0M0 = Crysna::SiteWithPosition.new("Te_000", [ 0,-1, 0], [ 0.25, 0.25, 0.25])
|
71
|
+
TE000_0M1 = Crysna::SiteWithPosition.new("Te_000", [ 0,-1, 1], [ 0.25, 0.25, 0.25])
|
72
|
+
TE000_0MM = Crysna::SiteWithPosition.new("Te_000", [ 0,-1,-1], [ 0.25, 0.25, 0.25])
|
73
|
+
TE000_100 = Crysna::SiteWithPosition.new("Te_000", [ 1, 0, 0], [ 0.25, 0.25, 0.25])
|
74
|
+
TE000_101 = Crysna::SiteWithPosition.new("Te_000", [ 1, 0, 1], [ 0.25, 0.25, 0.25])
|
75
|
+
TE000_10M = Crysna::SiteWithPosition.new("Te_000", [ 1, 0,-1], [ 0.25, 0.25, 0.25])
|
76
|
+
TE000_110 = Crysna::SiteWithPosition.new("Te_000", [ 1, 1, 0], [ 0.25, 0.25, 0.25])
|
77
|
+
TE000_111 = Crysna::SiteWithPosition.new("Te_000", [ 1, 1, 1], [ 0.25, 0.25, 0.25])
|
78
|
+
TE000_11M = Crysna::SiteWithPosition.new("Te_000", [ 1, 1,-1], [ 0.25, 0.25, 0.25])
|
79
|
+
TE000_1M0 = Crysna::SiteWithPosition.new("Te_000", [ 1,-1, 0], [ 0.25, 0.25, 0.25])
|
80
|
+
TE000_1M1 = Crysna::SiteWithPosition.new("Te_000", [ 1,-1, 1], [ 0.25, 0.25, 0.25])
|
81
|
+
TE000_1MM = Crysna::SiteWithPosition.new("Te_000", [ 1,-1,-1], [ 0.25, 0.25, 0.25])
|
82
|
+
TE000_M00 = Crysna::SiteWithPosition.new("Te_000", [-1, 0, 0], [ 0.25, 0.25, 0.25])
|
83
|
+
TE000_M01 = Crysna::SiteWithPosition.new("Te_000", [-1, 0, 1], [ 0.25, 0.25, 0.25])
|
84
|
+
TE000_M0M = Crysna::SiteWithPosition.new("Te_000", [-1, 0,-1], [ 0.25, 0.25, 0.25])
|
85
|
+
TE000_M10 = Crysna::SiteWithPosition.new("Te_000", [-1, 1, 0], [ 0.25, 0.25, 0.25])
|
86
|
+
TE000_M11 = Crysna::SiteWithPosition.new("Te_000", [-1, 1, 1], [ 0.25, 0.25, 0.25])
|
87
|
+
TE000_M1M = Crysna::SiteWithPosition.new("Te_000", [-1, 1,-1], [ 0.25, 0.25, 0.25])
|
88
|
+
TE000_MM0 = Crysna::SiteWithPosition.new("Te_000", [-1,-1, 0], [ 0.25, 0.25, 0.25])
|
89
|
+
TE000_MM1 = Crysna::SiteWithPosition.new("Te_000", [-1,-1, 1], [ 0.25, 0.25, 0.25])
|
90
|
+
TE000_MMM = Crysna::SiteWithPosition.new("Te_000", [-1,-1,-1], [ 0.25, 0.25, 0.25])
|
91
|
+
|
92
|
+
TE001_000 = Crysna::SiteWithPosition.new("Te_001", [ 0, 0, 0], [-0.25,-0.25,-0.25])
|
93
|
+
TE001_001 = Crysna::SiteWithPosition.new("Te_001", [ 0, 0, 1], [-0.25,-0.25,-0.25])
|
94
|
+
TE001_00M = Crysna::SiteWithPosition.new("Te_001", [ 0, 0,-1], [-0.25,-0.25,-0.25])
|
95
|
+
TE001_010 = Crysna::SiteWithPosition.new("Te_001", [ 0, 1, 0], [-0.25,-0.25,-0.25])
|
96
|
+
TE001_011 = Crysna::SiteWithPosition.new("Te_001", [ 0, 1, 1], [-0.25,-0.25,-0.25])
|
97
|
+
TE001_01M = Crysna::SiteWithPosition.new("Te_001", [ 0, 1,-1], [-0.25,-0.25,-0.25])
|
98
|
+
TE001_0M0 = Crysna::SiteWithPosition.new("Te_001", [ 0,-1, 0], [-0.25,-0.25,-0.25])
|
99
|
+
TE001_0M1 = Crysna::SiteWithPosition.new("Te_001", [ 0,-1, 1], [-0.25,-0.25,-0.25])
|
100
|
+
TE001_0MM = Crysna::SiteWithPosition.new("Te_001", [ 0,-1,-1], [-0.25,-0.25,-0.25])
|
101
|
+
TE001_100 = Crysna::SiteWithPosition.new("Te_001", [ 1, 0, 0], [-0.25,-0.25,-0.25])
|
102
|
+
TE001_101 = Crysna::SiteWithPosition.new("Te_001", [ 1, 0, 1], [-0.25,-0.25,-0.25])
|
103
|
+
TE001_10M = Crysna::SiteWithPosition.new("Te_001", [ 1, 0,-1], [-0.25,-0.25,-0.25])
|
104
|
+
TE001_110 = Crysna::SiteWithPosition.new("Te_001", [ 1, 1, 0], [-0.25,-0.25,-0.25])
|
105
|
+
TE001_111 = Crysna::SiteWithPosition.new("Te_001", [ 1, 1, 1], [-0.25,-0.25,-0.25])
|
106
|
+
TE001_11M = Crysna::SiteWithPosition.new("Te_001", [ 1, 1,-1], [-0.25,-0.25,-0.25])
|
107
|
+
TE001_1M0 = Crysna::SiteWithPosition.new("Te_001", [ 1,-1, 0], [-0.25,-0.25,-0.25])
|
108
|
+
TE001_1M1 = Crysna::SiteWithPosition.new("Te_001", [ 1,-1, 1], [-0.25,-0.25,-0.25])
|
109
|
+
TE001_1MM = Crysna::SiteWithPosition.new("Te_001", [ 1,-1,-1], [-0.25,-0.25,-0.25])
|
110
|
+
TE001_M00 = Crysna::SiteWithPosition.new("Te_001", [-1, 0, 0], [-0.25,-0.25,-0.25])
|
111
|
+
TE001_M01 = Crysna::SiteWithPosition.new("Te_001", [-1, 0, 1], [-0.25,-0.25,-0.25])
|
112
|
+
TE001_M0M = Crysna::SiteWithPosition.new("Te_001", [-1, 0,-1], [-0.25,-0.25,-0.25])
|
113
|
+
TE001_M10 = Crysna::SiteWithPosition.new("Te_001", [-1, 1, 0], [-0.25,-0.25,-0.25])
|
114
|
+
TE001_M11 = Crysna::SiteWithPosition.new("Te_001", [-1, 1, 1], [-0.25,-0.25,-0.25])
|
115
|
+
TE001_M1M = Crysna::SiteWithPosition.new("Te_001", [-1, 1,-1], [-0.25,-0.25,-0.25])
|
116
|
+
TE001_MM0 = Crysna::SiteWithPosition.new("Te_001", [-1,-1, 0], [-0.25,-0.25,-0.25])
|
117
|
+
TE001_MM1 = Crysna::SiteWithPosition.new("Te_001", [-1,-1, 1], [-0.25,-0.25,-0.25])
|
118
|
+
TE001_MMM = Crysna::SiteWithPosition.new("Te_001", [-1,-1,-1], [-0.25,-0.25,-0.25])
|
119
|
+
|
120
|
+
OC000_000 = Crysna::SiteWithPosition.new("Oc_000", [ 0, 0, 0], [-0.50,-0.50,-0.50])
|
121
|
+
OC000_001 = Crysna::SiteWithPosition.new("Oc_000", [ 0, 0, 1], [-0.50,-0.50,-0.50])
|
122
|
+
OC000_00M = Crysna::SiteWithPosition.new("Oc_000", [ 0, 0,-1], [-0.50,-0.50,-0.50])
|
123
|
+
OC000_010 = Crysna::SiteWithPosition.new("Oc_000", [ 0, 1, 0], [-0.50,-0.50,-0.50])
|
124
|
+
OC000_011 = Crysna::SiteWithPosition.new("Oc_000", [ 0, 1, 1], [-0.50,-0.50,-0.50])
|
125
|
+
OC000_01M = Crysna::SiteWithPosition.new("Oc_000", [ 0, 1,-1], [-0.50,-0.50,-0.50])
|
126
|
+
OC000_0M0 = Crysna::SiteWithPosition.new("Oc_000", [ 0,-1, 0], [-0.50,-0.50,-0.50])
|
127
|
+
OC000_0M1 = Crysna::SiteWithPosition.new("Oc_000", [ 0,-1, 1], [-0.50,-0.50,-0.50])
|
128
|
+
OC000_0MM = Crysna::SiteWithPosition.new("Oc_000", [ 0,-1,-1], [-0.50,-0.50,-0.50])
|
129
|
+
OC000_100 = Crysna::SiteWithPosition.new("Oc_000", [ 1, 0, 0], [-0.50,-0.50,-0.50])
|
130
|
+
OC000_101 = Crysna::SiteWithPosition.new("Oc_000", [ 1, 0, 1], [-0.50,-0.50,-0.50])
|
131
|
+
OC000_10M = Crysna::SiteWithPosition.new("Oc_000", [ 1, 0,-1], [-0.50,-0.50,-0.50])
|
132
|
+
OC000_110 = Crysna::SiteWithPosition.new("Oc_000", [ 1, 1, 0], [-0.50,-0.50,-0.50])
|
133
|
+
OC000_111 = Crysna::SiteWithPosition.new("Oc_000", [ 1, 1, 1], [-0.50,-0.50,-0.50])
|
134
|
+
OC000_11M = Crysna::SiteWithPosition.new("Oc_000", [ 1, 1,-1], [-0.50,-0.50,-0.50])
|
135
|
+
OC000_1M0 = Crysna::SiteWithPosition.new("Oc_000", [ 1,-1, 0], [-0.50,-0.50,-0.50])
|
136
|
+
OC000_1M1 = Crysna::SiteWithPosition.new("Oc_000", [ 1,-1, 1], [-0.50,-0.50,-0.50])
|
137
|
+
OC000_1MM = Crysna::SiteWithPosition.new("Oc_000", [ 1,-1,-1], [-0.50,-0.50,-0.50])
|
138
|
+
OC000_M00 = Crysna::SiteWithPosition.new("Oc_000", [-1, 0, 0], [-0.50,-0.50,-0.50])
|
139
|
+
OC000_M01 = Crysna::SiteWithPosition.new("Oc_000", [-1, 0, 1], [-0.50,-0.50,-0.50])
|
140
|
+
OC000_M0M = Crysna::SiteWithPosition.new("Oc_000", [-1, 0,-1], [-0.50,-0.50,-0.50])
|
141
|
+
OC000_M10 = Crysna::SiteWithPosition.new("Oc_000", [-1, 1, 0], [-0.50,-0.50,-0.50])
|
142
|
+
OC000_M11 = Crysna::SiteWithPosition.new("Oc_000", [-1, 1, 1], [-0.50,-0.50,-0.50])
|
143
|
+
OC000_M1M = Crysna::SiteWithPosition.new("Oc_000", [-1, 1,-1], [-0.50,-0.50,-0.50])
|
144
|
+
OC000_MM0 = Crysna::SiteWithPosition.new("Oc_000", [-1,-1, 0], [-0.50,-0.50,-0.50])
|
145
|
+
OC000_MM1 = Crysna::SiteWithPosition.new("Oc_000", [-1,-1, 1], [-0.50,-0.50,-0.50])
|
146
|
+
OC000_MMM = Crysna::SiteWithPosition.new("Oc_000", [-1,-1,-1], [-0.50,-0.50,-0.50])
|
147
|
+
|
148
|
+
def setup
|
149
|
+
hash = {
|
150
|
+
"frame_elements" => FRAME_ELEMENTS,
|
151
|
+
"frame_sites" => FRAME_SITES,
|
152
|
+
"symmetry_operations" => SYMMETRY_OPERATIONS,
|
153
|
+
"tetrahedral_sites" => TETRAHEDRAL_SITES,
|
154
|
+
"octahedral_sites" => OCTAHEDRAL_SITES,
|
155
|
+
}
|
156
|
+
@mc00 = Crysna::ModelStructure.new(hash)
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_load_file
|
160
|
+
FileUtils.rm TMP_MODEL_YAML if File.exist? TMP_MODEL_YAML
|
161
|
+
model = {
|
162
|
+
"frame_elements" => FRAME_ELEMENTS,
|
163
|
+
"frame_sites" => FRAME_SITES,
|
164
|
+
"symmetry_operations" => SYMMETRY_OPERATIONS,
|
165
|
+
"tetrahedral_sites" => TETRAHEDRAL_SITES,
|
166
|
+
"octahedral_sites" => OCTAHEDRAL_SITES,
|
167
|
+
}
|
168
|
+
File.open(TMP_MODEL_YAML, "w") { |io| YAML.dump(model, io) }
|
169
|
+
tmp = Crysna::ModelStructure.load_file(TMP_MODEL_YAML)
|
170
|
+
#
|
171
|
+
# 横着
|
172
|
+
assert_equal(FRAME_ELEMENTS , tmp.frame_elements)
|
173
|
+
assert_equal(7 , tmp.frame_sites.size)
|
174
|
+
assert_equal(2 , tmp.symmetry_operations.size)
|
175
|
+
#assert_equal(2 , tmp.tetrahedral_sites.size)
|
176
|
+
#assert_equal(1 , tmp.octahedral_sites.size)
|
177
|
+
assert_equal(3 , tmp.polyhedra.size)
|
178
|
+
assert_equal(3 , tmp.site_names.size)
|
179
|
+
#
|
180
|
+
FileUtils.rm TMP_MODEL_YAML if File.exist? TMP_MODEL_YAML
|
181
|
+
end
|
182
|
+
|
183
|
+
def test_initialize
|
184
|
+
assert_equal(Crysna::ModelStructure, @mc00.class)
|
185
|
+
|
186
|
+
#未知の要素があればエラー。
|
187
|
+
hash = {}
|
188
|
+
hash["frame_elements"] = FRAME_ELEMENTS
|
189
|
+
hash["frame_sites"] = FRAME_SITES
|
190
|
+
hash["symmetry_operations"] = SYMMETRY_OPERATIONS
|
191
|
+
hash["tetrahedral_sites"] = TETRAHEDRAL_SITES
|
192
|
+
hash["octahedral_sites"] = OCTAHEDRAL_SITES
|
193
|
+
hash["something"] = nil
|
194
|
+
assert_raise(Crysna::ModelStructure::InitializeError){
|
195
|
+
Crysna::ModelStructure.new( hash )
|
196
|
+
}
|
197
|
+
|
198
|
+
# 未知の要素を含む 5個の要素。当然エラー。
|
199
|
+
hash = {}
|
200
|
+
hash["frame_elements"] = FRAME_ELEMENTS
|
201
|
+
hash["frame_sites"] = FRAME_SITES
|
202
|
+
hash["symmetry_operations"] = SYMMETRY_OPERATIONS
|
203
|
+
hash["tetrahedral_sites"] = TETRAHEDRAL_SITES
|
204
|
+
hash["something"] = nil
|
205
|
+
assert_raise(Crysna::ModelStructure::InitializeError){
|
206
|
+
Crysna::ModelStructure.new( hash )
|
207
|
+
}
|
208
|
+
|
209
|
+
## 要素欠けは例外ではないと扱うことにした。[2014-12-09]
|
210
|
+
#hash = {}
|
211
|
+
#hash["frame_elements"] = FRAME_ELEMENTS
|
212
|
+
#hash["frame_sites"] = FRAME_SITES
|
213
|
+
##hash["symmetry_operations"] = SYMMETRY_OPERATIONS
|
214
|
+
#hash["tetrahedral_sites"] = TETRAHEDRAL_SITES
|
215
|
+
#hash["octahedral_sites"] = OCTAHEDRAL_SITES
|
216
|
+
#assert_raise(Crysna::ModelStructure::InitializeError){
|
217
|
+
# Crysna::ModelStructure.new( hash )
|
218
|
+
#}
|
219
|
+
|
220
|
+
#hash = {}
|
221
|
+
#hash["frame_elements"] = FRAME_ELEMENTS
|
222
|
+
##hash["frame_sites"] = FRAME_SITES
|
223
|
+
#hash["symmetry_operations"] = SYMMETRY_OPERATIONS
|
224
|
+
#hash["tetrahedral_sites"] = TETRAHEDRAL_SITES
|
225
|
+
#hash["octahedral_sites"] = OCTAHEDRAL_SITES
|
226
|
+
#assert_raise(Crysna::ModelStructure::InitializeError){
|
227
|
+
# Crysna::ModelStructure.new( hash )
|
228
|
+
#}
|
229
|
+
|
230
|
+
#hash = {}
|
231
|
+
##hash["frame_elements"] = FRAME_ELEMENTS
|
232
|
+
#hash["frame_sites"] = FRAME_SITES
|
233
|
+
#hash["symmetry_operations"] = SYMMETRY_OPERATIONS
|
234
|
+
#hash["tetrahedral_sites"] = TETRAHEDRAL_SITES
|
235
|
+
#hash["octahedral_sites"] = OCTAHEDRAL_SITES
|
236
|
+
#assert_raise(Crysna::ModelStructure::InitializeError){
|
237
|
+
# Crysna::ModelStructure.new( hash )
|
238
|
+
#}
|
239
|
+
|
240
|
+
# OctahedralSites がなくても通過する。
|
241
|
+
# チェックは体積のみなので、重なっていても検出できない。
|
242
|
+
tmp = [
|
243
|
+
["FS_000", [0, 0, 0]], ["FS_000", [1, 0, 0]],
|
244
|
+
["FS_000", [0, 1, 0]], ["FS_000", [0, 0, 1]]
|
245
|
+
]
|
246
|
+
tetrahedral_sites = {
|
247
|
+
"Te_000"=> tmp,
|
248
|
+
"Te_001"=> tmp,
|
249
|
+
"Te_02"=> tmp,
|
250
|
+
"Te_03"=> tmp,
|
251
|
+
"Te_04"=> tmp,
|
252
|
+
"Te_05"=> tmp,
|
253
|
+
}
|
254
|
+
hash = {}
|
255
|
+
hash["frame_elements"] = FRAME_ELEMENTS
|
256
|
+
hash["frame_sites"] = FRAME_SITES
|
257
|
+
hash["symmetry_operations"] = SYMMETRY_OPERATIONS
|
258
|
+
hash["tetrahedral_sites"] = tetrahedral_sites
|
259
|
+
#hash["octahedral_sites"] = OCTAHEDRAL_SITES
|
260
|
+
assert_nothing_raised{ Crysna::ModelStructure.new( hash ) }
|
261
|
+
|
262
|
+
# TetrahedralSites がなくても通過する。
|
263
|
+
# チェックは体積のみなので、重なっていても検出できない。
|
264
|
+
frame_sites = {
|
265
|
+
"FS_000"=>[0.0, 0.0, 0.0],
|
266
|
+
"FS_001"=>[0.5, 0.5, 0.0],
|
267
|
+
}
|
268
|
+
tmp = [
|
269
|
+
[["FS_000", [0, 0, 0]], ["FS_000", [1, 1, 0]]],
|
270
|
+
[["FS_000", [1, 0, 0]], ["FS_000", [0, 1, 0]]],
|
271
|
+
[["FS_001", [0, 0, 0]], ["FS_000", [0, 0, 1]]],
|
272
|
+
]
|
273
|
+
octahedral_sites = {
|
274
|
+
"Oc_000" => tmp,
|
275
|
+
"Oc_01" => tmp,
|
276
|
+
"Oc_02" => tmp,
|
277
|
+
}
|
278
|
+
hash = {}
|
279
|
+
hash["frame_elements"] = FRAME_ELEMENTS
|
280
|
+
hash["frame_sites"] = frame_sites
|
281
|
+
hash["symmetry_operations"] = SYMMETRY_OPERATIONS
|
282
|
+
#hash["tetrahedral_sites"] = TETRAHEDRAL_SITES
|
283
|
+
hash["octahedral_sites"] = octahedral_sites
|
284
|
+
Crysna::ModelStructure.new( hash )
|
285
|
+
assert_nothing_raised{ Crysna::ModelStructure.new( hash ) }
|
286
|
+
|
287
|
+
assert_equal(Mageo::Vector3DInternal, @mc00.frame_sites["FS_000"].class )
|
288
|
+
|
289
|
+
#Check coodinates are 0 <= x,y,z < 1
|
290
|
+
frame_elements = [ 0 ]
|
291
|
+
frame_sites = { "FS_000" => [ 1.00, 0.00, 0.00], }
|
292
|
+
symmetry_operations = [
|
293
|
+
{ "rotation" => [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]],
|
294
|
+
"translation" => [ 0.0, 0.0, 0.0]
|
295
|
+
}
|
296
|
+
]
|
297
|
+
tetrahedral_sites = {
|
298
|
+
"Te_000"=> [
|
299
|
+
["FS_000", [0, 0, 0]],
|
300
|
+
["FS_000", [0, 0, 1]],
|
301
|
+
["FS_000", [0, 1, 0]],
|
302
|
+
["FS_000", [1, 0, 0]]
|
303
|
+
],
|
304
|
+
"Te_001"=> [
|
305
|
+
["FS_000", [ 0, 0, 0]],
|
306
|
+
["FS_000", [ 0, 0,-1]],
|
307
|
+
["FS_000", [ 0,-1, 0]],
|
308
|
+
["FS_000", [-1, 0, 0]]
|
309
|
+
]
|
310
|
+
}
|
311
|
+
octahedral_sites = {
|
312
|
+
"Oc_000"=> [
|
313
|
+
[["FS_000", [-1,-1, 0]], ["FS_000", [ 0, 0,-1]]],
|
314
|
+
[["FS_000", [-1, 0,-1]], ["FS_000", [ 0,-1, 0]]],
|
315
|
+
[["FS_000", [ 0,-1,-1]], ["FS_000", [-1, 0, 0]]]
|
316
|
+
]
|
317
|
+
}
|
318
|
+
|
319
|
+
## symmetry operation は外部に書くこともあるので例外から外した。
|
320
|
+
## raise error if invalid symmetry operation
|
321
|
+
#symmetry_operations = [
|
322
|
+
# { "rotation" => [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]],
|
323
|
+
# "translation" => [ 0.0, 0.0, 0.0]
|
324
|
+
# },
|
325
|
+
# { "rotation" => [[-1, 0, 0], [ 0,-1, 0], [ 0, 0,-1]],
|
326
|
+
# "translation" => [ 0.0, 0.0, 0.0]
|
327
|
+
# },
|
328
|
+
# { }
|
329
|
+
#]
|
330
|
+
#hash = {}
|
331
|
+
#hash["frame_elements"] = FRAME_ELEMENTS
|
332
|
+
#hash["frame_sites"] = FRAME_SITES
|
333
|
+
#hash["symmetry_operations"] = symmetry_operations
|
334
|
+
#hash["tetrahedral_sites"] = TETRAHEDRAL_SITES
|
335
|
+
#hash["octahedral_sites"] = OCTAHEDRAL_SITES
|
336
|
+
##pp hash
|
337
|
+
#assert_raise(Crysna::ModelStructure::InitializeError){
|
338
|
+
# Crysna::ModelStructure.new( hash )
|
339
|
+
#}
|
340
|
+
|
341
|
+
#hash = {
|
342
|
+
# "frame_elements" => frame_elements,
|
343
|
+
# "frame_sites" => frame_sites,
|
344
|
+
# "symmetry_operations" => symmetry_operations,
|
345
|
+
# "tetrahedral_sites" => tetrahedral_sites,
|
346
|
+
# "octahedral_sites" => octahedral_sites,
|
347
|
+
#}
|
348
|
+
#assert_raise(Crysna::ModelStructure::SiteRangeError){ Crysna::ModelStructure.new( hash) }
|
349
|
+
|
350
|
+
#frame_sites = {"FS_000" => [ 0.00, 1.00, 0.00] }
|
351
|
+
#hash = {
|
352
|
+
# "frame_elements" => frame_elements,
|
353
|
+
# "frame_sites" => frame_sites,
|
354
|
+
# "symmetry_operations" => symmetry_operations,
|
355
|
+
# "tetrahedral_sites" => tetrahedral_sites,
|
356
|
+
# "octahedral_sites" => octahedral_sites,
|
357
|
+
#}
|
358
|
+
#assert_raise(Crysna::ModelStructure::SiteRangeError){ Crysna::ModelStructure.new( hash) }
|
359
|
+
|
360
|
+
#frame_sites = { "FS_000" => [ 0.00, 0.00, 1.00], }
|
361
|
+
#hash = {
|
362
|
+
# "frame_elements" => frame_elements,
|
363
|
+
# "frame_sites" => frame_sites,
|
364
|
+
# "symmetry_operations" => symmetry_operations,
|
365
|
+
# "tetrahedral_sites" => tetrahedral_sites,
|
366
|
+
# "octahedral_sites" => octahedral_sites,
|
367
|
+
#}
|
368
|
+
#assert_raise(Crysna::ModelStructure::SiteRangeError){ Crysna::ModelStructure.new( hash) }
|
369
|
+
|
370
|
+
##Octahedral is
|
371
|
+
#frame_sites = { "FS_000" => [ 0.50, 0.50, 0.50], }
|
372
|
+
#octahedral_sites = {
|
373
|
+
# "Oc_000"=> [
|
374
|
+
# [["FS_000", [ 1, 1, 0]], ["FS_000", [ 0, 0, 1]]],
|
375
|
+
# [["FS_000", [ 1, 0, 1]], ["FS_000", [ 0, 1, 0]]],
|
376
|
+
# [["FS_000", [ 0, 1, 1]], ["FS_000", [ 1, 0, 0]]]
|
377
|
+
# ]
|
378
|
+
#}
|
379
|
+
#hash = {
|
380
|
+
# "frame_elements" => frame_elements,
|
381
|
+
# "frame_sites" => frame_sites,
|
382
|
+
# "symmetry_operations" => symmetry_operations,
|
383
|
+
# "tetrahedral_sites" => tetrahedral_sites,
|
384
|
+
# "octahedral_sites" => octahedral_sites,
|
385
|
+
#}
|
386
|
+
#assert_raise(Crysna::ModelStructure::SiteRangeError){ Crysna::ModelStructure.new( hash) }
|
387
|
+
|
388
|
+
end
|
389
|
+
|
390
|
+
def test_symmetry_operations
|
391
|
+
assert_equal(
|
392
|
+
[
|
393
|
+
{ "rotation" => [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]],
|
394
|
+
"translation" => [ 0.0, 0.0, 0.0]
|
395
|
+
},
|
396
|
+
{ "rotation" => [[-1, 0, 0], [ 0,-1, 0], [ 0, 0,-1]],
|
397
|
+
"translation" => [ 0.0, 0.0, 0.0]
|
398
|
+
}
|
399
|
+
],
|
400
|
+
@mc00.symmetry_operations
|
401
|
+
)
|
402
|
+
end
|
403
|
+
|
404
|
+
def test_frame_elements
|
405
|
+
assert_equal([0], @mc00.frame_elements)
|
406
|
+
end
|
407
|
+
|
408
|
+
def test_frame_sites
|
409
|
+
tmp = @mc00.frame_sites
|
410
|
+
assert_equal("FS_000", tmp.keys[0])
|
411
|
+
assert_equal("FS_001", tmp.keys[1])
|
412
|
+
assert_equal("FS_003", tmp.keys[2])
|
413
|
+
assert_equal("FS_020", tmp.keys[3])
|
414
|
+
assert_equal("FS_060", tmp.keys[4])
|
415
|
+
assert_equal("FS_300", tmp.keys[5])
|
416
|
+
assert_equal("FS_900", tmp.keys[6])
|
417
|
+
assert_equal(Mageo::Vector3DInternal, tmp["FS_000"].class)
|
418
|
+
assert_equal(Mageo::Vector3DInternal, tmp["FS_001"].class)
|
419
|
+
assert_equal(Mageo::Vector3DInternal, tmp["FS_003"].class)
|
420
|
+
assert_equal(Mageo::Vector3DInternal, tmp["FS_020"].class)
|
421
|
+
assert_equal(Mageo::Vector3DInternal, tmp["FS_060"].class)
|
422
|
+
assert_equal(Mageo::Vector3DInternal, tmp["FS_300"].class)
|
423
|
+
assert_equal(Mageo::Vector3DInternal, tmp["FS_900"].class)
|
424
|
+
#pp 0.10
|
425
|
+
#pp tmp["FS_000"][0]
|
426
|
+
#pp $tolerance
|
427
|
+
assert_in_delta(0.50, tmp["FS_000"][0], $tolerance)
|
428
|
+
assert_in_delta(0.50, tmp["FS_000"][1], $tolerance)
|
429
|
+
assert_in_delta(0.50, tmp["FS_000"][2], $tolerance)
|
430
|
+
assert_in_delta(0.50, tmp["FS_001"][0], $tolerance)
|
431
|
+
assert_in_delta(0.50, tmp["FS_001"][1], $tolerance)
|
432
|
+
assert_in_delta(0.51, tmp["FS_001"][2], $tolerance)
|
433
|
+
assert_in_delta(0.50, tmp["FS_003"][0], $tolerance)
|
434
|
+
assert_in_delta(0.50, tmp["FS_003"][1], $tolerance)
|
435
|
+
assert_in_delta(0.53, tmp["FS_003"][2], $tolerance)
|
436
|
+
assert_in_delta(0.50, tmp["FS_020"][0], $tolerance)
|
437
|
+
assert_in_delta(0.52, tmp["FS_020"][1], $tolerance)
|
438
|
+
assert_in_delta(0.50, tmp["FS_020"][2], $tolerance)
|
439
|
+
assert_in_delta(0.50, tmp["FS_060"][0], $tolerance)
|
440
|
+
assert_in_delta(0.56, tmp["FS_060"][1], $tolerance)
|
441
|
+
assert_in_delta(0.50, tmp["FS_060"][2], $tolerance)
|
442
|
+
assert_in_delta(0.53, tmp["FS_300"][0], $tolerance)
|
443
|
+
assert_in_delta(0.50, tmp["FS_300"][1], $tolerance)
|
444
|
+
assert_in_delta(0.50, tmp["FS_300"][2], $tolerance)
|
445
|
+
assert_in_delta(0.59, tmp["FS_900"][0], $tolerance)
|
446
|
+
assert_in_delta(0.50, tmp["FS_900"][1], $tolerance)
|
447
|
+
assert_in_delta(0.50, tmp["FS_900"][2], $tolerance)
|
448
|
+
assert_equal(7, tmp.size)
|
449
|
+
end
|
450
|
+
|
451
|
+
def test_ideal_interstitial_sites
|
452
|
+
results = @mc00.ideal_interstitial_sites
|
453
|
+
assert_equal(Mageo::Vector3DInternal, results["Te_000"].class)
|
454
|
+
assert_in_delta( 0.75 , results["Te_000"][0], $tolerance)
|
455
|
+
assert_in_delta( 0.75 , results["Te_000"][1], $tolerance)
|
456
|
+
assert_in_delta( 0.75 , results["Te_000"][2], $tolerance)
|
457
|
+
assert_equal(Mageo::Vector3DInternal, results["Te_001"].class)
|
458
|
+
assert_in_delta( 0.25 , results["Te_001"][0], $tolerance)
|
459
|
+
assert_in_delta( 0.25 , results["Te_001"][1], $tolerance)
|
460
|
+
assert_in_delta( 0.25 , results["Te_001"][2], $tolerance)
|
461
|
+
assert_equal(Mageo::Vector3DInternal, results["Oc_000"].class)
|
462
|
+
assert_in_delta( 0.00 , results["Oc_000"][0], $tolerance)
|
463
|
+
assert_in_delta( 0.00 , results["Oc_000"][1], $tolerance)
|
464
|
+
assert_in_delta( 0.00 , results["Oc_000"][2], $tolerance)
|
465
|
+
end
|
466
|
+
|
467
|
+
def test_polyhedra
|
468
|
+
results = @mc00.polyhedra
|
469
|
+
assert_equal(["Te_000", "Te_001", "Oc_000"], results.keys)
|
470
|
+
assert_equal(Mageo::Tetrahedron, results["Te_000"].class)
|
471
|
+
assert_equal(Mageo::Vector3D, results["Te_000"].vertices[0].class)
|
472
|
+
assert_in_delta( 0.50, results["Te_000"].vertices[0][0], $tolerance)
|
473
|
+
assert_in_delta( 0.50, results["Te_000"].vertices[0][1], $tolerance)
|
474
|
+
assert_in_delta( 0.50, results["Te_000"].vertices[0][2], $tolerance)
|
475
|
+
assert_in_delta( 0.50, results["Te_000"].vertices[1][0], $tolerance)
|
476
|
+
assert_in_delta( 0.50, results["Te_000"].vertices[1][1], $tolerance)
|
477
|
+
assert_in_delta( 1.50, results["Te_000"].vertices[1][2], $tolerance)
|
478
|
+
assert_in_delta( 0.50, results["Te_000"].vertices[2][0], $tolerance)
|
479
|
+
assert_in_delta( 1.50, results["Te_000"].vertices[2][1], $tolerance)
|
480
|
+
assert_in_delta( 0.50, results["Te_000"].vertices[2][2], $tolerance)
|
481
|
+
assert_in_delta( 1.50, results["Te_000"].vertices[3][0], $tolerance)
|
482
|
+
assert_in_delta( 0.50, results["Te_000"].vertices[3][1], $tolerance)
|
483
|
+
assert_in_delta( 0.50, results["Te_000"].vertices[3][2], $tolerance)
|
484
|
+
#
|
485
|
+
assert_equal(Mageo::Tetrahedron, results["Te_001"].class)
|
486
|
+
assert_equal(Mageo::Vector3D, results["Te_001"].vertices[0].class)
|
487
|
+
assert_in_delta( 0.50, results["Te_001"].vertices[0][0], $tolerance)
|
488
|
+
assert_in_delta( 0.50, results["Te_001"].vertices[0][1], $tolerance)
|
489
|
+
assert_in_delta( 0.50, results["Te_001"].vertices[0][2], $tolerance)
|
490
|
+
assert_in_delta( 0.50, results["Te_001"].vertices[1][0], $tolerance)
|
491
|
+
assert_in_delta( 0.50, results["Te_001"].vertices[1][1], $tolerance)
|
492
|
+
assert_in_delta(-0.50, results["Te_001"].vertices[1][2], $tolerance)
|
493
|
+
assert_in_delta( 0.50, results["Te_001"].vertices[2][0], $tolerance)
|
494
|
+
assert_in_delta(-0.50, results["Te_001"].vertices[2][1], $tolerance)
|
495
|
+
assert_in_delta( 0.50, results["Te_001"].vertices[2][2], $tolerance)
|
496
|
+
assert_in_delta(-0.50, results["Te_001"].vertices[3][0], $tolerance)
|
497
|
+
assert_in_delta( 0.50, results["Te_001"].vertices[3][1], $tolerance)
|
498
|
+
assert_in_delta( 0.50, results["Te_001"].vertices[3][2], $tolerance)
|
499
|
+
#
|
500
|
+
assert_equal(Mageo::Octahedron, results["Oc_000"].class)
|
501
|
+
assert_equal(Mageo::Vector3D, results["Oc_000"].vertices[0].class)
|
502
|
+
assert_in_delta(-0.50, results["Oc_000"].vertices[0][0], $tolerance)
|
503
|
+
assert_in_delta(-0.50, results["Oc_000"].vertices[0][1], $tolerance)
|
504
|
+
assert_in_delta( 0.50, results["Oc_000"].vertices[0][2], $tolerance)
|
505
|
+
assert_in_delta( 0.50, results["Oc_000"].vertices[1][0], $tolerance)
|
506
|
+
assert_in_delta( 0.50, results["Oc_000"].vertices[1][1], $tolerance)
|
507
|
+
assert_in_delta(-0.50, results["Oc_000"].vertices[1][2], $tolerance)
|
508
|
+
assert_in_delta(-0.50, results["Oc_000"].vertices[2][0], $tolerance)
|
509
|
+
assert_in_delta( 0.50, results["Oc_000"].vertices[2][1], $tolerance)
|
510
|
+
assert_in_delta(-0.50, results["Oc_000"].vertices[2][2], $tolerance)
|
511
|
+
assert_in_delta( 0.50, results["Oc_000"].vertices[3][0], $tolerance)
|
512
|
+
assert_in_delta(-0.50, results["Oc_000"].vertices[3][1], $tolerance)
|
513
|
+
assert_in_delta( 0.50, results["Oc_000"].vertices[3][2], $tolerance)
|
514
|
+
assert_in_delta( 0.50, results["Oc_000"].vertices[4][0], $tolerance)
|
515
|
+
assert_in_delta(-0.50, results["Oc_000"].vertices[4][1], $tolerance)
|
516
|
+
assert_in_delta(-0.50, results["Oc_000"].vertices[4][2], $tolerance)
|
517
|
+
assert_in_delta(-0.50, results["Oc_000"].vertices[5][0], $tolerance)
|
518
|
+
assert_in_delta( 0.50, results["Oc_000"].vertices[5][1], $tolerance)
|
519
|
+
assert_in_delta( 0.50, results["Oc_000"].vertices[5][2], $tolerance)
|
520
|
+
end
|
521
|
+
|
522
|
+
def test_site_names
|
523
|
+
assert_equal(["Te_000", "Te_001", "Oc_000"], @mc00.site_names)
|
524
|
+
end
|
525
|
+
|
526
|
+
def test_volume_check
|
527
|
+
#サイト定義の四面体のいずれかが体積を持たなければエラー
|
528
|
+
tetrahedral_sites = {
|
529
|
+
"Te_000"=> [
|
530
|
+
["FS_000", [0, 0, 1]], ["FS_000", [1, 0, 1]],
|
531
|
+
["FS_000", [0, 1, 1]], ["FS_000", [0, 0, 1]]
|
532
|
+
],
|
533
|
+
"Te_001"=> [
|
534
|
+
["FS_000", [1, 1, 1]], ["FS_000", [1, 0, 0]],
|
535
|
+
["FS_000", [0, 1, 0]], ["FS_000", [1, 1, 0]]
|
536
|
+
]
|
537
|
+
}
|
538
|
+
frame_sites = {
|
539
|
+
"FS_000"=>[0.0, 0.0, 0.0], "FS_001"=>[0.5, 0.5, 0.0],
|
540
|
+
"FS_002"=>[0.5, 0.0, 0.5], "FS_003"=>[0.0, 0.5, 0.5],
|
541
|
+
}
|
542
|
+
hash = {}
|
543
|
+
hash["frame_elements"] = FRAME_ELEMENTS
|
544
|
+
hash["frame_sites"] = FRAME_SITES
|
545
|
+
hash["symmetry_operations"] = SYMMETRY_OPERATIONS
|
546
|
+
hash["tetrahedral_sites"] = tetrahedral_sites
|
547
|
+
hash["octahedral_sites"] = OCTAHEDRAL_SITES
|
548
|
+
model = Crysna::ModelStructure.new(hash)
|
549
|
+
assert_raise(Crysna::ModelStructure::SiteVolumeError){model.check_volume}
|
550
|
+
|
551
|
+
#サイト定義の八面体のいずれかが体積を持たなければエラー
|
552
|
+
octahedral_sites = {
|
553
|
+
"Oc_000"=> [
|
554
|
+
[["FS_000", [0, 0, 0]], ["FS_000", [1, 1, 0]]],
|
555
|
+
[["FS_000", [1, 0, 0]], ["FS_000", [0, 1, 0]]],
|
556
|
+
[["FS_000", [1, 0, 0]], ["FS_000", [0, 1, 0]]]
|
557
|
+
]
|
558
|
+
}
|
559
|
+
frame_sites = {
|
560
|
+
"FS_000"=>[0.0, 0.0, 0.0], "FS_001"=>[0.5, 0.5, 0.0],
|
561
|
+
"FS_002"=>[0.5, 0.0, 0.5], "FS_003"=>[0.0, 0.5, 0.5],
|
562
|
+
}
|
563
|
+
hash = {}
|
564
|
+
hash["frame_elements"] = FRAME_ELEMENTS
|
565
|
+
hash["frame_sites"] = FRAME_SITES
|
566
|
+
hash["symmetry_operations"] = SYMMETRY_OPERATIONS
|
567
|
+
hash["tetrahedral_sites"] = TETRAHEDRAL_SITES
|
568
|
+
hash["octahedral_sites"] = octahedral_sites
|
569
|
+
model = Crysna::ModelStructure.new(hash)
|
570
|
+
assert_raise(Crysna::ModelStructure::SiteVolumeError){model.check_volume}
|
571
|
+
|
572
|
+
#サイト定義の体積の総和がセル体積と一致しなければエラー
|
573
|
+
tetrahedral_sites = {
|
574
|
+
"Te_000"=> [
|
575
|
+
["FS_000", [0, 0, 0]], ["FS_000", [1, 0, 1]],
|
576
|
+
["FS_000", [0, 1, 1]], ["FS_000", [0, 0, 1]]
|
577
|
+
],
|
578
|
+
"Te_001"=> [
|
579
|
+
["FS_000", [1, 1, 1]], ["FS_000", [1, 0, 0]],
|
580
|
+
["FS_000", [0, 1, 0]], ["FS_000", [1, 1, 0]]
|
581
|
+
],
|
582
|
+
"Te_002"=> [
|
583
|
+
["FS_000", [1, 1, 1]], ["FS_000", [1, 0, 0]],
|
584
|
+
["FS_000", [0, 1, 0]], ["FS_000", [1, 1, 0]]
|
585
|
+
]
|
586
|
+
}
|
587
|
+
octahedral_sites = {
|
588
|
+
"Oc_000"=> [
|
589
|
+
[["FS_000", [0, 0, 0]], ["FS_000", [1, 1, 1]]],
|
590
|
+
[["FS_000", [1, 0, 0]], ["FS_000", [0, 1, 1]]],
|
591
|
+
[["FS_000", [1, 0, 1]], ["FS_000", [0, 1, 0]]]
|
592
|
+
]
|
593
|
+
}
|
594
|
+
hash = {}
|
595
|
+
hash["frame_elements"] = FRAME_ELEMENTS
|
596
|
+
hash["frame_sites"] = FRAME_SITES
|
597
|
+
hash["symmetry_operations"] = SYMMETRY_OPERATIONS
|
598
|
+
hash["tetrahedral_sites"] = tetrahedral_sites
|
599
|
+
hash["octahedral_sites"] = octahedral_sites
|
600
|
+
model = Crysna::ModelStructure.new(hash)
|
601
|
+
assert_raise(Crysna::ModelStructure::SiteVolumeError){model.check_volume}
|
602
|
+
end
|
603
|
+
|
604
|
+
def test_to_coord
|
605
|
+
#assert_equal(Mageo::Vector3DInternal[0.50, -0.50, 2.50], @mc00.to_coord("FS_000", [0,-1,2]))
|
606
|
+
results = @mc00.to_coord("FS_000", [0,-1,2])
|
607
|
+
assert_equal(Mageo::Vector3D, results.class)
|
608
|
+
assert_in_delta( 0.50, results[0], $tolerance)
|
609
|
+
assert_in_delta(-0.50, results[1], $tolerance)
|
610
|
+
assert_in_delta( 2.50, results[2], $tolerance)
|
611
|
+
|
612
|
+
assert_raise(Crysna::ModelStructure::NoEntrySiteError) { @mc00.to_coord("SITE_A", [0,-1,2])}
|
613
|
+
end
|
614
|
+
|
615
|
+
def test_select_interstitial_sites27
|
616
|
+
#In polyhedron
|
617
|
+
assert_equal([TE000_000], @mc00.select_interstitial_sites27([ 0.51, 0.51, 0.51], $tolerance, StringIO.new))
|
618
|
+
assert_equal([TE000_M00], @mc00.select_interstitial_sites27([ 0.40, 0.51, 0.51], $tolerance, StringIO.new))
|
619
|
+
assert_equal([TE000_0M0], @mc00.select_interstitial_sites27([ 0.51, 0.40, 0.51], $tolerance, StringIO.new))
|
620
|
+
assert_equal([TE000_00M], @mc00.select_interstitial_sites27([ 0.51, 0.51, 0.40], $tolerance, StringIO.new))
|
621
|
+
#
|
622
|
+
assert_equal([TE001_000], @mc00.select_interstitial_sites27([ 0.49, 0.49, 0.49], $tolerance, StringIO.new))
|
623
|
+
assert_equal([TE001_100], @mc00.select_interstitial_sites27([ 0.60, 0.49, 0.49], $tolerance, StringIO.new))
|
624
|
+
assert_equal([TE001_010], @mc00.select_interstitial_sites27([ 0.49, 0.60, 0.49], $tolerance, StringIO.new))
|
625
|
+
assert_equal([TE001_001], @mc00.select_interstitial_sites27([ 0.49, 0.49, 0.60], $tolerance, StringIO.new))
|
626
|
+
#
|
627
|
+
assert_equal([OC000_011], @mc00.select_interstitial_sites27([ 0.49, 0.60, 0.60], $tolerance, StringIO.new))
|
628
|
+
assert_equal([OC000_101], @mc00.select_interstitial_sites27([ 0.60, 0.49, 0.60], $tolerance, StringIO.new))
|
629
|
+
assert_equal([OC000_110], @mc00.select_interstitial_sites27([ 0.60, 0.60, 0.49], $tolerance, StringIO.new))
|
630
|
+
assert_equal([OC000_100], @mc00.select_interstitial_sites27([ 0.51, 0.40, 0.40], $tolerance, StringIO.new))
|
631
|
+
assert_equal([OC000_010], @mc00.select_interstitial_sites27([ 0.40, 0.51, 0.40], $tolerance, StringIO.new))
|
632
|
+
assert_equal([OC000_001], @mc00.select_interstitial_sites27([ 0.40, 0.40, 0.51], $tolerance, StringIO.new))
|
633
|
+
|
634
|
+
#at vertex
|
635
|
+
io = StringIO.new
|
636
|
+
#io = $stdout
|
637
|
+
results = @mc00.select_interstitial_sites27([ 0.50, 0.50, 0.50], $tolerance, io)
|
638
|
+
assert_equal(14, results.size)
|
639
|
+
assert_equal(TE000_00M, results[ 0]) #0,0,1
|
640
|
+
assert_equal(TE000_0M0, results[ 1]) #1,0,0
|
641
|
+
assert_equal(TE000_M00, results[ 2]) #0,1,0
|
642
|
+
assert_equal(TE000_000, results[ 3]) #0,0,0
|
643
|
+
assert_equal(TE001_000, results[ 4]) #1,1,1
|
644
|
+
assert_equal(TE001_100, results[ 5]) #1,0,1
|
645
|
+
assert_equal(TE001_010, results[ 6]) #0,1,1
|
646
|
+
assert_equal(TE001_001, results[ 7]) #1,1,0
|
647
|
+
assert_equal(OC000_100, results[ 8]) #1,0,1
|
648
|
+
assert_equal(OC000_010, results[ 9]) #0,1,1
|
649
|
+
assert_equal(OC000_110, results[10]) #0,0,1
|
650
|
+
assert_equal(OC000_001, results[11]) #1,1,0
|
651
|
+
assert_equal(OC000_101, results[12]) #1,0,0
|
652
|
+
assert_equal(OC000_011, results[13]) #0,1,0
|
653
|
+
|
654
|
+
#at edge
|
655
|
+
io = StringIO.new
|
656
|
+
#io = $stdout
|
657
|
+
results = @mc00.select_interstitial_sites27([ 0.50, 0.00, 0.00], $tolerance, io)
|
658
|
+
#pp results
|
659
|
+
assert_equal(4, results.size)
|
660
|
+
assert_equal(TE000_0MM, results[0])
|
661
|
+
assert_equal(TE001_000, results[1])
|
662
|
+
assert_equal(OC000_000, results[2])
|
663
|
+
assert_equal(OC000_100, results[3])
|
664
|
+
|
665
|
+
#on face
|
666
|
+
results = @mc00.select_interstitial_sites27([ 0.75, 0.75, 0.00], $tolerance, StringIO.new)
|
667
|
+
assert_equal( TE000_00M, results[0])
|
668
|
+
assert_equal( OC000_110, results[1])
|
669
|
+
end
|
670
|
+
|
671
|
+
def test_find_site
|
672
|
+
sites = {
|
673
|
+
"FS_000" => [ 0.50, 0.50, 0.50].to_v3di,
|
674
|
+
"FS_001" => [ 0.50, 0.50, 0.51].to_v3di,
|
675
|
+
"FS_003" => [ 0.50, 0.50, 0.53].to_v3di,
|
676
|
+
"FS_020" => [ 0.50, 0.52, 0.50].to_v3di,
|
677
|
+
"FS_060" => [ 0.50, 0.56, 0.50].to_v3di,
|
678
|
+
"FS_300" => [ 0.53, 0.50, 0.50].to_v3di,
|
679
|
+
"FS_900" => [ 0.59, 0.50, 0.50].to_v3di,
|
680
|
+
}
|
681
|
+
|
682
|
+
#sites.each do |name, pos|
|
683
|
+
# @scatter_sites[name] = pos.to_v3di
|
684
|
+
#end
|
685
|
+
|
686
|
+
assert_equal(
|
687
|
+
["FS_000", [0,0,0]],
|
688
|
+
@mc00.find_site([0.50, 0.50, 0.50], sites)
|
689
|
+
)
|
690
|
+
|
691
|
+
assert_equal(
|
692
|
+
["FS_900", [0,0,0]],
|
693
|
+
@mc00.find_site([0.60, 0.50, 0.50], sites)
|
694
|
+
)
|
695
|
+
|
696
|
+
assert_equal(
|
697
|
+
["FS_900", [-1,0, 0]],
|
698
|
+
@mc00.find_site([0.01, 0.01, 0.01], sites)
|
699
|
+
)
|
700
|
+
end
|
701
|
+
|
702
|
+
#Return the nearest frame site.
|
703
|
+
def test_find_nearest_frame_site
|
704
|
+
assert_equal(
|
705
|
+
["FS_000", [0,0,0]],
|
706
|
+
@mc00.find_nearest_frame_site([0.50, 0.50, 0.50])
|
707
|
+
)
|
708
|
+
|
709
|
+
assert_equal(
|
710
|
+
["FS_900", [0,0,0]],
|
711
|
+
@mc00.find_nearest_frame_site([0.60, 0.50, 0.50])
|
712
|
+
)
|
713
|
+
|
714
|
+
assert_equal(
|
715
|
+
["FS_900", [-1,0, 0]],
|
716
|
+
@mc00.find_nearest_frame_site([0.01, 0.01, 0.01])
|
717
|
+
)
|
718
|
+
end
|
719
|
+
|
720
|
+
def test_find_interstitial_site
|
721
|
+
#In polyhedron
|
722
|
+
assert_equal("Te_000", @mc00.find_interstitial_site([ 0.51, 0.51, 0.51], $tolerance, StringIO.new))
|
723
|
+
assert_equal("Te_000", @mc00.find_interstitial_site([ 0.40, 0.51, 0.51], $tolerance, StringIO.new))
|
724
|
+
assert_equal("Te_000", @mc00.find_interstitial_site([ 0.51, 0.40, 0.51], $tolerance, StringIO.new))
|
725
|
+
assert_equal("Te_000", @mc00.find_interstitial_site([ 0.51, 0.51, 0.40], $tolerance, StringIO.new))
|
726
|
+
#
|
727
|
+
assert_equal("Te_001", @mc00.find_interstitial_site([ 0.49, 0.49, 0.49], $tolerance, StringIO.new))
|
728
|
+
assert_equal("Te_001", @mc00.find_interstitial_site([ 0.60, 0.49, 0.49], $tolerance, StringIO.new))
|
729
|
+
assert_equal("Te_001", @mc00.find_interstitial_site([ 0.49, 0.60, 0.49], $tolerance, StringIO.new))
|
730
|
+
assert_equal("Te_001", @mc00.find_interstitial_site([ 0.49, 0.49, 0.60], $tolerance, StringIO.new))
|
731
|
+
#
|
732
|
+
assert_equal("Oc_000", @mc00.find_interstitial_site([ 0.49, 0.60, 0.60], $tolerance, StringIO.new))
|
733
|
+
assert_equal("Oc_000", @mc00.find_interstitial_site([ 0.60, 0.49, 0.60], $tolerance, StringIO.new))
|
734
|
+
assert_equal("Oc_000", @mc00.find_interstitial_site([ 0.60, 0.60, 0.49], $tolerance, StringIO.new))
|
735
|
+
assert_equal("Oc_000", @mc00.find_interstitial_site([ 0.51, 0.40, 0.40], $tolerance, StringIO.new))
|
736
|
+
assert_equal("Oc_000", @mc00.find_interstitial_site([ 0.40, 0.51, 0.40], $tolerance, StringIO.new))
|
737
|
+
assert_equal("Oc_000", @mc00.find_interstitial_site([ 0.40, 0.40, 0.51], $tolerance, StringIO.new))
|
738
|
+
|
739
|
+
#at vertex
|
740
|
+
assert_equal("Te_001", @mc00.find_interstitial_site([ 0.50, 0.50, 0.50], $tolerance, StringIO.new))
|
741
|
+
|
742
|
+
#at edge
|
743
|
+
assert_equal("Te_001", @mc00.find_interstitial_site([ 0.50, 0.00, 0.00], $tolerance, StringIO.new))
|
744
|
+
|
745
|
+
#on face
|
746
|
+
assert_equal("Oc_000", @mc00.find_interstitial_site([ 0.75, 0.75, 0.00], $tolerance, StringIO.new))
|
747
|
+
end
|
748
|
+
|
749
|
+
def test_choose_zyx
|
750
|
+
candidates = [
|
751
|
+
TE000_000, TE000_001, TE000_00M,
|
752
|
+
TE000_010, TE000_011, TE000_01M,
|
753
|
+
TE000_0M0, TE000_0M1, TE000_0MM,
|
754
|
+
TE000_100, TE000_101, TE000_10M,
|
755
|
+
TE000_110, TE000_111, TE000_11M,
|
756
|
+
TE000_1M0, TE000_1M1, TE000_1MM,
|
757
|
+
TE000_M00, TE000_M01, TE000_M0M,
|
758
|
+
TE000_M10, TE000_M11, TE000_M1M,
|
759
|
+
TE000_MM0, TE000_MM1, TE000_MMM,
|
760
|
+
]
|
761
|
+
result = @mc00.choose_zyx(candidates)
|
762
|
+
#pp result
|
763
|
+
assert_equal(TE000_111, result)
|
764
|
+
|
765
|
+
candidates = [
|
766
|
+
TE001_000, TE001_001, TE001_00M,
|
767
|
+
TE001_010, TE001_011, TE001_01M,
|
768
|
+
TE001_0M0, TE001_0M1, TE001_0MM,
|
769
|
+
TE001_100, TE001_101, TE001_10M,
|
770
|
+
TE001_110, TE001_111, TE001_11M,
|
771
|
+
TE001_1M0, TE001_1M1, TE001_1MM,
|
772
|
+
TE001_M00, TE001_M01, TE001_M0M,
|
773
|
+
TE001_M10, TE001_M11, TE001_M1M,
|
774
|
+
TE001_MM0, TE001_MM1, TE001_MMM,
|
775
|
+
]
|
776
|
+
result = @mc00.choose_zyx(candidates)
|
777
|
+
assert_equal(TE001_111, result)
|
778
|
+
|
779
|
+
candidates = [
|
780
|
+
OC000_000, OC000_001, OC000_00M,
|
781
|
+
OC000_010, OC000_011, OC000_01M,
|
782
|
+
OC000_0M0, OC000_0M1, OC000_0MM,
|
783
|
+
OC000_100, OC000_101, OC000_10M,
|
784
|
+
OC000_110, OC000_111, OC000_11M,
|
785
|
+
OC000_1M0, OC000_1M1, OC000_1MM,
|
786
|
+
OC000_M00, OC000_M01, OC000_M0M,
|
787
|
+
OC000_M10, OC000_M11, OC000_M1M,
|
788
|
+
OC000_MM0, OC000_MM1, OC000_MMM,
|
789
|
+
]
|
790
|
+
result = @mc00.choose_zyx(candidates)
|
791
|
+
assert_equal(OC000_111, result)
|
792
|
+
|
793
|
+
candidates = [
|
794
|
+
TE000_000, TE001_000, OC000_000,
|
795
|
+
]
|
796
|
+
result = @mc00.choose_zyx(candidates)
|
797
|
+
assert_equal(TE000_000, result)
|
798
|
+
|
799
|
+
candidates = [
|
800
|
+
TE000_100, TE000_010, TE000_001,
|
801
|
+
]
|
802
|
+
result = @mc00.choose_zyx(candidates)
|
803
|
+
assert_equal(TE000_001, result)
|
804
|
+
end
|
805
|
+
|
806
|
+
end
|
807
|
+
|