Esempio n. 1
0
 def test_scattering_vector(self):
     Fe_fcc = Lattice.face_centered_cubic(0.287)  # FCC iron
     hkl = HklPlane(2, 0, 0, Fe_fcc)
     Gc = hkl.scattering_vector()
     self.assertAlmostEqual(np.linalg.norm(Gc),
                            1 / hkl.interplanar_spacing())
     Al_fcc = Lattice.face_centered_cubic(0.405)
     hkl = HklPlane(0, 0, 2, lattice=Al_fcc)
     Gc = hkl.scattering_vector()
     self.assertAlmostEqual(np.linalg.norm(Gc),
                            1 / hkl.interplanar_spacing())
Esempio n. 2
0
 def test_110_normal_monoclinic(self):
     """Testing (110) plane normal in monoclinic crystal structure.
     This test comes from
     http://www.mse.mtu.edu/~drjohn/my3200/stereo/sg5.html
     corrected for a few errors in the html page.
     In this test, the lattice is defined with the c-axis aligned with the Z direction of the Cartesian frame.
     """
     Mg2Si = Lattice.from_parameters(1.534,
                                     0.405,
                                     0.683,
                                     90.,
                                     106.,
                                     90.,
                                     x_aligned_with_a=False)
     a = Mg2Si.matrix[0]
     b = Mg2Si.matrix[1]
     c = Mg2Si.matrix[2]
     self.assertAlmostEqual(a[0], 1.475, 3)
     self.assertAlmostEqual(a[1], 0., 3)
     self.assertAlmostEqual(a[2], -0.423, 3)
     self.assertAlmostEqual(b[0], 0., 3)
     self.assertAlmostEqual(b[1], 0.405, 3)
     self.assertAlmostEqual(b[2], 0., 3)
     self.assertAlmostEqual(c[0], 0., 3)
     self.assertAlmostEqual(c[1], 0., 3)
     self.assertAlmostEqual(c[2], 0.683, 3)
     p = HklPlane(1, 1, 1, Mg2Si)
     Gc = p.scattering_vector()
     self.assertAlmostEqual(Gc[0], 1.098, 3)
     self.assertAlmostEqual(Gc[1], 2.469, 3)
     self.assertAlmostEqual(Gc[2], 1.464, 3)
     self.assertAlmostEqual(p.interplanar_spacing(), 0.325, 3)
     Ghkl = np.dot(Mg2Si.matrix, Gc)
     self.assertEqual(Ghkl[0], 1.)  # h
     self.assertEqual(Ghkl[1], 1.)  # k
     self.assertEqual(Ghkl[2], 1.)  # l