예제 #1
0
    def testinterplanarangle_triclinic(self):
        lat = self.triclinic

        s11 = lat.b ** 2 * lat.c ** 2 * sin(lat.alpha) ** 2
        s22 = lat.a ** 2 * lat.c ** 2 * sin(lat.beta) ** 2
        s33 = lat.a ** 2 * lat.b ** 2 * sin(lat.gamma) ** 2
        s12 = lat.a * lat.b * lat.c ** 2 * (cos(lat.alpha) * cos(lat.beta) - cos(lat.gamma))
        s23 = lat.a ** 2 * lat.b * lat.c * (cos(lat.beta) * cos(lat.gamma) - cos(lat.alpha))
        s13 = lat.a * lat.b ** 2 * lat.c * (cos(lat.gamma) * cos(lat.alpha) - cos(lat.beta))
        v = lat.a * lat.b * lat.c * sqrt(1 - cos(lat.alpha) ** 2 - \
                                         cos(lat.beta) ** 2 - \
                                         cos(lat.gamma) ** 2 + \
                                         2 * cos(lat.alpha) * cos(lat.beta) * cos(lat.gamma))

        equation = lambda lat, h1, k1, l1, h2, k2, l2: \
            d1 * d2 / v ** 2 * (s11 * h1 * h2 + \
                                s22 * k1 * k2 + \
                                s33 * l1 * l2 + \
                                s23 * (k1 * l2 + k2 * l1) + \
                                s13 * (l1 * h2 + l2 * h1) + \
                                s12 * (h1 * k2 + h2 * k1))

        for plane1 in self.planes:
            for plane2 in self.planes:
                d1 = calculations.planespacing(plane1, self.triclinic)
                d2 = calculations.planespacing(plane2, self.triclinic)
                angle = calculations.interplanarangle(plane1, plane2, self.triclinic)
                args = copy.deepcopy(plane1)
                args.extend(plane2)
                expected_angle = acos(equation(self.triclinic, *args))
                self.assertAlmostEqual(angle, expected_angle, 6)
예제 #2
0
    def testinterplanarangle_triclinic(self):
        lat = self.triclinic

        s11 = lat.b**2 * lat.c**2 * sin(lat.alpha)**2
        s22 = lat.a**2 * lat.c**2 * sin(lat.beta)**2
        s33 = lat.a**2 * lat.b**2 * sin(lat.gamma)**2
        s12 = lat.a * lat.b * lat.c**2 * (cos(lat.alpha) * cos(lat.beta) -
                                          cos(lat.gamma))
        s23 = lat.a**2 * lat.b * lat.c * (cos(lat.beta) * cos(lat.gamma) -
                                          cos(lat.alpha))
        s13 = lat.a * lat.b**2 * lat.c * (cos(lat.gamma) * cos(lat.alpha) -
                                          cos(lat.beta))
        v = lat.a * lat.b * lat.c * sqrt(1 - cos(lat.alpha) ** 2 - \
                                         cos(lat.beta) ** 2 - \
                                         cos(lat.gamma) ** 2 + \
                                         2 * cos(lat.alpha) * cos(lat.beta) * cos(lat.gamma))

        equation = lambda lat, h1, k1, l1, h2, k2, l2: \
            d1 * d2 / v ** 2 * (s11 * h1 * h2 + \
                                s22 * k1 * k2 + \
                                s33 * l1 * l2 + \
                                s23 * (k1 * l2 + k2 * l1) + \
                                s13 * (l1 * h2 + l2 * h1) + \
                                s12 * (h1 * k2 + h2 * k1))

        for plane1 in self.planes:
            for plane2 in self.planes:
                d1 = calculations.planespacing(plane1, self.triclinic)
                d2 = calculations.planespacing(plane2, self.triclinic)
                angle = calculations.interplanarangle(plane1, plane2,
                                                      self.triclinic)
                args = copy.deepcopy(plane1)
                args.extend(plane2)
                expected_angle = acos(equation(self.triclinic, *args))
                self.assertAlmostEqual(angle, expected_angle, 6)
