def __compute_superstrate(self, structure, harmonics, S_global): Nharm = harmonics.Nharm kx_mat = self.kx_mat ky_mat = self.ky_mat # reflection region Q_ref_mat = np.zeros((2 * Nharm, 2 * Nharm), dtype=complex) Q_ref_mat[0:Nharm, 0:Nharm] = matmul(kx_mat, ky_mat) Q_ref_mat[0:Nharm, Nharm:2*Nharm] = structure.UR2*structure.ER2*self.I_mat -\ matmul(kx_mat, kx_mat) Q_ref_mat[Nharm:2*Nharm, 0:Nharm] = matmul(ky_mat, ky_mat) -\ structure.UR2*structure.ER2*self.I_mat Q_ref_mat[Nharm:2 * Nharm, Nharm:2 * Nharm] = -matmul(ky_mat, kx_mat) Q_ref_mat /= structure.UR2 self.W_ref_mat = np.diag(np.ones(2 * Nharm)) lambda_ref_mat = np.concatenate( (np.concatenate((-1j * self.kz_ref_mat, self.zeros_mat), axis=1), np.concatenate((self.zeros_mat, -1j * self.kz_ref_mat), axis=1))) V_ref_mat = matmul(Q_ref_mat, np.linalg.inv(lambda_ref_mat)) A_ref_mat = matmul(np.linalg.inv(self.W0_mat), self.W_ref_mat) +\ matmul(np.linalg.inv(self.V0_mat), V_ref_mat) B_ref_mat = matmul(np.linalg.inv(self.W0_mat), self.W_ref_mat) -\ matmul(np.linalg.inv(self.V0_mat), V_ref_mat) S_ref_11 = -matmul(np.linalg.inv(A_ref_mat), B_ref_mat) S_ref_12 = 2 * np.linalg.inv(A_ref_mat) S_ref_21 = 0.5 * ( A_ref_mat - matmul(B_ref_mat, np.linalg.inv(A_ref_mat), B_ref_mat)) S_ref_22 = matmul(B_ref_mat, np.linalg.inv(A_ref_mat)) S_ref = np.concatenate((np.concatenate((S_ref_11, S_ref_12), axis=1), np.concatenate((S_ref_21, S_ref_22), axis=1))) S_global = redheffer_star_prod(S_ref, S_global, self.I_big_mat) return S_global
def __compute_substrate(self, structure, harmonics, S_global): Nharm = harmonics.Nharm kx_mat = self.kx_mat ky_mat = self.ky_mat # transmission region Q_trn_mat = np.zeros((2 * Nharm, 2 * Nharm), dtype=complex) Q_trn_mat[0:Nharm, 0:Nharm] = matmul(kx_mat, ky_mat) Q_trn_mat[0:Nharm, Nharm:2*Nharm] = structure.UR1*structure.ER1*self.I_mat -\ matmul(kx_mat, kx_mat) Q_trn_mat[Nharm:2*Nharm, 0:Nharm] = matmul(ky_mat, ky_mat) -\ structure.UR1*structure.ER1*self.I_mat Q_trn_mat[Nharm:2 * Nharm, Nharm:2 * Nharm] = -matmul(ky_mat, kx_mat) Q_trn_mat /= structure.UR1 self.W_trn_mat = np.diag(np.ones(2 * Nharm)) lambda_trn_mat = np.concatenate( (np.concatenate((1j * self.kz_trn_mat, self.zeros_mat), axis=1), np.concatenate((self.zeros_mat, 1j * self.kz_trn_mat), axis=1))) V_trn_mat = matmul(Q_trn_mat, np.linalg.inv(lambda_trn_mat)) A_trn_mat = matmul(np.linalg.inv(self.W0_mat), self.W_trn_mat) +\ matmul(np.linalg.inv(self.V0_mat), V_trn_mat) B_trn_mat = matmul(np.linalg.inv(self.W0_mat), self.W_trn_mat) -\ matmul(np.linalg.inv(self.V0_mat), V_trn_mat) S_trn_11 = matmul(B_trn_mat, np.linalg.inv(A_trn_mat)) S_trn_12 = 0.5 * ( A_trn_mat - matmul(B_trn_mat, np.linalg.inv(A_trn_mat), B_trn_mat)) S_trn_21 = 2 * np.linalg.inv(A_trn_mat) S_trn_22 = -matmul(np.linalg.inv(A_trn_mat), B_trn_mat) S_trn = np.concatenate((np.concatenate((S_trn_11, S_trn_12), axis=1), np.concatenate((S_trn_21, S_trn_22), axis=1))) S_global = redheffer_star_prod(S_global, S_trn, self.I_big_mat) return S_global
def __compute_layers(self, structure, source, S_global): kx, ky = self.k_inc[0], self.k_inc[1] # take layers into account for i in range(0, structure.num_layers): ur = structure.ur_vec[i] er = structure.er_vec[i] l = structure.layer_thicknesses_vec[i] s_layer_mat = self.__calc_s_mat(l, ur, er, kx, ky, source.K0) S_global = redheffer_star_prod(S_global, s_layer_mat, UNIT_MAT_2D) return S_global
def __compute_layers(self, structure, source, harmonics, S_global): Nharm = harmonics.Nharm kx_mat = self.kx_mat ky_mat = self.ky_mat # iterating through layers for i in range(0, structure.num_layers): ERC = structure.erc_vec[i] URC = structure.urc_vec[i] thickness = structure.L[i] P_mat = np.zeros((2 * Nharm, 2 * Nharm), dtype=complex) P_mat[0:Nharm, 0:Nharm] = matmul(kx_mat, np.linalg.inv(ERC), ky_mat) P_mat[0:Nharm, Nharm:2 * Nharm] = URC - matmul(kx_mat, np.linalg.inv(ERC), kx_mat) P_mat[Nharm:2 * Nharm, 0:Nharm] = matmul(ky_mat, np.linalg.inv(ERC), ky_mat) - URC P_mat[Nharm:2 * Nharm, Nharm:2 * Nharm] = -matmul(ky_mat, np.linalg.inv(ERC), kx_mat) Q_mat = np.zeros((2 * Nharm, 2 * Nharm), dtype=complex) Q_mat[0:Nharm, 0:Nharm] = matmul(kx_mat, np.linalg.inv(URC), ky_mat) Q_mat[0:Nharm, Nharm:2 * Nharm] = ERC - matmul(kx_mat, np.linalg.inv(URC), kx_mat) Q_mat[Nharm:2 * Nharm, 0:Nharm] = matmul(ky_mat, np.linalg.inv(URC), ky_mat) - ERC Q_mat[Nharm:2 * Nharm, Nharm:2 * Nharm] = -matmul(ky_mat, np.linalg.inv(URC), kx_mat) Omega_sq_mat = matmul(P_mat, Q_mat) v_vec, W_mat = np.linalg.eig(Omega_sq_mat) lambda_mat = np.diag(np.conj(np.sqrt(v_vec))) V_mat = matmul(Q_mat, W_mat, np.linalg.inv(lambda_mat)) A_mat = matmul(np.linalg.inv(W_mat), self.W0_mat) +\ matmul(np.linalg.inv(V_mat), self.V0_mat) B_mat = matmul(np.linalg.inv(W_mat), self.W0_mat) -\ matmul(np.linalg.inv(V_mat), self.V0_mat) X_mat = np.diag( np.exp(-np.diag(lambda_mat) * source.K0 * thickness)) S_11 = matmul(np.linalg.inv(A_mat -\ matmul(X_mat, B_mat, np.linalg.inv(A_mat), X_mat, B_mat)), (matmul(X_mat, B_mat, np.linalg.inv(A_mat), X_mat, A_mat) - B_mat)) S_12 = matmul(np.linalg.inv(A_mat -\ matmul(X_mat, B_mat, np.linalg.inv(A_mat), X_mat, B_mat)), X_mat, (A_mat - matmul(B_mat, np.linalg.inv(A_mat), B_mat))) S = np.concatenate((np.concatenate( (S_11, S_12), axis=1), np.concatenate((S_12, S_11), axis=1))) S_global = redheffer_star_prod(S_global, S, self.I_big_mat) return S_global
def __compute_substrate(self, structure, S_global): kx, ky = self.k_inc[0], self.k_inc[1] # take substrate into account _, v_trn_mat = self.__calc_layer_params(structure.UR2, structure.ER2, kx, ky) vg_mat = self.__calc_gap_layer_params(kx, ky) a_trn_mat = UNIT_MAT_2D + matmul(np.linalg.inv(vg_mat), v_trn_mat) b_trn_mat = UNIT_MAT_2D - matmul(np.linalg.inv(vg_mat), v_trn_mat) s_trn_11_mat = matmul(b_trn_mat, np.linalg.inv(a_trn_mat)) s_trn_12_mat = 0.5*(a_trn_mat - matmul(b_trn_mat, np.linalg.inv(a_trn_mat), b_trn_mat)) s_trn_21_mat = 2*np.linalg.inv(a_trn_mat) s_trn_22_mat = -matmul(np.linalg.inv(a_trn_mat), b_trn_mat) s_trn_mat = np.concatenate((np.concatenate((s_trn_11_mat, s_trn_12_mat), axis=1), np.concatenate((s_trn_21_mat, s_trn_22_mat), axis=1))) S_global = redheffer_star_prod(S_global, s_trn_mat, UNIT_MAT_2D) return S_global