def test_cartesian_to_lattice(self): lattice = mp.Lattice(size=mp.Vector3(1, 7), basis1=mp.Vector3(math.sqrt(3) / 2, 0.5), basis2=mp.Vector3(math.sqrt(3) / 2, -0.5)) res = mp.cartesian_to_lattice(lattice.basis * mp.Vector3(1), lattice) self.assertEqual(res, mp.Vector3(1))
def test_cartesian_to_lattice(self): lattice = mp.Lattice(size=mp.Vector3(1, 7), basis1=mp.Vector3(math.sqrt(3) / 2, 0.5), basis2=mp.Vector3(math.sqrt(3) / 2, -0.5)) res = mp.cartesian_to_lattice(lattice.basis * mp.Vector3(1), lattice) self.assertEqual(res, mp.Vector3(1))