def test_apply_transformation(self): Li_bulk = Structure.from_spacegroup("Im-3m", Lattice.cubic(2.96771), ["Li"], [[0, 0, 0]]) gb_gen_params_s3 = {"rotation_axis": [1, 1, 1], "rotation_angle": 60.0, "expand_times": 2, "vacuum_thickness": 0.0, "normal": True, "ratio": None, "plane": None} gbg = GBGenerator(Li_bulk) gb_from_generator = gbg.gb_from_parameters(**gb_gen_params_s3) gbt_s3 = GrainBoundaryTransformation(**gb_gen_params_s3) gb_from_trans = gbt_s3.apply_transformation(Li_bulk) self.assertArrayAlmostEqual(gb_from_generator.lattice.matrix, gb_from_trans.lattice.matrix) self.assertArrayAlmostEqual(gb_from_generator.cart_coords, gb_from_trans.cart_coords)
def test_apply_transformation(self): with warnings.catch_warnings(): warnings.simplefilter("ignore") Al_bulk = Structure.from_spacegroup("Fm-3m", Lattice.cubic(2.8575585), ["Al"], [[0, 0, 0]]) gb_gen_params_s5 = {"rotation_axis": [1, 0, 0], "rotation_angle": 53.13010235415599, "expand_times": 3, "vacuum_thickness": 0.0, "normal": True, "plane": [0, -1, -3], 'rm_ratio': 0.6} gbg = GrainBoundaryGenerator(Al_bulk) gb_from_generator = gbg.gb_from_parameters(**gb_gen_params_s5) gbt_s5 = GrainBoundaryTransformation(**gb_gen_params_s5) gb_from_trans = gbt_s5.apply_transformation(Al_bulk) self.assertArrayAlmostEqual(gb_from_generator.lattice.matrix, gb_from_trans.lattice.matrix) self.assertArrayAlmostEqual(gb_from_generator.cart_coords, gb_from_trans.cart_coords)