kT = 1 I_0 = np.logspace(-1, 2, 10) * kT bias = np.linspace(-10 * kT, 10 * kT, 100) ab_R = np.array([0.25]) current = np.zeros((len(I_0), len(ab_R), len(bias))) #%% Initialize system kmc = kmc_dn.kmc_dn(1, 0, xdim, ydim, 0, electrodes=electrodes) kmc.load_acceptors(acceptors) tic = time.time() #%% Simulation loop for i in range(len(I_0)): for j in range(len(ab_R)): # Set constants kmc.kT = kT kmc.I_0 = I_0[i] kmc.ab = ab_R[j] * kmc.R kmc.initialize(placement=False) # Simulate current_sim = kmc_dn_utils.IV(kmc, 0, bias, hops=1000) current[i, j] = current_sim[:, 0] print(f'{time.time() - tic}') np.savez('current_map', current=current, I_0=I_0, ab_R=ab_R, bias=bias) #%% Visualize domain = kmc_dn_utils.visualize_basic(kmc) #plt.figure() #plt.plot(bias, current[:, 0]) plt.show()
electrodes = np.zeros((2, 4)) electrodes[0] = [0, 0, 0, 10] electrodes[1] = [xdim, 0, 0, 0] #%% Initialize simulation object kmc = kmc_dn.kmc_dn(N, M, xdim, ydim, zdim, mu=mu, electrodes=electrodes) # Set U_0 = kmc.kT U_0 = 0.1 * kmc.kT # Place single atom in middle of domain acceptors = np.array([[xdim / 2, 0, 0]]) kmc.load_acceptors(acceptors) # Set ab >> R, such that distance does not matter kmc.ab = 100000 * kmc.R kmc.initialize(V=False, dopant_placement=False) #%% Current simulation with backgate # Voltages bias = np.linspace(-100 * U_0, 100 * U_0, num=101) current = np.zeros((avg, 2, len(bias))) # IV measurement for i in range(avg): current[i] = kmc_dn_ut.IV(kmc, 0, bias, hops=hops) # Save np.savez('data', bias=bias, current=current)
kmc = kmc_dn.kmc_dn(1, 0, xdim, ydim, 0, electrodes=electrodes, callback = 'none') kmc.load_acceptors(acceptors) kmc.R = R # Set constants kmc.kT = kT kmc.I_0 = I_0 kmc.ab = ab_R*kmc.R kmc.initialize(placement = False) #%% Simulate IV curve V_high = -250 points = 100 prehops = 5000 tol = 1E-3 interval = 5000 hops = 1000 avg = 10 bias = np.linspace(V_high, 0, points) current = np.zeros((avg, points, 2)) for i in range(avg): current[i] = kmc_dn_utils.IV(kmc, 0, bias, prehops = prehops, tol = tol, interval = interval) current_avg = np.mean(current, axis = 0) #%% Save data np.savez('data', current = current, bias = bias, kT = kT, I_0 = I_0, ab_R = ab_R) #%% Visualize plt.figure() plt.plot(-bias, current_avg[:, 0]) plt.show()
0, electrodes=electrodes, callback='none') kmc.load_acceptors(acceptors) kmc.load_donors(donors) #%% Simulation loop for i in range(len(I_0)): for j in range(len(ab_R)): # Set constants kmc.kT = kT kmc.I_0 = I_0[i] kmc.ab = ab_R[j] * kmc.R kmc.initialize(dopant_placement=False) # Simulate current_sim = kmc_dn_utils.IV(kmc, 0, bias, prehops=prehops, hops=hops) current[k, i, j] = current_sim[:, 1] #np.savez('data', current = current, I_0 = I_0, ab_R = ab_R, bias = bias) #%% Visualize domain = kmc_dn_utils.visualize_basic(kmc) plt.figure() for i in range(current.shape[0]): plt.plot(bias, current[i, 0, 0]) plt.show()
0, electrodes=electrodes, callback='none') kmc.load_acceptors(acceptors) kmc.load_donors(donors) #%% Simulation loop for i in range(len(I_0)): for j in range(len(ab_R)): # Set constants kmc.kT = kT kmc.I_0 = I_0[i] kmc.ab = ab_R[j] * kmc.R kmc.initialize(placement=False) # Simulate current_sim = kmc_dn_utils.IV(kmc, 0, bias, tol=1E-3, prehops=1000, interval=1000) current[i, j] = current_sim[:, 1] np.savez('data', current=current, I_0=I_0, ab_R=ab_R, bias=bias) #%% Visualize domain = kmc_dn_utils.visualize_basic(kmc) plt.figure() plt.plot(bias, current[0, 0]) plt.show()
P = [0, 1, 0, 1] Q = [0, 0, 1, 1] w = [1, 1, 1, 1] kmc.electrodes[cf.output] = 0 # Set control voltages and electrode 0 to high for index, control in enumerate(cf.controls): kmc.electrodes[control, 3] = (1-cf.gene[index])*cf.controlrange[0] \ + cf.gene[index]*cf.controlrange[1] kmc.electrodes[cf.P, 3] = cf.inputrange if cf.allzero: kmc.electrodes[:, 3] = 0 kmc.update_V() # Obtain IV curve by sweeping electrode 1 currentlist = np.zeros((cf.avg, 8, cf.n_voltage)) for i in range(cf.avg): currentlist[i] = kmc_dn_utils.IV(kmc, cf.sweep_electrode, cf.voltagelist, hops=cf.hops, prehops=cf.prehops) SaveLib.saveExperiment(saveDirectory, V=cf.voltagelist, I=currentlist) plt.figure() plt.plot(cf.voltagelist, currentlist[0, cf.output]) plt.show()
for i in range(4): for j in range(4): acceptors[4 * i + j] = [(i + 1) * xdim / 5, (j + 1) * ydim / 5, 0] electrodes = np.zeros((2, 4)) electrodes[0] = [0, ydim / 2, 0, 10] electrodes[1] = [xdim, ydim / 2, 0, 0] kT = 1 bias = np.linspace(-10 * kT, 10 * kT, 100) I_0 = 1000 ab_R = 0.1 #%% Initialize system kmc = kmc_dn.kmc_dn(1, 0, xdim, ydim, 0, electrodes=electrodes) kmc.load_acceptors(acceptors) tic = time.time() #%% Simulation loop # Set constants kmc.kT = kT kmc.I_0 = I_0 kmc.ab = ab_R * kmc.R kmc.initialize(placement=False) # Simulate current_sim = kmc_dn_utils.IV(kmc, 0, bias, interval=1000) current = current_sim[:, 0] #%% Visualize plt.figure() plt.plot(bias, current) plt.show()
kmc.kT = kT kmc.I_0 = cf.I_0 kmc.ab = cf.ab_R * kmc.R # Update constant quantities that depend on I_0 and ab kmc.calc_E_constant() kmc.calc_transitions_constant() # Initialize starting occupation kmc.place_charges_random() start_occupation = kmc.occupation.copy() # Obtain device response currents = kmc_dn_utils.IV(kmc, cf.bias_electrode, voltagelist, prehops=prehops, hops=hops, printETA=True) output = currents[1].copy() # Save output and kmc object outputs[ii] = output kmc.saveSelf(filepath + '/kmc_objects/' + '{0:03}'.format(ii) + '.kmc') # Save experiment SaveLib.saveExperiment( filepath, outputs=outputs, voltagelist=voltagelist, )
kmc.I_0 = cf.generange[0][0] + genePool.pool[j, 0] \ * (cf.generange[0][1] - cf.generange[0][0]) kmc.ab = cf.generange[1][0] + genePool.pool[j, 1] \ * (cf.generange[1][1] - cf.generange[1][0]) kmc.ab = kmc.ab * kmc.R # Update constant quantities that depend on I_0 and ab kmc.calc_E_constant() kmc.calc_transitions_constant() fitness_list = [] # Obtain device response for l in range(cf.avg): current_array = kmc_dn_utils.IV(kmc, 0, voltagelist, prehops=prehops, hops=hops) output = current_array[1] outputArray[i, j] = output fitness_list.append(cf.Fitness(output, target)) genePool.fitness[j] = min(fitness_list) fitnessArray[i, j] = genePool.fitness[j] # Status print print("Generation nr. " + str(i + 1) + " completed") print("Highest fitness: " + str(max(genePool.fitness))) # Evolve to the next generation genePool.NextGen()