crystalcell 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db6d8120f97d6fa22fe9fe5095bb3f848a75e8ba
4
- data.tar.gz: 9aee254b92a6c89df45b3459bc30f35297a3c4b5
3
+ metadata.gz: 2ab1ca9023c434c254a2f47ef1daad5f5692399b
4
+ data.tar.gz: 81e12f4dea37190c62b377d1ffa01a4c79507872
5
5
  SHA512:
6
- metadata.gz: 3a5158acc279b9f2bfd7bca995e0584e9afb34ddbab6aa9e48ea9c1d3b4a868589b0c502679900d1f2869730b4b1cc2d0a2414ff81e24a683d689462ca8896b3
7
- data.tar.gz: 68a56c0ea4bf4eb2ee5f58a40727b4df5c9697ea0aad93cecf6a71c65193adcd5cff4713c9eaa0ff00f16409bd8f8fc81fa2e4ad22d868e0fc0b256a4ed5e3b9
6
+ metadata.gz: 9b69e9a69caaceb60f47e112fd371902436dda5b4af4c06beddb426b6b78b3fe746dcf23191ce11eec062f47977145a6451a0bbe8d4c50967ced6130b648d3a8
7
+ data.tar.gz: f3c9cfd9614fb65050c0c2ae04961e9a39ecaf50352f9ff5384473492dc8f9664190b534efa4c1e440a49c2ee89b329cb7447fb5bad0177144905866a30a83d3
data/CHANGES CHANGED
@@ -1,6 +1,11 @@
1
1
  = crystalcell Changelog
2
2
 
3
- == Master (for 0.0.5)
3
+ == Master (for 0.0.6)
4
+
5
+ == Version 0.0.5 [2016-05-09] released
6
+
7
+ * Add CrystalCell::Povray::Camera
8
+ * Delete meaningless codes
4
9
 
5
10
  == Version 0.0.4 [2016-03-11] released
6
11
  * LatticeAxes.axes is added.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
data/crystalcell.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: crystalcell 0.0.4 ruby lib
5
+ # stub: crystalcell 0.0.5 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "crystalcell"
9
- s.version = "0.0.4"
9
+ s.version = "0.0.5"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["ippei94da"]
14
- s.date = "2016-03-10"
14
+ s.date = "2016-05-09"
15
15
  s.description = "This gem provides Cell, LatticeAxes, Atom classes, and so on.\n And this provides simple treatment of a periodic boundary condition.\n "
16
16
  s.email = "ippei94da@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -34,6 +34,7 @@ Gem::Specification.new do |s|
34
34
  "lib/crystalcell/latticeaxes.rb",
35
35
  "lib/crystalcell/periodiccell.rb",
36
36
  "lib/crystalcell/povray.rb",
37
+ "lib/crystalcell/povray/camera.rb",
37
38
  "lib/crystalcell/povray/cell.rb",
38
39
  "lib/crystalcell/povray/cylinder.rb",
39
40
  "lib/crystalcell/povray/element.rb",
@@ -41,6 +42,7 @@ Gem::Specification.new do |s|
41
42
  "lib/crystalcell/povray/triangle.rb",
42
43
  "test/cif/ZrO2-25C.cif",
43
44
  "test/helper.rb",
45
+ "test/povray/test_camera.rb",
44
46
  "test/povray/test_cell.rb",
45
47
  "test/povray/test_element.rb",
46
48
  "test/test_atom.rb",
@@ -336,7 +336,7 @@ class CrystalCell::Cell
336
336
  end
337
337
  @axes = CrystalCell::LatticeAxes.new( axes )
338
338
 
339
- atoms = []
339
+ #atoms = []
340
340
  @atoms.each do |atom|
341
341
  position = []
342
342
  3.times do |i|
@@ -476,12 +476,12 @@ class CrystalCell::Cell
476
476
 
477
477
  #pp axes_t, poss, types, symprec, angle_tolerance
478
478
 
479
- spgnum, spg, hallnum, hall_symbol, t_mat, o_shift,
480
- rotations, translations, wyckoffs =
481
- #include Getspg
482
- #pp Getspg.methods.sort
483
- #Getspg::get_dataset(axes_t, poss, types, symprec, angle_tolerance)
484
- get_dataset(axes_t, poss, types, symprec, angle_tolerance)
479
+ #spgnum, spg, hallnum, hall_symbol, t_mat, o_shift,
480
+ #rotations, translations, wyckoffs =
481
+ # get_dataset(axes_t, poss, types, symprec, angle_tolerance)
482
+ dataset = get_dataset(axes_t, poss, types, symprec, angle_tolerance)
483
+ rotations = dataset[6]
484
+ translations = dataset[7]
485
485
 