예제 #3
0
 def testinterplanarangle(self):
     # Problem 2.15
     plane1 = plane.Plane(1, 0, 0)
     plane2 = plane.Plane(1, 1, 0)
     angle = calculations.interplanarangle(plane1, plane2, self.L4)
     angle *= 180 / pi
     self.assertAlmostEqual(angle, 44.7387, 3)
예제 #4
0
 def testinterplanarangle(self):
     # Problem 2.15
     plane1 = plane.Plane(1, 0, 0)
     plane2 = plane.Plane(1, 1, 0)
     angle = calculations.interplanarangle(plane1, plane2, self.L4)
     angle *= 180 / pi
     self.assertAlmostEqual(angle, 44.7387, 3)
예제 #5
0
    def testinterplanarangle_cubic(self):
        equation = lambda h1, k1, l1, h2, k2, l2: \
          (h1 * h2 + k1 * k2 + l1 * l2) / \
          sqrt((h1 ** 2 + k1 ** 2 + l1 ** 2) * (h2 ** 2 + k2 ** 2 + l2 ** 2))

        for plane1 in self.planes:
            for plane2 in self.planes:
                angle = calculations.interplanarangle(plane1, plane2, self.cubic)
                args = copy.deepcopy(plane1)
                args.extend(plane2)
                expected_angle = acos(equation(*args))
                self.assertAlmostEqual(angle, expected_angle)
예제 #6
0
    def testinterplanarangle_tetragonal(self):
        equation = lambda lat, h1, k1, l1, h2, k2, l2: \
          ((h1 * h2 + k1 * k2) / lat.a ** 2 + l1 * l2 / lat.c ** 2) / \
          sqrt(((h1 ** 2 + k1 ** 2) / lat.a ** 2 + l1 ** 2 / lat.c ** 2) * \
               ((h2 ** 2 + k2 ** 2) / lat.a ** 2 + l2 ** 2 / lat.c ** 2))

        for plane1 in self.planes:
            for plane2 in self.planes:
                angle = calculations.interplanarangle(plane1, plane2, self.tetragonal)
                args = copy.deepcopy(plane1)
                args.extend(plane2)
                expected_angle = acos(equation(self.tetragonal, *args))
                self.assertAlmostEqual(angle, expected_angle)
예제 #7
0
    def testinterplanarangle_cubic(self):
        equation = lambda h1, k1, l1, h2, k2, l2: \
          (h1 * h2 + k1 * k2 + l1 * l2) / \
          sqrt((h1 ** 2 + k1 ** 2 + l1 ** 2) * (h2 ** 2 + k2 ** 2 + l2 ** 2))

        for plane1 in self.planes:
            for plane2 in self.planes:
                angle = calculations.interplanarangle(plane1, plane2,
                                                      self.cubic)
                args = copy.deepcopy(plane1)
                args.extend(plane2)
                expected_angle = acos(equation(*args))
                self.assertAlmostEqual(angle, expected_angle)
예제 #8
0
    def testinterplanarangle_tetragonal(self):
        equation = lambda lat, h1, k1, l1, h2, k2, l2: \
          ((h1 * h2 + k1 * k2) / lat.a ** 2 + l1 * l2 / lat.c ** 2) / \
          sqrt(((h1 ** 2 + k1 ** 2) / lat.a ** 2 + l1 ** 2 / lat.c ** 2) * \
               ((h2 ** 2 + k2 ** 2) / lat.a ** 2 + l2 ** 2 / lat.c ** 2))

        for plane1 in self.planes:
            for plane2 in self.planes:
                angle = calculations.interplanarangle(plane1, plane2,
                                                      self.tetragonal)
                args = copy.deepcopy(plane1)
                args.extend(plane2)
                expected_angle = acos(equation(self.tetragonal, *args))
                self.assertAlmostEqual(angle, expected_angle)
