示例#1
0
 def test_HklPlane_normal(self):
     ZrO2 = Lattice.tetragonal(3.64, 5.27)
     p = HklPlane(1, 1, 1, ZrO2)
     n = p.normal()
     self.assertAlmostEqual(n[0], 0.635, 3)
     self.assertAlmostEqual(n[1], 0.635, 3)
     self.assertAlmostEqual(n[2], 0.439, 3)
示例#2
0
 def test_tetragonal_direction2(self):
     ZrO2 = Lattice.tetragonal(0.364, 0.527)
     d = HklDirection(1, 1, 1, ZrO2)
     target = np.array([1., 1., 1.448])
     target /= np.linalg.norm(target)
     self.assertAlmostEqual(d.direction()[0], target[0], 4)
     self.assertAlmostEqual(d.direction()[1], target[1], 4)
     self.assertAlmostEqual(d.direction()[2], target[2], 4)
示例#3
0
base_name = os.path.splitext(__file__)[0]
s3d = Scene3D(display=False, ren_size=(800, 400), name=base_name)

# create all the different unit lattice cells
a = 1.0
b = 1.5
c = 2.0
alpha = 66
beta = 66
gamma = 66

l = Lattice.cubic(a)
cubic = lattice_3d(l)
apply_translation_to_actor(cubic, (0.5, 0.5, 0.0))

l = Lattice.tetragonal(a, c)
tetragonal = lattice_3d(l)
apply_translation_to_actor(tetragonal, (2.0, 2.0, 0.0))

l = Lattice.orthorombic(a, b, c)
orthorombic = lattice_3d(l)
apply_translation_to_actor(orthorombic, (3.5, 3.5, 0.0))

l = Lattice.hexagonal(a, c)
hexagonal = lattice_3d(l)
apply_translation_to_actor(hexagonal, (5.0, 5.0, 0.0))

l = Lattice.rhombohedral(a, alpha)
rhombohedral = lattice_3d(l)
apply_translation_to_actor(rhombohedral, (6.5, 6.5, 0.0))