static void Calculate_1D_Band_Structure(Dictionary <string, object> inputs) { OneD_ThomasFermiPoisson.Experiment exp_init = new OneD_ThomasFermiPoisson.Experiment(); Console.WriteLine("Performing density dopent calculation"); Dictionary <string, object> inputs_init = new Dictionary <string, object>(); if ((int)(double)inputs["dim"] != 1) { inputs_init = inputs.Where(s => s.Key.ToLower().EndsWith("_1d")).ToDictionary(dict => dict.Key.Remove(dict.Key.Length - 3), dict => dict.Value); inputs_init.Add("BandStructure_File", inputs["BandStructure_File"]); inputs_init.Add("output_suffix", "_1d.dat"); inputs_init.Add("T", inputs["T"]); } else { inputs_init = inputs.Where(s => s.Key.ToLower().EndsWith("")).ToDictionary(dict => dict.Key, dict => dict.Value); } // Inputs_to_Dictionary.Add_Input_Parameters_to_Dictionary(ref inputs_init, "Input_Parameters_1D.txt"); exp_init.Initialise(inputs_init); exp_init.Run(); inputs.Add("Carrier_Density", exp_init.Carrier_Density); inputs.Add("Dopent_Density", exp_init.Dopent_Density); inputs.Add("Chemical_Potential", exp_init.Chemical_Potential); inputs.Add("nz_pot_1d", inputs_init["nz"]); inputs.Add("zmin_pot_1d", inputs_init["zmin"]); inputs.Add("zmax_pot_1d", inputs_init["zmax"]); // get the frozen out surface charge at 70K if (!inputs.ContainsKey("surface_charge")) { inputs.Add("surface_charge", exp_init.Surface_Charge(70.0)); } else { Console.WriteLine("Surface charge set from Input_Parameters.txt to " + ((double)inputs["surface_charge"]).ToString()); } Console.WriteLine("Calculated 1D density for dopents"); if ((int)(double)inputs["dim"] == 2) { // create a scaled data file containing the dopent density double scaling_factor = ((double)inputs["ny"] * (double)inputs["dy"]) / ((double)inputs["nz"] * (double)inputs["dz"]); Input_Band_Structure.Expand_BandStructure(exp_init.Dopent_Density, (int)(double)inputs["ny_1d"]).Spin_Summed_Data.Save_2D_Data("dens_2D_dopents.dat", (double)inputs["dy"] * ((double)inputs["ny"] + 2.0) / ((double)inputs["ny_1d"] - 1.0), scaling_factor * (double)inputs_init["dz"], -1.0 * (double)inputs["dy"] * ((double)inputs["ny"] + 2.0) / 2.0, scaling_factor * Geom_Tool.Get_Zmin(exp_init.Layers)); } else if ((int)(double)inputs["dim"] == 3) { // this is a scaled version for the dopents! double y_scaling = ((double)inputs["nx"] * (double)inputs["dx"]) / ((double)inputs["ny"] * (double)inputs["dy"]); double z_scaling = ((double)inputs["nx"] * (double)inputs["dx"]) / ((double)inputs["nz"] * (double)inputs["dz"]); // extract the dopent layer (leaving the top and bottom set to zero) int dopent_min = -1; int dopent_max = -2; ILayer dopent_layer = exp_init.Layers[0]; for (int i = 0; i < exp_init.Layers.Length; i++) { if (exp_init.Layers[i].Donor_Conc != 0.0 || exp_init.Layers[i].Acceptor_Conc != 0) { dopent_layer = exp_init.Layers[i]; dopent_min = (int)Math.Round((dopent_layer.Zmin - Geom_Tool.Get_Zmin(exp_init.Layers)) / (int)(double)inputs_init["dz"]); dopent_max = (int)Math.Round((dopent_layer.Zmax - Geom_Tool.Get_Zmin(exp_init.Layers)) / (int)(double)inputs_init["dz"]); } } Band_Data tmp_dop_dens_1D = new Band_Data(dopent_max - dopent_min, 0.0); for (int i = dopent_min + 1; i < dopent_max - 1; i++) { tmp_dop_dens_1D.vec[i - dopent_min] = exp_init.Dopent_Density.Spin_Summed_Data.vec[i]; } // and expand into the correct data structure Band_Data tmp_dop_dens = Input_Band_Structure.Expand_BandStructure(tmp_dop_dens_1D.vec, (int)(double)inputs["nx_1d"], (int)(double)inputs["ny_1d"]); tmp_dop_dens.Save_3D_Data("dens_3D_dopents.dat", (double)inputs["dx"] * ((double)inputs["nx"] + 1.0) / ((double)inputs["nx_1d"] - 1.0), y_scaling * (double)inputs["dy"] * ((double)inputs["ny"] + 1.0) / ((double)inputs["ny_1d"] - 1.0), z_scaling * (double)inputs["dz_1d"], -1.0 * (double)inputs["dx"] * ((double)inputs["nx"] + 1.0) / 2.0, -1.0 * y_scaling * (double)inputs["dy"] * ((double)inputs["ny"] + 1.0) / 2.0, z_scaling * dopent_layer.Zmin); Console.WriteLine("Saved 1D dopent density"); } }
static void Main(string[] args) { // set nmath license key CenterSpace.NMath.Core.NMathConfiguration.LicenseKey = License.NMath_License_Key; Console.WriteLine("Program starting"); Console.WriteLine("Loading input parameters from file"); Dictionary<string, object> inputs = new Dictionary<string, object>(); Inputs_to_Dictionary.Add_Input_Parameters_to_Dictionary(ref inputs, "Input_Parameters.txt"); Inputs_to_Dictionary.Add_Input_Parameters_to_Dictionary(ref inputs, "Solver_Config.txt"); Console.WriteLine("Input parameters loaded"); // read in the value of vsg to be used Console.WriteLine("Enter split gate voltage"); inputs["split_V"] = double.Parse(Console.ReadLine()); Console.WriteLine("Setting \"split_V\" to " + ((double)inputs["split_V"]).ToString() + "V"); // check to make sure it's negative if ((double)inputs["split_V"] > 0) { Console.WriteLine("\"split_V\" has been set positive at " + ((double)inputs["split_V"]).ToString() + "V. Are you sure you want to do this?"); Console.ReadKey(); } // temporarily, just set the output suffix to something boring inputs.Add("output_suffix", ".dat"); // initialise the band structure experiment Experiment exp = new Experiment(); OneD_ThomasFermiPoisson.Experiment exp_init = new OneD_ThomasFermiPoisson.Experiment(); Console.WriteLine("Performing density dopent calculation"); Dictionary<string, object> inputs_init = new Dictionary<string, object>(); inputs_init = inputs.Where(s => s.Key.ToLower().EndsWith("_1d")).ToDictionary(dict => dict.Key.Remove(dict.Key.Length - 3), dict => dict.Value); inputs_init.Add("BandStructure_File", inputs["BandStructure_File"]); inputs_init.Add("T", inputs["T"]); inputs_init.Add("output_suffix", "_1d.dat"); exp_init.Initialise(inputs_init); exp_init.Run(); inputs.Add("SpinResolved_Density", exp_init.Carrier_Density); inputs.Add("Dopent_Density", exp_init.Dopent_Density); inputs.Add("Chemical_Potential", exp_init.Chemical_Potential); inputs.Add("nz_pot_1d", inputs_init["nz"]); inputs.Add("zmin_pot_1d", inputs_init["zmin"]); inputs.Add("zmax_pot_1d", inputs_init["zmax"]); // get the frozen out surface charge at 70K if (!inputs.ContainsKey("surface_charge")) inputs.Add("surface_charge", exp_init.Surface_Charge(70.0)); else Console.WriteLine("Surface charge set from Input_Parameters.txt to " + ((double)inputs["surface_charge"]).ToString()); Console.WriteLine("Calculated 1D density for dopents"); // this is a scaled version for the dopents! double y_scaling = ((double)inputs["nx"] * (double)inputs["dx"]) / ((double)inputs["ny"] * (double)inputs["dy"]); double z_scaling = ((double)inputs["nx"] * (double)inputs["dx"]) / ((double)inputs["nz"] * (double)inputs["dz"]); // extract the dopent layer (leaving the top and bottom set to zero) int dopent_min = -1; int dopent_max = -2; ILayer dopent_layer = exp_init.Layers[0]; for (int i = 0; i < exp_init.Layers.Length; i++) if (exp_init.Layers[i].Donor_Conc != 0.0 || exp_init.Layers[i].Acceptor_Conc != 0) { dopent_layer = exp_init.Layers[i]; dopent_min = (int)Math.Round((dopent_layer.Zmin - Geom_Tool.Get_Zmin(exp_init.Layers)) / (int)(double)inputs_init["dz"]); dopent_max = (int)Math.Round((dopent_layer.Zmax - Geom_Tool.Get_Zmin(exp_init.Layers)) / (int)(double)inputs_init["dz"]); } Band_Data tmp_dop_dens_1D = new Band_Data(dopent_max - dopent_min, 0.0); for (int i = dopent_min + 1; i < dopent_max - 1; i++) tmp_dop_dens_1D.vec[i - dopent_min] = exp_init.Dopent_Density.Spin_Summed_Data.vec[i]; // and expand into the correct data structure Band_Data tmp_dop_dens = Input_Band_Structure.Expand_BandStructure(tmp_dop_dens_1D.vec, (int)(double)inputs["nx_1d"], (int)(double)inputs["ny_1d"]); tmp_dop_dens.Save_3D_Data("dens_3D_dopents.dat", (double)inputs["dx"] * ((double)inputs["nx"] + 1.0) / ((double)inputs["nx_1d"] - 1.0), y_scaling * (double)inputs["dy"] * ((double)inputs["ny"] + 1.0) / ((double)inputs["ny_1d"] - 1.0), z_scaling * (double)inputs["dz_1d"], -1.0 * (double)inputs["dx"] * ((double)inputs["nx"] + 1.0) / 2.0, -1.0 * y_scaling * (double)inputs["dy"] * ((double)inputs["ny"] + 1.0) / 2.0, z_scaling * dopent_layer.Zmin); Console.WriteLine("Saved 1D dopent density"); Console.WriteLine("Starting experiment"); exp.Initialise(inputs); Console.WriteLine("Experiment initialised"); exp.Run(); Console.WriteLine("Experiment complete"); }
static void Calculate_1D_Band_Structure(Dictionary<string, object> inputs) { OneD_ThomasFermiPoisson.Experiment exp_init = new OneD_ThomasFermiPoisson.Experiment(); Console.WriteLine("Performing density dopent calculation"); Dictionary<string, object> inputs_init = new Dictionary<string, object>(); if ((int)(double)inputs["dim"] != 1) { inputs_init = inputs.Where(s => s.Key.ToLower().EndsWith("_1d")).ToDictionary(dict => dict.Key.Remove(dict.Key.Length - 3), dict => dict.Value); inputs_init.Add("BandStructure_File", inputs["BandStructure_File"]); inputs_init.Add("output_suffix", "_1d.dat"); inputs_init.Add("T", inputs["T"]); } else inputs_init = inputs.Where(s => s.Key.ToLower().EndsWith("")).ToDictionary(dict => dict.Key, dict => dict.Value); // Inputs_to_Dictionary.Add_Input_Parameters_to_Dictionary(ref inputs_init, "Input_Parameters_1D.txt"); exp_init.Initialise(inputs_init); exp_init.Run(); inputs.Add("Carrier_Density", exp_init.Carrier_Density); inputs.Add("Dopent_Density", exp_init.Dopent_Density); inputs.Add("Chemical_Potential", exp_init.Chemical_Potential); inputs.Add("nz_pot_1d", inputs_init["nz"]); inputs.Add("zmin_pot_1d", inputs_init["zmin"]); inputs.Add("zmax_pot_1d", inputs_init["zmax"]); // get the frozen out surface charge at 70K if (!inputs.ContainsKey("surface_charge")) inputs.Add("surface_charge", exp_init.Surface_Charge(70.0)); else Console.WriteLine("Surface charge set from Input_Parameters.txt to " + ((double)inputs["surface_charge"]).ToString()); Console.WriteLine("Calculated 1D density for dopents"); if ((int)(double)inputs["dim"] == 2) { // create a scaled data file containing the dopent density double scaling_factor = ((double)inputs["ny"] * (double)inputs["dy"]) / ((double)inputs["nz"] * (double)inputs["dz"]); Input_Band_Structure.Expand_BandStructure(exp_init.Dopent_Density, (int)(double)inputs["ny_1d"]).Spin_Summed_Data.Save_2D_Data("dens_2D_dopents.dat", (double)inputs["dy"] * ((double)inputs["ny"] + 2.0) / ((double)inputs["ny_1d"] - 1.0), scaling_factor * (double)inputs_init["dz"], -1.0 * (double)inputs["dy"] * ((double)inputs["ny"] + 2.0) / 2.0, scaling_factor * Geom_Tool.Get_Zmin(exp_init.Layers)); } else if ((int)(double)inputs["dim"] == 3) { // this is a scaled version for the dopents! double y_scaling = ((double)inputs["nx"] * (double)inputs["dx"]) / ((double)inputs["ny"] * (double)inputs["dy"]); double z_scaling = ((double)inputs["nx"] * (double)inputs["dx"]) / ((double)inputs["nz"] * (double)inputs["dz"]); // extract the dopent layer (leaving the top and bottom set to zero) int dopent_min = -1; int dopent_max = -2; ILayer dopent_layer = exp_init.Layers[0]; for (int i = 0; i < exp_init.Layers.Length; i++) if (exp_init.Layers[i].Donor_Conc != 0.0 || exp_init.Layers[i].Acceptor_Conc != 0) { dopent_layer = exp_init.Layers[i]; dopent_min = (int)Math.Round((dopent_layer.Zmin - Geom_Tool.Get_Zmin(exp_init.Layers)) / (int)(double)inputs_init["dz"]); dopent_max = (int)Math.Round((dopent_layer.Zmax - Geom_Tool.Get_Zmin(exp_init.Layers)) / (int)(double)inputs_init["dz"]); } Band_Data tmp_dop_dens_1D = new Band_Data(dopent_max - dopent_min, 0.0); for (int i = dopent_min + 1; i < dopent_max - 1; i++) tmp_dop_dens_1D.vec[i - dopent_min] = exp_init.Dopent_Density.Spin_Summed_Data.vec[i]; // and expand into the correct data structure Band_Data tmp_dop_dens = Input_Band_Structure.Expand_BandStructure(tmp_dop_dens_1D.vec, (int)(double)inputs["nx_1d"], (int)(double)inputs["ny_1d"]); tmp_dop_dens.Save_3D_Data("dens_3D_dopents.dat", (double)inputs["dx"] * ((double)inputs["nx"] + 1.0) / ((double)inputs["nx_1d"] - 1.0), y_scaling * (double)inputs["dy"] * ((double)inputs["ny"] + 1.0) / ((double)inputs["ny_1d"] - 1.0), z_scaling * (double)inputs["dz_1d"], -1.0 * (double)inputs["dx"] * ((double)inputs["nx"] + 1.0) / 2.0, -1.0 * y_scaling * (double)inputs["dy"] * ((double)inputs["ny"] + 1.0) / 2.0, z_scaling * dopent_layer.Zmin); Console.WriteLine("Saved 1D dopent density"); } }
static void Main(string[] args) { // set nmath license key CenterSpace.NMath.Core.NMathConfiguration.LicenseKey = License.NMath_License_Key; Console.WriteLine("Program starting"); Console.WriteLine("Loading input parameters from file"); Dictionary <string, object> inputs = new Dictionary <string, object>(); Inputs_to_Dictionary.Add_Input_Parameters_to_Dictionary(ref inputs, "Input_Parameters.txt"); Inputs_to_Dictionary.Add_Input_Parameters_to_Dictionary(ref inputs, "Solver_Config.txt"); Console.WriteLine("Input parameters loaded"); // read in the value of vsg to be used Console.WriteLine("Enter split gate voltage"); inputs["split_V"] = double.Parse(Console.ReadLine()); Console.WriteLine("Setting \"split_V\" to " + ((double)inputs["split_V"]).ToString() + "V"); // check to make sure it's negative if ((double)inputs["split_V"] > 0) { Console.WriteLine("\"split_V\" has been set positive at " + ((double)inputs["split_V"]).ToString() + "V. Are you sure you want to do this?"); Console.ReadKey(); } // temporarily, just set the output suffix to something boring inputs.Add("output_suffix", ".dat"); // initialise the band structure experiment Experiment exp = new Experiment(); OneD_ThomasFermiPoisson.Experiment exp_init = new OneD_ThomasFermiPoisson.Experiment(); Console.WriteLine("Performing density dopent calculation"); Dictionary <string, object> inputs_init = new Dictionary <string, object>(); inputs_init = inputs.Where(s => s.Key.ToLower().EndsWith("_1d")).ToDictionary(dict => dict.Key.Remove(dict.Key.Length - 3), dict => dict.Value); inputs_init.Add("BandStructure_File", inputs["BandStructure_File"]); inputs_init.Add("T", inputs["T"]); inputs_init.Add("output_suffix", "_1d.dat"); exp_init.Initialise(inputs_init); exp_init.Run(); inputs.Add("SpinResolved_Density", exp_init.Carrier_Density); inputs.Add("Dopent_Density", exp_init.Dopent_Density); inputs.Add("Chemical_Potential", exp_init.Chemical_Potential); inputs.Add("nz_pot_1d", inputs_init["nz"]); inputs.Add("zmin_pot_1d", inputs_init["zmin"]); inputs.Add("zmax_pot_1d", inputs_init["zmax"]); // get the frozen out surface charge at 70K if (!inputs.ContainsKey("surface_charge")) { inputs.Add("surface_charge", exp_init.Surface_Charge(70.0)); } else { Console.WriteLine("Surface charge set from Input_Parameters.txt to " + ((double)inputs["surface_charge"]).ToString()); } Console.WriteLine("Calculated 1D density for dopents"); // this is a scaled version for the dopents! double y_scaling = ((double)inputs["nx"] * (double)inputs["dx"]) / ((double)inputs["ny"] * (double)inputs["dy"]); double z_scaling = ((double)inputs["nx"] * (double)inputs["dx"]) / ((double)inputs["nz"] * (double)inputs["dz"]); // extract the dopent layer (leaving the top and bottom set to zero) int dopent_min = -1; int dopent_max = -2; ILayer dopent_layer = exp_init.Layers[0]; for (int i = 0; i < exp_init.Layers.Length; i++) { if (exp_init.Layers[i].Donor_Conc != 0.0 || exp_init.Layers[i].Acceptor_Conc != 0) { dopent_layer = exp_init.Layers[i]; dopent_min = (int)Math.Round((dopent_layer.Zmin - Geom_Tool.Get_Zmin(exp_init.Layers)) / (int)(double)inputs_init["dz"]); dopent_max = (int)Math.Round((dopent_layer.Zmax - Geom_Tool.Get_Zmin(exp_init.Layers)) / (int)(double)inputs_init["dz"]); } } Band_Data tmp_dop_dens_1D = new Band_Data(dopent_max - dopent_min, 0.0); for (int i = dopent_min + 1; i < dopent_max - 1; i++) { tmp_dop_dens_1D.vec[i - dopent_min] = exp_init.Dopent_Density.Spin_Summed_Data.vec[i]; } // and expand into the correct data structure Band_Data tmp_dop_dens = Input_Band_Structure.Expand_BandStructure(tmp_dop_dens_1D.vec, (int)(double)inputs["nx_1d"], (int)(double)inputs["ny_1d"]); tmp_dop_dens.Save_3D_Data("dens_3D_dopents.dat", (double)inputs["dx"] * ((double)inputs["nx"] + 1.0) / ((double)inputs["nx_1d"] - 1.0), y_scaling * (double)inputs["dy"] * ((double)inputs["ny"] + 1.0) / ((double)inputs["ny_1d"] - 1.0), z_scaling * (double)inputs["dz_1d"], -1.0 * (double)inputs["dx"] * ((double)inputs["nx"] + 1.0) / 2.0, -1.0 * y_scaling * (double)inputs["dy"] * ((double)inputs["ny"] + 1.0) / 2.0, z_scaling * dopent_layer.Zmin); Console.WriteLine("Saved 1D dopent density"); Console.WriteLine("Starting experiment"); exp.Initialise(inputs); Console.WriteLine("Experiment initialised"); exp.Run(); Console.WriteLine("Experiment complete"); }
static void Main(string[] args) { Console.WriteLine("Setting Centerspace key"); // set nmath license key CenterSpace.NMath.Core.NMathConfiguration.LicenseKey = License.NMath_License_Key; Console.WriteLine("Program starting"); Console.WriteLine("Loading input parameters from file"); Dictionary<string, object> inputs = new Dictionary<string, object>(); Inputs_to_Dictionary.Add_Input_Parameters_to_Dictionary(ref inputs, "Input_Parameters.txt"); Inputs_to_Dictionary.Add_Input_Parameters_to_Dictionary(ref inputs, "Solver_Config.txt"); Console.WriteLine("Input parameters loaded"); //////////////////////////////////////////////// // // EDITS FOR BATCH RUNS // //////////////////////////////////////////////// // read in the value of vsg to be used Console.WriteLine("Enter split gate voltage"); // inputs["split_V"] = double.Parse(Console.ReadLine()); int index = int.Parse(args[0]); int maxval = (int)(double)inputs["nVsg"]; int i1 = index % maxval; int i2 = (index - i1) / maxval; // split gate with bias // double v1 = -0.5 - 0.25 * (double)i1; // double v2 = -0.5 - 0.02 * (double)i2; // if (v1 + v2 < -2.2 || v1 < v2) // return; // inputs["split_V1"] = v1; // inputs["split_V2"] = v2; // inputs["voltages"] = "{" + v1.ToString() + ", " + v2.ToString() + "}"; // Console.WriteLine("Setting \"split_V1\" to " + ((double)inputs["split_V1"]).ToString() + "V"); // Console.WriteLine("Setting \"split_V2\" to " + ((double)inputs["split_V2"]).ToString() + "V"); // inputs["top_V"] = 0.0; // Console.WriteLine("Setting \"top_V\" to " + ((double)inputs["top_V"]).ToString() + "V"); // inputs["output_suffix"] = "_sg1" + ((double)inputs["split_V1"]).ToString("F2") + "_sg2" + ((double)inputs["split_V2"]).ToString("F2") + ".dat"; //top gated with constant side gate double v1 = (double)inputs["sg_init"] + (double)inputs["dVsg"] * (double)i1; inputs["split_V"] = v1; Console.WriteLine("Setting \"split_V\" to " + ((double)inputs["split_V"]).ToString() + "V"); inputs["top_V"] = (double)inputs["tg_init"] + (double)inputs["dVtg"] * (double)i2; Console.WriteLine("Setting \"top_V\" to " + ((double)inputs["top_V"]).ToString() + "V"); inputs["output_suffix"] = "_sg" + ((double)inputs["split_V"]).ToString("F3") + "_tg" + ((double)inputs["top_V"]).ToString("F3") + ".dat"; //////////////////////////////////////////////// inputs["voltages"] = "{" + v1.ToString() + ", " + v1.ToString() + "}"; // check to make sure it's negative if ((double)inputs["split_V"] > 0) { Console.WriteLine("\"split_V\" has been set positive at " + ((double)inputs["split_V"]).ToString() + "V. Are you sure you want to do this?"); Console.ReadKey(); } // initialise the band structure experiment Experiment exp = new Experiment(); OneD_ThomasFermiPoisson.Experiment exp_init = new OneD_ThomasFermiPoisson.Experiment(); // check if we should start from a precalculated density // consistency of band-structure, etc is the responsibility of the user... //if (!(bool)inputs["hot_start"]) { Console.WriteLine("Performing density dopent calculation"); Dictionary<string, object> inputs_init = new Dictionary<string, object>(); inputs_init = inputs.Where(s => s.Key.ToLower().EndsWith("_1d")).ToDictionary(dict => dict.Key.Remove(dict.Key.Length - 3), dict => dict.Value); inputs_init.Add("BandStructure_File", inputs["BandStructure_File"]); inputs_init.Add("T", inputs["T"]); // Inputs_to_Dictionary.Add_Input_Parameters_to_Dictionary(ref inputs_init, "Input_Parameters_1D.txt"); exp_init.Initialise(inputs_init); exp_init.Run(); inputs.Add("Carrier_Density", exp_init.Carrier_Density); inputs.Add("Dopent_Density", exp_init.Dopent_Density); inputs.Add("Chemical_Potential", exp_init.Chemical_Potential); inputs.Add("nz_pot_1d", inputs_init["nz"]); inputs.Add("zmin_pot_1d", inputs_init["zmin"]); inputs.Add("zmax_pot_1d", inputs_init["zmax"]); // get the frozen out surface charge at 70K if (!inputs.ContainsKey("surface_charge")) inputs.Add("surface_charge", exp_init.Surface_Charge(70.0)); else Console.WriteLine("Surface charge set from Input_Parameters.txt to " + ((double)inputs["surface_charge"]).ToString()); Console.WriteLine("Calculated 1D density for dopents"); //Input_Band_Structure.Expand_BandStructure(exp_init.Dopent_Density, (int)(double)inputs_init["ny_1d"]).Spin_Summed_Data.Save_2D_Data("dens_2D_dopents.dat", (double)inputs["dy"] * (double)inputs["ny"] / (double)inputs_init["ny_1d"], (double)inputs_init["dz"], -1.0 * (double)inputs["dy"] * (double)inputs["ny"] / 2.0, Geom_Tool.Get_Zmin(exp_init.Layers)); // this is a scaled version for the dopents! double scaling_factor = ((double)inputs["ny"] * (double)inputs["dy"]) / ((double)inputs["nz"] * (double)inputs["dz"]); Input_Band_Structure.Expand_BandStructure(exp_init.Dopent_Density, (int)(double)inputs["ny_1d"]).Spin_Summed_Data.Save_2D_Data("dens_2D_dopents.dat", (double)inputs["dy"] * ((double)inputs["ny"] + 2.0) / ((double)inputs["ny_1d"] - 1.0), scaling_factor * (double)inputs_init["dz"], -1.0 * (double)inputs["dy"] * ((double)inputs["ny"] + 2.0) / 2.0, scaling_factor * Geom_Tool.Get_Zmin(exp_init.Layers)); // Input_Band_Structure.Expand_BandStructure(exp_init.Carrier_Density, (int)(double)inputs_init["ny_1d"]).Spin_Summed_Data.Save_2D_Data("dens_2D.dat", (double)inputs["dy"] * ((double)inputs["ny"] + 2.0) / ((double)inputs_init["ny_1d"] - 1.0), (double)inputs_init["dz"], -1.0 * (double)inputs["dy"] * ((double)inputs["ny"] + 2.0) / 2.0, Geom_Tool.Get_Zmin(exp_init.Layers)); Console.WriteLine("Saved 1D dopent density"); } if ((bool)inputs["batch_run"]) { Run_Multiple_SGs(inputs); } else { Console.WriteLine("Starting experiment"); exp.Initialise(inputs); // check that the dz_pot are the same for both simulations as this is needed for the interpolation of SpinResolved_Density if (!(bool)inputs["hot_start"] && exp_init.Dz_Pot != exp.Dz_Pot) throw new Exception("Error - the dz values for the potentials must be the same for \"Input_Parameters.txt\" and \"Input_Parameters_1D.txt\""); Console.WriteLine("Experiment initialised"); exp.Run(); Console.WriteLine("Experiment complete"); } }
static void Main(string[] args) { Console.WriteLine("Setting Centerspace key"); // set nmath license key CenterSpace.NMath.Core.NMathConfiguration.LicenseKey = License.NMath_License_Key; Console.WriteLine("Program starting"); Console.WriteLine("Loading input parameters from file"); Dictionary <string, object> inputs = new Dictionary <string, object>(); Inputs_to_Dictionary.Add_Input_Parameters_to_Dictionary(ref inputs, "Input_Parameters.txt"); Inputs_to_Dictionary.Add_Input_Parameters_to_Dictionary(ref inputs, "Solver_Config.txt"); Console.WriteLine("Input parameters loaded"); //////////////////////////////////////////////// // // EDITS FOR BATCH RUNS // //////////////////////////////////////////////// // read in the value of vsg to be used Console.WriteLine("Enter split gate voltage"); // inputs["split_V"] = double.Parse(Console.ReadLine()); int index = int.Parse(args[0]); int maxval = (int)(double)inputs["nVsg"]; int i1 = index % maxval; int i2 = (index - i1) / maxval; // split gate with bias // double v1 = -0.5 - 0.25 * (double)i1; // double v2 = -0.5 - 0.02 * (double)i2; // if (v1 + v2 < -2.2 || v1 < v2) // return; // inputs["split_V1"] = v1; // inputs["split_V2"] = v2; // inputs["voltages"] = "{" + v1.ToString() + ", " + v2.ToString() + "}"; // Console.WriteLine("Setting \"split_V1\" to " + ((double)inputs["split_V1"]).ToString() + "V"); // Console.WriteLine("Setting \"split_V2\" to " + ((double)inputs["split_V2"]).ToString() + "V"); // inputs["top_V"] = 0.0; // Console.WriteLine("Setting \"top_V\" to " + ((double)inputs["top_V"]).ToString() + "V"); // inputs["output_suffix"] = "_sg1" + ((double)inputs["split_V1"]).ToString("F2") + "_sg2" + ((double)inputs["split_V2"]).ToString("F2") + ".dat"; //top gated with constant side gate double v1 = (double)inputs["sg_init"] + (double)inputs["dVsg"] * (double)i1; inputs["split_V"] = v1; Console.WriteLine("Setting \"split_V\" to " + ((double)inputs["split_V"]).ToString() + "V"); inputs["top_V"] = (double)inputs["tg_init"] + (double)inputs["dVtg"] * (double)i2; Console.WriteLine("Setting \"top_V\" to " + ((double)inputs["top_V"]).ToString() + "V"); inputs["output_suffix"] = "_sg" + ((double)inputs["split_V"]).ToString("F3") + "_tg" + ((double)inputs["top_V"]).ToString("F3") + ".dat"; //////////////////////////////////////////////// inputs["voltages"] = "{" + v1.ToString() + ", " + v1.ToString() + "}"; // check to make sure it's negative if ((double)inputs["split_V"] > 0) { Console.WriteLine("\"split_V\" has been set positive at " + ((double)inputs["split_V"]).ToString() + "V. Are you sure you want to do this?"); Console.ReadKey(); } // initialise the band structure experiment Experiment exp = new Experiment(); OneD_ThomasFermiPoisson.Experiment exp_init = new OneD_ThomasFermiPoisson.Experiment(); // check if we should start from a precalculated density // consistency of band-structure, etc is the responsibility of the user... //if (!(bool)inputs["hot_start"]) { Console.WriteLine("Performing density dopent calculation"); Dictionary <string, object> inputs_init = new Dictionary <string, object>(); inputs_init = inputs.Where(s => s.Key.ToLower().EndsWith("_1d")).ToDictionary(dict => dict.Key.Remove(dict.Key.Length - 3), dict => dict.Value); inputs_init.Add("BandStructure_File", inputs["BandStructure_File"]); inputs_init.Add("T", inputs["T"]); // Inputs_to_Dictionary.Add_Input_Parameters_to_Dictionary(ref inputs_init, "Input_Parameters_1D.txt"); exp_init.Initialise(inputs_init); exp_init.Run(); inputs.Add("Carrier_Density", exp_init.Carrier_Density); inputs.Add("Dopent_Density", exp_init.Dopent_Density); inputs.Add("Chemical_Potential", exp_init.Chemical_Potential); inputs.Add("nz_pot_1d", inputs_init["nz"]); inputs.Add("zmin_pot_1d", inputs_init["zmin"]); inputs.Add("zmax_pot_1d", inputs_init["zmax"]); // get the frozen out surface charge at 70K if (!inputs.ContainsKey("surface_charge")) { inputs.Add("surface_charge", exp_init.Surface_Charge(70.0)); } else { Console.WriteLine("Surface charge set from Input_Parameters.txt to " + ((double)inputs["surface_charge"]).ToString()); } Console.WriteLine("Calculated 1D density for dopents"); //Input_Band_Structure.Expand_BandStructure(exp_init.Dopent_Density, (int)(double)inputs_init["ny_1d"]).Spin_Summed_Data.Save_2D_Data("dens_2D_dopents.dat", (double)inputs["dy"] * (double)inputs["ny"] / (double)inputs_init["ny_1d"], (double)inputs_init["dz"], -1.0 * (double)inputs["dy"] * (double)inputs["ny"] / 2.0, Geom_Tool.Get_Zmin(exp_init.Layers)); // this is a scaled version for the dopents! double scaling_factor = ((double)inputs["ny"] * (double)inputs["dy"]) / ((double)inputs["nz"] * (double)inputs["dz"]); Input_Band_Structure.Expand_BandStructure(exp_init.Dopent_Density, (int)(double)inputs["ny_1d"]).Spin_Summed_Data.Save_2D_Data("dens_2D_dopents.dat", (double)inputs["dy"] * ((double)inputs["ny"] + 2.0) / ((double)inputs["ny_1d"] - 1.0), scaling_factor * (double)inputs_init["dz"], -1.0 * (double)inputs["dy"] * ((double)inputs["ny"] + 2.0) / 2.0, scaling_factor * Geom_Tool.Get_Zmin(exp_init.Layers)); // Input_Band_Structure.Expand_BandStructure(exp_init.Carrier_Density, (int)(double)inputs_init["ny_1d"]).Spin_Summed_Data.Save_2D_Data("dens_2D.dat", (double)inputs["dy"] * ((double)inputs["ny"] + 2.0) / ((double)inputs_init["ny_1d"] - 1.0), (double)inputs_init["dz"], -1.0 * (double)inputs["dy"] * ((double)inputs["ny"] + 2.0) / 2.0, Geom_Tool.Get_Zmin(exp_init.Layers)); Console.WriteLine("Saved 1D dopent density"); } if ((bool)inputs["batch_run"]) { Run_Multiple_SGs(inputs); } else { Console.WriteLine("Starting experiment"); exp.Initialise(inputs); // check that the dz_pot are the same for both simulations as this is needed for the interpolation of SpinResolved_Density if (!(bool)inputs["hot_start"] && exp_init.Dz_Pot != exp.Dz_Pot) { throw new Exception("Error - the dz values for the potentials must be the same for \"Input_Parameters.txt\" and \"Input_Parameters_1D.txt\""); } Console.WriteLine("Experiment initialised"); exp.Run(); Console.WriteLine("Experiment complete"); } }