public override Band_Data Calculate_Newton_Step(SpinResolved_Data rho_prime, Band_Data g_phi) { DoubleTriDiagMatrix lap_mat = -1.0 * Generate_Laplacian(exp.Layers); Band_Data rho_prime_spin_summed = rho_prime.Spin_Summed_Data; // check that lap_mat and rho_prime have the same dimension if (rho_prime_spin_summed.Length != lap_mat.Rows) { throw new Exception("Error - the Laplacian generated by pois_solv has a different order to rho_prime!"); } for (int i = 0; i < rho_prime_spin_summed.Length; i++) { lap_mat[i, i] -= rho_prime_spin_summed.vec[i]; } DoubleTriDiagFact lu_newt_step = new DoubleTriDiagFact(lap_mat); // calculate newton step and its laplacian Band_Data result = new Band_Data(lu_newt_step.Solve(-1.0 * g_phi.vec)); result.Laplacian = Calculate_Phi_Laplacian(result); return(result); }
protected override Band_Data Get_Pot_On_Regular_Grid(Band_Data charge_density) { // set the top and bottom boundary conditions where [0] is the bottom of the device charge_density.vec[0] = bottom_bc * -1.0 * bottom_eps / (exp.Dz_Pot * exp.Dz_Pot); charge_density.vec[charge_density.Length - 1] = top_bc * -1.0 * top_eps / (exp.Dz_Pot * exp.Dz_Pot); // solve Poisson's equation Band_Data potential = new Band_Data(lu_fact.Solve(-1.0 * charge_density.vec)); // and save its laplacian potential.Laplacian = Calculate_Phi_Laplacian(potential); return(potential); }
public override Band_Data Calculate_Newton_Step(SpinResolved_Data rho_prime, Band_Data g_phi) { DoubleTriDiagMatrix lap_mat = -1.0 * Generate_Laplacian(exp.Layers); Band_Data rho_prime_spin_summed = rho_prime.Spin_Summed_Data; // check that lap_mat and rho_prime have the same dimension if (rho_prime_spin_summed.Length != lap_mat.Rows) throw new Exception("Error - the Laplacian generated by pois_solv has a different order to rho_prime!"); for (int i = 0; i < rho_prime_spin_summed.Length; i++) lap_mat[i, i] -= rho_prime_spin_summed.vec[i]; DoubleTriDiagFact lu_newt_step = new DoubleTriDiagFact(lap_mat); // calculate newton step and its laplacian Band_Data result = new Band_Data(lu_newt_step.Solve(-1.0 * g_phi.vec)); result.Laplacian = Calculate_Phi_Laplacian(result); return result; }