ViennaSHE 1.3.0
Free open-source semiconductor device simulator using spherical harmonics expansions techniques.
resistor.py
Go to the documentation of this file.
1#!/usr/bin/env python
2
15
16import sys
17import os
18
19
20
21
22# append the path of the viennashe python bindings
23sys.path.append('../../pythonbinding/src')
24sys.path.append('./pythonbinding/src')
25
26try:
27 import pyviennashe as viennashe
28except Exception, ex:
29 print ex
30 print "\nCannot import pyviennashe. Possible causes:"
31 print "\n - The LD_LIBRARY_PATH (UNIX) or the WINDOWS paths are set incorrectly."
32 print "\n - The PYTHONPATH needs to be set to the same directory as the library search path (LD_LIBRARY_PATH for *NIX SYSTEMS)"
33 sys.exit(1)
34
35viennashe.initalize()
36
37
38len_x = 1e-6
39points_x = 51
40
41SI_ID = viennashe.get_silicon_id()[1]
42METAL_ID = viennashe.get_metal_id()[1]
43SIO2_ID = viennashe.get_sio2_id()[1]
44HFO2_ID = viennashe.get_hfo2_id()[1]
45
46dev = viennashe.create_1d_device(len_x, points_x)
47
48num_cells = viennashe.get_num_cells(dev)[1]
49
50print "num_vertices = ", viennashe.get_num_vertices(dev)[1]
51print "num_cells = ", num_cells
52
53
54matids=[]
55for i in range(0, num_cells): matids.append(SI_ID)
56matids[0] = METAL_ID
57matids[num_cells-1] = METAL_ID
58
59Nd = []; Na = []
60for i in range(0, num_cells):
61 Nd.append(1e25)
62 Na.append(1e7)
63
64bnd_cells = [0, num_cells-1]
65bnd_pot = [0.0, 1.0]
66
67viennashe.initalize_device(dev, matids, Nd, Na)
68viennashe.set_contact_potential_cells(dev, bnd_cells, bnd_pot, 2)
69
70
71
72conf_dd = viennashe.create_config();
73
74
75viennashe.config_standard_dd(conf_dd)
76viennashe.set_nonlinear_solver_config(conf_dd, viennashe.nonlinear_solver_gummel, 55, 0.5)
77
78
79sim_dd = viennashe.create_simulator(dev, conf_dd)
80
81
82viennashe.run(sim_dd)
83
84reg = viennashe.create_quantity_register(sim_dd )
85
86viennashe.write_to_gnuplot(reg, "Electrostatic potential", "potential_she.dat")
87viennashe.write_to_gnuplot(reg, "Electron density", "n_she.dat")
88viennashe.write_to_gnuplot(reg, "Hole density", "p_she.dat")
89
90
91viennashe.finalize()
92