예제 #9
0
    def testinterplanarangle_hexagonal(self):
        equation = lambda lat, h1, k1, l1, h2, k2, l2: \
          (h1 * h2 + k1 * k2 + 0.5 * (h1 * k2 + h2 * k1) + \
           (3 * lat.a ** 2) / (4 * lat.c ** 2) * l1 * l2) / \
           sqrt((h1 ** 2 + k1 ** 2 + h1 * k1 + (3 * lat.a ** 2) / \
                 (4 * lat.c ** 2) * l1 ** 2) * \
                 (h2 ** 2 + k2 ** 2 + h2 * k2 + (3 * lat.a ** 2) / \
                  (4 * lat.c ** 2) * l2 ** 2))

        for plane1 in self.planes:
            for plane2 in self.planes:
                angle = calculations.interplanarangle(plane1, plane2, self.hexagonal)
                args = copy.deepcopy(plane1)
                args.extend(plane2)
                expected_angle = acos(equation(self.hexagonal, *args))
                self.assertAlmostEqual(angle, expected_angle)
예제 #10
0
    def testinterplanarangle_monoclinic(self):
        equation = lambda lat, h1, k1, l1, h2, k2, l2: \
          d1 * d2 / sin(lat.beta) ** 2 * \
          (h1 * h2 / lat.a ** 2 + \
           k1 * k2 * sin(lat.beta) ** 2 / lat.b ** 2 + \
           l1 * l2 / lat.c ** 2 - \
           (l1 * h2 + l2 * h1) * cos(lat.beta) / (lat.a * lat.c))

        for plane1 in self.planes:
            for plane2 in self.planes:
                d1 = calculations.planespacing(plane1, self.monoclinic)
                d2 = calculations.planespacing(plane2, self.monoclinic)
                angle = calculations.interplanarangle(plane1, plane2, self.monoclinic)
                args = copy.deepcopy(plane1)
                args.extend(plane2)
                expected_angle = acos(equation(self.monoclinic, *args))
                self.assertAlmostEqual(angle, expected_angle, 6)
예제 #11
0
    def testinterplanarangle_orthorhombic(self):
        equation = lambda lat, h1, k1, l1, h2, k2, l2: \
          (h1 * h2 / lat.a ** 2 + k1 * k2 / lat.b ** 2 + l1 * l2 / lat.c ** 2) / \
          sqrt((h1 ** 2 / lat.a ** 2 + \
                k1 ** 2 / lat.b ** 2 + \
                l1 ** 2 / lat.c ** 2) \
               * (h2 ** 2 / lat.a ** 2 + \
                  k2 ** 2 / lat.b ** 2 + \
                  l2 ** 2 / lat.c ** 2))

        for plane1 in self.planes:
            for plane2 in self.planes:
                angle = calculations.interplanarangle(plane1, plane2, self.orthorhombic)
                args = copy.deepcopy(plane1)
                args.extend(plane2)
                expected_angle = acos(equation(self.orthorhombic, *args))
                self.assertAlmostEqual(angle, expected_angle, 6)
예제 #12
0
    def testinterplanarangle_hexagonal(self):
        equation = lambda lat, h1, k1, l1, h2, k2, l2: \
          (h1 * h2 + k1 * k2 + 0.5 * (h1 * k2 + h2 * k1) + \
           (3 * lat.a ** 2) / (4 * lat.c ** 2) * l1 * l2) / \
           sqrt((h1 ** 2 + k1 ** 2 + h1 * k1 + (3 * lat.a ** 2) / \
                 (4 * lat.c ** 2) * l1 ** 2) * \
                 (h2 ** 2 + k2 ** 2 + h2 * k2 + (3 * lat.a ** 2) / \
                  (4 * lat.c ** 2) * l2 ** 2))

        for plane1 in self.planes:
            for plane2 in self.planes:
                angle = calculations.interplanarangle(plane1, plane2,
                                                      self.hexagonal)
                args = copy.deepcopy(plane1)
                args.extend(plane2)
                expected_angle = acos(equation(self.hexagonal, *args))
                self.assertAlmostEqual(angle, expected_angle)
