|
4 | 4 | from pymatgen.core.surface import SlabGenerator |
5 | 5 | from interfacemaster.cellcalc import get_primitive_hkl, get_pri_vec_inplane, get_normal_index, get_normal_from_MI, rot |
6 | 6 | from interfacemaster.interface_generator import core, convert_vector_index, get_disorientation |
| 7 | +from interfacemaster.tool import get_indices_from_cart |
7 | 8 | from numpy import * |
8 | 9 | from numpy.linalg import * |
9 | 10 | import os |
@@ -57,6 +58,9 @@ def float_to_rational(x, lim =50): |
57 | 58 | else: |
58 | 59 | raise RuntimeError('failed to found rational matrix') |
59 | 60 |
|
| 61 | +def get_rational_mtx(M): |
| 62 | + return apply_function_to_array(M, float_to_rational) |
| 63 | + |
60 | 64 | def plane_set_transform(old_set, new_l, format = 'int'): |
61 | 65 | hkl = get_primitive_hkl(old_set.hkl, old_set.lattice, new_l) |
62 | 66 | v1 = dot(inv(new_l), old_set.cart_v1) |
@@ -240,26 +244,44 @@ def generating(self, max_anum = 150, min_slab_length = 15): |
240 | 244 | cstl_id_2_conv = apply_function_to_array(dot(inv(my_interface.conv_lattice_2), cart_id), float_to_rational) |
241 | 245 |
|
242 | 246 | results[count] = {} |
243 | | - results[count]['film_prim_hkl'] = mtch_data.plane_set_film.hkl |
244 | | - results[count]['film_prim_v1'] = mtch_data.plane_set_film.v1 |
245 | | - results[count]['film_prim_v2'] = mtch_data.plane_set_film.v2 |
246 | | - results[count]['film_conv_hkl'] = mtch_data.plane_set_film_conv.hkl |
| 247 | + results[count]['film_prim_hkl'] = array(mtch_data.plane_set_film.hkl, dtype = int) |
| 248 | + results[count]['film_prim_v1'] = array(mtch_data.plane_set_film.v1, dtype = int) |
| 249 | + results[count]['film_prim_v2'] = array(mtch_data.plane_set_film.v2, dtype = int) |
| 250 | + results[count]['film_conv_hkl'] = array(mtch_data.plane_set_film_conv.hkl, dtype = int) |
247 | 251 | results[count]['film_conv_v1'] = mtch_data.plane_set_film_conv.v1 |
248 | 252 | results[count]['film_conv_v2'] = mtch_data.plane_set_film_conv.v2 |
249 | 253 |
|
250 | | - results[count]['substrate_prim_hkl'] = mtch_data.plane_set_substrate.hkl |
251 | | - results[count]['substrate_prim_v1'] = mtch_data.plane_set_substrate.v1 |
252 | | - results[count]['substrate_prim_v2'] = mtch_data.plane_set_substrate.v2 |
253 | | - results[count]['substrate_conv_hkl'] = mtch_data.plane_set_substrate_conv.hkl |
| 254 | + results[count]['substrate_prim_hkl'] = array(mtch_data.plane_set_substrate.hkl, dtype = int) |
| 255 | + results[count]['substrate_prim_v1'] = array(mtch_data.plane_set_substrate.v1, dtype = int) |
| 256 | + results[count]['substrate_prim_v2'] = array(mtch_data.plane_set_substrate.v2, dtype = int) |
| 257 | + results[count]['substrate_conv_hkl'] = array(mtch_data.plane_set_substrate_conv.hkl, dtype = int) |
254 | 258 | results[count]['substrate_conv_v1'] = mtch_data.plane_set_substrate_conv.v1 |
255 | 259 | results[count]['substrate_conv_v2'] = mtch_data.plane_set_substrate_conv.v2 |
256 | | - results[count]['area'] = data[i][-1] |
| 260 | + results[count]['CSL area'] = data[i][-1] |
257 | 261 | results[count]['strain'] = my_interface.D |
| 262 | + results[count]['atom_num'] = len(my_interface.atoms_bi) |
| 263 | + |
| 264 | + cnid_indices_1_prim = get_rational_mtx(get_indices_from_cart(my_interface.lattice_1, my_interface.CNID)) |
| 265 | + transL2 = dot(my_interface.a2_transform, my_interface.lattice_2) |
| 266 | + cnid_indices_2_prim = get_rational_mtx(get_indices_from_cart(transL2, my_interface.CNID)) |
| 267 | + results[count]['substrate_prim_CNID_express'] = cnid_indices_1_prim |
| 268 | + results[count]['film_prim_CNID_express'] = cnid_indices_2_prim |
| 269 | + |
| 270 | + cnid_indices_1_conv = get_rational_mtx(get_indices_from_cart(my_interface.conv_lattice_1, my_interface.CNID)) |
| 271 | + transL2 = dot(my_interface.a2_transform, my_interface.conv_lattice_2) |
| 272 | + cnid_indices_2_conv = get_rational_mtx(get_indices_from_cart(transL2, my_interface.CNID)) |
| 273 | + results[count]['substrate_conv_CNID_express'] = cnid_indices_1_conv |
| 274 | + results[count]['film_conv_CNID_express'] = cnid_indices_2_conv |
| 275 | + c1, c2 = my_interface.CNID.T |
| 276 | + results[count]['CNID area'] = norm(cross(c1, c2)) |
| 277 | + |
258 | 278 | with open(f'{it_folder}/{count}/interface.info','w') as f: |
259 | | - f.write(f"""film miller: {tuple(array(data[i][0:3], dtype = int))} |
260 | | -film vecs: {list(array(data[i][3:6], dtype = int))} {list(array(data[i][6:9], dtype = int))} |
261 | | -sub miller: {tuple(array(data[i][9:12], dtype = int))} |
262 | | -sub vecs: {list(array(data[i][12:15],dtype = int))} {list(array(data[i][15:18], dtype = int))} |
| 279 | + f.write(f"""substrate primitive miller indices:{array(mtch_data.plane_set_substrate.hkl, dtype = int)} |
| 280 | +film primitive miller indices: {array(mtch_data.plane_set_film.hkl, dtype = int)} |
| 281 | +
|
| 282 | +substrate conventional miller indices:{array(mtch_data.plane_set_substrate_conv.hkl, dtype = int)} |
| 283 | +film conventional miller indices:{array(mtch_data.plane_set_film_conv.hkl, dtype = int)} |
| 284 | +
|
263 | 285 | strain: |
264 | 286 | {my_interface.D}\n |
265 | 287 | atom number: {len(my_interface.atoms_bi)}\n |
|
0 commit comments