예제 #1
0
# Define input signals
P = [0, 1, 0, 1]
Q = [0, 0, 1, 1]
w = [1, 1, 1, 1]
kmc.electrodes[output_electrode] = 0
P_V = np.linspace(-2 * V_high, 2 * V_high, res)
Q_V = np.linspace(-2 * V_high, 2 * V_high, res)
outputmap = np.zeros((res, res))

for index, control in enumerate(cf.controls):
    kmc.electrodes[control, 3] = -V_high + 2 * V_high * gene[index]

# Obtain device response
output = np.zeros(4 * avg)
for mapi in range(res):
    for mapj in range(res):

        kmc.electrodes[cf.P] = P_V[mapi]
        kmc.electrodes[cf.Q] = Q_V[mapj]
        kmc.update_V()
        for l in range(avg):
            kmc.simulate_discrete(prehops=prehops)
            kmc.simulate_discrete(hops=hops)
            output = kmc.current[cf.output]
        outputmap[mapi, mapj] = output

kmc_dn_utils.visualize_basic(kmc)
plt.figure()
plt.imshow(outputmap)
plt.show()
예제 #2
0
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()