2from fractions
import Fraction
6 make_ab_graphene_bilayer,
7 make_aa_prime_mos2_bilayer,
10from inverse_design_core
import run_inverse_design, print_fraction_matrix
11from lammps_writer
import write_lammps_data, summarize_configuration
18bilayer = make_aa_prime_mos2_bilayer(6.5)
26b1u = np.array([Fraction(0, 1), Fraction(1, 1)], dtype=object)
27b2u = np.array([Fraction(0, 1), Fraction(0, 1)], dtype=object)
28b3u = np.array([Fraction(0, 1), Fraction(0, 1)], dtype=object)
30l1u = np.array([Fraction(-1, 1), Fraction(1, 1)], dtype=object)
31l2u = np.array([Fraction(121, 1), Fraction(119, 1)], dtype=object)
40result = run_inverse_design(
41 A=bilayer.bottom_layer.A,
52print_fraction_matrix(
"Q", result.Q)
54print_fraction_matrix(
"Q^{-1}", result.Qinv)
66hetero_bilayer = heterodeform_bilayer(
72sigmaA = abs(hetero_bilayer.bicrystal.sigmaA)
73sigmaB = abs(hetero_bilayer.bicrystal.sigmaB)
74exp_number_of_atoms_top_layer = sigmaA * len(hetero_bilayer.top_layer.basis_atoms)
75exp_number_of_atoms_bottom_layer = sigmaB * len(hetero_bilayer.bottom_layer.basis_atoms)
76print(
"\nExpected number of atoms in the top layer = ", exp_number_of_atoms_top_layer)
77print(
"Expected number of atoms in the bottom layer = ", exp_number_of_atoms_bottom_layer)
78print(
"Expected total number of atoms in the bilayer = ", exp_number_of_atoms_top_layer+exp_number_of_atoms_bottom_layer)
83bicrystal = hetero_bilayer.bicrystal
86ell1 = gb.LatticeVector2D(np.array([1, 0], dtype=np.int64), bicrystal.csl)
87ell2 = gb.LatticeVector2D(np.array([0, 1], dtype=np.int64), bicrystal.csl)
94positions, atom_types, charges, labels, molecule_ids = hetero_bilayer.box(ell1, ell2)
96print(f
"\nNumber of atoms in box = {len(positions)}")
104ell1_cart = np.array(ell1.cartesian(), dtype=float)
105ell2_cart = np.array(ell2.cartesian(), dtype=float)
108 theta = np.arctan2(ell1_cart[1], ell1_cart[0])
111 [np.cos(-theta), -np.sin(-theta)],
112 [np.sin(-theta), np.cos(-theta)],
116 tuple(R @ np.array([x, y])) + (z,)
117 for (x, y, z)
in positions
120 ell1_cart = R @ ell1_cart
121 ell2_cart = R @ ell2_cart
127summarize_configuration(positions, atom_types, ell1_cart, ell2_cart)
129 filename=
"initial.data",
131 atom_types=atom_types,
133 molecule_ids=molecule_ids,
136 atom_style=bilayer.atom_style,
140print(
"\nWrote LAMMPS data file: initial.data")