def test_ortho_cell(self):
    cell = UnitCell(25.14, 39.5, 45.07, 90, 90, 90)
    pos = Position(5, (- 6), 7)
    frac = cell.fractionalize(pos)
    self.assertAlmostEqual(frac.x, 0.198886, delta=1e-06)
    self.assertAlmostEqual(frac.y, (- 0.151899), delta=1e-06)
    self.assertAlmostEqual(frac.z, 0.155314, delta=1e-06)
    pos2 = cell.orthogonalize(frac)
    self.assertAlmostEqual(pos.x, pos2.x, delta=1e-12)
    self.assertAlmostEqual(pos.y, pos2.y, delta=1e-12)
    self.assertAlmostEqual(pos.z, pos2.z, delta=1e-12)
    corner = cell.orthogonalize(gemmi.Fractional(1, 1, 1))
    self.assertAlmostEqual(corner.x, cell.a, delta=1e-12)
    self.assertAlmostEqual(corner.y, cell.b, delta=1e-12)
    self.assertAlmostEqual(corner.z, cell.c, delta=1e-12)
    rec = cell.reciprocal()
    self.assertEqual([rec.alpha, rec.beta, rec.gamma], [90, 90, 90])
    self.assertAlmostEqual(rec.a, (1 / cell.a), delta=1e-17)
def test_ortho_cell(self):
    cell = UnitCell(25.14, 39.5, 45.07, 90, 90, 90)
    pos = Position(5, (- 6), 7)
    frac = cell.fractionalize(pos)
    self.assertAlmostEqual(frac.x, 0.198886, delta=1e-06)
    self.assertAlmostEqual(frac.y, (- 0.151899), delta=1e-06)
    self.assertAlmostEqual(frac.z, 0.155314, delta=1e-06)
    pos2 = cell.orthogonalize(frac)
    self.assertAlmostEqual(pos.x, pos2.x, delta=1e-12)
    self.assertAlmostEqual(pos.y, pos2.y, delta=1e-12)
    self.assertAlmostEqual(pos.z, pos2.z, delta=1e-12)
    corner = cell.orthogonalize(gemmi.Fractional(1, 1, 1))
    self.assertAlmostEqual(corner.x, cell.a, delta=1e-12)
    self.assertAlmostEqual(corner.y, cell.b, delta=1e-12)
    self.assertAlmostEqual(corner.z, cell.c, delta=1e-12)
    rec = cell.reciprocal()
    self.assertEqual([rec.alpha, rec.beta, rec.gamma], [90, 90, 90])
    self.assertAlmostEqual(rec.a, (1 / cell.a), delta=1e-17)