예제 #13
0
    def testinterplanarangle_monoclinic(self):
        equation = lambda lat, h1, k1, l1, h2, k2, l2: \
          d1 * d2 / sin(lat.beta) ** 2 * \
          (h1 * h2 / lat.a ** 2 + \
           k1 * k2 * sin(lat.beta) ** 2 / lat.b ** 2 + \
           l1 * l2 / lat.c ** 2 - \
           (l1 * h2 + l2 * h1) * cos(lat.beta) / (lat.a * lat.c))

        for plane1 in self.planes:
            for plane2 in self.planes:
                d1 = calculations.planespacing(plane1, self.monoclinic)
                d2 = calculations.planespacing(plane2, self.monoclinic)
                angle = calculations.interplanarangle(plane1, plane2,
                                                      self.monoclinic)
                args = copy.deepcopy(plane1)
                args.extend(plane2)
                expected_angle = acos(equation(self.monoclinic, *args))
                self.assertAlmostEqual(angle, expected_angle, 6)
예제 #14
0
    def testinterplanarangle_orthorhombic(self):
        equation = lambda lat, h1, k1, l1, h2, k2, l2: \
          (h1 * h2 / lat.a ** 2 + k1 * k2 / lat.b ** 2 + l1 * l2 / lat.c ** 2) / \
          sqrt((h1 ** 2 / lat.a ** 2 + \
                k1 ** 2 / lat.b ** 2 + \
                l1 ** 2 / lat.c ** 2) \
               * (h2 ** 2 / lat.a ** 2 + \
                  k2 ** 2 / lat.b ** 2 + \
                  l2 ** 2 / lat.c ** 2))

        for plane1 in self.planes:
            for plane2 in self.planes:
                angle = calculations.interplanarangle(plane1, plane2,
                                                      self.orthorhombic)
                args = copy.deepcopy(plane1)
                args.extend(plane2)
                expected_angle = acos(equation(self.orthorhombic, *args))
                self.assertAlmostEqual(angle, expected_angle, 6)
예제 #15
0
    def testinterplanarangle_trigonal(self):
        lat = self.trigonal

        v = lat.a ** 3 * sqrt(1 - 3 * cos(lat.alpha) ** 2 + 2 * cos(lat.alpha) ** 3)

        equation = lambda lat, h1, k1, l1, h2, k2, l2: \
          (lat.a ** 4 * d1 * d2) / v ** 2 * \
          (sin(lat.alpha) ** 2 * (h1 * h2 + k1 * k2 + l1 * l2) + \
           (cos(lat.alpha) ** 2 - cos(lat.alpha)) * \
           (k1 * l2 + k2 * l1 + l1 * h2 + l2 * h1 + h1 * k2 + h2 * k1))

        for plane1 in self.planes:
            for plane2 in self.planes:
                d1 = calculations.planespacing(plane1, lat)
                d2 = calculations.planespacing(plane2, lat)
                angle = calculations.interplanarangle(plane1, plane2, self.trigonal)
                args = copy.deepcopy(plane1)
                args.extend(plane2)
                expected_angle = acos(equation(self.trigonal, *args))
                self.assertAlmostEqual(angle, expected_angle, 6)
예제 #16
0
    def testinterplanarangle_trigonal(self):
        lat = self.trigonal

        v = lat.a**3 * sqrt(1 - 3 * cos(lat.alpha)**2 + 2 * cos(lat.alpha)**3)

        equation = lambda lat, h1, k1, l1, h2, k2, l2: \
          (lat.a ** 4 * d1 * d2) / v ** 2 * \
          (sin(lat.alpha) ** 2 * (h1 * h2 + k1 * k2 + l1 * l2) + \
           (cos(lat.alpha) ** 2 - cos(lat.alpha)) * \
           (k1 * l2 + k2 * l1 + l1 * h2 + l2 * h1 + h1 * k2 + h2 * k1))

        for plane1 in self.planes:
            for plane2 in self.planes:
                d1 = calculations.planespacing(plane1, lat)
                d2 = calculations.planespacing(plane2, lat)
                angle = calculations.interplanarangle(plane1, plane2,
                                                      self.trigonal)
                args = copy.deepcopy(plane1)
                args.extend(plane2)
                expected_angle = acos(equation(self.trigonal, *args))
                self.assertAlmostEqual(angle, expected_angle, 6)