def setUpClass(cls): warnings.filterwarnings("ignore") cls.Cu_conv = Structure.from_file(os.path.join(test_dir, "Cu_mp-30_conventional_standard.cif")) GB_Cu_conv = GrainBoundaryGenerator(cls.Cu_conv) cls.Cu_GB1 = GB_Cu_conv.gb_from_parameters([1, 2, 3], 123.74898859588858, expand_times=4, vacuum_thickness=1.5, ab_shift=[0.0, 0.0], plane=[1, 3, 1], rm_ratio=0.0) cls.Cu_GB2 = GB_Cu_conv.gb_from_parameters([1, 2, 3], 123.74898859588858, expand_times=4, vacuum_thickness=1.5, ab_shift=[0.2, 0.2], rm_ratio=0.0)
def setUpClass(cls): warnings.filterwarnings("ignore") cls.Cu_conv = Structure.from_file( os.path.join(test_dir, "Cu_mp-30_conventional_standard.cif")) GB_Cu_conv = GrainBoundaryGenerator(cls.Cu_conv) cls.Cu_GB1 = GB_Cu_conv.gb_from_parameters([1, 2, 3], 123.74898859588858, expand_times=4, vacuum_thickness=1.5, ab_shift=[0.0, 0.0], plane=[1, 3, 1], rm_ratio=0.0) cls.Cu_GB2 = GB_Cu_conv.gb_from_parameters([1, 2, 3], 123.74898859588858, expand_times=4, vacuum_thickness=1.5, ab_shift=[0.2, 0.2], rm_ratio=0.0)
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)
def test_apply_transformation(self): with warnings.catch_warnings(): warnings.simplefilter("ignore") 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 = GrainBoundaryGenerator(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): 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 = GrainBoundaryGenerator(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)