486
486
  results = []
487
487
  rotations.size.times do |index|
@@ -244,12 +244,10 @@ class CrystalCell::PeriodicCell < CrystalCell::Cell
244
244
  return tmp
245
245
  end
246
246
 
247
- #undef center_of_atoms
248
-
249
247
  # superclass の inverse_axis! を行ったあと、
250
248
  # 原子の座標をセル内部に移す。
251
249
  def inverse_axis!( axis_id )
252
- result = Marshal.load( Marshal.dump( self ) )
250
+ #result = Marshal.load( Marshal.dump( self ) )
253
251
  super( axis_id )
254
252
  reset_positions_inside
255
253
  end
@@ -1,5 +1,6 @@
1
1
  module CrystalCell::Povray; end
2
2
 
3
+ require 'crystalcell/povray/camera.rb'
3
4
  require 'crystalcell/povray/cell.rb'
4
5
  require 'crystalcell/povray/cylinder.rb'
5
6
  require 'crystalcell/povray/element.rb'
@@ -0,0 +1,57 @@
1
+ #! /usr/bin/env ruby
2
+ # coding: utf-8
3
+
4
+ #
5
+ #
6
+ #
7
+ class CrystalCell::Povray::Camera
8
+ #
9
+ #camera { orthographic
10
+ # // orthographic // これを入れる場合は location の前に。
11
+ # location < 3.0, 3.0, 3.0 > // camera location
12
+ # look_at < 0.0, 0.0, 0.0 > // 注視点
13
+ # sky < 0.0, 0.0, 1.0 >
14
+ # right <-1.00, 0.0, 0.0 >
15
+ # up < 0.0, 1.0, 0.0 >
16
+ # angle 68 // カメラの水平方向の画角。左右合計の角度。
17
+ #}
18
+ #@orthographic = true
19
+ #@location = [ 3.0, 3.0, 3.0 ]
20
+ #@look_at = [ 0.0, 0.0, 0.0 ]
21
+ #@sky = [ 0.0, 0.0, 1.0 ]
22
+ #@right = [ -1.00, 0.0, 0.0 ]
23
+ #@up = [ 0.0, 1.0, 0.0 ]
24
+ #@angle = 68
25
+
26
+ attr_accessor :orthographic, :location, :look_at, :sky, :right, :up, :angle
27
+
28
+ def initialize(orthographic:, location:, look_at:, sky:, right:, up:, angle:,
29
+ additions: [])
30
+ @orthographic = orthographic
31
+ @location = location
32
+ @look_at = look_at
33
+ @sky = sky
34
+ @right = right
35
+ @up = up
36
+ @angle = angle
37
+ @additions = additions
38
+ end
39
+
40
+ def dump(io)
41
+ io.puts "camera {"
42
+ io.puts " orthographic" if @orthographic
43
+ io.printf(" location <%f, %f, %f >\n", *@location)
44
+ io.printf(" look_at <%f, %f, %f >\n", *@look_at)
45
+ io.printf(" sky <%f, %f, %f >\n", *@sky)
46
+ io.printf(" right <%f, %f, %f >\n", *@right)
47
+ io.printf(" up <%f, %f, %f >\n", *@up)
48
+ io.printf(" angle %f\n" , @angle)
49
+ io.puts "}"
50
+ @additions.each do |i|
51
+ io.puts i
52
+ end
53
+ end
54
+
55
+ end
56
+
57
+
@@ -0,0 +1,109 @@
1
+ #! /usr/bin/env ruby
2
+ # coding: utf-8
3
+
4
+ require "pp"
5
+ require "helper"
6
+ #require "test/unit"
7
+ #require "pkg/klass.rb"
8
+
9
+ class TC_Camera < Test::Unit::TestCase
10
+ def setup
11
+ @c00 = CrystalCell::Povray::Camera.new(
12
+ orthographic: true,
13
+ location: [ 3.0, 3.0, 3.0 ],
14
+ look_at: [ 0.0, 0.0, 0.0 ],
15
+ sky: [ 0.0, 0.0, 1.0 ],
16
+ right: [ -1.00, 0.0, 0.0 ],
17
+ up: [ 0.0, 1.0, 0.0 ],
18
+ angle: 68
19
+ )
20
+ end
21
+
22
+ def test_initialize
23
+ hash = {
24
+ orthographic: true,
25
+ location: [ 3.0, 3.0, 3.0 ],
26
+ look_at: [ 0.0, 0.0, 0.0 ],
27
+ sky: [ 0.0, 0.0, 1.0 ],
28
+ right: [ -1.00, 0.0, 0.0 ],
29
+ up: [ 0.0, 1.0, 0.0 ],
30
+ angle: 68
31
+ }
32
+ @c01 = CrystalCell::Povray::Camera.new(hash)
33
+ assert_equal( true , @c01.orthographic)
34
+ assert_equal( [ 3.0, 3.0, 3.0 ], @c01.location )
35
+ assert_equal( [ 0.0, 0.0, 0.0 ], @c01.look_at )
36
+ assert_equal( [ 0.0, 0.0, 1.0 ], @c01.sky )
37
+ assert_equal( [ -1.00, 0.0, 0.0 ], @c01.right )
38
+ assert_equal( [ 0.0, 1.0, 0.0 ], @c01.up )
39
+ assert_equal( 68 , @c01.angle )
40
+ end
41
+
42
+ def test_accessor
43
+ assert_equal( true , @c00.orthographic)
44
+ assert_equal( [ 3.0, 3.0, 3.0 ], @c00.location )
45
+ assert_equal( [ 0.0, 0.0, 0.0 ], @c00.look_at )
46
+ assert_equal( [ 0.0, 0.0, 1.0 ], @c00.sky )
47
+ assert_equal( [ -1.00, 0.0, 0.0 ], @c00.right )
48
+ assert_equal( [ 0.0, 1.0, 0.0 ], @c00.up )
49
+ assert_equal( 68 , @c00.angle )
50
+
51
+ @c00.orthographic = false
52
+ assert_equal( false , @c00.orthographic)
53
+ end
54
+
55
+ def test_additional
56
+ c10 = CrystalCell::Povray::Camera.new(
57
+ orthographic: true,
58
+ location: [ 3.0, 3.0, 3.0 ],
59
+ look_at: [ 0.0, 0.0, 0.0 ],
60
+ sky: [ 0.0, 0.0, 1.0 ],
61
+ right: [ -1.00, 0.0, 0.0 ],
62
+ up: [ 0.0, 1.0, 0.0 ],
63
+ angle: 68,
64
+ additions:[ "background {color rgb<1,1,1>}",
65
+ "light_source{ < 4, 1, 4 > color <1,1,1> parallel point_at 0 }",
66
+ "default{ texture{ finish{ ambient 0.4 phong 1.0 phong_size 10 } } }",
67
+ ]
68
+ )
69
+ correct = <<HERE
70
+ camera {
71
+ orthographic
72
+ location <3.000000, 3.000000, 3.000000 >
73
+ look_at <0.000000, 0.000000, 0.000000 >
74
+ sky <0.000000, 0.000000, 1.000000 >
75
+ right <-1.000000, 0.000000, 0.000000 >
76
+ up <0.000000, 1.000000, 0.000000 >
77
+ angle 68.000000
78
+ }
79
+ background {color rgb<1,1,1>}
80
+ light_source{ < 4, 1, 4 > color <1,1,1> parallel point_at 0 }
81
+ default{ texture{ finish{ ambient 0.4 phong 1.0 phong_size 10 } } }
82
+ HERE
83
+ io = StringIO.new
84
+ c10.dump(io)
85
+ io.rewind
86
+ result = io.read
87
+ assert_equal(correct, result)
88
+ end
89
+
90
+ def test_dump
91
+ correct = <<HERE
92
+ camera {
93
+ orthographic
94
+ location <3.000000, 3.000000, 3.000000 >
95
+ look_at <0.000000, 0.000000, 0.000000 >
96
+ sky <0.000000, 0.000000, 1.000000 >
97
+ right <-1.000000, 0.000000, 0.000000 >
98
+ up <0.000000, 1.000000, 0.000000 >
99
+ angle 68.000000
100
+ }
101
+ HERE
102
+ io = StringIO.new
103
+ @c00.dump(io)
104
+ io.rewind
105
+ result = io.read
106
+ assert_equal(correct, result)
107
+ end
108
+
109
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crystalcell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - ippei94da
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2016-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit
@@ -160,6 +160,7 @@ files:
160
160
  - lib/crystalcell/latticeaxes.rb
161
161
  - lib/crystalcell/periodiccell.rb
162
162
  - lib/crystalcell/povray.rb
163
+ - lib/crystalcell/povray/camera.rb
163
164
  - lib/crystalcell/povray/cell.rb
164
165
  - lib/crystalcell/povray/cylinder.rb
165
166
  - lib/crystalcell/povray/element.rb
@@ -167,6 +168,7 @@ files:
167
168
  - lib/crystalcell/povray/triangle.rb
168
169
  - test/cif/ZrO2-25C.cif
169
170
  - test/helper.rb
171
+ - test/povray/test_camera.rb
170
172
  - test/povray/test_cell.rb
171
173
  - test/povray/test_element.rb
172
174
  - test/test_atom.rb