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,340 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
require "fileutils"
|
5
|
+
require "helper"
|
6
|
+
#require "test/unit"
|
7
|
+
#require "crysna/modelcell.rb"
|
8
|
+
#require "crysna/frameatom.rb"
|
9
|
+
#require "crysna/interstitialatom.rb"
|
10
|
+
#require "crysna/frameinterstitialcell.rb"
|
11
|
+
#require "vasputils/poscar.rb"
|
12
|
+
|
13
|
+
$tolerance = 1.0E-10
|
14
|
+
|
15
|
+
class TC_CrysnaCommands < Test::Unit::TestCase
|
16
|
+
|
17
|
+
#def test_optimizedframecell
|
18
|
+
# TODO
|
19
|
+
#end
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
##def setup
|
26
|
+
## @k = Klass.new
|
27
|
+
##end
|
28
|
+
##
|
29
|
+
#TMP_DIR = "test/tmp"
|
30
|
+
#TMP_POSCAR = "#{TMP_DIR}/POSCAR"
|
31
|
+
#TMP_OPTIMIZED_YAML = "#{TMP_DIR}/optimized.yaml"
|
32
|
+
#TMP_MODEL_YAML = "#{TMP_DIR}/model.yaml"
|
33
|
+
#TMP_FILES = [
|
34
|
+
# TMP_POSCAR,
|
35
|
+
# TMP_OPTIMIZED_YAML,
|
36
|
+
# TMP_MODEL_YAML,
|
37
|
+
# "#{TMP_DIR}/optimized_ficell.yaml",
|
38
|
+
#]
|
39
|
+
|
40
|
+
#def setup
|
41
|
+
# TMP_FILES.each { |file| FileUtils.rm file if File.exist? file }
|
42
|
+
# Dir.glob("#{TMP_DIR}/*").each {|file| FileUtils.rm file}
|
43
|
+
# Dir.rmdir TMP_DIR if Dir.exist? TMP_DIR
|
44
|
+
# #
|
45
|
+
# Dir.mkdir TMP_DIR unless Dir.exist? TMP_DIR
|
46
|
+
# File.open(TMP_POSCAR, "w") do |io|
|
47
|
+
# io.puts "Model to test optimizeframe command"
|
48
|
+
# io.puts "1.0"
|
49
|
+
# io.puts " 2.0 2.0 2.0"
|
50
|
+
# io.puts " 0.0 2.0 2.0"
|
51
|
+
# io.puts " 0.0 0.0 2.0"
|
52
|
+
# io.puts "7 1 2"
|
53
|
+
# io.puts "Direct"
|
54
|
+
# io.puts " 0.10 0.10 0.10"
|
55
|
+
# io.puts " 0.10 0.10 0.11"
|
56
|
+
# io.puts " 0.10 0.10 0.13"
|
57
|
+
# io.puts " 0.10 0.12 0.10"
|
58
|
+
# io.puts " 0.10 0.16 0.10"
|
59
|
+
# io.puts " 0.13 0.10 0.10"
|
60
|
+
# io.puts " 0.19 0.10 0.10"
|
61
|
+
# io.puts " 0.11 0.11 0.11"
|
62
|
+
# io.puts " 0.00 0.00 0.00"
|
63
|
+
# io.puts " 0.90 0.90 0.90"
|
64
|
+
# end
|
65
|
+
|
66
|
+
# model = {
|
67
|
+
# "frame_elements" => [ 0 ],
|
68
|
+
# "frame_sites" => {
|
69
|
+
# "FS_000"=>[0.00, 0.00, 0.00],
|
70
|
+
# "FS_001"=>[0.00, 0.00, 0.01],
|
71
|
+
# "FS_003"=>[0.00, 0.00, 0.03],
|
72
|
+
# "FS_020"=>[0.00, 0.02, 0.00],
|
73
|
+
# "FS_060"=>[0.00, 0.06, 0.00],
|
74
|
+
# "FS_300"=>[0.03, 0.00, 0.00],
|
75
|
+
# "FS_900"=>[0.09, 0.00, 0.00],
|
76
|
+
# },
|
77
|
+
# "symmetry_operations" => [
|
78
|
+
# {
|
79
|
+
# "rotation" => [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]],
|
80
|
+
# "translation" => [ 0.0000000, 0.0000000, 0.0000000]
|
81
|
+
# }, {
|
82
|
+
# "rotation" => [ [ -1, 0, 0], [ 0, -1, 0], [ 0, 0, -1]],
|
83
|
+
# "translation" => [ 0.0000000, 0.0000000, 0.0000000]
|
84
|
+
# }
|
85
|
+
# ],
|
86
|
+
# "octahedral_sites" => {
|
87
|
+
# "Oc_000"=> [
|
88
|
+
# [["FS_000", [0, 0, 1]], ["FS_000", [1, 1, 0]]],
|
89
|
+
# [["FS_000", [0, 1, 0]], ["FS_000", [1, 0, 1]]],
|
90
|
+
# [["FS_000", [1, 0, 0]], ["FS_000", [0, 1, 1]]]
|
91
|
+
# ]
|
92
|
+
# },
|
93
|
+
# "tetrahedral_sites" => {
|
94
|
+
# "Te_000"=> [
|
95
|
+
# ["FS_000", [0, 0, 0]], ["FS_000", [0, 0, 1]],
|
96
|
+
# ["FS_000", [0, 1, 0]], ["FS_000", [1, 0, 0]]
|
97
|
+
# ],
|
98
|
+
# "Te_001"=> [
|
99
|
+
# ["FS_000", [1, 1, 1]], ["FS_000", [1, 1, 0]],
|
100
|
+
# ["FS_000", [1, 0, 1]], ["FS_000", [0, 1, 1]]
|
101
|
+
# ]
|
102
|
+
# }
|
103
|
+
# }
|
104
|
+
# File.open(TMP_MODEL_YAML, "w") do |io|
|
105
|
+
# YAML.dump(model, io)
|
106
|
+
# end
|
107
|
+
#end
|
108
|
+
|
109
|
+
#def teardown
|
110
|
+
# TMP_FILES.each { |file| FileUtils.rm file if File.exist? file }
|
111
|
+
# Dir.glob("#{TMP_DIR}/*").each {|file| FileUtils.rm file}
|
112
|
+
# Dir.rmdir TMP_DIR if Dir.exist? TMP_DIR
|
113
|
+
#end
|
114
|
+
|
115
|
+
#
|
116
|
+
#def test_optimizedframecell
|
117
|
+
# # キチンと証明はしていないが、内部座標を直交座標として扱っても線形変換だから大丈夫だと思う。
|
118
|
+
# log_file = "optimizeframecell.log"
|
119
|
+
# FileUtils.rm log_file if File.exist? log_file
|
120
|
+
|
121
|
+
# result = YAML.load(`bin/optimizeframecell #{TMP_MODEL_YAML} #{TMP_POSCAR}`)
|
122
|
+
# # ハッシュの鍵がサイト名、値は元素名と座標からなる配列。
|
123
|
+
# assert_equal(["frame_atoms", "interstitials"], result.keys)
|
124
|
+
# assert_equal(
|
125
|
+
# ["FS_000", "FS_001", "FS_003", "FS_020", "FS_060", "FS_300", "FS_900"],
|
126
|
+
# result["frame_atoms"].keys
|
127
|
+
# )
|
128
|
+
# assert_equal(0, result["frame_atoms"]["FS_000"][0])
|
129
|
+
# assert_equal(0, result["frame_atoms"]["FS_001"][0])
|
130
|
+
# assert_equal(0, result["frame_atoms"]["FS_003"][0])
|
131
|
+
# assert_equal(0, result["frame_atoms"]["FS_020"][0])
|
132
|
+
# assert_equal(0, result["frame_atoms"]["FS_060"][0])
|
133
|
+
# assert_equal(0, result["frame_atoms"]["FS_300"][0])
|
134
|
+
# assert_equal(0, result["frame_atoms"]["FS_900"][0])
|
135
|
+
|
136
|
+
# assert_in_delta(0.00, result["frame_atoms"]["FS_000"][1][0], $tolerance)
|
137
|
+
# assert_in_delta(0.00, result["frame_atoms"]["FS_000"][1][1], $tolerance)
|
138
|
+
# assert_in_delta(0.00, result["frame_atoms"]["FS_000"][1][2], $tolerance)
|
139
|
+
# #あとは横着
|
140
|
+
# #assert_equal([ 0.10, 0.10, 0.11 ], result["frame_atoms"]["FS_001"][1])
|
141
|
+
# #assert_equal([ 0.10, 0.10, 0.13 ], result["frame_atoms"]["FS_003"][1])
|
142
|
+
# #assert_equal([ 0.10, 0.12, 0.10 ], result["frame_atoms"]["FS_020"][1])
|
143
|
+
# #assert_equal([ 0.10, 0.16, 0.10 ], result["frame_atoms"]["FS_060"][1])
|
144
|
+
# #assert_equal([ 0.13, 0.10, 0.10 ], result["frame_atoms"]["FS_300"][1])
|
145
|
+
# #assert_equal([ 0.19, 0.10, 0.10 ], result["frame_atoms"]["FS_900"][1])
|
146
|
+
# # },
|
147
|
+
# # "interstitials" => [
|
148
|
+
# # [ 1, [0.11, 0.11, 0.11]],
|
149
|
+
# # [ 2, [0.00, 0.00, 0.00]],
|
150
|
+
# # [ 2, [0.90, 0.90, 0.90]],
|
151
|
+
# # ]
|
152
|
+
# #}
|
153
|
+
# #assert_equal(correct, result)
|
154
|
+
|
155
|
+
# FileUtils.rm log_file if File.exist? log_file
|
156
|
+
#end
|
157
|
+
|
158
|
+
#def test_identifyatomsites
|
159
|
+
# optimized_ficell_yaml = "#{TMP_DIR}/optimized_ficell.yaml"
|
160
|
+
# FileUtils.rm optimized_ficell_yaml if File.exist? optimized_ficell_yaml
|
161
|
+
# log_file = "identifyatomsites.log"
|
162
|
+
# FileUtils.rm log_file if File.exist? log_file
|
163
|
+
|
164
|
+
# optimized_ficell = {
|
165
|
+
# "frame_atoms"=>
|
166
|
+
# { "FS_000"=>[0, [0.60, 0.60, 0.60]],
|
167
|
+
# "FS_001"=>[0, [0.60, 0.60, 0.61]],
|
168
|
+
# "FS_003"=>[0, [0.60, 0.60, 0.63]],
|
169
|
+
# "FS_020"=>[0, [0.60, 0.62, 0.60]],
|
170
|
+
# "FS_060"=>[0, [0.60, 0.66, 0.60]],
|
171
|
+
# "FS_300"=>[0, [0.63, 0.60, 0.60]],
|
172
|
+
# "FS_900"=>[0, [0.69, 0.60, 0.60]],
|
173
|
+
# },
|
174
|
+
# "interstitials"=> [
|
175
|
+
# [1, [0.61, 0.61, 0.61]],
|
176
|
+
# [2, [0.50, 0.50, 0.50]],
|
177
|
+
# [2, [0.10, 0.10, 0.10]],
|
178
|
+
# ]
|
179
|
+
# }
|
180
|
+
# File.open(optimized_ficell_yaml, "w") do |io|
|
181
|
+
# YAML.dump(optimized_ficell, io)
|
182
|
+
# end
|
183
|
+
# result = YAML.load(`bin/identifyatomsites #{TMP_MODEL_YAML} #{optimized_ficell_yaml}`)
|
184
|
+
# correct = {
|
185
|
+
# 0 => [ "FS_000", "FS_001", "FS_003", "FS_020", "FS_060", "FS_300", "FS_900", ],
|
186
|
+
# 1 => [ "Te_000", ],
|
187
|
+
# 2 => [ "Oc_000", "Te_001", ]
|
188
|
+
# }
|
189
|
+
# assert_equal(correct, result)
|
190
|
+
|
191
|
+
# FileUtils.rm optimized_ficell_yaml if File.exist? optimized_ficell_yaml
|
192
|
+
# FileUtils.rm log_file if File.exist? log_file
|
193
|
+
#end
|
194
|
+
|
195
|
+
#def test_site2pov
|
196
|
+
# results = `site2pov #{TMP_MODEL_YAML} Te_000`.split("\n")
|
197
|
+
# corrects = [
|
198
|
+
# "polygon { 4, < 0.0000, 0.0000, 0.0000>, < 0.0000, 0.0000, 1.0000>, < 0.0000, 1.0000, 0.0000>, < 0.0000, 0.0000, 0.0000> pigment { color rgb <1, 0, 0> } }",
|
199
|
+
# "polygon { 4, < 0.0000, 0.0000, 1.0000>, < 0.0000, 1.0000, 0.0000>, < 1.0000, 0.0000, 0.0000>, < 0.0000, 0.0000, 1.0000> pigment { color rgb <1, 0, 0> } }",
|
200
|
+
# "polygon { 4, < 0.0000, 1.0000, 0.0000>, < 1.0000, 0.0000, 0.0000>, < 0.0000, 0.0000, 0.0000>, < 0.0000, 1.0000, 0.0000> pigment { color rgb <1, 0, 0> } }",
|
201
|
+
# "polygon { 4, < 1.0000, 0.0000, 0.0000>, < 0.0000, 0.0000, 0.0000>, < 0.0000, 0.0000, 1.0000>, < 1.0000, 0.0000, 0.0000> pigment { color rgb <1, 0, 0> } }",
|
202
|
+
# ]
|
203
|
+
# corrects.each_with_index do |line, index|
|
204
|
+
# assert_equal(line, results[index])
|
205
|
+
# end
|
206
|
+
#end
|
207
|
+
|
208
|
+
#def test_minExpConfiguration
|
209
|
+
# config = {
|
210
|
+
# 0=>["FS_000", "FS_006"],
|
211
|
+
# 1=>["Te_002", "Te_006"]
|
212
|
+
# }
|
213
|
+
# config_yaml = "tmp_site_config.yaml"
|
214
|
+
# File.open(config_yaml, "w") { |io| YAML.dump(config, io) }
|
215
|
+
|
216
|
+
# operations = [
|
217
|
+
# {
|
218
|
+
# "FS_000" => "FS_000",
|
219
|
+
# "FS_006" => "FS_006",
|
220
|
+
# "Te_002" => "Te_002",
|
221
|
+
# "Te_006" => "Te_006",
|
222
|
+
# "Oc_000" => "Oc_000",
|
223
|
+
# }, {
|
224
|
+
# "FS_000" => "A0",
|
225
|
+
# "FS_006" => "A1",
|
226
|
+
# "Te_002" => "A2",
|
227
|
+
# "Te_006" => "A3",
|
228
|
+
# "Oc_000" => "A4",
|
229
|
+
# }
|
230
|
+
# ]
|
231
|
+
# operations_yaml = "tmp_site_operations.yaml"
|
232
|
+
# File.open(operations_yaml, "w") { |io| YAML.dump(operations, io) }
|
233
|
+
|
234
|
+
# result = YAML.load(`bin/minExpConfiguration #{config_yaml} #{operations_yaml}`)
|
235
|
+
# correct = {
|
236
|
+
# 0=>["A0", "A1"],
|
237
|
+
# 1=>["A2", "A3"]
|
238
|
+
# }
|
239
|
+
# assert_equal(correct, result)
|
240
|
+
|
241
|
+
# FileUtils.rm operations_yaml if File.exist? operations_yaml
|
242
|
+
# FileUtils.rm config_yaml if File.exist? config_yaml
|
243
|
+
#end
|
244
|
+
|
245
|
+
#def test_siteoperations
|
246
|
+
# model = {
|
247
|
+
# "frame_elements" => [ 0 ],
|
248
|
+
# "frame_sites" => {
|
249
|
+
# "FS_000"=>[0.00, 0.00, 0.00],
|
250
|
+
# },
|
251
|
+
# "symmetry_operations" => [
|
252
|
+
# {
|
253
|
+
# "rotation" => [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]],
|
254
|
+
# "translation" => [ 0.0000000, 0.0000000, 0.0000000]
|
255
|
+
# }, {
|
256
|
+
# "rotation" => [ [ -1, 0, 0], [ 0, -1, 0], [ 0, 0, -1]],
|
257
|
+
# "translation" => [ 0.0000000, 0.0000000, 0.0000000]
|
258
|
+
# }
|
259
|
+
# ],
|
260
|
+
# "octahedral_sites" => {
|
261
|
+
# "Oc_000"=> [
|
262
|
+
# [["FS_000", [0, 0, 1]], ["FS_000", [1, 1, 0]]],
|
263
|
+
# [["FS_000", [0, 1, 0]], ["FS_000", [1, 0, 1]]],
|
264
|
+
# [["FS_000", [1, 0, 0]], ["FS_000", [0, 1, 1]]]
|
265
|
+
# ]
|
266
|
+
# },
|
267
|
+
# "tetrahedral_sites" => {
|
268
|
+
# "Te_000"=> [
|
269
|
+
# ["FS_000", [0, 0, 0]], ["FS_000", [0, 0, 1]],
|
270
|
+
# ["FS_000", [0, 1, 0]], ["FS_000", [1, 0, 0]]
|
271
|
+
# ],
|
272
|
+
# "Te_001"=> [
|
273
|
+
# ["FS_000", [1, 1, 1]], ["FS_000", [1, 1, 0]],
|
274
|
+
# ["FS_000", [1, 0, 1]], ["FS_000", [0, 1, 1]]
|
275
|
+
# ]
|
276
|
+
# }
|
277
|
+
# }
|
278
|
+
# File.open(TMP_MODEL_YAML, "w") do |io|
|
279
|
+
# YAML.dump(model, io)
|
280
|
+
# end
|
281
|
+
# result = YAML.load(`bin/siteoperations #{TMP_MODEL_YAML}`)
|
282
|
+
# correct = [
|
283
|
+
# {
|
284
|
+
# "FS_000" => "FS_000",
|
285
|
+
# "Te_000" => "Te_000",
|
286
|
+
# "Te_001" => "Te_001",
|
287
|
+
# "Oc_000" => "Oc_000",
|
288
|
+
# }, {
|
289
|
+
# "FS_000" => "FS_000",
|
290
|
+
# "Te_000" => "Te_000",
|
291
|
+
# "Te_000" => "Te_001",
|
292
|
+
# "Te_001" => "Te_000",
|
293
|
+
# "Oc_000" => "Oc_000",
|
294
|
+
# }
|
295
|
+
# ]
|
296
|
+
# assert_equal(correct, result)
|
297
|
+
#end
|
298
|
+
|
299
|
+
#def test_site2poscar
|
300
|
+
# # ここのテストは Poscar クラスを VASP 5 形式に対応する改造してから。
|
301
|
+
# lattice_yaml = "#{TMP_DIR}/lattice.yaml"
|
302
|
+
# lattice = [10.0, 11.0, 12.0, 90.0, 91.0, 92.0]
|
303
|
+
# File.open(lattice_yaml, "w") do |io|
|
304
|
+
# YAML.dump(lattice, io)
|
305
|
+
# end
|
306
|
+
|
307
|
+
# site_configuration_yaml = "#{TMP_DIR}/site_configuration.yaml"
|
308
|
+
# site_configuration = {
|
309
|
+
# 0 => [ "FS_000", "FS_001"],
|
310
|
+
# 1 => [ "Oc_000", "Te_000"],
|
311
|
+
# }
|
312
|
+
# File.open(site_configuration_yaml, "w") do |io|
|
313
|
+
# YAML.dump(site_configuration, io)
|
314
|
+
# end
|
315
|
+
|
316
|
+
# FileUtils.rm lattice_yaml if File.exist? lattice_yaml
|
317
|
+
# FileUtils.rm site_configuration_yaml if File.exist? site_configuration_yaml
|
318
|
+
#end
|
319
|
+
|
320
|
+
#def test_genuniqsites
|
321
|
+
# # setting up
|
322
|
+
# files = [ "00-0000.yaml", "01-0000.yaml", "01-0001.yaml" ]
|
323
|
+
# files.each { |file| FileUtils.rm file if FileTest.exist? file }
|
324
|
+
# command =
|
325
|
+
# "bin/genuniqsites " +
|
326
|
+
# "test/uniquesitesgenerator/elements-sitenames.yaml " +
|
327
|
+
# "test/uniquesitesgenerator/siteoperations.yaml " +
|
328
|
+
# "-l 1"
|
329
|
+
# system("#{command}")
|
330
|
+
# assert_equal( {0 => []}, YAML.load_file("00-0000.yaml"))
|
331
|
+
# #
|
332
|
+
# assert_equal( {0 => ["a"]}, YAML.load_file("01-0000.yaml"))
|
333
|
+
# assert_equal( {0 => ["c"]}, YAML.load_file("01-0001.yaml"))
|
334
|
+
# #
|
335
|
+
# files = [ "00-0000.yaml", "01-0000.yaml", "01-0001.yaml" ]
|
336
|
+
# files.each { |file| FileUtils.rm file if FileTest.exist? file }
|
337
|
+
#end
|
338
|
+
|
339
|
+
end
|
340
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
require "helper"
|
5
|
+
#require "test/unit"
|
6
|
+
#require "crysna/frameatom.rb"
|
7
|
+
|
8
|
+
# assert_equal( cor, data)
|
9
|
+
# assert_in_delta( cor, data, $tolerance )
|
10
|
+
# assert_raise( RuntimeError ){}
|
11
|
+
|
12
|
+
class TC_FrameAtom < Test::Unit::TestCase
|
13
|
+
def setup
|
14
|
+
@fa00 = FrameAtom.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,939 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
require "helper"
|
5
|
+
#require "test/unit"
|
6
|
+
#require "crysna/frameinterstitialcell.rb"
|
7
|
+
require "stringio"
|
8
|
+
|
9
|
+
$test = true
|
10
|
+
|
11
|
+
class FrameInterstitialCell
|
12
|
+
#public :site_name
|
13
|
+
#public :include_in_27_polyhedra?
|
14
|
+
public :equivalent_cells
|
15
|
+
public :frame_atoms
|
16
|
+
public :interstitial_atoms
|
17
|
+
public :frame_cell
|
18
|
+
public :interstitial_cell
|
19
|
+
end
|
20
|
+
|
21
|
+
class TC_FrameInterstitialCell < Test::Unit::TestCase
|
22
|
+
$tolerance = 10.0 ** (-10)
|
23
|
+
|
24
|
+
def setup
|
25
|
+
@frame_sites ={
|
26
|
+
"FS_000" => Mageo::Vector3DInternal[0.10, 0.10, 0.10],
|
27
|
+
"FS_001" => Mageo::Vector3DInternal[0.10, 0.10, 0.11],
|
28
|
+
"FS_002" => Mageo::Vector3DInternal[0.10, 0.10, 0.13],
|
29
|
+
"FS_010" => Mageo::Vector3DInternal[0.10, 0.12, 0.10],
|
30
|
+
"FS_020" => Mageo::Vector3DInternal[0.10, 0.16, 0.10],
|
31
|
+
"FS_100" => Mageo::Vector3DInternal[0.13, 0.10, 0.10],
|
32
|
+
"FS_200" => Mageo::Vector3DInternal[0.19, 0.10, 0.10],
|
33
|
+
}
|
34
|
+
|
35
|
+
@lattice_axes = CrystalCell::LatticeAxes.new([[1.0, 1.0, 1.0], [0.0, 1.0, 1.0], [0.0, 0.0, 1.0]])
|
36
|
+
atoms = [
|
37
|
+
FrameAtom.new( 0, [0.10, 0.10, 0.10]),
|
38
|
+
FrameAtom.new( 0, [0.10, 0.10, 0.11]),
|
39
|
+
FrameAtom.new( 0, [0.10, 0.10, 0.13]),
|
40
|
+
FrameAtom.new( 0, [0.10, 0.12, 0.10]),
|
41
|
+
FrameAtom.new( 0, [0.10, 0.16, 0.10]),
|
42
|
+
FrameAtom.new( 0, [0.13, 0.10, 0.10]),
|
43
|
+
FrameAtom.new( 0, [0.19, 0.10, 0.10]),
|
44
|
+
InterstitialAtom.new(1, [0.50, 0.50, 0.30]),
|
45
|
+
]
|
46
|
+
@fic00 = FrameInterstitialCell.new(@lattice_axes, atoms)
|
47
|
+
|
48
|
+
atoms = [
|
49
|
+
FrameAtom.new( 0, [0.00, 0.00, 0.00]),
|
50
|
+
InterstitialAtom.new(0, [0.50, 0.50, 0.50]),
|
51
|
+
InterstitialAtom.new(1, [0.10, 0.10, 0.10]),
|
52
|
+
InterstitialAtom.new(2, [0.90, 0.90, 0.90]),
|
53
|
+
InterstitialAtom.new(3, [0.01, 0.01, 0.01]),
|
54
|
+
InterstitialAtom.new(3, [0.90, 0.01, 0.01]),
|
55
|
+
InterstitialAtom.new(3, [0.01, 0.90, 0.01]),
|
56
|
+
InterstitialAtom.new(3, [0.01, 0.01, 0.90]),
|
57
|
+
InterstitialAtom.new(4, [0.99, 0.99, 0.99]),
|
58
|
+
InterstitialAtom.new(4, [0.10, 0.99, 0.99]),
|
59
|
+
InterstitialAtom.new(4, [0.99, 0.10, 0.99]),
|
60
|
+
InterstitialAtom.new(4, [0.99, 0.99, 0.10]),
|
61
|
+
InterstitialAtom.new(5, [0.99, 0.10, 0.10]),
|
62
|
+
InterstitialAtom.new(5, [0.10, 0.99, 0.10]),
|
63
|
+
InterstitialAtom.new(5, [0.10, 0.10, 0.99]),
|
64
|
+
InterstitialAtom.new(5, [0.01, 0.90, 0.90]),
|
65
|
+
InterstitialAtom.new(5, [0.90, 0.01, 0.90]),
|
66
|
+
InterstitialAtom.new(5, [0.90, 0.90, 0.01]),
|
67
|
+
]
|
68
|
+
@fic01 = FrameInterstitialCell.new(@lattice_axes, atoms)
|
69
|
+
|
70
|
+
atoms = [
|
71
|
+
FrameAtom.new( 0, [0.00, 0.00, 0.00]),
|
72
|
+
InterstitialAtom.new(1, [0.60, 0.60, 0.60]),
|
73
|
+
InterstitialAtom.new(2, [0.40, 0.40, 0.40]),
|
74
|
+
InterstitialAtom.new(3, [0.51, 0.51, 0.51]),
|
75
|
+
InterstitialAtom.new(3, [0.40, 0.51, 0.51]),
|
76
|
+
InterstitialAtom.new(3, [0.51, 0.40, 0.51]),
|
77
|
+
InterstitialAtom.new(3, [0.51, 0.51, 0.40]),
|
78
|
+
InterstitialAtom.new(4, [0.49, 0.49, 0.49]),
|
79
|
+
InterstitialAtom.new(4, [0.60, 0.49, 0.49]),
|
80
|
+
InterstitialAtom.new(4, [0.49, 0.60, 0.49]),
|
81
|
+
InterstitialAtom.new(4, [0.49, 0.49, 0.60]),
|
82
|
+
InterstitialAtom.new(5, [0.49, 0.60, 0.60]),
|
83
|
+
InterstitialAtom.new(5, [0.60, 0.49, 0.60]),
|
84
|
+
InterstitialAtom.new(5, [0.60, 0.60, 0.49]),
|
85
|
+
InterstitialAtom.new(5, [0.51, 0.40, 0.40]),
|
86
|
+
InterstitialAtom.new(5, [0.40, 0.51, 0.40]),
|
87
|
+
InterstitialAtom.new(5, [0.40, 0.40, 0.51]),
|
88
|
+
]
|
89
|
+
@fic02 = FrameInterstitialCell.new(@lattice_axes, atoms)
|
90
|
+
|
91
|
+
lattice_axes = [[10.0, 0.0, 0.0], [0.0, 20.0, 0.0], [0.0, 0.0, 30.0]]
|
92
|
+
@fic03 = FrameInterstitialCell.new(lattice_axes)
|
93
|
+
|
94
|
+
@la = CrystalCell::LatticeAxes.new( [ [1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0] ] )
|
95
|
+
|
96
|
+
@oc_sites00 = {
|
97
|
+
"Oc_00"=> [
|
98
|
+
[["FS_00", [1, 0, 0]], ["FS_00", [0, 1, 1]]],
|
99
|
+
[["FS_00", [0, 1, 0]], ["FS_00", [1, 0, 1]]],
|
100
|
+
[["FS_00", [0, 0, 1]], ["FS_00", [1, 1, 0]]]
|
101
|
+
]
|
102
|
+
}
|
103
|
+
|
104
|
+
@te_sites00 = {
|
105
|
+
"Te_00"=> [
|
106
|
+
["FS_00", [0, 0, 0]],
|
107
|
+
["FS_00", [1, 0, 0]],
|
108
|
+
["FS_00", [0, 1, 0]],
|
109
|
+
["FS_00", [0, 0, 1]]
|
110
|
+
],
|
111
|
+
"Te_01"=> [
|
112
|
+
["FS_00", [1, 1, 1]],
|
113
|
+
["FS_00", [0, 1, 1]],
|
114
|
+
["FS_00", [1, 0, 1]],
|
115
|
+
["FS_00", [1, 1, 0]]
|
116
|
+
]
|
117
|
+
}
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_initialize
|
121
|
+
vectors00 = [[1.02, 0.02, 0.02], [0.0, 1.01, 0.01], [0.0, 0.0, 1.00]]
|
122
|
+
atoms = [
|
123
|
+
CrystalCell::Atom.new(0, [0.0, 0.0, 0.0])
|
124
|
+
]
|
125
|
+
assert_raise(FrameInterstitialCell::TypeError){
|
126
|
+
FrameInterstitialCell.new(vectors00, atoms )
|
127
|
+
}
|
128
|
+
|
129
|
+
assert_nothing_raised{
|
130
|
+
FrameInterstitialCell.new(
|
131
|
+
[[1.02, 0.02, 0.02], [0.0, 1.01, 0.01], [0.0, 0.0, 1.00]]
|
132
|
+
)
|
133
|
+
}
|
134
|
+
|
135
|
+
atoms = [ FrameAtom.new(0, [0.0, 0.0, 0.0]) ]
|
136
|
+
assert_nothing_raised{
|
137
|
+
FrameInterstitialCell.new(
|
138
|
+
[[1.02, 0.02, 0.02], [0.0, 1.01, 0.01], [0.0, 0.0, 1.00]]
|
139
|
+
)
|
140
|
+
}
|
141
|
+
|
142
|
+
atoms = [ InterstitialAtom.new(0, [0.0, 0.0, 0.0]) ]
|
143
|
+
assert_nothing_raised{
|
144
|
+
FrameInterstitialCell.new(
|
145
|
+
[[1.02, 0.02, 0.02], [0.0, 1.01, 0.01], [0.0, 0.0, 1.00]]
|
146
|
+
)
|
147
|
+
}
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_optimized_cell
|
152
|
+
io = StringIO.new
|
153
|
+
frame_sites ={
|
154
|
+
"FS_000" => Mageo::Vector3DInternal[0.00, 0.00, 0.00],
|
155
|
+
"FS_001" => Mageo::Vector3DInternal[0.00, 0.00, 0.01],
|
156
|
+
"FS_002" => Mageo::Vector3DInternal[0.00, 0.00, 0.03],
|
157
|
+
"FS_010" => Mageo::Vector3DInternal[0.00, 0.02, 0.00],
|
158
|
+
"FS_020" => Mageo::Vector3DInternal[0.00, 0.06, 0.00],
|
159
|
+
"FS_100" => Mageo::Vector3DInternal[0.03, 0.00, 0.00],
|
160
|
+
"FS_200" => Mageo::Vector3DInternal[0.09, 0.00, 0.00],
|
161
|
+
}
|
162
|
+
|
163
|
+
@lattice_axes = CrystalCell::LatticeAxes.new([[1.0, 1.0, 1.0], [0.0, 1.0, 1.0], [0.0, 0.0, 1.0]])
|
164
|
+
atoms = [
|
165
|
+
FrameAtom.new( 0, [0.000, 0.000, 0.000]),
|
166
|
+
FrameAtom.new( 0, [0.000, 0.000, 0.010]),
|
167
|
+
FrameAtom.new( 0, [0.000, 0.000, 0.037]),
|
168
|
+
FrameAtom.new( 0, [0.000, 0.020, 0.000]),
|
169
|
+
FrameAtom.new( 0, [0.000, 0.067, 0.000]),
|
170
|
+
FrameAtom.new( 0, [0.030, 0.000, 0.000]),
|
171
|
+
FrameAtom.new( 0, [0.097, 0.000, 0.000]),
|
172
|
+
]
|
173
|
+
fic10 = FrameInterstitialCell.new(@lattice_axes, atoms)
|
174
|
+
t = fic10.optimized_cell(frame_sites, io)
|
175
|
+
assert_equal(FrameInterstitialCell, t.class)
|
176
|
+
assert_equal(CrystalCell::LatticeAxes, t.axes.class)
|
177
|
+
assert_in_delta(1.0, t.axes[0][0], $tolerance)
|
178
|
+
assert_in_delta(1.0, t.axes[0][1], $tolerance)
|
179
|
+
assert_in_delta(1.0, t.axes[0][2], $tolerance)
|
180
|
+
assert_in_delta(0.0, t.axes[1][0], $tolerance)
|
181
|
+
assert_in_delta(1.0, t.axes[1][1], $tolerance)
|
182
|
+
assert_in_delta(1.0, t.axes[1][2], $tolerance)
|
183
|
+
assert_in_delta(0.0, t.axes[2][0], $tolerance)
|
184
|
+
assert_in_delta(0.0, t.axes[2][1], $tolerance)
|
185
|
+
assert_in_delta(1.0, t.axes[2][2], $tolerance)
|
186
|
+
assert_equal(7, t.atoms.size)
|
187
|
+
|
188
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[0].position.class)
|
189
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[1].position.class)
|
190
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[2].position.class)
|
191
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[3].position.class)
|
192
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[4].position.class)
|
193
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[5].position.class)
|
194
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[6].position.class)
|
195
|
+
assert_in_delta(-0.001, t.atoms[0].position[0], $tolerance)
|
196
|
+
assert_in_delta(-0.001, t.atoms[0].position[1], $tolerance)
|
197
|
+
assert_in_delta(-0.001, t.atoms[0].position[2], $tolerance)
|
198
|
+
assert_in_delta(-0.001, t.atoms[1].position[0], $tolerance)
|
199
|
+
assert_in_delta(-0.001, t.atoms[1].position[1], $tolerance)
|
200
|
+
assert_in_delta( 0.009, t.atoms[1].position[2], $tolerance)
|
201
|
+
assert_in_delta(-0.001, t.atoms[2].position[0], $tolerance)
|
202
|
+
assert_in_delta(-0.001, t.atoms[2].position[1], $tolerance)
|
203
|
+
assert_in_delta( 0.036, t.atoms[2].position[2], $tolerance)
|
204
|
+
assert_in_delta(-0.001, t.atoms[3].position[0], $tolerance)
|
205
|
+
assert_in_delta( 0.019, t.atoms[3].position[1], $tolerance)
|
206
|
+
assert_in_delta(-0.001, t.atoms[3].position[2], $tolerance)
|
207
|
+
assert_in_delta(-0.001, t.atoms[4].position[0], $tolerance)
|
208
|
+
assert_in_delta( 0.066, t.atoms[4].position[1], $tolerance)
|
209
|
+
assert_in_delta(-0.001, t.atoms[4].position[2], $tolerance)
|
210
|
+
assert_in_delta( 0.029, t.atoms[5].position[0], $tolerance)
|
211
|
+
assert_in_delta(-0.001, t.atoms[5].position[1], $tolerance)
|
212
|
+
assert_in_delta(-0.001, t.atoms[5].position[2], $tolerance)
|
213
|
+
assert_in_delta( 0.096, t.atoms[6].position[0], $tolerance)
|
214
|
+
assert_in_delta(-0.001, t.atoms[6].position[1], $tolerance)
|
215
|
+
assert_in_delta(-0.001, t.atoms[6].position[2], $tolerance)
|
216
|
+
|
217
|
+
assert_equal("FS_000", t.atoms[0].name)
|
218
|
+
assert_equal("FS_001", t.atoms[1].name)
|
219
|
+
assert_equal("FS_002", t.atoms[2].name)
|
220
|
+
assert_equal("FS_010", t.atoms[3].name)
|
221
|
+
assert_equal("FS_020", t.atoms[4].name)
|
222
|
+
assert_equal("FS_100", t.atoms[5].name)
|
223
|
+
assert_equal("FS_200", t.atoms[6].name)
|
224
|
+
assert_equal( "Equivalent cell No.00: Original.; Rough translation: ( 0.00000, 0.00000, 0.00000), 0th atom of frame to FS_000; Precise translation: (-0.00100, -0.00100, -0.00100)\n", t.comment)
|
225
|
+
|
226
|
+
io = StringIO.new
|
227
|
+
|
228
|
+
# そのまま重なるもの。
|
229
|
+
t = @fic00.optimized_cell(@frame_sites, io)
|
230
|
+
assert_equal(FrameInterstitialCell, t.class)
|
231
|
+
assert_equal(CrystalCell::LatticeAxes, t.axes.class)
|
232
|
+
assert_in_delta(1.0, t.axes[0][0], $tolerance)
|
233
|
+
assert_in_delta(1.0, t.axes[0][1], $tolerance)
|
234
|
+
assert_in_delta(1.0, t.axes[0][2], $tolerance)
|
235
|
+
assert_in_delta(0.0, t.axes[1][0], $tolerance)
|
236
|
+
assert_in_delta(1.0, t.axes[1][1], $tolerance)
|
237
|
+
assert_in_delta(1.0, t.axes[1][2], $tolerance)
|
238
|
+
assert_in_delta(0.0, t.axes[2][0], $tolerance)
|
239
|
+
assert_in_delta(0.0, t.axes[2][1], $tolerance)
|
240
|
+
assert_in_delta(1.0, t.axes[2][2], $tolerance)
|
241
|
+
assert_equal(8, t.atoms.size)
|
242
|
+
assert_equal(Mageo::Vector3DInternal[0.10, 0.10, 0.10], t.atoms[0].position)
|
243
|
+
assert_equal(Mageo::Vector3DInternal[0.10, 0.10, 0.11], t.atoms[1].position)
|
244
|
+
assert_equal(Mageo::Vector3DInternal[0.10, 0.10, 0.13], t.atoms[2].position)
|
245
|
+
assert_equal(Mageo::Vector3DInternal[0.10, 0.12, 0.10], t.atoms[3].position)
|
246
|
+
assert_equal(Mageo::Vector3DInternal[0.10, 0.16, 0.10], t.atoms[4].position)
|
247
|
+
assert_equal(Mageo::Vector3DInternal[0.13, 0.10, 0.10], t.atoms[5].position)
|
248
|
+
assert_equal(Mageo::Vector3DInternal[0.19, 0.10, 0.10], t.atoms[6].position)
|
249
|
+
assert_equal(Mageo::Vector3DInternal[0.50, 0.50, 0.30], t.atoms[7].position)
|
250
|
+
assert_equal("FS_000", t.atoms[0].name)
|
251
|
+
assert_equal("FS_001", t.atoms[1].name)
|
252
|
+
assert_equal("FS_002", t.atoms[2].name)
|
253
|
+
assert_equal("FS_010", t.atoms[3].name)
|
254
|
+
assert_equal("FS_020", t.atoms[4].name)
|
255
|
+
assert_equal("FS_100", t.atoms[5].name)
|
256
|
+
assert_equal("FS_200", t.atoms[6].name)
|
257
|
+
assert_equal( "Equivalent cell No.00: Original.; Rough translation: ( 0.00000, 0.00000, 0.00000), 0th atom of frame to FS_000; Precise translation: ( 0.00000, 0.00000, 0.00000)\n", t.comment)
|
258
|
+
|
259
|
+
# 並進移動を加えたもの。
|
260
|
+
cell = @fic00.translate(Mageo::Vector3DInternal[0.1, 0.2, 0.3])
|
261
|
+
assert_equal(Mageo::Vector3DInternal, cell.atoms[0].position.class)
|
262
|
+
assert_in_delta(0.20, cell.atoms[0].position[0], $tolerance)
|
263
|
+
assert_in_delta(0.30, cell.atoms[0].position[1], $tolerance)
|
264
|
+
assert_in_delta(0.40, cell.atoms[0].position[2], $tolerance)
|
265
|
+
#
|
266
|
+
t = cell.optimized_cell(@frame_sites, io)
|
267
|
+
assert_equal(FrameInterstitialCell, t.class)
|
268
|
+
assert_equal(8, t.atoms.size)
|
269
|
+
assert_in_delta(0.10, t.atoms[0].position[0], $tolerance)
|
270
|
+
assert_in_delta(0.10, t.atoms[0].position[1], $tolerance)
|
271
|
+
assert_in_delta(0.10, t.atoms[0].position[2], $tolerance)
|
272
|
+
assert_in_delta(0.10, t.atoms[1].position[0], $tolerance)
|
273
|
+
assert_in_delta(0.10, t.atoms[1].position[1], $tolerance)
|
274
|
+
assert_in_delta(0.11, t.atoms[1].position[2], $tolerance)
|
275
|
+
assert_in_delta(0.10, t.atoms[2].position[0], $tolerance)
|
276
|
+
assert_in_delta(0.10, t.atoms[2].position[1], $tolerance)
|
277
|
+
assert_in_delta(0.13, t.atoms[2].position[2], $tolerance)
|
278
|
+
assert_in_delta(0.10, t.atoms[3].position[0], $tolerance)
|
279
|
+
assert_in_delta(0.12, t.atoms[3].position[1], $tolerance)
|
280
|
+
assert_in_delta(0.10, t.atoms[3].position[2], $tolerance)
|
281
|
+
assert_in_delta(0.10, t.atoms[4].position[0], $tolerance)
|
282
|
+
assert_in_delta(0.16, t.atoms[4].position[1], $tolerance)
|
283
|
+
assert_in_delta(0.10, t.atoms[4].position[2], $tolerance)
|
284
|
+
assert_in_delta(0.13, t.atoms[5].position[0], $tolerance)
|
285
|
+
assert_in_delta(0.10, t.atoms[5].position[1], $tolerance)
|
286
|
+
assert_in_delta(0.10, t.atoms[5].position[2], $tolerance)
|
287
|
+
assert_in_delta(0.19, t.atoms[6].position[0], $tolerance)
|
288
|
+
assert_in_delta(0.10, t.atoms[6].position[1], $tolerance)
|
289
|
+
assert_in_delta(0.10, t.atoms[6].position[2], $tolerance)
|
290
|
+
assert_in_delta(0.50, t.atoms[7].position[0], $tolerance)
|
291
|
+
assert_in_delta(0.50, t.atoms[7].position[1], $tolerance)
|
292
|
+
assert_in_delta(0.30, t.atoms[7].position[2], $tolerance)
|
293
|
+
assert_equal("FS_000", t.atoms[0].name)
|
294
|
+
assert_equal("FS_001", t.atoms[1].name)
|
295
|
+
assert_equal("FS_002", t.atoms[2].name)
|
296
|
+
assert_equal("FS_010", t.atoms[3].name)
|
297
|
+
assert_equal("FS_020", t.atoms[4].name)
|
298
|
+
assert_equal("FS_100", t.atoms[5].name)
|
299
|
+
assert_equal("FS_200", t.atoms[6].name)
|
300
|
+
assert_equal("Equivalent cell No.00: Original.; Rough translation: (-0.10000, -0.20000, -0.30000), 0th atom of frame to FS_000; Precise translation: ( 0.00000, 0.00000, 0.00000)\n", t.comment)
|
301
|
+
|
302
|
+
|
303
|
+
# 周期境界をまたぐもの。
|
304
|
+
cell = @fic00.translate(Mageo::Vector3DInternal[0.85, 0.85, 0.85])
|
305
|
+
cell.to_pcell.to_cell
|
306
|
+
assert_equal(Mageo::Vector3DInternal, cell.atoms[0].position.class)
|
307
|
+
assert_in_delta(0.95, cell.atoms[0].position[0], $tolerance)
|
308
|
+
assert_in_delta(0.95, cell.atoms[0].position[1], $tolerance)
|
309
|
+
assert_in_delta(0.95, cell.atoms[0].position[2], $tolerance)
|
310
|
+
assert_equal(Mageo::Vector3DInternal, cell.atoms[6].position.class)
|
311
|
+
assert_in_delta(1.04, cell.atoms[6].position[0], $tolerance)
|
312
|
+
assert_in_delta(0.95, cell.atoms[6].position[1], $tolerance)
|
313
|
+
assert_in_delta(0.95, cell.atoms[6].position[2], $tolerance)
|
314
|
+
#
|
315
|
+
t = cell.optimized_cell(@frame_sites, io)
|
316
|
+
assert_equal(FrameInterstitialCell, t.class)
|
317
|
+
assert_equal(8, t.atoms.size)
|
318
|
+
assert_in_delta(0.10, t.atoms[0].position[0], $tolerance)
|
319
|
+
assert_in_delta(0.10, t.atoms[0].position[1], $tolerance)
|
320
|
+
assert_in_delta(0.10, t.atoms[0].position[2], $tolerance)
|
321
|
+
assert_in_delta(0.10, t.atoms[1].position[0], $tolerance)
|
322
|
+
assert_in_delta(0.10, t.atoms[1].position[1], $tolerance)
|
323
|
+
assert_in_delta(0.11, t.atoms[1].position[2], $tolerance)
|
324
|
+
assert_in_delta(0.10, t.atoms[2].position[0], $tolerance)
|
325
|
+
assert_in_delta(0.10, t.atoms[2].position[1], $tolerance)
|
326
|
+
assert_in_delta(0.13, t.atoms[2].position[2], $tolerance)
|
327
|
+
assert_in_delta(0.10, t.atoms[3].position[0], $tolerance)
|
328
|
+
assert_in_delta(0.12, t.atoms[3].position[1], $tolerance)
|
329
|
+
assert_in_delta(0.10, t.atoms[3].position[2], $tolerance)
|
330
|
+
assert_in_delta(0.10, t.atoms[4].position[0], $tolerance)
|
331
|
+
assert_in_delta(0.16, t.atoms[4].position[1], $tolerance)
|
332
|
+
assert_in_delta(0.10, t.atoms[4].position[2], $tolerance)
|
333
|
+
assert_in_delta(0.13, t.atoms[5].position[0], $tolerance)
|
334
|
+
assert_in_delta(0.10, t.atoms[5].position[1], $tolerance)
|
335
|
+
assert_in_delta(0.10, t.atoms[5].position[2], $tolerance)
|
336
|
+
assert_in_delta(0.19, t.atoms[6].position[0], $tolerance)
|
337
|
+
assert_in_delta(0.10, t.atoms[6].position[1], $tolerance)
|
338
|
+
assert_in_delta(0.10, t.atoms[6].position[2], $tolerance)
|
339
|
+
assert_in_delta(0.50, t.atoms[7].position[0], $tolerance)
|
340
|
+
assert_in_delta(0.50, t.atoms[7].position[1], $tolerance)
|
341
|
+
assert_in_delta(0.30, t.atoms[7].position[2], $tolerance)
|
342
|
+
assert_equal("FS_000", t.atoms[0].name)
|
343
|
+
assert_equal("FS_001", t.atoms[1].name)
|
344
|
+
assert_equal("FS_002", t.atoms[2].name)
|
345
|
+
assert_equal("FS_010", t.atoms[3].name)
|
346
|
+
assert_equal("FS_020", t.atoms[4].name)
|
347
|
+
assert_equal("FS_100", t.atoms[5].name)
|
348
|
+
assert_equal("FS_200", t.atoms[6].name)
|
349
|
+
assert_equal("Equivalent cell No.00: Original.; Rough translation: (-0.85000, -0.85000, -0.85000), 0th atom of frame to FS_000; Precise translation: ( 0.00000, 0.00000, 0.00000)\n", t.comment)
|
350
|
+
|
351
|
+
# a軸反転したもの。
|
352
|
+
cell = @fic00.inverse_axis(0)
|
353
|
+
assert_equal(Mageo::Vector3DInternal[-0.10, 0.10, 0.10], cell.atoms[0].position)
|
354
|
+
#
|
355
|
+
t = cell.optimized_cell(@frame_sites, io)
|
356
|
+
assert_equal(FrameInterstitialCell, t.class)
|
357
|
+
assert_equal(8, t.atoms.size)
|
358
|
+
assert_equal(Mageo::Vector3DInternal[0.10, 0.10, 0.10], t.atoms[0].position)
|
359
|
+
assert_equal(Mageo::Vector3DInternal[0.10, 0.10, 0.11], t.atoms[1].position)
|
360
|
+
assert_equal(Mageo::Vector3DInternal[0.10, 0.10, 0.13], t.atoms[2].position)
|
361
|
+
assert_equal(Mageo::Vector3DInternal[0.10, 0.12, 0.10], t.atoms[3].position)
|
362
|
+
assert_equal(Mageo::Vector3DInternal[0.10, 0.16, 0.10], t.atoms[4].position)
|
363
|
+
assert_equal(Mageo::Vector3DInternal[0.13, 0.10, 0.10], t.atoms[5].position)
|
364
|
+
assert_equal(Mageo::Vector3DInternal[0.19, 0.10, 0.10], t.atoms[6].position)
|
365
|
+
assert_equal(Mageo::Vector3DInternal[0.50, 0.50, 0.30], t.atoms[7].position)
|
366
|
+
assert_equal("FS_000", t.atoms[0].name)
|
367
|
+
assert_equal("FS_001", t.atoms[1].name)
|
368
|
+
assert_equal("FS_002", t.atoms[2].name)
|
369
|
+
assert_equal("FS_010", t.atoms[3].name)
|
370
|
+
assert_equal("FS_020", t.atoms[4].name)
|
371
|
+
assert_equal("FS_100", t.atoms[5].name)
|
372
|
+
assert_equal("FS_200", t.atoms[6].name)
|
373
|
+
assert_equal("Equivalent cell No.06: Original -> Axis 'a' inversed.; Rough translation: ( 0.00000, 0.00000, 0.00000), 0th atom of frame to FS_000; Precise translation: ( 0.00000, 0.00000, 0.00000)\n", t.comment)
|
374
|
+
|
375
|
+
|
376
|
+
# a,b軸交換したもの。
|
377
|
+
cell = @fic00.exchange_axes([0,1])
|
378
|
+
assert_equal(Mageo::Vector3DInternal[0.12, 0.10, 0.10], cell.atoms[3].position)
|
379
|
+
#
|
380
|
+
t = cell.optimized_cell(@frame_sites, io)
|
381
|
+
assert_equal(FrameInterstitialCell, t.class)
|
382
|
+
assert_equal(8, t.atoms.size)
|
383
|
+
assert_equal(Mageo::Vector3DInternal[0.10, 0.10, 0.10], t.atoms[0].position)
|
384
|
+
assert_equal(Mageo::Vector3DInternal[0.10, 0.10, 0.11], t.atoms[1].position)
|
385
|
+
assert_equal(Mageo::Vector3DInternal[0.10, 0.10, 0.13], t.atoms[2].position)
|
386
|
+
assert_equal(Mageo::Vector3DInternal[0.10, 0.12, 0.10], t.atoms[3].position)
|
387
|
+
assert_equal(Mageo::Vector3DInternal[0.10, 0.16, 0.10], t.atoms[4].position)
|
388
|
+
assert_equal(Mageo::Vector3DInternal[0.13, 0.10, 0.10], t.atoms[5].position)
|
389
|
+
assert_equal(Mageo::Vector3DInternal[0.19, 0.10, 0.10], t.atoms[6].position)
|
390
|
+
assert_equal(Mageo::Vector3DInternal[0.50, 0.50, 0.30], t.atoms[7].position)
|
391
|
+
assert_equal("FS_000", t.atoms[0].name)
|
392
|
+
assert_equal("FS_001", t.atoms[1].name)
|
393
|
+
assert_equal("FS_002", t.atoms[2].name)
|
394
|
+
assert_equal("FS_010", t.atoms[3].name)
|
395
|
+
assert_equal("FS_020", t.atoms[4].name)
|
396
|
+
assert_equal("FS_100", t.atoms[5].name)
|
397
|
+
assert_equal("FS_200", t.atoms[6].name)
|
398
|
+
assert_equal("Equivalent cell No.03: Original -> Axes exchanged(a,b,c -> b,a,c).; Rough translation: ( 0.00000, 0.00000, 0.00000), 0th atom of frame to FS_000; Precise translation: ( 0.00000, 0.00000, 0.00000)\n", t.comment)
|
399
|
+
|
400
|
+
# 変位をまぜたもの。
|
401
|
+
lattice_axes = [[1.0, 1.0, 1.0], [0.0, 1.0, 1.0], [0.0, 0.0, 1.0]]
|
402
|
+
atoms = [
|
403
|
+
FrameAtom.new( 0, [0.1007, 0.1007, 0.1007]),
|
404
|
+
FrameAtom.new( 0, [0.1000, 0.1000, 0.1100]),
|
405
|
+
FrameAtom.new( 0, [0.1000, 0.1000, 0.1300]),
|
406
|
+
FrameAtom.new( 0, [0.1000, 0.1200, 0.1000]),
|
407
|
+
FrameAtom.new( 0, [0.1000, 0.1600, 0.1000]),
|
408
|
+
FrameAtom.new( 0, [0.1300, 0.1000, 0.1000]),
|
409
|
+
FrameAtom.new( 0, [0.1900, 0.1000, 0.1000]),
|
410
|
+
InterstitialAtom.new(1, [0.5000, 0.5000, 0.3000]),
|
411
|
+
]
|
412
|
+
cell = FrameInterstitialCell.new(lattice_axes, atoms)
|
413
|
+
assert_equal(Mageo::Vector3DInternal[0.1007, 0.1007, 0.1007], cell.atoms[0].position)
|
414
|
+
#
|
415
|
+
t = cell.optimized_cell(@frame_sites, io)
|
416
|
+
assert_equal(FrameInterstitialCell, t.class)
|
417
|
+
assert_equal(
|
418
|
+
CrystalCell::LatticeAxes.new([[1.0, 1.0, 1.0], [0.0, 1.0, 1.0], [0.0, 0.0, 1.0]]),
|
419
|
+
t.axes
|
420
|
+
)
|
421
|
+
assert_equal(8, t.atoms.size)
|
422
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[0].position.class)
|
423
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[1].position.class)
|
424
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[2].position.class)
|
425
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[3].position.class)
|
426
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[4].position.class)
|
427
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[5].position.class)
|
428
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[6].position.class)
|
429
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[7].position.class)
|
430
|
+
assert_in_delta(0.1006, t.atoms[0].position[0], $tolerance)
|
431
|
+
assert_in_delta(0.0999, t.atoms[1].position[0], $tolerance)
|
432
|
+
assert_in_delta(0.0999, t.atoms[2].position[0], $tolerance)
|
433
|
+
assert_in_delta(0.0999, t.atoms[3].position[0], $tolerance)
|
434
|
+
assert_in_delta(0.0999, t.atoms[4].position[0], $tolerance)
|
435
|
+
assert_in_delta(0.1299, t.atoms[5].position[0], $tolerance)
|
436
|
+
assert_in_delta(0.1899, t.atoms[6].position[0], $tolerance)
|
437
|
+
assert_in_delta(0.4999, t.atoms[7].position[0], $tolerance)
|
438
|
+
assert_in_delta(0.1006, t.atoms[0].position[1], $tolerance)
|
439
|
+
assert_in_delta(0.0999, t.atoms[1].position[1], $tolerance)
|
440
|
+
assert_in_delta(0.0999, t.atoms[2].position[1], $tolerance)
|
441
|
+
assert_in_delta(0.1199, t.atoms[3].position[1], $tolerance)
|
442
|
+
assert_in_delta(0.1599, t.atoms[4].position[1], $tolerance)
|
443
|
+
assert_in_delta(0.0999, t.atoms[5].position[1], $tolerance)
|
444
|
+
assert_in_delta(0.0999, t.atoms[6].position[1], $tolerance)
|
445
|
+
assert_in_delta(0.4999, t.atoms[7].position[1], $tolerance)
|
446
|
+
assert_in_delta(0.1006, t.atoms[0].position[2], $tolerance)
|
447
|
+
assert_in_delta(0.1099, t.atoms[1].position[2], $tolerance)
|
448
|
+
assert_in_delta(0.1299, t.atoms[2].position[2], $tolerance)
|
449
|
+
assert_in_delta(0.0999, t.atoms[3].position[2], $tolerance)
|
450
|
+
assert_in_delta(0.0999, t.atoms[4].position[2], $tolerance)
|
451
|
+
assert_in_delta(0.0999, t.atoms[5].position[2], $tolerance)
|
452
|
+
assert_in_delta(0.0999, t.atoms[6].position[2], $tolerance)
|
453
|
+
assert_in_delta(0.2999, t.atoms[7].position[2], $tolerance)
|
454
|
+
assert_equal("FS_000", t.atoms[0].name)
|
455
|
+
assert_equal("FS_001", t.atoms[1].name)
|
456
|
+
assert_equal("FS_002", t.atoms[2].name)
|
457
|
+
assert_equal("FS_010", t.atoms[3].name)
|
458
|
+
assert_equal("FS_020", t.atoms[4].name)
|
459
|
+
assert_equal("FS_100", t.atoms[5].name)
|
460
|
+
assert_equal("FS_200", t.atoms[6].name)
|
461
|
+
assert_equal("Equivalent cell No.00: Original.; Rough translation: (-0.00070, -0.00070, -0.00070), 0th atom of frame to FS_000; Precise translation: ( 0.00060, 0.00060, 0.00060)\n", t.comment)
|
462
|
+
|
463
|
+
# 複合的なもの。
|
464
|
+
lattice_axes = [[1.0, 1.0, 1.0], [0.0, 1.0, 1.0], [0.0, 0.0, 1.0]]
|
465
|
+
atoms = [
|
466
|
+
FrameAtom.new( 0, [0.1007, 0.1007, 0.1007]),
|
467
|
+
FrameAtom.new( 0, [0.1000, 0.1000, 0.1100]),
|
468
|
+
FrameAtom.new( 0, [0.1000, 0.1000, 0.1300]),
|
469
|
+
FrameAtom.new( 0, [0.1000, 0.1200, 0.1000]),
|
470
|
+
FrameAtom.new( 0, [0.1000, 0.1600, 0.1000]),
|
471
|
+
FrameAtom.new( 0, [0.1300, 0.1000, 0.1000]),
|
472
|
+
FrameAtom.new( 0, [0.1900, 0.1000, 0.1000]),
|
473
|
+
InterstitialAtom.new(1, [0.5000, 0.5000, 0.3000]),
|
474
|
+
]
|
475
|
+
cell = FrameInterstitialCell.new(lattice_axes, atoms)
|
476
|
+
cell.translate!(Mageo::Vector3DInternal[0.85, 0.85, 0.85])
|
477
|
+
cell.inverse_axis!(0)
|
478
|
+
cell.exchange_axes!([0,1])
|
479
|
+
#
|
480
|
+
assert_equal(Mageo::Vector3DInternal, cell.atoms[6].position.class)
|
481
|
+
assert_in_delta( 0.9500, cell.atoms[6].position[0], $tolerance)
|
482
|
+
assert_in_delta(-1.0400, cell.atoms[6].position[1], $tolerance)
|
483
|
+
assert_in_delta( 0.9500, cell.atoms[6].position[2], $tolerance)
|
484
|
+
#
|
485
|
+
t = cell.optimized_cell(@frame_sites, io)
|
486
|
+
assert_equal(FrameInterstitialCell, t.class)
|
487
|
+
assert_equal(CrystalCell::LatticeAxes, t.axes.class)
|
488
|
+
assert_in_delta(1.0, t.axes[0][0], $tolerance)
|
489
|
+
assert_in_delta(1.0, t.axes[0][1], $tolerance)
|
490
|
+
assert_in_delta(1.0, t.axes[0][2], $tolerance)
|
491
|
+
assert_in_delta(0.0, t.axes[1][0], $tolerance)
|
492
|
+
assert_in_delta(1.0, t.axes[1][1], $tolerance)
|
493
|
+
assert_in_delta(1.0, t.axes[1][2], $tolerance)
|
494
|
+
assert_in_delta(0.0, t.axes[2][0], $tolerance)
|
495
|
+
assert_in_delta(0.0, t.axes[2][1], $tolerance)
|
496
|
+
assert_in_delta(1.0, t.axes[2][2], $tolerance)
|
497
|
+
assert_equal(8, t.atoms.size)
|
498
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[0].position.class)
|
499
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[1].position.class)
|
500
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[2].position.class)
|
501
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[3].position.class)
|
502
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[4].position.class)
|
503
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[5].position.class)
|
504
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[6].position.class)
|
505
|
+
assert_equal(Mageo::Vector3DInternal, t.atoms[7].position.class)
|
506
|
+
assert_in_delta(0.1006, t.atoms[0].position[0], $tolerance)
|
507
|
+
assert_in_delta(0.0999, t.atoms[1].position[0], $tolerance)
|
508
|
+
assert_in_delta(0.0999, t.atoms[2].position[0], $tolerance)
|
509
|
+
assert_in_delta(0.0999, t.atoms[3].position[0], $tolerance)
|
510
|
+
assert_in_delta(0.0999, t.atoms[4].position[0], $tolerance)
|
511
|
+
assert_in_delta(0.1299, t.atoms[5].position[0], $tolerance)
|
512
|
+
assert_in_delta(0.1899, t.atoms[6].position[0], $tolerance)
|
513
|
+
assert_in_delta(0.4999, t.atoms[7].position[0], $tolerance)
|
514
|
+
assert_in_delta(0.1006, t.atoms[0].position[1], $tolerance)
|
515
|
+
assert_in_delta(0.0999, t.atoms[1].position[1], $tolerance)
|
516
|
+
assert_in_delta(0.0999, t.atoms[2].position[1], $tolerance)
|
517
|
+
assert_in_delta(0.1199, t.atoms[3].position[1], $tolerance)
|
518
|
+
assert_in_delta(0.1599, t.atoms[4].position[1], $tolerance)
|
519
|
+
assert_in_delta(0.0999, t.atoms[5].position[1], $tolerance)
|
520
|
+
assert_in_delta(0.0999, t.atoms[6].position[1], $tolerance)
|
521
|
+
assert_in_delta(0.4999, t.atoms[7].position[1], $tolerance)
|
522
|
+
assert_in_delta(0.1006, t.atoms[0].position[2], $tolerance)
|
523
|
+
assert_in_delta(0.1099, t.atoms[1].position[2], $tolerance)
|
524
|
+
assert_in_delta(0.1299, t.atoms[2].position[2], $tolerance)
|
525
|
+
assert_in_delta(0.0999, t.atoms[3].position[2], $tolerance)
|
526
|
+
assert_in_delta(0.0999, t.atoms[4].position[2], $tolerance)
|
527
|
+
assert_in_delta(0.0999, t.atoms[5].position[2], $tolerance)
|
528
|
+
assert_in_delta(0.0999, t.atoms[6].position[2], $tolerance)
|
529
|
+
assert_in_delta(0.2999, t.atoms[7].position[2], $tolerance)
|
530
|
+
assert_equal("FS_000", t.atoms[0].name)
|
531
|
+
assert_equal("FS_001", t.atoms[1].name)
|
532
|
+
assert_equal("FS_002", t.atoms[2].name)
|
533
|
+
assert_equal("FS_010", t.atoms[3].name)
|
534
|
+
assert_equal("FS_020", t.atoms[4].name)
|
535
|
+
assert_equal("FS_100", t.atoms[5].name)
|
536
|
+
assert_equal("FS_200", t.atoms[6].name)
|
537
|
+
assert_equal("Equivalent cell No.09: Original -> Axes exchanged(a,b,c -> b,a,c) -> Axis 'a' inversed.; Rough translation: (-0.85070, -0.85070, -0.85070), 0th atom of frame to FS_000; Precise translation: ( 0.00060, 0.00060, 0.00060)\n", t.comment)
|
538
|
+
|
539
|
+
end
|
540
|
+
|
541
|
+
def test_frame_atoms
|
542
|
+
assert_equal(
|
543
|
+
[
|
544
|
+
FrameAtom.new( 0, [0.10, 0.10, 0.10]),
|
545
|
+
FrameAtom.new( 0, [0.10, 0.10, 0.11]),
|
546
|
+
FrameAtom.new( 0, [0.10, 0.10, 0.13]),
|
547
|
+
FrameAtom.new( 0, [0.10, 0.12, 0.10]),
|
548
|
+
FrameAtom.new( 0, [0.10, 0.16, 0.10]),
|
549
|
+
FrameAtom.new( 0, [0.13, 0.10, 0.10]),
|
550
|
+
FrameAtom.new( 0, [0.19, 0.10, 0.10]),
|
551
|
+
],
|
552
|
+
@fic00.frame_atoms
|
553
|
+
)
|
554
|
+
end
|
555
|
+
|
556
|
+
def test_interstitial_atoms
|
557
|
+
assert_equal(
|
558
|
+
[
|
559
|
+
InterstitialAtom.new(1, [0.50, 0.50, 0.30]),
|
560
|
+
],
|
561
|
+
@fic00.interstitial_atoms
|
562
|
+
)
|
563
|
+
end
|
564
|
+
|
565
|
+
def test_frame_cell
|
566
|
+
t = @fic00.frame_cell
|
567
|
+
assert_equal(FrameInterstitialCell, t.class)
|
568
|
+
assert_equal(CrystalCell::LatticeAxes, t.axes.class)
|
569
|
+
assert_in_delta(1.0, t.axes[0][0], $tolerance)
|
570
|
+
assert_in_delta(1.0, t.axes[0][1], $tolerance)
|
571
|
+
assert_in_delta(1.0, t.axes[0][2], $tolerance)
|
572
|
+
assert_in_delta(0.0, t.axes[1][0], $tolerance)
|
573
|
+
assert_in_delta(1.0, t.axes[1][1], $tolerance)
|
574
|
+
assert_in_delta(1.0, t.axes[1][2], $tolerance)
|
575
|
+
assert_in_delta(0.0, t.axes[2][0], $tolerance)
|
576
|
+
assert_in_delta(0.0, t.axes[2][1], $tolerance)
|
577
|
+
assert_in_delta(1.0, t.axes[2][2], $tolerance)
|
578
|
+
assert_equal(7, t.atoms.size)
|
579
|
+
assert_equal(FrameAtom.new(0, [0.10, 0.10, 0.10]), t.atoms[0])
|
580
|
+
assert_equal(FrameAtom.new(0, [0.10, 0.10, 0.11]), t.atoms[1])
|
581
|
+
assert_equal(FrameAtom.new(0, [0.10, 0.10, 0.13]), t.atoms[2])
|
582
|
+
assert_equal(FrameAtom.new(0, [0.10, 0.12, 0.10]), t.atoms[3])
|
583
|
+
assert_equal(FrameAtom.new(0, [0.10, 0.16, 0.10]), t.atoms[4])
|
584
|
+
assert_equal(FrameAtom.new(0, [0.13, 0.10, 0.10]), t.atoms[5])
|
585
|
+
assert_equal(FrameAtom.new(0, [0.19, 0.10, 0.10]), t.atoms[6])
|
586
|
+
end
|
587
|
+
|
588
|
+
def test_interstitial_cell
|
589
|
+
t = @fic00.interstitial_cell
|
590
|
+
assert_equal(FrameInterstitialCell, t.class)
|
591
|
+
assert_equal(CrystalCell::LatticeAxes, t.axes.class)
|
592
|
+
assert_in_delta(1.0, t.axes[0][0], $tolerance)
|
593
|
+
assert_in_delta(1.0, t.axes[0][1], $tolerance)
|
594
|
+
assert_in_delta(1.0, t.axes[0][2], $tolerance)
|
595
|
+
assert_in_delta(0.0, t.axes[1][0], $tolerance)
|
596
|
+
assert_in_delta(1.0, t.axes[1][1], $tolerance)
|
597
|
+
assert_in_delta(1.0, t.axes[1][2], $tolerance)
|
598
|
+
assert_in_delta(0.0, t.axes[2][0], $tolerance)
|
599
|
+
assert_in_delta(0.0, t.axes[2][1], $tolerance)
|
600
|
+
assert_in_delta(1.0, t.axes[2][2], $tolerance)
|
601
|
+
assert_equal(1, t.atoms.size)
|
602
|
+
assert_equal(
|
603
|
+
InterstitialAtom.new(1, [0.50, 0.50, 0.30]),
|
604
|
+
t.atoms[0]
|
605
|
+
)
|
606
|
+
end
|
607
|
+
|
608
|
+
def test_elements_names
|
609
|
+
atoms = [
|
610
|
+
FrameAtom.new( 0, [0.00, 0.00, 0.00], "A00"),
|
611
|
+
InterstitialAtom.new(0, [0.50, 0.50, 0.50], "A01"),
|
612
|
+
InterstitialAtom.new(1, [0.10, 0.10, 0.10], "A02"),
|
613
|
+
InterstitialAtom.new(2, [0.90, 0.90, 0.90], "A03"),
|
614
|
+
InterstitialAtom.new(3, [0.01, 0.01, 0.01], "A04"),
|
615
|
+
InterstitialAtom.new(3, [0.90, 0.01, 0.01], "A05"),
|
616
|
+
InterstitialAtom.new(3, [0.01, 0.90, 0.01], "A06"),
|
617
|
+
InterstitialAtom.new(3, [0.01, 0.01, 0.90], "A07"),
|
618
|
+
InterstitialAtom.new(4, [0.99, 0.99, 0.99], "A08"),
|
619
|
+
InterstitialAtom.new(4, [0.10, 0.99, 0.99], "A09"),
|
620
|
+
InterstitialAtom.new(4, [0.99, 0.10, 0.99], "A10"),
|
621
|
+
InterstitialAtom.new(4, [0.99, 0.99, 0.10], "A11"),
|
622
|
+
InterstitialAtom.new(5, [0.99, 0.10, 0.10], "A17"),
|
623
|
+
InterstitialAtom.new(5, [0.10, 0.99, 0.10], "A16"),
|
624
|
+
InterstitialAtom.new(5, [0.10, 0.10, 0.99], "A15"),
|
625
|
+
InterstitialAtom.new(5, [0.01, 0.90, 0.90], "A14"),
|
626
|
+
InterstitialAtom.new(5, [0.90, 0.01, 0.90], "A13"),
|
627
|
+
InterstitialAtom.new(5, [0.90, 0.90, 0.01], "A12"),
|
628
|
+
]
|
629
|
+
fic = FrameInterstitialCell.new(@lattice_axes, atoms)
|
630
|
+
t = fic.elements_names
|
631
|
+
correct = {
|
632
|
+
0 => ["A00", "A01"],
|
633
|
+
1 => ["A02"],
|
634
|
+
2 => ["A03"],
|
635
|
+
3 => ["A04", "A05", "A06", "A07"],
|
636
|
+
4 => ["A08", "A09", "A10", "A11"],
|
637
|
+
5 => ["A12", "A13", "A14", "A15", "A16", "A17"],
|
638
|
+
}
|
639
|
+
assert_equal(correct, t)
|
640
|
+
end
|
641
|
+
|
642
|
+
|
643
|
+
# def test_site_name
|
644
|
+
# # 体心
|
645
|
+
# sitenames_positions = {
|
646
|
+
# "FS_00" => [0.5, 0.5, 0.5],
|
647
|
+
# "FS_01" => [0.0, 0.0, 0.0],
|
648
|
+
# }
|
649
|
+
# log_io = StringIO.new
|
650
|
+
# @fic02 = FrameInterstitialCell.new(@la)
|
651
|
+
#
|
652
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[0.51, 0.51, 0.51], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
653
|
+
# assert_equal("Te_00", t)
|
654
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[0.40, 0.51, 0.51], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
655
|
+
# assert_equal("Te_00", t)
|
656
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[0.51, 0.40, 0.51], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
657
|
+
# assert_equal("Te_00", t)
|
658
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[0.51, 0.51, 0.40], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
659
|
+
# assert_equal("Te_00", t)
|
660
|
+
#
|
661
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[0.49, 0.49, 0.49], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
662
|
+
# assert_equal("Te_01", t)
|
663
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[0.60, 0.49, 0.49], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
664
|
+
# assert_equal("Te_01", t)
|
665
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[0.49, 0.60, 0.49], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
666
|
+
# assert_equal("Te_01", t)
|
667
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[0.49, 0.49, 0.60], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
668
|
+
# assert_equal("Te_01", t)
|
669
|
+
#
|
670
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[0.49, 0.60, 0.60], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
671
|
+
# assert_equal("Oc_00", t)
|
672
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[0.60, 0.49, 0.60], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
673
|
+
# assert_equal("Oc_00", t)
|
674
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[0.60, 0.60, 0.49], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
675
|
+
# assert_equal("Oc_00", t)
|
676
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[0.51, 0.40, 0.40], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
677
|
+
# assert_equal("Oc_00", t)
|
678
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[0.40, 0.51, 0.40], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
679
|
+
# assert_equal("Oc_00", t)
|
680
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[0.40, 0.40, 0.51], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
681
|
+
# assert_equal("Oc_00", t)
|
682
|
+
#
|
683
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[0.50, 0.50, 0.50], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
684
|
+
# assert_equal("border: Oc_00 Te_00 Te_01", t)
|
685
|
+
#
|
686
|
+
# # 内側移動テスト
|
687
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[9.51, 0.51, 0.51], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
688
|
+
# assert_equal("Te_00", t)
|
689
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[1.51, 0.51, 0.51], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
690
|
+
# assert_equal("Te_00", t)
|
691
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[0.51, 1.51, 0.51], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
692
|
+
# assert_equal("Te_00", t)
|
693
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[0.51, 0.51, 1.51], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
694
|
+
# assert_equal("Te_00", t)
|
695
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[-0.49, 0.51, 0.51], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
696
|
+
# assert_equal("Te_00", t)
|
697
|
+
# t = @fic02.site_name(Mageo::Vector3DInternal[-9.49, 0.51, 0.51], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
698
|
+
# assert_equal("Te_00", t)
|
699
|
+
#
|
700
|
+
# # border test
|
701
|
+
# sitenames_positions = { "FS_00" => Mageo::Vector3DInternal[0.0, 0.0, 0.0] }
|
702
|
+
# t = @fic03.site_name(Mageo::Vector3DInternal[0.30, 0.30, 0.00], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
703
|
+
# assert_equal("border: Oc_00 Te_00", t)
|
704
|
+
#
|
705
|
+
# sitenames_positions = { "FS_00" => Mageo::Vector3DInternal[0.0, 0.0, 0.0] }
|
706
|
+
# t = @fic03.site_name(Mageo::Vector3DInternal[0.30, 0.30, 0.00], sitenames_positions, @oc_sites00, @te_sites00, $tolerance, log_io)
|
707
|
+
# assert_equal("border: Oc_00 Te_00", t)
|
708
|
+
#
|
709
|
+
# end
|
710
|
+
|
711
|
+
def test_equivalent_cells
|
712
|
+
# テストは全数ではなく、抽出で行う。
|
713
|
+
# 0 交換なし
|
714
|
+
# 1 順序保存(b,c,a)
|
715
|
+
# 3 順序非保存(b,a,c)
|
716
|
+
# 6 c反転
|
717
|
+
# 12 b反転
|
718
|
+
# 24 a反転
|
719
|
+
# 47 順序非保存(c,b,a)+c反転 + b反転 + a反転
|
720
|
+
#
|
721
|
+
lattice_axes = [ [2.0, 2.0, 2.0], [0.0, 2.0, 2.0], [0.0, 0.0, 2.0] ]
|
722
|
+
atoms = [
|
723
|
+
FrameAtom.new( 0, [0.0, 0.0, 0.0] ),
|
724
|
+
InterstitialAtom.new( 1, [0.1, 0.2, 0.3] ),
|
725
|
+
]
|
726
|
+
fic = FrameInterstitialCell.new(lattice_axes , atoms)
|
727
|
+
fic.comment = 'c01'
|
728
|
+
|
729
|
+
t = fic.equivalent_cells
|
730
|
+
assert_equal(48, t.size)
|
731
|
+
|
732
|
+
cell = t[0]
|
733
|
+
assert_equal("Equivalent cell No.00: Original.", cell.comment)
|
734
|
+
lc = cell.axes.get_lattice_constants
|
735
|
+
assert_in_delta(2.0 * Math::sqrt(3.0), lc[0], $tolerance)
|
736
|
+
assert_in_delta(2.0 * Math::sqrt(2.0), lc[1], $tolerance)
|
737
|
+
assert_in_delta(2.0 , lc[2], $tolerance)
|
738
|
+
assert_in_delta(45.0000000000000 , lc[3], $tolerance)
|
739
|
+
assert_in_delta(54.7356103172453 , lc[4], $tolerance)
|
740
|
+
assert_in_delta(35.2643896827547 , lc[5], $tolerance)
|
741
|
+
assert_equal(true, cell.axes.righthand?)
|
742
|
+
assert_equal(Mageo::Vector3DInternal[0.1, 0.2, 0.3], cell.atoms[1].position)
|
743
|
+
|
744
|
+
cell = t[ 1]
|
745
|
+
assert_equal("Equivalent cell No.01: Original -> Axes exchanged(a,b,c -> b,c,a).", cell.comment)
|
746
|
+
lc = cell.axes.get_lattice_constants
|
747
|
+
assert_in_delta(2.0 * Math::sqrt(2.0) , lc[0], $tolerance)
|
748
|
+
assert_in_delta(2.0 , lc[1], $tolerance)
|
749
|
+
assert_in_delta(2.0 * Math::sqrt(3.0) , lc[2], $tolerance)
|
750
|
+
assert_in_delta(54.7356103172453 , lc[3], $tolerance)
|
751
|
+
assert_in_delta(35.2643896827547 , lc[4], $tolerance)
|
752
|
+
assert_in_delta(45.0000000000000 , lc[5], $tolerance)
|
753
|
+
assert_equal(true, cell.axes.righthand?)
|
754
|
+
assert_equal(Mageo::Vector3DInternal[0.2, 0.3, 0.1], cell.atoms[1].position)
|
755
|
+
|
756
|
+
cell = t[ 3]
|
757
|
+
assert_equal("Equivalent cell No.03: Original -> Axes exchanged(a,b,c -> b,a,c).", cell.comment)
|
758
|
+
lc = cell.axes.get_lattice_constants
|
759
|
+
assert_in_delta(2.0 * Math::sqrt(2.0) , lc[0], $tolerance)
|
760
|
+
assert_in_delta(2.0 * Math::sqrt(3.0) , lc[1], $tolerance)
|
761
|
+
assert_in_delta(2.0 , lc[2], $tolerance)
|
762
|
+
assert_in_delta(54.7356103172453 , lc[3], $tolerance)
|
763
|
+
assert_in_delta(45.0000000000000 , lc[4], $tolerance)
|
764
|
+
assert_in_delta(35.2643896827547 , lc[5], $tolerance)
|
765
|
+
assert_equal(true, cell.axes.lefthand?)
|
766
|
+
assert_equal(Mageo::Vector3DInternal[0.2, 0.1, 0.3], cell.atoms[1].position)
|
767
|
+
|
768
|
+
cell = t[ 6]
|
769
|
+
assert_equal("Equivalent cell No.06: Original -> Axis 'a' inversed.", cell.comment)
|
770
|
+
lc = cell.axes.get_lattice_constants
|
771
|
+
assert_in_delta(2.0 * Math::sqrt(3.0) , lc[0], $tolerance)
|
772
|
+
assert_in_delta(2.0 * Math::sqrt(2.0) , lc[1], $tolerance)
|
773
|
+
assert_in_delta(2.0 , lc[2], $tolerance)
|
774
|
+
assert_in_delta( 45.0000000000000, lc[3], $tolerance)
|
775
|
+
assert_in_delta(180.0-54.7356103172453, lc[4], $tolerance)
|
776
|
+
assert_in_delta(180.0-35.2643896827547, lc[5], $tolerance)
|
777
|
+
assert_equal(true, cell.axes.lefthand?)
|
778
|
+
assert_equal(Mageo::Vector3DInternal[-0.1, 0.2, 0.3], cell.atoms[1].position)
|
779
|
+
|
780
|
+
cell = t[12]
|
781
|
+
assert_equal("Equivalent cell No.12: Original -> Axis 'b' inversed.", cell.comment)
|
782
|
+
lc = cell.axes.get_lattice_constants
|
783
|
+
assert_in_delta(2.0 * Math::sqrt(3.0) , lc[0], $tolerance)
|
784
|
+
assert_in_delta(2.0 * Math::sqrt(2.0) , lc[1], $tolerance)
|
785
|
+
assert_in_delta(2.0 , lc[2], $tolerance)
|
786
|
+
assert_in_delta(180.0-45.0000000000000, lc[3], $tolerance)
|
787
|
+
assert_in_delta( 54.7356103172453, lc[4], $tolerance)
|
788
|
+
assert_in_delta(180.0-35.2643896827547, lc[5], $tolerance)
|
789
|
+
assert_equal(true, cell.axes.lefthand?)
|
790
|
+
assert_equal(Mageo::Vector3DInternal[0.1,-0.2, 0.3], cell.atoms[1].position)
|
791
|
+
|
792
|
+
cell = t[24]
|
793
|
+
assert_equal("Equivalent cell No.24: Original -> Axis 'c' inversed.", cell.comment)
|
794
|
+
lc = cell.axes.get_lattice_constants
|
795
|
+
assert_in_delta(2.0 * Math::sqrt(3.0) , lc[0], $tolerance)
|
796
|
+
assert_in_delta(2.0 * Math::sqrt(2.0) , lc[1], $tolerance)
|
797
|
+
assert_in_delta(2.0 , lc[2], $tolerance)
|
798
|
+
assert_in_delta(180.0-45.0000000000000, lc[3], $tolerance)
|
799
|
+
assert_in_delta(180.0-54.7356103172453, lc[4], $tolerance)
|
800
|
+
assert_in_delta( 35.2643896827547, lc[5], $tolerance)
|
801
|
+
assert_equal(true, cell.axes.lefthand?)
|
802
|
+
assert_equal(Mageo::Vector3DInternal[0.1, 0.2,-0.3], cell.atoms[1].position)
|
803
|
+
|
804
|
+
cell = t[47]
|
805
|
+
assert_equal("Equivalent cell No.47: Original -> Axes exchanged(a,b,c -> c,b,a) -> Axis 'a' inversed -> Axis 'b' inversed -> Axis 'c' inversed.", cell.comment)
|
806
|
+
lc = cell.axes.get_lattice_constants
|
807
|
+
assert_in_delta(2.0 , lc[0], $tolerance)
|
808
|
+
assert_in_delta(2.0 * Math::sqrt(2.0), lc[1], $tolerance)
|
809
|
+
assert_in_delta(2.0 * Math::sqrt(3.0), lc[2], $tolerance)
|
810
|
+
assert_in_delta(35.2643896827547 , lc[3], $tolerance)
|
811
|
+
assert_in_delta(54.7356103172453 , lc[4], $tolerance)
|
812
|
+
assert_in_delta(45.0000000000000 , lc[5], $tolerance)
|
813
|
+
assert_equal(false, cell.axes.lefthand?)
|
814
|
+
assert_equal(Mageo::Vector3DInternal[-0.3,-0.2, -0.1], cell.atoms[1].position)
|
815
|
+
end
|
816
|
+
end
|
817
|
+
|
818
|
+
class TC_CrystalCell_Cell < Test::Unit::TestCase
|
819
|
+
$tolerance = 10 ** (-10)
|
820
|
+
|
821
|
+
def test_to_ficell
|
822
|
+
atoms = [
|
823
|
+
CrystalCell::Atom.new( 'Li', [ 1.2, 3.4, 5.6], "atom0", [ false, false, true] ),
|
824
|
+
CrystalCell::Atom.new( 'O' , [-1.2, -3.4, -5.6] ),
|
825
|
+
]
|
826
|
+
c08 = CrystalCell::Cell.new([[2.0, 2.0, 2.0], [0.0, 2.0, 2.0], [0.0, 0.0, 2.0]], atoms)
|
827
|
+
c08.comment = 'c08'
|
828
|
+
#
|
829
|
+
t = c08.to_ficell([1])
|
830
|
+
assert_equal( FrameInterstitialCell, t.class )
|
831
|
+
assert_equal( CrystalCell::LatticeAxes, t.axes.class )
|
832
|
+
assert_in_delta( 2.0, t.axes[0][0], $tolerance )
|
833
|
+
assert_in_delta( 2.0, t.axes[0][1], $tolerance )
|
834
|
+
assert_in_delta( 2.0, t.axes[0][2], $tolerance )
|
835
|
+
assert_in_delta( 0.0, t.axes[1][0], $tolerance )
|
836
|
+
assert_in_delta( 2.0, t.axes[1][1], $tolerance )
|
837
|
+
assert_in_delta( 2.0, t.axes[1][2], $tolerance )
|
838
|
+
assert_in_delta( 0.0, t.axes[2][0], $tolerance )
|
839
|
+
assert_in_delta( 0.0, t.axes[2][1], $tolerance )
|
840
|
+
assert_in_delta( 2.0, t.axes[2][2], $tolerance )
|
841
|
+
#
|
842
|
+
assert_equal( 2, t.atoms.size)
|
843
|
+
assert_equal( InterstitialAtom, t.atoms[0].class )
|
844
|
+
assert_equal( FrameAtom , t.atoms[1].class )
|
845
|
+
assert_in_delta( 1.2, t.atoms[0].position[0], $tolerance )
|
846
|
+
assert_in_delta( 3.4, t.atoms[0].position[1], $tolerance )
|
847
|
+
assert_in_delta( 5.6, t.atoms[0].position[2], $tolerance )
|
848
|
+
assert_in_delta(-1.2, t.atoms[1].position[0], $tolerance )
|
849
|
+
assert_in_delta(-3.4, t.atoms[1].position[1], $tolerance )
|
850
|
+
assert_in_delta(-5.6, t.atoms[1].position[2], $tolerance )
|
851
|
+
#
|
852
|
+
assert_equal( "atom0", t.atoms[0].name )
|
853
|
+
assert_equal( nil , t.atoms[1].name )
|
854
|
+
#
|
855
|
+
assert_equal( [ false, false, true ], t.atoms[0].movable_flags )
|
856
|
+
assert_equal( nil, t.atoms[1].movable_flags )
|
857
|
+
#
|
858
|
+
assert_equal( "c08", t.comment )
|
859
|
+
|
860
|
+
atoms = [
|
861
|
+
CrystalCell::Atom.new( 'Li', [ 1.2, 3.4, 5.6], "atom0", [ false, false, true] ),
|
862
|
+
CrystalCell::Atom.new( 'O' , [-1.2, -3.4, -5.6] ),
|
863
|
+
]
|
864
|
+
c08 = CrystalCell::Cell.new([[2.0, 2.0, 2.0], [0.0, 2.0, 2.0], [0.0, 0.0, 2.0]], atoms)
|
865
|
+
c08.comment = 'c08'
|
866
|
+
#
|
867
|
+
t = c08.to_ficell([])
|
868
|
+
assert_equal( FrameInterstitialCell, t.class )
|
869
|
+
assert_equal( CrystalCell::LatticeAxes, t.axes.class )
|
870
|
+
assert_in_delta( 2.0, t.axes[0][0], $tolerance )
|
871
|
+
assert_in_delta( 2.0, t.axes[0][1], $tolerance )
|
872
|
+
assert_in_delta( 2.0, t.axes[0][2], $tolerance )
|
873
|
+
assert_in_delta( 0.0, t.axes[1][0], $tolerance )
|
874
|
+
assert_in_delta( 2.0, t.axes[1][1], $tolerance )
|
875
|
+
assert_in_delta( 2.0, t.axes[1][2], $tolerance )
|
876
|
+
assert_in_delta( 0.0, t.axes[2][0], $tolerance )
|
877
|
+
assert_in_delta( 0.0, t.axes[2][1], $tolerance )
|
878
|
+
assert_in_delta( 2.0, t.axes[2][2], $tolerance )
|
879
|
+
#
|
880
|
+
assert_equal( 2, t.atoms.size)
|
881
|
+
assert_equal( InterstitialAtom, t.atoms[0].class )
|
882
|
+
assert_equal( InterstitialAtom, t.atoms[1].class )
|
883
|
+
assert_in_delta( 1.2, t.atoms[0].position[0], $tolerance )
|
884
|
+
assert_in_delta( 3.4, t.atoms[0].position[1], $tolerance )
|
885
|
+
assert_in_delta( 5.6, t.atoms[0].position[2], $tolerance )
|
886
|
+
assert_in_delta(-1.2, t.atoms[1].position[0], $tolerance )
|
887
|
+
assert_in_delta(-3.4, t.atoms[1].position[1], $tolerance )
|
888
|
+
assert_in_delta(-5.6, t.atoms[1].position[2], $tolerance )
|
889
|
+
#
|
890
|
+
assert_equal( "atom0", t.atoms[0].name )
|
891
|
+
assert_equal( nil , t.atoms[1].name )
|
892
|
+
#
|
893
|
+
assert_equal( [ false, false, true ], t.atoms[0].movable_flags )
|
894
|
+
assert_equal( nil, t.atoms[1].movable_flags )
|
895
|
+
#
|
896
|
+
assert_equal( "c08", t.comment )
|
897
|
+
|
898
|
+
|
899
|
+
atoms = [
|
900
|
+
CrystalCell::Atom.new( 'Li', [ 1.2, 3.4, 5.6], "atom0", [ false, false, true] ),
|
901
|
+
CrystalCell::Atom.new( 'O' , [-1.2, -3.4, -5.6] ),
|
902
|
+
]
|
903
|
+
c08 = CrystalCell::Cell.new([[2.0, 2.0, 2.0], [0.0, 2.0, 2.0], [0.0, 0.0, 2.0]], atoms)
|
904
|
+
c08.comment = 'c08'
|
905
|
+
#
|
906
|
+
t = c08.to_ficell
|
907
|
+
assert_equal( FrameInterstitialCell, t.class )
|
908
|
+
assert_equal( CrystalCell::LatticeAxes, t.axes.class )
|
909
|
+
assert_in_delta( 2.0, t.axes[0][0], $tolerance )
|
910
|
+
assert_in_delta( 2.0, t.axes[0][1], $tolerance )
|
911
|
+
assert_in_delta( 2.0, t.axes[0][2], $tolerance )
|
912
|
+
assert_in_delta( 0.0, t.axes[1][0], $tolerance )
|
913
|
+
assert_in_delta( 2.0, t.axes[1][1], $tolerance )
|
914
|
+
assert_in_delta( 2.0, t.axes[1][2], $tolerance )
|
915
|
+
assert_in_delta( 0.0, t.axes[2][0], $tolerance )
|
916
|
+
assert_in_delta( 0.0, t.axes[2][1], $tolerance )
|
917
|
+
assert_in_delta( 2.0, t.axes[2][2], $tolerance )
|
918
|
+
#
|
919
|
+
assert_equal( 2, t.atoms.size)
|
920
|
+
assert_equal( FrameAtom, t.atoms[0].class )
|
921
|
+
assert_equal( FrameAtom, t.atoms[1].class )
|
922
|
+
assert_in_delta( 1.2, t.atoms[0].position[0], $tolerance )
|
923
|
+
assert_in_delta( 3.4, t.atoms[0].position[1], $tolerance )
|
924
|
+
assert_in_delta( 5.6, t.atoms[0].position[2], $tolerance )
|
925
|
+
assert_in_delta(-1.2, t.atoms[1].position[0], $tolerance )
|
926
|
+
assert_in_delta(-3.4, t.atoms[1].position[1], $tolerance )
|
927
|
+
assert_in_delta(-5.6, t.atoms[1].position[2], $tolerance )
|
928
|
+
#
|
929
|
+
assert_equal( "atom0", t.atoms[0].name )
|
930
|
+
assert_equal( nil , t.atoms[1].name )
|
931
|
+
#
|
932
|
+
assert_equal( [ false, false, true ], t.atoms[0].movable_flags )
|
933
|
+
assert_equal( nil, t.atoms[1].movable_flags )
|
934
|
+
#
|
935
|
+
assert_equal( "c08", t.comment )
|
936
|
+
|
937
|
+
end
|
938
|
+
|
939
|
+
end
|