87
Random Walk Simulation of p-n Junctions by Jennifer Wang Submitted to the Department of Physics in partial fulfillment of the requirements for the degree of Bachelor of Arts in Physics at WELLESLEY COLLEGE May 2020 c Wellesley College 2020. All rights reserved. Author .............................................................. Department of Physics May 6th, 2020 Certified by .......................................................... Yue Hu Professor of Physics Thesis Supervisor Accepted by ......................................................... Yue Hu Chair, Department of Physics

Random Walk Simulation of p-n Junctions

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Random Walk Simulation of p-n Junctions

Random Walk Simulation of p-n Junctions

by

Jennifer Wang

Submitted to the Department of Physicsin partial fulfillment of the requirements for the degree of

Bachelor of Arts in Physics

at

WELLESLEY COLLEGE

May 2020

c© Wellesley College 2020. All rights reserved.

Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Department of Physics

May 6th, 2020

Certified by. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Yue Hu

Professor of PhysicsThesis Supervisor

Accepted by . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Yue Hu

Chair, Department of Physics

Page 2: Random Walk Simulation of p-n Junctions

Random Walk Simulation of p-n Junctions

by

Jennifer Wang

Submitted to the Department of Physicson May 6th, 2020, in partial fulfillment of the

requirements for the degree ofBachelor of Arts in Physics

Abstract

Random walks rely on stochastic sampling instead of analytical calculations tosimulate complex processes; thus, these methods are flexible and mathematicallysimple. In the semiconductor field, random walks are often utilized to model bulktransport of charge carriers. However, junction transport models generally rely onmore complex numerical methods, which are computationally unwieldy and opaqueto a general audience. To aim for greater accessibility, this thesis applies randomwalks to simulate carrier transport in p-n junctions. We first show that our randomwalk methods are consistent with finite-difference methods to model drift-diffusionprocesses. Next, we apply a basic random walk to model a p-n junction at equilibrium.This demonstrates successful proof-of-concept simulation of the depletion layer, aswell as calculation of the the electric field and potential of a typical p-n junction.Additionally, because the basic random walk assumption cannot incorporate differentmobility parameters for electrons and holes, we develop an improved compound p-n junction model. We demonstrate that the compound model is consistent withthe basic model, and that it is adaptable to realistic material parameters for bothelectrons and holes.

Thesis Supervisor: Yue HuTitle: Professor of Physics

2

Page 3: Random Walk Simulation of p-n Junctions

Acknowledgments

I wish to express my deepest gratitude to my thesis advisor, Professor Yue Hu,

for her constant guidance throughout my undergraduate experience. She has been

incredibly patient and supportive, helping me with crucial obstacles and offering

invaluable life advice. This thesis draws heavily from her ideas and quite literally

would not be possible without her.

I am also profoundly grateful to Professor Robbie Berg, my major advisor, for

setting me on the path to a research career; Professor Rebecca Belisle, for sparking

my interest in materials science; and Professor Brian Tjaden, for providing a much-

needed computer science perspective. Thank you all for agreeing to serve as my thesis

reviewers.

Thanks also to Hope Anderson, my thesis mate, for thought-provoking discussions

and moral support throughout our senior year. I would also like to thank my friends

Jackie Ehrlich, Maddy Buxton and Maya Igarashi for their edits and camaraderie, as

well as my parents for their love and care.

3

Page 4: Random Walk Simulation of p-n Junctions

Contents

1 Introduction 6

1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

1.1.1 Semiconductor junction structure . . . . . . . . . . . . . . . . 7

1.1.2 Random walk simulation process . . . . . . . . . . . . . . . . 12

1.2 Research motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

2 Depletion approximation for p-n junctions 17

2.1 Setup and assumptions of depletion approximation . . . . . . . . . . 17

2.2 Mathematical process . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

2.2.1 Charge distribution, electric field and electrostatic potential di-

agrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

2.2.2 Depletion width calculation . . . . . . . . . . . . . . . . . . . 22

3 Random walks and the diffusion process 25

3.1 The drift-diffusion equation . . . . . . . . . . . . . . . . . . . . . . . 26

3.1.1 Derivation of drift-diffusion equation from random walk . . . . 27

3.1.2 Derivation of carrier motion probability . . . . . . . . . . . . . 29

3.2 The finite difference method . . . . . . . . . . . . . . . . . . . . . . . 32

3.3 Random walk simulation implementation . . . . . . . . . . . . . . . . 33

3.3.1 Simulation mechanics . . . . . . . . . . . . . . . . . . . . . . . 33

3.3.2 Simulation cases . . . . . . . . . . . . . . . . . . . . . . . . . 34

3.4 Comparing random walk and finite difference methods . . . . . . . . 34

4

Page 5: Random Walk Simulation of p-n Junctions

4 Simulation method for p-n junctions 37

4.1 Simulation overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

4.1.1 Finding discretized electric field . . . . . . . . . . . . . . . . . 39

4.1.2 Calculating carrier motion probabilities . . . . . . . . . . . . . 41

4.1.3 Running the simulation . . . . . . . . . . . . . . . . . . . . . . 42

4.2 Material parameters for p-n simulations . . . . . . . . . . . . . . . . 44

4.3 Scaling parameter derivations . . . . . . . . . . . . . . . . . . . . . . 44

4.3.1 Fixed physical dimension (∆x) and time scale (∆t) . . . . . . 44

4.3.2 Doping concentration: fixed A and variable init . . . . . . . . 46

4.3.3 Electric field: fixed scaling parameter and E-field unit . . . . . 47

4.4 Simulation strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

4.4.1 Basic p-n junction case . . . . . . . . . . . . . . . . . . . . . . 48

4.4.2 Limitation of basic p-n junction case . . . . . . . . . . . . . . 49

4.4.3 Compound p-n junction case . . . . . . . . . . . . . . . . . . . 50

5 Results 51

5.1 Basic p-n junction simulation . . . . . . . . . . . . . . . . . . . . . . 52

5.2 Realistic diffusion coefficient issue . . . . . . . . . . . . . . . . . . . . 58

5.3 Compound p-n junction simulation . . . . . . . . . . . . . . . . . . . 59

6 Conclusions and future work 62

A Simulation code for random walks 65

A.1 Basic random walk . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

A.2 Biased random walk . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

A.3 Compound random walk . . . . . . . . . . . . . . . . . . . . . . . . . 70

B Simulation code for p-n junctions 74

B.1 Basic p-n junction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

B.2 Compound p-n junction . . . . . . . . . . . . . . . . . . . . . . . . . 80

5

Page 6: Random Walk Simulation of p-n Junctions

Chapter 1

Introduction

The p-n junction is an interface structure between semiconductor materials, which

forms the basis for electronic devices such as diodes, transistors, and solar cells. This

junction occurs at the boundary between a p-type material, with excess positive

charge carriers, and a n-type material, with excess negative charge carriers. This

allows electrical current to flow through the junction in only one direction. Depending

on external controls, such as a directional voltage bias, it is possible to achieve precise

control of the current flow, thus creating an ‘on’ and ‘off’ state and enabling the p-n

junction to function as a diode.

Due to their ubiquitous use in technology infrastructure, p-n junctions and semi-

conductors in general are well-studied; many commercial software packages exist to

model junction behavior. However, most of these models are highly complex, in-

volving multiple coupled differential equations and inherent assumptions that remain

opaque to a general audience. This thesis will lay out a simple method of simulating

p-n junctions using the Monte Carlo random walk. Through this investigation, I will

endeavor to demonstrate three points: firstly, the random walk method achieves a

level of accuracy comparable to that of analytical methods, and results in a more

realistic solution than a conventional approximation treatment. Secondly, investigat-

ing junction structures using a random walks enables semiconductor simulations to

achieve a high degree of flexibility when incorporating external conditions. Thirdly,

the random walk method is easily understandable by a broader audience, which bodes

6

Page 7: Random Walk Simulation of p-n Junctions

well for technology outreach in the computing and clean energy industries.

In this first chapter, I will provide necessary background and elaborate on the mo-

tivation for using random walks to simulate p-n junctions. Chapter 2 will delineate

the theoretical analysis of p-n junctions through the depletion approximation. Chap-

ter 3 will justify how random walks can be used to model drift-diffusion processes, as

well as how to simulate random walks using Monte Carlo methods. Next, Chapter

4 will introduce the setup and parameter analysis for p-n junctions simulations. In

Chapter 5, we present simulation results for several different p-n junction models, to

evaluate the accuracy, flexibility and applicability of our methods to the p-n junction

system. Finally, Chapter 6 will conclude the thesis with a discussion of limitations

and potential future explorations.

1.1 Overview

1.1.1 Semiconductor junction structure

Electrical conductivity is a measure of how easily a material conducts electricity,

often calculated as the ratio of current density to electric field within the material.[1] It

is a fundamental material property and can be qualitatively understood with concepts

from energy band theory. Every material has a distinctive band gap determined

by internal structure. The size of the band gap is defined as the energy difference

between the lowest energy of electrons in the conduction band, in which electrons

are free to move around, and the highest energy of electrons in the valance band,

in which electrons are bound close to the nuclei in the atoms. We can characterize

material conductivity based on the size of this band gap. For example, as shown in

Figure. 1-1, metals are conductors because the conduction band (blue) and valance

band (red) overlap, which means electrons with that energy level are free to flow

away from their original nuclei. Insulators, like rubber, have a large band gap, which

indicates that electron flow in the material is not easy to achieve; in order to escape

their bindings from the nuclei, electrons in the valance band have to absorb a large

7

Page 8: Random Walk Simulation of p-n Junctions

amount of energy to reach the conduction band. Semiconductors like monocrystalline

silicon have a small band gap, which means they have a conductivity between that of

metals and insulators. We note that the Fermi energy (indicated with dashed line) is

the highest energy of electrons if the material is kept at a temperature of 0 Kelvin;

it provides a benchmark for the general energy region in which the conduction and

valance band reside.

Figure 1-1: Metals are conductors, since they have overlapping conduction andvalance bands (zero band gap). Insulators have large band gaps (commonly greaterthan 9 eV). Semiconductors have smaller, easily tunable band gaps, which indicatesthat they have a conductivity between that of metals and insulators.

Semiconductor band gaps are small enough (usually around 1.1 eV for silicon)

that a tiny shift in energy level can have a large effect on electronic properties within

the material.[2] Thus, the key advantage of using semiconductors to engineer devices

is that their conductivity can be tuned by external factors, such as doping, which is

the introduction of impurities into the material structure. In Figure. 1-2, we take a

closer look at both the positive and negative doping of silicon, which lends the p-n

junction its name.

Figure. 1-2(a) shows the atomic structure of monocrystalline silicon, which has

four bonds with the nearest neighboring silicon atoms. As these four bonds are

all covalent, each pair of silicon atoms shares two electrons within the bond; thus,

8

Page 9: Random Walk Simulation of p-n Junctions

(a) Atomic structure of monocrystalline silicon.

(b) Doping with arsenic lends one extra electron, so the material becomes nega-tively charged (n-type). Doping with boron leads to one missing electron, so thematerial becomes positively charged (p-type).[2]

Figure 1-2: Description of n-type and p-type regions in silicon, starting with aninterpretation from the four covalent bonds found in silicon crystal structure.

9

Page 10: Random Walk Simulation of p-n Junctions

in Figure. 1-2(b) we see silicon (Si) atoms normally have eight electrons covalently

bonded to the nuclei. Doping of silicon can be achieved by replacing one silicon atom

with arsenic (As), which has one extra electron. The the overall silicon material

becomes negatively doped, which we denote n-type; we call the arsenic atom a

donor. Similarly, replacing one silicon atom with boron (B), which has one less

electron, makes the material positively doped, which we denote p-type, and the boron

atom becomes an acceptor. Conventionally, this one missing electron is designated

as a hole (empty circle in figure) and treated as a particle of positive charge, with

particle mass equivalent to that of an electron.

A p-n junction is the interface between a p-type region and a n-type region, with

electrons and holes acting as charge carriers. Due to the concentration difference of

different types of charge carriers between the p-type and n-type regions, electrons are

generally inclined to diffuse from the n-type region to the p-type region without any

external perturbation; holes are oppositely charged, and thus flow the other direction.

This one-way diffusion indicates that within a circuit, a p-n junction can function as

a diode, as shown in Figure. 1-3. However, there processes opposing diffusion at the

interface, which are central to the complexity of the p-n junction.

Figure 1-3: One-way flow of electrons indicates that p-n junction can function asdiode.[3]

In particular, we imagine a p-n junction at equilibrium, disconnected from external

voltage biases. How far do charge carriers diffuse across the junction? The simplest

model of diffusion, such as that of ideal gas particles in a box, would indicate that

charge carriers spread themselves out evenly; however, due to the presence of the

donors and acceptors ions, which cannot move freely within the p-n junction, there is

an internal electric field that opposes the carrier diffusion. We consider Figure. 1-4,

10

Page 11: Random Walk Simulation of p-n Junctions

which shows the equilibration process of a p-n junction.

Figure 1-4: Equilibration process of p-n junction. Drift forces oppose charge carrierdiffusion and create a depletion region at the p-n junction interface.[4]

To aid our understanding, we assume that initially the p-type region (white circles

indicate acceptors) and n-type region (black circles indicate donors) are physically

separated. At time t = 0, we bring them into contact with each other, and charge

carriers begin to diffuse: negatively charged electrons move towards the p-type region,

and positively charged holes move towards the n-type region. As holes near the

interface diffuse across and leave the p-type region, acceptor atoms become ionized

and thus negatively charged (red circle). Similarly, as electrons near the interface leave

the n-type region, donors become positively charged (blue circle). Since these acceptor

and donor ions have a fixed location within the p-n junction, an internal electric field

arises in the p-n direction (pointing left on the page). Since an electric field indicates

the direction of force on a positive charge, holes that have not yet diffused across

the interface are pushed backwards into the p-type region and electrons are kept in

the n-type region. This effect results in a drift current that directly opposes the

diffusion of charge carriers. Thus, within a small distance of the interface, there is an

insulating region with only ionized donors and very few charge carriers. This region

11

Page 12: Random Walk Simulation of p-n Junctions

is called the space charge region or depletion layer, and the size of this region is

denoted depletion width.

1.1.2 Random walk simulation process

In order to fully understand the benefits of modeling p-n junctions with Monte

Carlo random walks, we now briefly explain the mechanics of the simulation. Monte

Carlo simulations are widely used computational methods that rely on random sam-

pling to numerically model complex processes. Instead of solving a deterministic

problem and then using statistical sampling to estimate uncertainties, which is often

mathematically unwieldy, Monte Carlo models incorporate probabilistic distributions

during each step of the simulation. Thus, they are incredibly successful at modelling

processes with multiple coupled degrees of freedom, from nuclear weapons detona-

tions, to traffic jams, to oscillatory chemical reactions.[5]

In particular, random walks in one dimension are the simplest form of Monte

Carlo simulation. As the name suggests, 1D random walks utilize walkers, which

are entities in the simulation that can usually take one of two actions: either to

move left or to move right. The probability that the walker goes in either direction

is statistically randomized, usually dependent on a random number generator and

a previously assumed threshold. For instance, a walker may step to the left if the

random probability generated is within the interval [0, 0.5) and step to the right if

the probability is within [0.5, 1). A common visualization, depicted in Figure. 1-5(a),

is to imagine taking steps along a number line. For an experimental visualization,

we can easily imagine modeling particle diffusion with a random walk, as shown in

Figure. 1-5(b). Supposing that all particles start off at position x = 0, we can depict

them located along a straight line; then, as the simulation continues through each

time step, they will gradually step away from the central position. Given enough

time, their positions will end up in a normal distribution, which is consistent with

the process of diffusion in a homogeneous medium and shown in Figure. 1-5(c).

12

Page 13: Random Walk Simulation of p-n Junctions

(a) Walker starting at position x = 0, taking five steps and ending upat position x = −1.

(b) Positions of 1000 walkers at time t = 0 time steps (left) and timet = 300 time steps (right).

(c) Histogram of the positions of 1000 walkers after 300 time steps. Thisdistribution can be modeled with a Gaussian curve, shown here in thered line.

Figure 1-5: Visualization of the random walk simulation process.

13

Page 14: Random Walk Simulation of p-n Junctions

1.2 Research motivation

As discussed in Section 1.1.2, random walks are effective at modelling the diffu-

sion of particles. Using this method, we can imagine treating charge carriers as point

particles that can move in directions constrained by a given probability. We now

briefly discuss how random walk methods relate to current research. Monte Carlo

electron transport models in semiconductors largely fall within two categories: bulk

processes, referring to transport within bulk materials, and junction processes, refer-

ring to transport across material interfaces. Random walks can be used to estimate

electron transport within the bulk of a material, as demonstrated by the CASINO

software package in Figure. 1-6. Recent literature has focused on determining the

diffusion length of electrons impacting the surface of a TiO2 dye sensitized solar cell,

which is a crucial engineering constraint for efficient photon-current conversion.[6]

Figure 1-6: Artificial random walk simulating trajectories of an electron beam withenergy 15 keV impacting a solid, Fe2SiO4 (fayalite), considering collisions eventsbetween electrons. [7]

As shown in Figure. 1-6, simple random walks with collision mechanics are effec-

tive for bulk transport modelling, but often do not account for the local Coulomb

interactions between moving charge carriers or stationary ions. However, these inter-

actions are crucial for junction structures. In particular, we have emphasized that

p-n junctions have a characteristic depletion layer that develops after mobile charge

carriers diffuse away, dependent on a net electric field generated by stationary donor

14

Page 15: Random Walk Simulation of p-n Junctions

and acceptor ions.

Therefore, current Monte Carlo junction simulations are often developed from

analytical equations; these simulations can include random walks, but are based on

numerically solving coupled differential equations. For example, Kirkemo modeled

p-n junctions in GaAs under voltage biases using carrier-carrier and coupled mode

scattering, as well as energy band models.[8] Nanoscale device modelling involves

Monte Carlo simulation methods that solve Boltzmann Transport Equations, in or-

der to analyze higher order effects when diffusion-drift equations no longer apply.[9]

These complex Monte Carlo methods, usually implemented with commercial soft-

ware such as Silvaco Atlas (PISCEC), lack the simplicity and intuitiveness of random

walks.[9] In addition, simulations solely relying on coupled differential equations are

comparatively inflexible at integrating external conditions into the system, such as a

p-n junction illuminated by an external light source.

By contrast, junction simulations based on random walks offer a flexible and math-

ematically simple setup, as well as comparable accuracy to analytical methods. One

recent application of random walks to junction structures is the investigation by Glo-

rieux et al., which simulates radiation-induced charge transport and collection across

p-n junctions in silicon. [10] Simulating single-event effects caused by energetic par-

ticles is often computationally complex, but random walk methods avoid numerically

solving 3D Poisson equations, can effectively incorporate external radiation-induced

effects, and provide results consistent with industry-standard circuit simulation tools

such as TCAD.[10]

This thesis aims to use random walks to model junction transport across equili-

brated p-n junctions in silicon. Similar to Glorieux’s approach, our model dynamically

adjusts the probabilities of motion, which are dependent on the instantaneous con-

centration profile of charge carriers in the system. Unlike Glorieux, we account for

the electrostatic interactions between charge carriers. This results in two improve-

ments: firstly, we do not need to rely on analytical junction approximation models

to obtain characteristic p-n junction behavior. Secondly, we can potentially handle a

wider range of charge carrier conditions, including different species of carriers as well

15

Page 16: Random Walk Simulation of p-n Junctions

as higher injection rates from intense radiation.[10]

In the following chapters, we will elaborate on the theoretical basis of analytical

p-n junction approximation models, which will serve as a reference for our random

walk simulation results. We will then discuss and demonstrate how random walks are

implemented to effectively model p-n junction mechanics.

16

Page 17: Random Walk Simulation of p-n Junctions

Chapter 2

Depletion approximation for p-n

junctions

2.1 Setup and assumptions of depletion approxi-

mation

Here we consider the p-n junction setup described in Chapter 1, Section 1.1, in

which the equilibrated p-n junction is reached by bringing p-type and n-type mate-

rials into contact and allowing free carrier movement until a stable state is reached.

The general process is delineated in Figure. 2-1, in which the two separated regions in

Figure. 2-1(a), with different energy band energies as dictated by dopant concentra-

tion, are brought into contact. We denote the dopant concentrations as follows: the

p-type region has an acceptor doping concentration of Na, and the n-type region has a

donor doping concentration of Nd. The initial electron and hole carrier concentrations

are defined as n0 and p0.

We first introduce an important relationship concerning the carrier concentration

of electrons, n, and the carrier concentration of holes, p, in both p-type and n-type

materials. A detailed exposition can be found in Hu,[2] but we define key concepts

as follows. Since mobile electrons are abundant in the n-type region and holes are

abundant in the p-type region, these carriers are called majority carriers. Due

17

Page 18: Random Walk Simulation of p-n Junctions

to the intrinsic material properties of a semiconductor, there are also a very small

number of holes in the n-type region and electrons in the p-type region. These are

minority carriers. Crucially, the product of these two types of carriers, the np

product, is constant. The np product is equal to the square of the intrinsic carrier

concentration ni, defined as the amount of electrons and holes in a semiconductor

even when dopants are not present; this is a constant material parameter. The np

product relation accounts for the minority carrier expressions in Figure. 2-1 and is

shown below.

np = n2i (2.1)

In Chapter 1, we briefly discussed the processes of diffusion and drift, which are

two counterbalancing processes that cause the charge carriers to move across the p-

n interface. Figure. 2-1(b) shows our expected final carrier concentrations. Due to

the localized nature of the diffusion and drift processes, the carrier profile remains

relatively constant far from the p-n interface. However, near the interface, some holes

have moved to the n-type region, and some electrons have moved to the p-type region.

This results in the ‘depletion layer’ with only ionized donors, acceptors, and very few

charge carriers.

In order to characterize the physical state of this equilibrated p-n junction, we

discuss the depletion approximation. This approximation assumes that the deple-

tion layer is completely free of charge carriers. It also assumes that the quasi-neutral

p-type and n-type regions far away from the interface have constant doping concentra-

tions and are completely charge neutral. This results in a sharp transition between the

depletion region and quasi-neutral regions, as shown in Figure. 2-2 below. Moreover,

we note that for our characterization of the drift process under this approximation,

the net electric field that the carriers are subject to is wholly confined to the depletion

region.

18

Page 19: Random Walk Simulation of p-n Junctions

(a)

(b)

Figure 2-1: Initial and final expectations for the carrier concentrations in p-typeand n-type regions, before and after contact. The logarithmic scale is present forease of visualizing minority carrier concentrations. Disparate concentrations in a)are brought together to connect at the interface, located at x = 0, resulting in thedistribution shown in b), in which charge carriers near the interface are subject tocounterbalanced drift and diffusion processes. This results in the depletion region atthe interface, with very few charge carriers and only ionized donor or acceptor atomsthat were originally in the p-type and n-type materials.[11]

19

Page 20: Random Walk Simulation of p-n Junctions

Figure 2-2: Depletion approximation (dashed lines) assumes a sharp transition be-tween the quasi-neutral p and n-type regions, and the depletion layer which hasno charge carriers. However, since the solutions to the drift-diffusion differentialequations should be continuous, there should be a small amount of charge carriersremaining in the depletion layer. Thus, there is a difference between the depletionapproximation (dashed lines) and actual carrier concentrations (solid line); however,this is a necessary assumption for our theoretical treatment. The depletion width, ω,is the distance between −xp0 and xn0. Note that we have used a linear scale, sinceminority carriers concentrations are small enough to not affect the depletion widthdefinition.

2.2 Mathematical process

2.2.1 Charge distribution, electric field and electrostatic po-

tential diagrams

Having set up our assumptions for the carrier concentrations of a p-n junction at

equilibrium, we can now physically characterize the system by calculating depletion

layer width, electric field across depletion layer, as well as the potential across the p-n

junction. Initially, we start from the total charge profile of the system, as shown in

Figure. 2-3(a). Since we assume that there are only ionized donors or acceptors left

in the depletion layer and that the p-n junction is electrically neutral otherwise, we

end up with a sharply delineated distribution of charge. There is zero total charge

outside of the depletion layer. Within the depletion layer, total charge is the acceptor

20

Page 21: Random Walk Simulation of p-n Junctions

or donor densities multiplied by the unit charge of electrons for the p-type and n-type

sides of the depletion layer, respectively. We can describe this mathematically by a

simple step function, graphed in Figure. 2-3(a) and shown below:

ρ(x) = 0; x < −xp0

= −qNa; − xp0 < x < 0

= qNd; 0 < x < xn0

= 0; x > xn0

(2.2)

From this step function, it is possible to find the electric field distribution across

the p-n junction by integrating Gauss’ law in differential form along the x-axis, as

shown below:

E (x2)− E (x1) =1

εs

∫ x2

x1

ρ(x)dx (2.3)

For each of the four regions in Eq. 2.2, we use Eq. 2.3 to obtain:

E(x) = 0; x < −xp0

=1

εs

∫ x

−xp0−qNadx

′ =−qNa

εs(x+ xp0) ; − xp0 < x < 0

=qNd

εs(x− xn0) ; 0 < x < xn0

= 0; x > xn0

(2.4)

which corresponds to the electric field profile graphed in Figure. 2-3(b).

Then, we obtain the electrostatic potential of the system by taking a path inte-

gral of the electric field found in Eq. 2.4. Since the electric field is zero outside the

depletion layer, we infer that the potential must be constant in the neutral regions,

and define them as φp and φn, respectively. We can obtain these constant values from

a detailed analysis of density of states and the Fermi-Dirac distribution; for refer-

ence, see Chapter 1 of Chenming Hu’s Modern Semiconductor Devices for Integrated

Circuits.[2] For the purposes of this thesis, the relevant equations are reproduced

below:

21

Page 22: Random Walk Simulation of p-n Junctions

φn =kT

q· ln no

ni, φp = −kT

q· ln po

ni(2.5)

In addition, we define the built-in potential, shown in Figure. 2-3(c), as:

φB = φn − φp =kT

qlnNaNd

n2i

(2.6)

Next, in order to obtain the potential difference in the depletion region, we take

a path integral over the electric field using the definition of electric potential, shown

below:

φ (x2)− φ (x1) = −∫ x2

x1

E(x)dx (2.7)

And thus, we obtain the distribution shown in Figure. 2-3(c), mathematically de-

scribed below:

φ(x) = φp; x < −xp0

= φp +qNa

2εs(x+ xp0)2 ; − xp0 < x < 0

= φn −qNd

2εs(x− xn0)2 ; 0 < x < xn0

= φn; x > xn0

(2.8)

In Eq. 2.8, we have obtained relationships between our unknown depletion width

parameters, xp0 and xn0, electric potential, and known quantities such as doping

concentration and permittivity. However, since there are two unknown quantities, we

need another equation to solve for the depletion width. The solution is described in

the following section.

2.2.2 Depletion width calculation

Here we derive the depletion width formula from the previously discussed potential

distribution. In order to obtain a second formula to constrain our two unknown width

parameters, xp0 and xn0, we assume that the overall charge must remain neutral,

22

Page 23: Random Walk Simulation of p-n Junctions

(a) Total charge distribution is assumed to follow sharp transitions, between neutral regionsand the depletion region with acceptor and donor atoms.

(b) Electric field is obtained using Gauss’ Law from the charge distri-bution from a).

(c) Electrostatic potential is obtained by integrating over the electricfield from b).

Figure 2-3: Total charge concentrations, electric field distribution, and potential dis-tribution of a p-n junction at equilibrium.[11]

23

Page 24: Random Walk Simulation of p-n Junctions

which gives us:

qNaxp0 = qNdxn0 (2.9)

We also know that the potential function must be continuous at x = 0. Then we

have:

φp +qNa

2εsx2p0 = φn −

qNd

2εsx2n0 (2.10)

So from the system of equations Eq. 2.9, and Eq. 2.10, we can finally solve for the

depletion width parameters. Plugging in the built-in potential from Eq. 2.6, we

obtain:

xn0 =

√2εsφBNa

q (Na +Nd)Nd

xp0 =

√2εsφBNd

q (Na +Nd)Na

(2.11)

The theoretical value of depletion width ω is therefore:

ω = xn0 + xp0 =

√2εsφB

q (Na +Nd)

(√Na

Nd

+

√Nd

Na

)(2.12)

We note that the depletion width approximation analytically models the p-n junc-

tion, and neatly avoids the complexity of having to numerically solve coupled differ-

ential equations. However, this theoretical treatment suffers from unrealistic assump-

tions of a rigidly defined and completely carrier-free depletion layer. In the following

sections, we will discuss the efficacy of our random walk simulations to model p-n

junctions, obtaining results with comparable accuracy to those from the depletion

approximation model.

24

Page 25: Random Walk Simulation of p-n Junctions

Chapter 3

Random walks and the diffusion

process

In this chapter, we will describe the theory and methodology of using random

walks to simulate the diffusion process. We discuss this in detail, because we need to

dynamically change the probabilities of carrier motion during our Monte Carlo sim-

ulation. By exploring the dependence of these probabilities on the diffusion constant

and electric field, we take into account the Coulomb interactions between moving

charge carriers and stationary ions. To ensure that we understand a generalized

model of diffusion, we will consider diffusion with an overall drift term, known as the

drift-diffusion equation.

Section 3.1 explores the relationship between the drift-diffusion equation and ran-

dom walks. In Section 3.2, we derive a finite difference method to numerically solve

the drift-diffusion equation, which is a deterministic method that always results in

the same distribution for the same initial conditions. Section 3.3 briefly outlines our

implementation of random walks with Monte Carlo methods. In Section 3.4, we solve

the drift-diffusion equation using this method, which is stochastic and introduces ran-

dom variation into the solutions. Finally, by comparing the results from deterministic

and stochastic solvers, we confirm that derived diffusion and drift terms correspond

to an accurate description of a drift-diffusion process.

In particular, to optimize our random walk model methodology, we will explore

25

Page 26: Random Walk Simulation of p-n Junctions

three random walk cases with different carrier motion probabilities. First, we consider

the basic random walk without drift, in which carriers can move with equal probability

to the left or right. Secondly, we consider biased random walks in which carriers are

biased to move towards either left or right. Finally, we consider a compound random

walk, in which carriers can move left, right, or stay in place. Having carriers stay

in place resolves some technical drawbacks from the first two cases, and allows us to

implement the time-dependent carrier motion probabilities, in which the calculated

probabilities of moving left and right do not exactly sum to 1. Thus, we posit that

the compound random walk method may result in the most realistic model of carrier

distribution.

3.1 The drift-diffusion equation

The drift-diffusion equation is a partial differential equation that can describe

the motion of particles from a combination of two processes: diffusion, by which

the particles move from higher to lower concentrations, and drift, by which particles

move collectively in one direction due to an external force, such as one imposed on

charged particles by an electric field. The generalized drift-diffusion equation in one

dimension is shown below:

∂c(x, t)

∂t= D

∂2c(x, t)

∂x2− v∂c(x, t)

∂x(3.1)

In Eq. 3.1, c represents the concentration of particles, D is a diffusion constant

depending on the material parameters, and v is the instantaneous drift velocity of

the particles. We are studying how the concentration changes in one dimension along

the x axis, as well as in time t. The interpretation of this drift-diffusion equation can

be found in references such as Stickler.[12]

26

Page 27: Random Walk Simulation of p-n Junctions

3.1.1 Derivation of drift-diffusion equation from random walk

We now derive the drift-diffusion equation starting from a generalized random

walk, in order to better understand how to manipulate drift and diffusion terms to

suit our simulation goals. Assume we have a biased random walk, with the probability

of a walker moving right given by r and the probability of a walker moving left given

by l; therefore, the probability of staying in place is s = 1− r− l. Each step is taken

in time ∆t of size ∆x. We denote the probability of a walker reaching position m

after n steps as Pn(m). We can write a master equation, showing the dependence of

the Pn(m) on the walker motion probabilities from the previous time step n− 1:

Pn(m) = rPn−1(m− 1) + lPn−1(m+ 1) + (1− r − l)Pn−1(m)

We rearrange this equation as:

Pn(m)− Pn−1(m) = rPn−1(m− 1) + lPn−1(m+ 1)− (r + l)Pn−1(m)

In order to obtain time and position derivatives, we divide both sides by ∆t, as

well as (∆x)2 . We assume that these time and position steps are sufficiently small.

On the left hand side, we then obtain:

Pn(m)− Pn−1(m)

∆t

1

∆x2 =∂P (x, t)

∂t

1

∆x2 (3.2)

Note that we can rewrite the right hand side as:

[rPn−1(m− 1) + lPn−1(m+ 1)− (r + l)Pn−1(m)]1

∆t∆x2

=1

2(r + l)[Pn−1(m− 1) + Pn−1(m+ 1)− 2Pn−1(m)]

1

∆t∆x2

− 1

2(r − l)[Pn−1(m+ 1)− Pn−1(m− 1)]

1

∆t∆x2

(3.3)

We consider the last term of Eq. 3.3; this becomes a spatial derivative, i.e.

27

Page 28: Random Walk Simulation of p-n Junctions

Pn−1(m+ 1)− Pn−1(m− 1)

2∆x

(r − l)∆t∆x

=∂P (x, t−∆t)

∂x

(r − l)∆t∆x

(3.4)

Similarly, when we analyze the first term in the right hand side of Eq. 3.3, we discover

that it is a second-order spatial derivative, i.e. when we divide by (∆x)2, we obtain:

Pn−1(m− 1) + Pn−1(m+ 1)− 2Pn−1(m)

(∆x)2

(r + l)

2∆t

=1

∆x[Pn−1(m+ 1)− Pn−1(m)

∆x− Pn−1(m)− Pn−1(m− 1)

∆x](r + l)

2∆t

=1

∆x[∂P (x+ ∆x, t−∆t)

∆x− ∂P (x, t−∆t)

∆x](r + l)

2∆t

=∂2P (x, t−∆t)

∂x2

(r + l)

2∆t

(3.5)

Assuming that ∆t is small, we can note that P (x, t − ∆t) ≈ P (x, t). Therefore we

plug Eq. 3.4 and Eq. 3.5 back into Eq. 3.3, and then set it equal to Eq. 3.2. We

rearrange to obtain:

∂P (x, t)

∂t

1

∆x2 =∂2P (x, t)

∂x2

(r + l)

2∆t− ∂P (x, t)

∂x

(r − l)∆x∆t

∂P (x, t)

∂t=

(∆x)2

2∆t(r + l)

∂2P (x, t)

∂x2− ∆x

∆t(r − l)∂P (x, t)

∂x(3.6)

in which we have a diffusion term and drift term. We can define the diffusion coeffi-

cient and drift velocity with the following expressions:

D =(∆x)2

2∆t(r + l) (3.7)

v =∆x

∆t(r − l) (3.8)

which match the relations given in Stickler.[12] This is reasonable, since the diffusion

constant should have units of area over time, and velocity should have units of length

over time. Note that velocity is usually dependent on time, space and other factors,

but v represents the drift velocity at a certain time step, and can thus be treated as

28

Page 29: Random Walk Simulation of p-n Junctions

a constant. These expressions simplify our master equation to

∂P (x, t)

∂t= D

∂2P (x, t)

∂x2− v∂P (x, t)

∂x

This equation exactly corresponds to the original diffusion equation Eq. 3.1, keep-

ing in mind that the concentration of walkers at a certain point is equivalent to the

total number of walkers, N , times the probability of a walker arriving at that point,

i.e. c(x, t) = NP (x, t).

3.1.2 Derivation of carrier motion probability

From the previous section, we have the system of equations

D =(∆x)2

2∆t(r + l) (3.7)

v =∆x

∆t(r − l) (3.8)

From Hu et.al, we know that the diffusion coefficient D is a constant determined by

material parameters, such as mobility, and external conditions such as temperature.[2]

For our purposes, we can treat this value as a predetermined constant. This leaves us

with the drift velocity v, which an be expressed in terms of the electric field E and

mobility µ, namely

v = µE (3.9)

of which the derivation of this expression is shown below.[2] From our discussion in

Chapter 1, Section 1.1.1., we know that the movement of carriers in p-n junctions

follows a drift-diffusion process, in which the diffusion process is counteracted by the

drift velocity, brought on by an internal electric field originating from local Coulomb

interactions with other charged particles. We can visualize this in Figure. 3-1. Here, a

mobile hole carrying one unit of positive charge undergoes diffusion steps (collisions),

as indicated by the haphazard arrows, but is also affected by a net electric field, E,

causing it to drift towards the right with a net drift velocity vp. We assume that the

29

Page 30: Random Walk Simulation of p-n Junctions

mean free time between collisions is τmp; the momentum gained from each collision is

the force F = qE times τmp. We also assume that the hole’s momentum gain, mpvp,

is entirely lost between collisions. Thus, we have:

mpvp = qEτmp

Which we rearrange as:

vp =qEτmpmp

This is known as the Drude Model [2], commonly written in the form:

vp = µpE , where µp =qτmpmp

Note that the first expression matches our expected relation in Eq. 3.9. The second

expression µp is defined as the mobility of holes, which is a material parameter

that we will treat as a predefined constant obtained from Hu.[2] A similar process is

followed for electrons, noting that the electric field will have an exact opposite effect.

Figure 3-1: An electric field creates a drift velocity that is superimposed on thediffusion process.[2]

We can now solve for the probabilities of carriers moving right or left, by plugging

in Eq. 3.9 to Eq. 3.8, and then solving the system of equations with Eq. 3.7. For

holes, the probability of moving right (rp) and the probability of moving left (lp) are

as follows:

30

Page 31: Random Walk Simulation of p-n Junctions

rp =µE∆t

2∆x+

D∆t

(∆x)2(3.10)

lp = −µE∆t

2∆x+

D∆t

(∆x)2(3.11)

For electron transport, we would just reverse the sign of the first terms. These

probability equations imply that the probabilities of carriers moving right or left is

comprised of two terms, as expected: a bias term (drift process dependent on electric

field magnitude) and a diffusion term. In order to interpret these two terms, note

that we can still plug in D = (∆x)2

2∆t(r + l), as well as the stay in place probability

s = 1− (r + l). We obtain the relation

D =(∆x)2

2∆t(1− s) (3.12)

Plugging in Eq. 3.12 to Eq. 3.10 and Eq. 3.11 transforms our probabilities of move-

ment, in which we drop the subscript p for convenience.

r =µE∆t

2∆x+

D∆t

(∆x)2=µE∆t

2∆x+

1− s2

(3.13)

l = −µE∆t

2∆x+

D∆t

(∆x)2= −µE∆t

2∆x+

1− s2

(3.14)

In both equations, the first term is the probability of drift, dependent on the

magnitude of the electric field, as well as the material parameter mobility; usually

this term is quite small, on the order of 1e-5 in our simulations, but achieves the

necessary counterbalance with the diffusion process to form the depletion region in

p-n junctions.

The second term assumes symmetric diffusion, in which the left and right move-

ment probabilities are equal, and thus both start off as half of the total movement

probability r + l = 1 − s. From this formulation, we see that the probabilities of

movement are the difference from half of the total probability of movement (both

left and right), which makes sense if we plug in some numbers. If the probability of

staying in place is s = 0, then the diffusion term is 12, and we revert to the most basic

31

Page 32: Random Walk Simulation of p-n Junctions

assumption that the probabilities of movement add up, i.e. r + l = 1.

3.2 The finite difference method

The finite difference method numerically solves partial differential equations with

discretization. In general, we convert the equation we are trying to solve to a dif-

ference equation, which converts the differential terms to finite steps; in our 1D

problem, we consider finite steps of time and space. A mesh is created using the spac-

ing from these finite steps, and matrix calculations can be performed over each point

in the mesh to approximate the solution to the original partial differential equation.

Our finite difference approach for the drift-diffusion equation is outlined below.

∂c(x, t)

∂t= D

∂2c(x, t)

∂x2− v∂c(x, t)

∂x(3.1)

We consider our original drift-diffusion equation, shown again here. Without

assuming that the particles undergo a random walk process, we can still utilize the

same differential relations to approximate the diffusion equation. We rewrite Eq. 3.1

using particle concentration c(x, t) = cn(m). Analogously to Eq. 3.2, Eq. 3.4, and

Eq. 3.5, we have

∂c(x, t)

∂t=cn(m)− cn−1(m)

∆t∂c(x, t−∆t)

∂x=cn−1(m+ 1)− cn−1(m+ 1)

∆x∂2c(x, t−∆t)

∂x2=cn−1(m− 1) + cn−1(m+ 1)− 2cn−1(m)

(∆x)2

We assume ∆x = 1 and ∆t = 1, so from Section 2.1, D = 12(r + l) and v = (r − l).

Thus, we obtain a generalized difference equation similar to Eq. 3.3.

cn(m)− cn−1(m) = D[cn−1(m− 1) + cn−1(m+ 1)− 2cn−1(m)]

− 1

2v[cn−1(m+ 1)− cn−1(m+ 1)]

(3.15)

32

Page 33: Random Walk Simulation of p-n Junctions

To calculate the result of approximating the drift-diffusion equation with Eq. 3.15,

we create a position-time matrix and calculate the value of the Eq. 3.15 at each point.

In the results shown in Section 3.4, we achieve this by creating a single position array,

then incorporating the finite difference equation into a for-loop that also controls the

time steps for a random walk simulation.

3.3 Random walk simulation implementation

Before analyzing results, we briefly discuss the implementation of random walks

simulations using a Monte Carlo method. As introduced in the beginning of this

chapter, we envision walkers starting out at a central position, then allow them to step

right, left, or stay in place, with predetermined probabilities. This results in normal

distribution of walkers, consistent with the diffusion of particles in a homogeneous

medium.

3.3.1 Simulation mechanics

As shown in the code in Appendix A, we start off with a fixed number of 20,000

walkers, taking 1000 steps in total; these numbers are chosen so that the simulation

reaches a stable state. To keep track of the walker locations, we create a position array

of length 1000, which stores the distance of each walker from the starting position,

x = 0. We also define of walker motion probabilities, i.e. the probabilities for a walker

to move left, right or stay in place, with fixed initial variables.

To implement our random walk, we run a for-loop over 1000 steps. During each

step, we generate a random number between 0 and 1 for each walker, stored in a

probability array of length 1000. This provides the stochastic basis for our simula-

tion, and ensures that we do not get the exact same distribution of walkers for each

run. Then, using the vectorization methods provided in MATLAB, we compare the

probability array to the previously set carrier motion probabilities, and carry out the

appropriate movement (left/right/stay in place) in the position array, updating the

location of each of the 1000 walkers. After 1000 iterations of this process, we arrive

33

Page 34: Random Walk Simulation of p-n Junctions

at the final state of the random walk simulation, which is a normal distribution that

may be shifted or flattened, depending on relative walker motion probabilities. For a

visualization of this process, refer back to Chapter 1, Section 1.1.2.

3.3.2 Simulation cases

We will discuss three different cases of random walks, mentioned at the beginning

of this chapter. In the basic random walk, we assume walkers move either left or

right with equal probability. In the biased random walk, walkers still either move left

or right, but can have unequal probabilities of movement, i.e. they can be biased to

move in one direction. In the compound random walk, the walker can still be biased

to move in one direction, but we add the possibility that walkers can stay in place.

We note that for all the basic, biased and compound random walk cases, we assume

all the walkers start on x = 0. This results in a binning issue for the first two cases.

Since the walkers can either take an even or odd number of steps, they end up in

either all even or all odd positions at the end of the simulation; thus, it is necessary

to multiply the final distribution by a scaling constant, C = 2, to plot an accurate

Gaussian model of random walk simulation results, as well as add extra constraints

on histogram binning. For reference, see code in Appendix A.1 and A.2. In the

compound case, shown in Appendix A.3, because walkers have a non-zero probability

of staying in place, we do not need these extra steps.

3.4 Comparing random walk and finite difference

methods

In this section, we give a detailed description of simulation results comparing the

random walk and finite-difference solutions for the drift-diffusion equation. In Fig. 3-

2 through Fig. 3-4, we see comparisons of the basic, biased and compound random

walk cases. All runs used the same number of walkers and steps, and the same initial

condition of all walkers located at the origin x = 0 at time t = 0. The blue pillars are a

34

Page 35: Random Walk Simulation of p-n Junctions

histogram of the walker positions, showing an expected amount of stochastic variation

and overall Gaussian distribution. In each graph, the red line delineates a Gaussian

distribution with mean and standard deviation obtained from walker positions, and

thus represents an idealized version of random walk results. The green line indicates

the expected, non-stochastic result using the finite-difference method, over the same

number of time steps as the random walk process.

Figure 3-2: Basic random walk with equal probability of walkers moving left or rightin each time step. The idealized random walk simulation result (red line) matchesthe finite difference result (green line).

Since the different methods for simulating random walk processes concur with

the finite difference method, we conclude that our interpretation of the random walk

process and theoretical derivation of diffusion and drift constants is correct. We also

note that the compound random walk, whilst slightly more complex than the other

two cases, neatly accounts for the binning issue mentioned in Section 3.3.2; as we can

see in the graph, there are twice the amount of bins (blue pillars) as the other random

walk cases. Though the walkers all start from position x = 0, during each time step,

they no longer end up in solely even or odd positions, due to the probability that some

walkers stay in place. This leads to easier plotting of results and has the potential to

model more realistic carrier behavior.

35

Page 36: Random Walk Simulation of p-n Junctions

Figure 3-3: Biased random walk with walkers moving right with probability 0.7 andmoving left with probability 0.3. The idealized random walk simulation result (redline) matches the finite difference result (green line).

Figure 3-4: Compound random walk with walkers moving right with probability 0.5,moving left with probability 0.4, and staying in place with probability 0.1. Theidealized random walk simulation result (red line) matches the finite difference result(green line).

36

Page 37: Random Walk Simulation of p-n Junctions

Chapter 4

Simulation method for p-n

junctions

4.1 Simulation overview

Previously, we have explored the theory of p-n junctions in Chapter 2, as well as

the applicability of random walks to simulate drift-diffusion processes in Chapter 3.

We now discuss the p-n junction simulation setup, as mentioned in Chapter 1, Section

1.1. Recall that we only consider the p-n junction at equilibrium, envisioning a joining

of the p-type and n-type regions under no external voltage bias. The geometry of the

junction and simulation setup is reproduced in Figure. 4-1 below, showing the p-n

junction right before carriers start to diffuse across the junction. In order to model

the p-n junction with random walks, we discretize the region by representing it as

a series of parallel infinite sheets on which charge carriers and donor atoms can be

located; each step of the random walk transfers the walkers, i.e. electron and hole

charge carriers, to an adjacent infinite sheet.

We note that the ionized donors (blue) and acceptors (red) are fixed charges,

whereas electrons (negative green circle) and holes (positive green circle) are mobile.

In order to simulate the depletion region of our p-n junction, we allow these mobile

charge carriers to undergo random walks; each step of the random walk transfers a

charge carrier to an adjacent infinite sheet. Since the concentration of electrons and

37

Page 38: Random Walk Simulation of p-n Junctions

Figure 4-1: Setup of the p-n junction simulation, in which the junction is discretizedinto a series of infinite sheets, on which electrons, holes, donor atoms, and acceptoratoms reside. The electrons (negative green circles) and holes (positive green circles)are charge carriers free to move away from their original positions near atomic nuclei.Once they do, they leave behind the fixed charges, i.e. ionized donor (positive bluecircles) and acceptor (negative red circles) atoms, which cannot move between sheets.Due to concentration disparity of mobile charge carriers between the p-type and n-type regions, electrons diffuse to the p-type region while holes diffuse to the n-typeregion.

holes is disparate between the p-type and n-type regions, they immediately start to

undergo diffusion, moving from regions of higher concentrations to regions of lower

concentrations. As the blue arrows show, electrons diffuse towards the p-type region,

and holes diffuse towards the n-type region.

In our simulation, we keep track of the fixed and mobile charges by creating

data arrays of length equal to the total number of infinite sheets. At each index of

the data arrays, corresponding to an infinite sheet at a specific location, we store

and update the number of donor atoms, acceptor atoms, mobile charge carriers, and

minority carriers on the infinite sheet. This enables us to initialize the state of the

p-n junction, perform random walk steps using the results of the previous step, and

automatically generate carrier concentration profiles at the end of the simulation.

38

Page 39: Random Walk Simulation of p-n Junctions

4.1.1 Finding discretized electric field

From Chapter 3, we are familiar with how random walks can model drift-diffusion

processes. At each step of the random walk process, the movement of mobile charge

carriers involves not only diffusion, but also drift, generated by the Coulomb inter-

actions between fixed charges and mobile charges on other infinite sheets. Here we

discuss how to obtain the electric field affecting each charge carrier at any time step

of the simulation.

According to Gauss’ law [1], the magnitude of the electric field generated by an

infinite sheet is

E =σ

2ε0

Though our ideal model will assume infinite sheets, we will actually model sheets that

are sufficiently large compared to the lateral dimension of the p-n junction, for ease

of simulation and to define doping concentrations; this decision will be explained in

more detail in Section 4.3.2. For now, we can assume the area of each sheet is A,

and using Gauss’s law on a rectangular “pillbox” surface, as shown in Figure. 4-2, we

obtain the magnitude of the electric field generated by large sheets,

E =Nq

2εsA(4.1)

in which N is the total units of net charge from mobile and fixed carriers, q is the

unit electron charge, and εs is the permittivity of silicon. We note that N is easily

found by totaling up the amount of charge on each sheet, i.e. N = Nd–Na + h–e, in

which Nd is the number of donors, Na is the number of acceptors, h is the number

of holes, and e is the number of electrons. The direction of the field created by each

sheet will depend on the signage of N ; if N is positive, the field will point out from

the sheet, while if N is negative the field will point into the sheet.

Operationally, we have to calculate the electric field felt by each charge carrier at

each step of the random walk process. We observe that for each unique position, i.e.

for each infinite sheet, the electric field felt by charge carriers should be identical in

magnitude, and only differ in signage for electrons versus holes. We can then create

39

Page 40: Random Walk Simulation of p-n Junctions

Figure 4-2: Derivation of electric field generated by each infinite sheet. The electricfield generated by an infinite sheet is perpendicular to the surface, as shown by thesmall green ‘E field’ arrows. By Gauss’ law, if we draw a rectangular “pillbox” oneach sheet, shown by the blue dashed lines, we can calculate the magnitude of theelectric field, which is proportional to net charge within the enclosed area. Overall,as charge carriers diffuse across the junction, an internal electric field arises from theionized donor and acceptor atoms, depicted by the ‘Net E field’ arrow.

an E-field data array which discretizes the electric field, in which each index stores

the magnitude of the electric field felt by charge carriers at that position.

This electric field magnitude is calculated as follows. For each infinite sheet, we

sum up the net charges from the previously mentioned donor, acceptor, and charge

carrier data arrays, then scale by various constants to obtain the electric field, as de-

scribed in Eq. 4.1. Based on the index of the E-field array, we know how many infinite

sheets are to the left or right of the target position; thus, we can appropriately assign

electric field directions and sum up the electric field contributions from other infinite

sheets. Thus, we obtain the total electric field magnitude felt by charge carriers at the

target index. We repeat this process for the whole E-field array during each step of

the random walk process, which amounts to a nested for-loop. As electrons and holes

diffuse across the junction, we know from the discussion in Chapter 1, Section 1.1,

40

Page 41: Random Walk Simulation of p-n Junctions

that an internal electric field arises in the p-n direction (pointing left on the page),

generated by the stationary ionized donor and acceptor atoms. This electric field

will be reflected in the final profile of the E-field data array, when the p-n junction

simulation reaches equilibrium.

4.1.2 Calculating carrier motion probabilities

In Chapter 3, Section 3.1.2, we provided a detailed derivation of carrier motion

probabilities. For ease of reference, the carrier motion probabilities for holes are

reproduced below; for electrons, the sign of the first term is reversed.

r =µE∆t

2∆x+

D∆t

(∆x)2(3.10)

l = −µE∆t

2∆x+

D∆t

(∆x)2(3.11)

Recall that these equations represent drift (first term) and diffusion (second term)

processes, which counteract each other to create a depletion region close to the p-n

junction. This process is depicted in Figure. 4-3 below. As the magnitude of the net

electric field across the junction builds up, electrons drift back towards the n-type

region and holes drift back towards the p-type region, both opposing their respective

directions of diffusion. This creates a depletion region in the middle, with ionized

donors and acceptors but no charge carriers, under the depletion approximation dis-

cussed in Chapter 2. However, since the solutions to the drift-diffusion differential

equations should be continuous, realistically there should be a small but non-zero

amount of charge carriers in the region, as previously shown in Chapter 2, Figure. 2-

2.

From our previous discussion of finding electric field, we have all the parameters

we need to calculate motion probabilities for each carrier, since D and µ are predeter-

mined constants for silicon, and the parameters ∆t and ∆x are simulation parameters

for the random walk process. Our expectation is that we will be able to stochastically

and accurately generate a realistic carrier concentration profile, with a depletion re-

41

Page 42: Random Walk Simulation of p-n Junctions

gion that is not so rigidly defined as the theoretical depletion approximation. We do

so by inserting the Eq. 3.10 and Eq. 3.11 in the overall random walk for-loop, under

each electric field calculation, to update carrier motion probabilities for each infinite

sheet. For a pseudocode summary of the entire simulation process, see the following

section.

Figure 4-3: Carrier motion probabilities describe carrier movement given by oppos-ing drift and diffusion processes, dependent on the diffusion coefficient and internalelectric field. The equilibrated result is a depletion region, in which theoretically nocharge carriers reside; however, our simulations account for stochastic effects, and willshow a more realistic depletion region with few charge carriers remaining.

4.1.3 Running the simulation

To summarize the simulation overview, we provide a pseudocode description of

the data structures used and the simulation process. As discussed, we initialize the

following data arrays, to keep track of charge, electric field, and carrier motion prob-

abilities on each infinite sheet, shown in Table. 4.1 below.

42

Page 43: Random Walk Simulation of p-n Junctions

Table 4.1: Data arrays used to keep track of system behavior at each infinite sheetlocation, denoted with index i. Examples of initial values stored in the arrays areshown in the last column.

Data array Function at ith sheet Ex. of data stored at index iNa Number of acceptor atoms 2000 acceptors (one - unit charge)Nd Number of donor atoms 2000 donors (one + unit charge)holes Number of holes 2000 holes (one + unit charge)elecs Number of electrons 2000 electrons (one - unit charge)rholes Probability that hole moves right 0.5lholes Probability that hole moves left 0.5relecs Probability that electron moves left 0.5lelecs Probability that electron moves left 0.5E-field Electric field felt by carrier 0.00005 N/C

The pseudocode for the entire simulation process is also shown on the next page.

We see that the nested for-loop provides a simple structure: for each time step of

the random walk, we iterate through the series of parallel random sheets, updating

the electric field and carrier motion probabilities, which depend on the positions of

carriers and fixed charges from the previous time step. Then, we use the carrier

motion probabilities to update the position of carriers, which will in turn define the

electric field and motion probabilities for the next time step. The simulation source

code may be found in Appendix B.

43

Page 44: Random Walk Simulation of p-n Junctions

4.2 Material parameters for p-n simulations

Having set up the simulation, we now briefly list material parameters that are

specific to silicon. From Hu, we obtain that typical doping concentrations in silicon

are around 1 × 1016 cm−3 for electrons and holes, which we will use for preliminary

simulations.[2] Mobility of charge carriers is given by material parameters, so we

also use typical values for silicon, i.e. 0.13 m/V · s for electrons and 0.04 m/V · s

for holes.[2] Moreover, the intrinsic carrier concentration of silicon is around ni =

1× 1010 cm−3 at room temperature of 300 K; in our simulations, for ease of setup in

defining minority carrier concentrations, we change the intrinsic carrier concentration

to be around 1× 1015 cm−3. Note that this does not affect the overall behavior of the

system.

4.3 Scaling parameter derivations

To simplify the mechanics of our simulation, we introduce three pairs of scaling

parameters. The first pair, time step ∆t and position step ∆x, are the mean free

time and mean free path between collisions, respectively. They correspond to the

random walk time step, as well as the distance between infinite sheets. In addition,

we also make use of parameters to determine doping concentration, which are related

to the number of initial charge carriers on each sheet init and area of each sheet

A. For ease of calculating the induced electric field within each time step, we also

introduce a unitless parameter E∗ and scaling parameter E0. The parameters and

relevant conversions are summarized in Table. 4.2 and Table. 4.3 below, and can be

referenced in the source code in Appendix B. We now establish the derivation and

usage of each pair of scaling parameters.

4.3.1 Fixed physical dimension (∆x) and time scale (∆t)

We briefly note the physical dimension and time scale of our simulation. Firstly,

we set the position step to ∆x to 20 nanometers, which is a typical value for the mean

44

Page 45: Random Walk Simulation of p-n Junctions

Table 4.2: Summary of scaling parameters and their interpretation, or conversion toSI units. Values shown are initial values.

Parameter Symbol Fixed/Variable Value InterpretationTime step ∆t Fixed 5.88× 10−14 s Random walk time stepPosition step ∆x Fixed 2× 10−8 m Distance b/w adjacent sheetsInitial carriers init Variable 2000 Doping concentrationArea of sheet A Fixed 1× 10−11 m2 Nd = init · A ·∆xE-field unit E∗ Variable N

2Electric field

E-field scaling E0 Fixed qεsA

E = E∗ · E0

Table 4.3: Summary of other constant parameters, both unitless and in SI units.Constants obtained from Hu.[2]

Physical interpretation Symbol Value or unitless descriptionNumber of time steps taken overall numSteps 20000 stepsTotal number of sheets numSheets 100 sheetsNet charge on each sheet N countsElectron charge q 1.6× 10−19 CPermittivity of silicon εs 12 · 8.85× 10−12 F/mMobility of electrons in silicon µn 0.13 m2/V · sMobility of holes in silicon µp 0.04 m2/V · sThermal voltage kT

q0.02586 V

free path of electron transport within silicon from Vasileska, et al.[9] Over the fixed

number of N = 100 sheets, this indicates we are simulating a p-n junction system in a

range spanning about 2 µm. For ease of interpreting results, we will keep this physical

dimension fixed. For ease of simulation, we will also set the boundary condition that

carriers cannot move out of the 2 µm p-n junction system.

For our time scale, we use ∆t = 5.88 × 10−14 seconds, or 0.0588 picoseconds.

This value is determined as follows. We first refer back to Eq. 3.7 for the diffusion

coefficient derived in Chapter 3, reproduced below.

D =(∆x)2

2∆t(r + l) (3.7)

At this point, we have assumed a fixed value for ∆x, and are able to find carrier

motion probabilities r and l through the process outlined in Section 4.1.2. Thus, the

only unknown values so far are the diffusion coefficient D and time step ∆t.

45

Page 46: Random Walk Simulation of p-n Junctions

However, as mentioned in Chapter 3, Section 3.1.2, the diffusion coefficient is a

constant material parameter. It is commonly defined by the Einstein relationship,

shown in Eq. 4.2 and Eq. 4.3.[2] This relationship indicates that we can calculate the

diffusion coefficient values for electrons and holes by multiplying thermal voltage kTq

by the respective carrier mobilities.

Dn =kT

qµn (4.2)

Dp =kT

qµp (4.3)

From these equations, we can obtain an appropriate constant value for D, then

plug it back into into Eq. 3.7. In order to define a reasonable value for ∆t, we will

choose to use the Einstein relationship with electron mobility in Eq. 4.2, and assume

the basic random walk case, in which the left and right motion probabilities satisfy

r+ l = 1. We obtain the diffusion coefficient D = 34 cm2/s, which is a realistic value

for electron transport in silicon.[2] From this value, we determine ∆t = 5.88× 10−14

seconds. Note that this time scale value is within range for the typical mean free time

between collisions during carrier flow, as found in Vasileska, et al., so our process for

defining ∆t has been effective.[9]

Finally, we will run each simulation over 20,000 time steps, which is a number

experimentally determined to let the system reach equilibrium; with the time step

of ∆t = 5.88 × 10−14 seconds, we essentially simulate the system for around 1.2

nanoseconds.

4.3.2 Doping concentration: fixed A and variable init

Doping concentrations are a measure of number of dopants within a certain vol-

ume, and we have three relevant scaling parameters to control this: the area of each

sheet A, the fixed position step ∆x, and the initial number of charge carriers on

each sheet, init. To effectively vary doping concentration, we must set an additional

parameter to a constant, and we have chosen to fix the area of each sheet, A. There

46

Page 47: Random Walk Simulation of p-n Junctions

is a subtlety to this point, as in our setup we mentioned the use of infinite sheets;

we are not considering variation along the axes parallel to the p-n junction interface

and our simulation is wholly 1-dimensional. However, we fix the area of each sheet

to be a sufficiently large value (10 µm) compared to the lateral dimension of the p-n

junction (2 µm), which preserves our infinite sheet assumption. We can then set

dopant concentration by varying the number of charge carriers and donors/acceptors

on each sheet, which is controlled by the variable init. For our simulations, we set

the value of init at 2000 counts, corresponding to a doping concentration of 1× 1016

cm−3 by the conversion shown in Table 1.

4.3.3 Electric field: fixed scaling parameter and E-field unit

Next, we discuss the scaling parameter and unit used for the induced electric

field, E0 and E∗. Recall that in order to calculate the electric field at each time

step, we have create an E-field array to store the electric field felt by carriers in each

infinite sheet. As discussed in Section 4.1.1, by Gauss’ Law, the net charge on each

infinite sheet will give us the magnitude of the electric field produced by said sheet.

The direction of the electric field points out of or into the sheet, depending on the

signage of net charge on the sheet and the signage of the moving charge carrier, but

will always be opposite for left and right sides of the sheet. In order to fill in the

position array, we have to iterate over all the infinite sheets while considering if they

are to the left or right of the target sheet. Since this process is relatively involved,

we find it easier to establish an electric field unit, E∗, which is directly proportional

to the net charge N , to describe the electric field produced by each sheet; in order to

convert to SI units, we multiply by an E-field scaling parameter E0. The derivation is

summarized below. From our previous discussion, we have the electric field generated

by an infinite sheet as:

E =Nq

2εSA(4.1)

47

Page 48: Random Walk Simulation of p-n Junctions

We can pull out the physical constants to define the E-field scaling parameter:

E0 =q

εSA(4.4)

So, the E-field unit parameter is then

E∗ =N

2(4.5)

with the electric field SI unit conversion given by E = E∗ · E0. Having defined

these scaling parameters, it is simple to write the process for finding electric field

on each sheet. Additionally, these scaling parameters also help us simplify the code

to for left/right movement probabilities within the random walk. For example, from

Chapter 3 Eq. 3.10, the bias in the probability of moving right in a basic random

walk with r + l = 1 is

r − 1

2=µE∆t

2∆x= E∗

µE0∆t

2∆x= E∗

µe∆t

2εsA∆x

in which we can simplify the complicated fraction to a constant, c1 = µe∆t2εsA∆x

. For

reference, see code in Appendix B.

4.4 Simulation strategy

4.4.1 Basic p-n junction case

Having set up simulation parameters, we now discuss implementation strategy

and expectations. In this thesis, we will explore two different cases of p-n junction

simulations. Firstly, as proof of concept, we consider a simple basic case in which

charge carriers can either move left or right, corresponding to the basic random walk

case in Chapter 3. For this simulation, since the probabilities of moving left and

right sum to 1, we will use the carrier probabilities in a simplified form, derived from

Eq. 3.13 and Eq. 3.14:

48

Page 49: Random Walk Simulation of p-n Junctions

r =µE∆t

2∆x+

D∆t

(∆x)2=µE∆t

2∆x+

1

2

l = −µE∆t

2∆x+

D∆t

(∆x)2= −µE∆t

2∆x+

1

2

(4.6)

4.4.2 Limitation of basic p-n junction case

However, we now explain that basic random walk assumption results in a key

limitation: namely, that we can only incorporate the diffusion coefficient value for

electrons. From Eq. 4.6 above, we see that we have equated the diffusion term to:

D∆t

(∆x)2=

1

2(4.7)

From our definition of the fixed time and position step parameters in Section 4.3.1,

this relation only works with the electron diffusion coefficient, which is dependent

on electron mobility µn by the Einstein relationship in Eq. 4.2. However, we recall

from Table. 4.3 that holes have a different mobility, and therefore a different diffusion

constant. If we plug in the hole mobility µp = 0.04 m2/V · s to Eq. 4.7, we obtain:

Dp∆t

(∆x)2= (

kT

qµp)

∆t

(∆x)2= 0.1521 6= 1

2(4.8)

Then from the first half of Eq. 4.6, we have

rp =µpE∆t

2∆x+ 0.1521 (4.9)

lp = −µpE∆t

2∆x+ 0.1521 (4.10)

in which rp + lp = 0.3042 6= 1. We infer from this equation that about 70% of holes

do not move left or right, i.e. they need to stay in place. However, our basic random

walk method requires that rp + lp = 1, which results in an incorrect carrier motion

probability. For instance, if rp is calculated first in the simulation, as shown in Eq.4.9,

then we have an incorrect expression

49

Page 50: Random Walk Simulation of p-n Junctions

lp = 1− rp = −µpE∆t

2∆x+ 0.8479 (4.11)

which will force holes that should have stayed in place to move towards the left,

as opposed to the correct expression in Eq. 4.10. Thus, the basic random walk

cannot accurately model p-n junction behavior when realistic diffusion coefficients

are incorporated; we will demonstrate this in Chapter 5, Section 5.2.

4.4.3 Compound p-n junction case

The basic case limitation pushes us to consider a compound case, in which

charge carriers can move left, right, or stay in place, corresponding to the compound

random walks performed in Chapter 3. For this simulation, we will use the original

form of carrier motion probabilities:

r =µE∆t

2∆x+

D∆t

(∆x)2

l = −µE∆t

2∆x+

D∆t

(∆x)2

(4.12)

Additionally, during the process of updating position arrays, as shown in the

pseudocode in Section 4.1.3, we will add cases to account for carriers staying in place.

This relaxes the requirement that the left and right motion probabilities must sum

to 1 for both electrons and holes. Then, we can use the electron and hole mobilities

in Table. 4.3 to obtain different diffusion coefficients Dn and Dp, plug them in to

the above equations, and independently calculate four motion probabilities: electrons

moving right (rn) and left (ln), as well as holes moving right (rp) and left (lp). For

reference, see the compound p-n junction code in Appendix B.

Thus, the compound p-n junction allows us to move beyond the limitations of the

basic case and incorporate realistic mobilities for different charge carriers. We will

demonstrate this result in Chapter 5, Section 5.3.

50

Page 51: Random Walk Simulation of p-n Junctions

Chapter 5

Results

In this chapter, we will explore two different cases of the p-n junction simulations:

basic and compound. For clarity, we briefly outline our expectations.

1. Overall, the behavior of our p-n junction simulations should match theoreti-

cal predictions discussed in Chapter 2. By dynamically changing the carrier motion

probabilities for mobile charge carriers performing random walks, we implement coun-

terbalanced drift and diffusion processes. We expect these processes to give typical

depletion width, electric field, and electric potential profiles for a p-n junction.

2. In Section 4.4.2, we discussed the limitation of using a basic random walk

strategy that assumes carriers move either left or right, namely that the diffusion co-

efficient value is constrained. Hence, we expect that the basic p-n junction simulation

cannot incorporate a realistic diffusion coefficient for holes, and we will demonstrate

how the simulation fails in Chapter 5, Section 5.2.

3. In Section 4.4.3, we have proposed a compound p-n junction simulation, which

will solve the aforementioned problem. We expect two results: firstly, when we plug in

identical values for diffusion coefficients, as in the basic case, the compound case will

display identical behavior. Secondly, when we plug in the hole mobility and diffusion

coefficient, the compound case will successfully model the p-n junction with realistic

material parameters.

51

Page 52: Random Walk Simulation of p-n Junctions

5.1 Basic p-n junction simulation

Here we present simulation results of the basic p-n junction simulation, assum-

ing doping concentration of 1e16 cm−3 for both the p-type and n-type regions. As

discussed in Chapter 4, our carrier motion probabilities are:

r =µE∆t

2∆x+

1

2

l = −µE∆t

2∆x+

1

2

(4.6)

Having set up the relationship between probability of directional movement and the

strength of the electric field felt by each infinite sheet, we can run the simulation

for 20,000 time steps, an experimentally determined length of time decided by how

quickly the simulation results stabilize. Since the time step ∆t = 0.0588 ps, each

run simulates the system over 1.2 ns. Final results are averaged over 2000 runs. As

shown in Figure. 5-1(a), we start from a particle density of 2000 carriers on each

infinite sheet for holes and electrons, and as the system evolves, the depletion region

is formed due to the balancing diffusion and drift processes. The black and red lines

indicate concentrations of holes and electrons versus position in the junction, and the

green line indicates the distribution of total charge; as expected, there is a depletion

of charge around the junction, but the transition between bulk material and depletion

region is not as abrupt as that of the theoretical model, in Figure. 5-1(b).

The theoretical expectation for depletion width, using the conventional theory

outlined in Chapter 2, is graphed in the blue line in Figure. 5-1(a); visual inspection

will confirm that our simulation result matches this value. An estimate of depletion

width from our simulation, given by a full-width-half-max calculation, shows that the

estimated depletion width of 5.742∆x, or around 115 nm, is close to the expected

theoretical value of 7.834∆x, or around 157 nm, calculated using the depletion ap-

proximation in Chapter 2. This simulation performance matches our expectation for

the stochastic benefits of our random walk model; we have obtained depletion width

results within around 25% from the theoretical value. We note that the theoretical

depletion width approximation does not necessarily depict a perfectly realistic deple-

52

Page 53: Random Walk Simulation of p-n Junctions

tion layer, which indicates that our simulation results are viable. Using basic random

walks, we have included a statistical estimate of realistic carrier distribution around

the depletion region, and did so without resorting to the complexity of conventional

partial differential equation solutions.

Next, we briefly consider the np product relation, previously mentioned in Chapter

2. Since we have not yet incorporated recombination-generation processes in our

simulation, we do not expect this relation to hold true. However, our chosen minority

carrier concentration happens to approximate the np product relation, as follows.

From Chapter 2, Section 2.1, we have the relation np = n2i , which we can write in

the form:np

ni2= 1 (2.1)

For ease of simulation, we assume that there is an integer number of minority carriers

per sheet, i.e. 2 carriers per sheet. We obtain an estimated value for n2i by graphing

the product of electron and hole concentrations (np) versus position. Since we want

the product to remain constant, we can then optimize for n2i ; in Figure. 5-2, we show

that the estimate n2i = 2.8× 1042 m−6 gives a 1:1 ratio of np and n2

i for our current

system.

Without incorporating recombination-generation processes, the n2i estimate is

larger than expected. An additional source of error lies in our boundary conditions.

Because carriers cannot move beyond the 100 sheets, the carriers originally in the de-

pletion layer have to spread out over the quasi-neutral regions; this results in a higher

carrier count than expected. In addition, there is a small peak in the np product at

the p-n junction interface, which is caused by the few charge carriers remaining in

the depletion layer, as shown in Figure. 5-1(a).

Future work can compensate for these effects with more sophisticated boundary

conditions or a longer physical length for the p-n junction, which will allow the

quasi-neutral regions to be closer to neutral. The fundamental solution would be

to incorporate carrier generation and recombination processes to ensure the system

is in dynamic equilibrium. Nevertheless, for the purposes of this thesis, the overall

53

Page 54: Random Walk Simulation of p-n Junctions

(a) Graph of p-n junction carrier distribution and depletion width us-ing basic random walk method. Black and red lines indicate hole andelectron distribution, respectively, and the green line indicates totalcharge distribution. Blue line is the theoretical expectation for depletionwidth of 7.834∆x, whereas our simulation results in a depletion width of5.742∆x, which is within around 25% of the theoretical result calculatedusing the depletion approximation in Chapter 2.

(b) Theoretical description of p-n junction total charge distribution. Total charge distribu-tion is the solid black lines, while the depletion width is the distance between −xp0 and xn0.We note the abrupt transition from bulk material to depletion region completely devoidof charge carriers, which arises from the purely numerical nature of the partial differentialequation solution method.[11]

Figure 5-1: Comparing the total charge distribution and depletion width estimatesof our basic p-n junction simulation, versus the theoretical expectation from thedepletion approximation explained in Chapter 2.

54

Page 55: Random Walk Simulation of p-n Junctions

Figure 5-2: An estimate of n2i = 2.8 × 1042 allows us to approximate the expected

relation np = n2i .

behavior of the p-n junction is not overly affected. Since our simulation is just a proof

of concept, we can still use our estimated n2i value to calculate the electric potential,

as derived in Chapter 2.

Having discussed depletion width and obtained an estimate for n2i , we now look

into the electric field and potential graphs of the p-n simulation to confirm that the

simulation is modeling the correct processes. As shown in Figure. 5-3, we obtain the

electric field by integrating over charge distribution and obtain the potential graph by

integrating over the electric field. For comparison, since at each step in our random

walk simulation we calculate the electric field felt by the charge carriers on each

infinite sheet, we already have an array of electric field values for each position in

the p-n junction. We can then directly graph the electric field in Figure. 5-3(a), and

then integrate to obtain the voltage versus position graph in Figure. 5-4(a). Using

the integration method for the potential, we obtain a value of 0.0941 V from the

simulation. The theoretical potential, obtained using the depletion approximation

in Chapter 2, is 0.0925 V; our simulated potential is accurate to within 1% of the

expected value. Both potential calculations use the estimated value of n2i = 2.8×1042

m−6 from Figure. 5-2.

55

Page 56: Random Walk Simulation of p-n Junctions

(a) Simulation results for the net electric field, in which the electric fieldis directly graphed from the array E-field used to calculate random walkprobabilities, previously discussed in Chapter 4.

(b) Theoretical description of p-n junction electric field.[11]

Figure 5-3: Comparing the electric field of simulation versus that of the theoreticaldescription.

56

Page 57: Random Walk Simulation of p-n Junctions

(a) Potential is calculated by integrating the electric field from Figure. 5-3(a).

(b) Theoretical description of p-n junction potential profile.[11] Poten-tial is calculated by integrating the electric field from Figure. 5-4(a).

Figure 5-4: Comparing the potential profile of simulation versus that of the theoret-ical description. Results from the potential calculation show a close match betweensimulation (0.0941 V) and theory (0.0925 V), which are within 1% of each other.

57

Page 58: Random Walk Simulation of p-n Junctions

5.2 Realistic diffusion coefficient issue

From our previous discussion in Chapter 4, Section 4.4.2, we know that when we

plug in realistic values of µp and Dp for holes into a basic p-n junction simulation, we

bias the carriers to move in one direction. Recall that the carrier motion probabilities

for holes become:

rp =µpE∆t

2∆x+ 0.1521 (4.10)

lp = −µpE∆t

2∆x+ 0.8479 (4.12)

Thus, carriers that should stay in place are biased to move towards the left. Since

boundary conditions constrain carriers to stay within the p-n system of 100 sheets,

there is a buildup of holes at the left end of the system. Due to local Coulomb

interactions taken into account by the drift term our carrier motion probabilities, a

significant number of electrons also move towards the left end of the system. Figure. 5-

5 demonstrates this behavior.

Figure 5-5: Basic p-n junction simulation with realistic hole mobility and diffusioncoefficient. Performance fails due to no consideration of carriers staying in place. Bydefault, extra carriers move with bias towards one end of the junction

58

Page 59: Random Walk Simulation of p-n Junctions

Therefore, to fix this issue, we add independent calculations of both left and right

movement probabilities, as well as cases to account for carriers staying in place. This

becomes our compound p-n junction simulation, with code in Appendix B.3.

5.3 Compound p-n junction simulation

Here we explore the results of the compound p-n junction simulation, defined as

using the hole motion probabilities below. As before, we obtain the electron motion

probabilities by changing the sign of the first term.

r =µE∆t

2∆x+

D∆t

(∆x)2

l = −µE∆t

2∆x+

D∆t

(∆x)2

(4.6)

Again, we start from the initial concentration of 2000 charge carriers (either holes

or electrons) on each infinite sheet, simulate the system over a total time frame of 1.2

ns, and average results over 2000 runs. In Figure. 5-6(a), we only use the electron

diffusion coefficient in order to demonstrate consistency with the basic p-n junction

simulation. As shown, we obtain a depletion width of 5.745∆x. This value is within

0.1% of the depletion width found using the basic p-n junction simulation, 5.742∆x;

the difference is negligible and arises from the stochastic nature of the simulation. In

addition, there is no significant difference in our estimates for potential; the compound

case results in a potential of 0.0944 V, which is within 0.5% of the previous basic case

potential, 0.0941 V. Therefore, our compound p-n junction simulation and basic p-n

junction simulation are consistent.

Next, we demonstrate the advantages of using the compound p-n junction simu-

lation. In Figure. 5-6(b), we now plug in realistic values of µp and Dp for holes. As

discussed in Chapter 4, Section 4.4.3, since the compound p-n junction simulation

accounts for carriers staying in place, we are no longer constrained by the requirement

that rp + lp = 1. This allows us to calculate the carrier motion probabilities inde-

pendently, and results in the expected equilibration process for a p-n junction. We

59

Page 60: Random Walk Simulation of p-n Junctions

obtain a depletion width of 5.716∆x, which is reasonable given the range of depletion

width values we have simulated so far.

In short, from these runs of the compound p-n junction simulation, we can see

that our expectation for consistency with the basic p-n junction simulation is met. In

addition, we can use different mobilities and diffusion coefficient values for different

charge carrier species, by adjusting the calculation method of carrier motion proba-

bilities and allowing carriers to stay in place. Therefore, the compound approach is

the most flexible and comprehensive of our p-n junction simulations.

60

Page 61: Random Walk Simulation of p-n Junctions

(a) Depletion width w = 5.745∆x, electric potential 0.0944 V, using thesame simulation parameters as the basic p-n junction simulation.

(b) Depletion width w = 5.716∆x, electric potential 0.0930 V, usingrealistic mobility and diffusion coefficient for holes.

Figure 5-6: Compound p-n junction simulation results are consistent with basicemphp-n junction simulation results, and can also handle realistic mobility and dif-fusion coefficient parameters. The green lines represent total charge concentrations,black lines represent hole concentrations, red lines represent electron concentrations,and the blues lines are the analytical expectations for depletion width, existing asreference.

61

Page 62: Random Walk Simulation of p-n Junctions

Chapter 6

Conclusions and future work

In this thesis, we have explored the use of Monte Carlo random walks to model

drift-diffusion processes, in particular their efficacy at simulating carrier transport in

p-n junctions at equilibrium. Here we summarize the conclusions drawn and point

towards future research directions.

Taking a simple classical view, carrier transport in p-n junctions is character-

ized by two counterbalancing processes: diffusion, resulting from difference in carrier

concentration gradient, and drift, resulting from local Coulomb interactions between

carriers and dopant atoms. To describe this process, we rely on differential equa-

tions of varying complexity, such as the drift-diffusion equation discussed in Chapter

3. There are more complex extensions of this equation, discussed in Vasileska et al.,

that cover semiclassical to quantum approaches and have their respective advantages.

[9] However, model complexity quickly becomes an issue, as an increasing number of

coupled differential equations are needed to account for external conditions, such as

illumination by light sources, etc.

By contrast, the most conventional approach towards simulating p-n junctions

relies on the depletion approximation, which we have developed the framework for

in Chapter 2. As demonstrated, this theoretical treatment can adequately predict

p-n junction carrier profiles, but assumes an unrealistic, abrupt depletion layer com-

pletely unpopulated by charge carriers. In addition, the mathematical process, while

effectively avoiding solving complicated differential equations, requires specific knowl-

62

Page 63: Random Walk Simulation of p-n Junctions

edge of semiconductor physics and statistical mechanics, thus making it unsuitable

for communication to a broader audience.

The Monte Carlo random walk approach presents a simple alternative to p-n junc-

tion simulation. We revisit the three points proposed in Chapter 1: firstly, random

walk simulations result in reasonably accurate and realistic charge carrier profiles,

with a small but non-zero amount of charge carriers remaining in the depletion layer.

We note that since our simulation makes the classical assumption that particles have

a simultaneously defined position and momentum, our simulation is not applicable to

small systems where quantum mechanical effects become pronounced. However, for

the purposes of large-scale simulation and understanding the key points of junction

physics, our model is viable.

Secondly, the random walk method is flexible. Since charge carriers are treated

as individual particles undergoing random walks that can be biased by external and

local effects, external conditions such as radiative excitation can be easily added to the

system.[10] Carrier transport in bulk semiconductors is often modelled with random

walks for this reason, for example in software such as CASINO,[7] and the capability

to model junction physics using similar methods lends a similar degree of flexibility.

Thirdly, as we can glean from the discussion in Chapter 1, Section 1.1.2, random

walks are mathematically simple and can offer an intuitive understanding of carrier

transport to a general audience. Recent literature suggests that in the solar energy

industry, open-access platforms for band diagram simulation are valuable for acces-

sibility and ease of experimental design. In particular, the band diagram of mobile

ions in halide perovskite solar cells is similar to that of p-n junctions, and researchers

have proposed a hybrid approach, combining analytical and numerical analysis, to

enable a wide range of users to accurately and quickly simulate these systems. [13]

Thus, Monte Carlo random walks are a promising avenue for p-n junction sim-

ulation. This thesis lays out a basic methodology and presents preliminary results.

To summarize, in Chapter 3, we explain and validate how to model drift-diffusion

equations with random walks, accounting for different strategies that improve upon

the basic random walk model, such as allowing a portion of carriers to stay in place.

63

Page 64: Random Walk Simulation of p-n Junctions

We then discuss the assumptions and setup for a basic p-n junction, and in Chapter

5, we demonstrate that the random walk approach can model depletion layer profiles

with comparable accuracy to the theoretical depletion approximation. In particular,

our prior exploration of different random walk models enables us to design a robust

and flexible compound p-n junction simulation.

We acknowledge that we have made our own share of assumptions, including

an exaggerated minority carrier concentration, rigid boundary conditions, transport

processes and electric fields that act only in one dimension, and a system confined

to the classical regime. These assumptions do not prevent us from capturing the

main features of p-n junction behavior; they were all made to simplify the simulation

process, and they can be rectified in future work.

More broadly, future work on random walk simulation of p-n junctions can fall

into three categories. We hope to move towards more accurate and comprehensive

physics: as discussed, we can replace assumptions with more realistic conditions. We

also need to incorporate more fundamental processes, such as carrier recombination

and generation. Computationally, the relative simplicity of this model also presents

interesting questions in the cost-benefit analysis of model complexity, as well as the

vectorization capabilities of different programming languages. Finally, since the ran-

dom walk approach is extremely accessible, both in terms of mathematical simplicity

and low computational cost, it can be utilized as an educational tool for undergrad-

uate students and non-scientific audiences alike.

64

Page 65: Random Walk Simulation of p-n Junctions

Appendix A

Simulation code for random walks

A.1 Basic random walk

1 %Random walk ba s i c case

2 %J e n n i f e r Wang, 10/18/19

3

4 c l e a r a l l ; c l o s e a l l

5

6 numWalkers = 20000 ; %number o f walkers

7 N = 1000 ; %number o f s t ep s each walker takes

8 r = 0 . 5 ; %p r o b a b i l i t y o f a walk tak ing a step to the r i g h t

9 s = 0 ; %p r o b a b i l i t y o f s tay ing in p lace

10 pos=ze ro s (1 , numWalkers ) ; %i n i t i a l p o s i t i o n o f a l l wa lkers

11 f i g u r e

12 p lo t ( pos , 1 : numWalkers , ’ r∗ ’ )

13 a x i s ([−3∗ s q r t (N) , 3∗ s q r t (N) ,0 , numWalkers ] )

14 pause ( . 1 )

15

16 c = ze ro s (2∗N+1 ,2) ;

17 i 0 = 1 ;

65

Page 66: Random Walk Simulation of p-n Junctions

18 i 1 = 2 ;

19 c (N) = numWalkers ;

20 D = 0 . 5 ;

21 U = 0 ; % U = r−l

22

23 f o r n=1:N

24 prob=rand (1 , numWalkers ) ;

25 pos ( prob<r ) = pos ( prob<r ) +1;

26 pos ( prob>=r+s ) = pos ( prob>=r+s )−1;

27 %d i f f u s i o n equat ion

28 f o r m = 2:2∗N

29 c (m, i 1 ) = c (m, i 0 ) + D∗( c (m−1, i 0 )−2∗c (m, i 0 )+c (m+1, i 0 ) )

;

30 end

31 i i = i 1 ;

32 i 1 = i 0 ;

33 i 0 = i i ;

34 p lo t ( pos , 1 : numWalkers , ’ r∗ ’ )

35 a x i s ([−N, N, 0 , numWalkers ] )

36 drawnow

37 end

38

39 %the t h e o r e t i c a l d i s t r i b u t i o n

40 xMean=(2∗r−1)∗N

41 xMeanSimulation=sum( pos ) /numWalkers

42 sigma=s q r t (4∗ r∗(1− r )∗N)

43 s igmaSimulat ion=s q r t (sum( pos . ˆ 2 ) /numWalkers−xMeanSimulation

ˆ2)

44 C=2∗numWalkers ;

45 xD i s t r i b u t i on=−N:N;

66

Page 67: Random Walk Simulation of p-n Junctions

46 probDi s t r ibu t i on=C/( s q r t (2∗ pi ∗ sigma ˆ2) ) ∗ . . .

47 exp(−( xDi s t r ibut i on−xMean) .ˆ2/(2∗ sigma ˆ2) ) ;

48 probDi s t r i bu t i on 2=C/( s q r t (2∗ pi ∗ s igmaSimulat ion ˆ2) ) ∗ . . . %

us ing s imu la t i on mean and sigma

49 exp(−( xDi s t r ibut i on−xMeanSimulation ) .ˆ2/(2∗

s igmaSimulat ion ˆ2) ) ;

50 fd = c ( : , 1 ) ;

51 %s i n c e walkers s p l i t between prev & t h i s s tep ; t h i s i s f a s t e r

52

53 %plo t d i s t r i b u t i o n

54 f i g u r e

55 [ b inD i s t r i bu t i on , binX]= h i s t ( pos ,2∗N) ;

56 h i s t ( pos ,2∗N)

57 hold on

58 p lo t ( xDi s t r ibut i on , p robDi s t r ibut i on 2 , ’ r− ’ , ’ LineWidth ’ , 2 ) ;

59 p lo t ( xD i s t r i bu t i on ( 2 : 2 : end ) , fd ( 2 : 2 : end ) , ’ g− ’ , ’ LineWidth ’ , 2 ) ;

60 a x i s ( [ min ( binX )−5,max( binX ) +5 ,0 ,max( b i n D i s t r i b u t i o n ) / 0 . 6 5 ] )

61 x l a b e l ( ’ Po s i t i on ’ )

62 y l a b e l ( ’Number o f Walkers ’ )

63 t ex t (min ( binX )+(max( binX )−min( binX ) ) ∗ . 6 ,max( b i n D i s t r i b u t i o n )

∗ 1 . 2 , . . .

64 [ ’ r= ’ , num2str ( r ) ] )

65 t ex t (min ( binX )+(max( binX )−min( binX ) ) ∗ . 6 ,max( b i n D i s t r i b u t i o n )

∗ 1 . 1 , . . .

66 [ ’ l= ’ , num2str(1− r ) ] )

67 t ex t (min ( binX )+(max( binX )−min( binX ) ) ∗ . 6 ,max( b i n D i s t r i b u t i o n )

, . . .

68 [ ’Number o f Walkers=’ , num2str ( numWalkers ) ] )

69 t ex t (min ( binX )+(max( binX )−min( binX ) ) ∗ . 6 ,max( b i n D i s t r i b u t i o n )

∗ . 9 , . . .

67

Page 68: Random Walk Simulation of p-n Junctions

70 [ ’Number o f Steps=’ , num2str (N) ] )

A.2 Biased random walk

Note that the code for graphing the biased random walk is the same as that of

the basic random walk; hence, it is not reproduced below.

1 %Random walk b iased case

2 %J e n n i f e r Wang, 10/1/2019

3

4 c l e a r a l l ; c l o s e a l l

5

6 numWalkers = 20000 ; %number o f walkers

7 N = 1000 ; %number o f s t ep s each walker takes

8 r = 0 . 7 ; %p r o b a b i l i t y o f a walk tak ing a step to the r i g h t

9 s = 0 ; %always 0 f o r t h i s s imu la t i on

10 pos=ze ro s (1 , numWalkers ) ; %i n i t i a l p o s i t i o n o f a l l wa lkers

11 f i g u r e

12 p lo t ( pos , 1 : numWalkers , ’ r∗ ’ )

13 a x i s ([−3∗ s q r t (N) , 3∗ s q r t (N) ,0 , numWalkers ] )

14 pause ( . 1 )

15

16 c = ze ro s (2∗N+1 ,2) ;

17 i 0 = 1 ;

18 i 1 = 2 ;

19 c (N) = numWalkers ;

20 D = 0 . 5 ;

21 U = r − (1− r ) ;

22

23 f o r n=1:N

24 prob=rand (1 , numWalkers ) ;

68

Page 69: Random Walk Simulation of p-n Junctions

25 pos ( prob<r ) = pos ( prob<r ) +1;

26 pos ( prob>=r+s ) = pos ( prob>=r+s )−1;

27

28 %d i f f u s i o n equat ion

29 f o r m = 2:2∗N % again , s i n c e walkers must move p o s i t i o n s ,

c b ins a l t e r n a t e even−odd

30 c (m, i 1 ) = c (m, i 0 ) + D∗( c (m−1, i 0 )−2∗c (m, i 0 )+c (m+1, i 0 ) )

− U∗0 .5∗ ( c (m+1, i 0 ) − c (m−1, i 0 ) ) ;

31 end

32 i i = i 1 ;

33 i 1 = i 0 ;

34 i 0 = i i ;

35 %end

36 p lo t ( pos , 1 : numWalkers , ’ r∗ ’ )

37 a x i s ([−N, N, 0 , numWalkers ] )

38 drawnow

39 end

40

41 %the t h e o r e t i c a l d i s t r i b u t i o n

42 xMean=(r−(1−r−s ) )∗N

43 xMeanSimulation=sum( pos ) /numWalkers

44 sigma=s q r t (4∗ r∗(1−r−s )∗N)

45 s igmaSimulat ion=s q r t (sum( pos . ˆ 2 ) /numWalkers−xMeanSimulation

ˆ2)

46 C=2∗numWalkers ;

47 xD i s t r i b u t i on=−N:N;

48 probDi s t r ibu t i on=C/( s q r t (2∗ pi ∗ sigma ˆ2) ) ∗ . . .

49 exp(−( xDi s t r ibut i on−xMean) .ˆ2/(2∗ sigma ˆ2) ) ;

50 probDi s t r i bu t i on 2=C/( s q r t (2∗ pi ∗ s igmaSimulat ion ˆ2) ) ∗ . . . %

us ing s imu la t i on mean and sigma

69

Page 70: Random Walk Simulation of p-n Junctions

51 exp(−( xDi s t r ibut i on−xMeanSimulation ) .ˆ2/(2∗

s igmaSimulat ion ˆ2) ) ;

52 fd = c ( : , 1 ) ;

A.3 Compound random walk

1 %Random Walk compound case

2 %J e n n i f e r Wang, 10/1/2019

3

4 c l e a r a l l ; c l o s e a l l

5

6 numWalkers = 20000 ; %number o f walkers

7 N = 1000 ; %number o f s t ep s each walker takes

8 r = 0 . 5 ; %p r o b a b i l i t y o f a walker tak ing step to r i g h t

9 s = 0 . 1 ; %p r o b a b i l i t y o f a walker s tay ing

10 pos=ze ro s (1 , numWalkers ) ; %i n i t i a l p o s i t i o n o f a l l wa lkers

11 f i g u r e

12 p lo t ( pos , 1 : numWalkers , ’ r∗ ’ )

13 a x i s ([−3∗ s q r t (N) , 3∗ s q r t (N) ,0 , numWalkers ] )

14 pause ( . 1 )

15

16 c = ze ro s (2∗N+1 ,2) ;

17 i 0 = 1 ;

18 i 1 = 2 ;

19 c (N) = numWalkers ;

20 D = (1− s ) ∗ 0 . 5 ; %h a l f o f prob r i g h t + prob l e f t

21 U = r −(1−r−s ) ; %prob r i g h t − prob l e f t

22

23 t i c

70

Page 71: Random Walk Simulation of p-n Junctions

24 f o r n=1:N

25 prob=rand (1 , numWalkers ) ;

26 pos ( prob<=r ) = pos ( prob<=r ) +1;

27 pos ( prob>=r+s ) = pos ( prob>=r+s )−1;

28

29 %d i f f u s i o n equat ion

30 f o r m = 2:2∗N

31 c (m, i 1 ) = c (m, i 0 ) + D∗( c (m−1, i 0 )−2∗c (m, i 0 )+c (m+1, i 0 ) )

− U∗0 .5∗ ( c (m+1, i 0 ) − c (m−1, i 0 ) ) ;

32 end

33 i i = i 1 ;

34 i 1 = i 0 ;

35 i 0 = i i ;

36 p lo t ( pos , 1 : numWalkers , ’ r∗ ’ )

37 a x i s ([−N, N, 0 , numWalkers ] )

38 drawnow

39 end

40 toc

41

42 %the t h e o r e t i c a l d i s t r i b u t i o n

43 xMean=(r−(1−r−s ) )∗N

44 xMeanSimulation=sum( pos ) /numWalkers

45 sigma=s q r t (4∗ r∗(1−r−s )∗N)

46 s igmaSimulat ion=s q r t (sum( pos . ˆ 2 ) /numWalkers−xMeanSimulation

ˆ2)

47 C = numWalkers ; %removed the ∗2 fudge f a c t o r

48 xD i s t r i b u t i on=−N:N;

49 probDi s t r ibu t i on=C/( s q r t (2∗ pi ∗ sigma ˆ2) ) ∗ . . . %us ing

t h e o r e t i c a l mean and sigma

50 exp(−( xDi s t r ibut i on−xMean) .ˆ2/(2∗ sigma ˆ2) ) ;

71

Page 72: Random Walk Simulation of p-n Junctions

51 probDi s t r i bu t i on 2=C/( s q r t (2∗ pi ∗ s igmaSimulat ion ˆ2) ) ∗ . . . %

us ing s imu la t i on mean and sigma

52 exp(−( xDi s t r ibut i on−xMeanSimulation ) .ˆ2/(2∗

s igmaSimulat ion ˆ2) ) ;

53

54 %plo t d i s t r i b u t i o n

55 f i g u r e

56 [ b inD i s t r i bu t i on , binX]= h i s t ( pos ,N) ;

57 h i s t ( pos ,N)

58 hold on

59 p lo t ( xDi s t r ibut i on , probDis t r ibut ion , ’ k− ’ , ’ LineWidth ’ , 2 ) ;

60 p lo t ( xDi s t r ibut i on , p robDi s t r ibut i on 2 , ’ r− ’ , ’ LineWidth ’ , 2 ) ;

61 p lo t ( xDi s t r ibut i on , c ( : , 1 ) , ’ g− ’ , ’ LineWidth ’ , 2 ) ; %e i t h e r c1 or

c2 works

62 a x i s ( [ min ( binX )−5,max( binX ) +5 ,0 ,max( b i n D i s t r i b u t i o n )+s q r t (

numWalkers ) ] )

63 x l a b e l ( ’ Po s i t i on ’ )

64 y l a b e l ( ’Number o f Walkers ’ )

65 t ex t (min ( binX )+(max( binX )−min( binX ) ) ∗ . 6 ,max( b i n D i s t r i b u t i o n )

∗ 1 . 4 , . . .

66 [ ’ r= ’ , num2str ( r ) ] )

67 t ex t (min ( binX )+(max( binX )−min( binX ) ) ∗ . 6 ,max( b i n D i s t r i b u t i o n )

∗ 1 . 3 , . . .

68 [ ’ s= ’ , num2str ( s ) ] )

69 t ex t (min ( binX )+(max( binX )−min( binX ) ) ∗ . 6 ,max( b i n D i s t r i b u t i o n )

∗ 1 . 2 , . . .

70 [ ’ l= ’ , num2str(1−r−s ) ] )

71 t ex t (min ( binX )+(max( binX )−min( binX ) ) ∗ . 6 ,max( b i n D i s t r i b u t i o n )

∗ 1 . 1 , . . .

72 [ ’Number o f Walkers=’ , num2str ( numWalkers ) ] )

72

Page 73: Random Walk Simulation of p-n Junctions

73 t ex t (min ( binX )+(max( binX )−min( binX ) ) ∗ . 6 ,max( b i n D i s t r i b u t i o n )

, . . .

74 [ ’Number o f Steps=’ , num2str (N) ] )

73

Page 74: Random Walk Simulation of p-n Junctions

Appendix B

Simulation code for p-n junctions

B.1 Basic p-n junction

1 %PHYS 370 , J e n n i f e r Wang, 5/5/20

2 %biased random walk to s imulate pn junc t i on at equ i l i b r i um

3

4 %v a r i a b l e s

5 numSteps = 50000 ;

6 N = 100 ; % number o f sheet s , assume even

7

8 i n i t = 2000 ;

9 dt = 5.88 e−14; %time step

10 dx = 2e−8; %p o s i t i o n step

11 A = 1e−11;

12 N a = i n i t ; % un i t s o f e , number o f negat ive charges due to

nuc leus o f acceptor atom

13 N d = i n i t ;

14 h o l e s i n i t = i n i t ;

15 e l e c s i n i t = i n i t ;

16 m i n c a r r i e r s = 2 ; %r e s u l t i n g in i n t r i n s i c concent ra t i on about

74

Page 75: Random Walk Simulation of p-n Junctions

1e13

17

18 mob p = 0 . 1 3 ; %f o r ho les , SI un i t s

19 mob n = 0 . 1 3 ; %f o r e l e c t r o n s , SI un i t s

20 e p s s = 12∗8.85 e−12;

21 e = 1 .6 e−19;

22 E 0 = e /( e p s s ∗A) ;

23 the rma l vo l tage = 0 . 02586 ; %vo l t s , kT/e

24

25 %p r o b a b i l i t y c o e f f i c i e n t s

26 c1 p = mob p∗e∗dt /(2∗ e p s s ∗A∗dx ) ;

27 c1 n = mob n∗e∗dt /(2∗ e p s s ∗A∗dx ) ;

28 c2 p = 0 . 5 ; %( the rma l vo l tage ∗mob p)∗dt /( dx ˆ2) ;

29 c2 n = 0 . 5 ; %( the rma l vo l tage ∗mob n)∗dt /( dx ˆ2) ;

30

31 %i n i t i a l i z e data s t r u c t u r e s

32 Na = cat (2 , −ones (1 ,N/2)∗N a , z e r o s (1 ,N/2) ) ;

33 Nd = cat (2 , z e r o s (1 ,N/2) , ones (1 ,N/2)∗N d) ;

34 ho l e s = cat (2 , ones (1 ,N/2)∗ h o l e s i n i t , ones (1 ,N/2)∗

m i n c a r r i e r s ) ;

35 e l e c s = cat (2 , ones (1 ,N/2)∗min ca r r i e r s , ones (1 ,N/2)∗

e l e c s i n i t ) ;

36

37 E = ze ro s (1 ,N) ;

38 r h o l e s = ze ro s (1 ,N) ;

39 r e l e c s = ze ro s (1 ,N) ;

40

41 %cumulat ive data s t r u c t u r e s

42 h o l e s t o t = ze ro s (1 ,N) ;

43 e l e c s t o t = ze ro s (1 ,N) ;

75

Page 76: Random Walk Simulation of p-n Junctions

44 E tot = ze ro s (1 ,N) ;

45

46 loop = 2000 ;

47

48 t i c

49

50 %biased random walk loop

51 f o r n = 1 : numSteps %f o r every step

52 tempH = ze ro s (1 ,N) ;

53 tempE = ze ro s (1 ,N) ;

54 f o r i = 1 :N %f o r every s l i c e

55 %c a l c u l a t e E f i e l d and p r o b a b i l i t y on each s l i c e

56 i f i == 1

57 E( i ) = −sum( ho l e s ( 2 :N)−e l e c s ( 2 :N)+Na ( 2 :N)+Nd( 2 :N)

) /2 ;

58 e l s e i f i == N

59 E( i ) = sum( ho l e s ( 1 :N−1)−e l e c s ( 1 :N−1)+Na ( 1 :N−1)+Nd

( 1 :N−1) ) /2 ;

60 e l s e

61 pos = 1 : i −1;

62 neg = i +1:N;

63 p o s f i e l d = sum( ho l e s ( pos )−e l e c s ( pos )+Na( pos )+Nd(

pos ) ) ;

64 n e g f i e l d = sum( ho l e s ( neg )−e l e c s ( neg )+Na( neg )+Nd(

neg ) ) ;

65 E( i ) = ( p o s f i e l d − n e g f i e l d ) /2 ;

66 end

67 r h o l e s ( i ) = E( i )∗ c1 p + c2 p ;

68 r e l e c s ( i ) = −E( i )∗ c1 n + c2 n ;

69

76

Page 77: Random Walk Simulation of p-n Junctions

70 %%%% HOLES %%%%

71 numH = ho l e s ( i ) ; % num ho l e s in t h i s s l i c e

72 prob = rand (1 , numH) ; % generate random p r o b a b i l i t y

f o r each ho le in t h i s s l i c e

73 numRight = sum( prob<r h o l e s ( i ) ) ;

74 i f i==1 % l e f t m o s t s l i c e

75 tempH(2) = tempH(2) + numRight ; %move r i g h t

76 tempH(1) = tempH(1) + (numH − numRight ) ; %can ’ t

move l e f t

77 e l s e i f i==N % rightmost s l i c e

78 tempH(N−1) = tempH(N−1) + (numH − numRight ) ; %

move l e f t

79 tempH(N) = tempH(N) + numRight ; %can ’ t move r i g h t

80 e l s e % any other s l i c e

81 %note tempH( i ) = numH−numH s i n c e we assume a l l

p a r t i c l e s move

82 tempH( i +1) = tempH( i +1) + numRight ; %move r i g h t

83 tempH( i −1) = tempH( i −1) + (numH − numRight ) ; %

move l e f t

84 end

85 %%%% ELECTRONS %%%%

86 numE = e l e c s ( i ) ; % num e l e c t r o n s in t h i s s l i c e

87 prob = rand (1 , numE) ; % generate random p r o b a b i l i t y

f o r each e l e c t r o n in t h i s s l i c e

88 numRight = sum( prob<r e l e c s ( i ) ) ;

89 i f i==1 % l e f t m o s t s l i c e

90 tempE (2) = tempE (2) + numRight ; %move r i g h t

91 tempE (1) = tempE (1) + (numE−numRight ) ; %can ’ t

move l e f t

92 e l s e i f i==N % rightmost s l i c e

77

Page 78: Random Walk Simulation of p-n Junctions

93 tempE(N−1) = tempE(N−1) + (numE−numRight ) ; %move

l e f t

94 tempE(N) = tempE(N) + numRight ; %can ’ t move r i g h t

95 e l s e % any other s l i c e

96 tempE( i +1) = tempE( i +1) + numRight ; %move r i g h t

97 tempE( i −1) = tempE( i −1) + (numE−numRight ) ; %move

l e f t

98 end

99 end

100 % update ho le and e l e c t r o n p o s i t i o n ar rays

101 ho l e s = tempH ;

102 e l e c s = tempE ;

103

104 i f n > ( numSteps−loop )

105 h o l e s t o t = h o l e s t o t + ho l e s ;

106 e l e c s t o t = e l e c s t o t + e l e c s ;

107 E tot = E tot + E;

108 end

109 end

110

111 toc

112

113 h o l e s t o t = h o l e s t o t / loop ;

114 e l e c s t o t = e l e c s t o t / loop ;

115 E tot = E tot / loop ;

116 to t = h o l e s t o t−e l e c s t o t+Nd+Na ;

117

118 % GRAPH

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

78

Page 79: Random Walk Simulation of p-n Junctions

119 pos = 1 :N;

120 f i g u r e (1 ) ;

121 p lo t ( pos , h o l e s t o t , ’ b lack ’ )

122 hold on

123 p lo t ( pos , e l e c s t o t , ’ red ’ )

124 hold on

125 p lo t ( pos , tot , ’ green ’ )

126 hold on

127 p lo t ( 4 6 : 54 , ones (1 , 9 ) , ’ b lue ’ )

128 hold o f f

129

130 ax = gca ;

131 ax . FontSize = 16 ;

132 x l a b e l ( ’ Po s i t i on ’ )

133 y l a b e l ( ’ P a r t i c l e Density ’ )

134 l egend ({ ’ Holes ’ , ’ E l e c t rons ’ , ’ Total ’ } , ’ Locat ion ’ , ’ northwest

’ )

135 t i t l e ( ’ Ca r r i e r concen t r a t i on s and d e p l e t i o n width ’ )

136

137 f i g u r e (2 ) ;

138 n i 2 = 2 .8 e42 ; %est imated from np graph

139 np = e l e c s t o t .∗ h o l e s t o t / ( (A∗dx ) ˆ2) ;

140 p lo t ( pos , np/ n i 2 ) ;

141 a x i s ( [ 0 100 0 1 . 2 ] )

142 t i t l e ( ’ np/ n i ˆ2 vs . p o s i t i o n ’ )

143

144 f i g u r e (3 ) ;

145 E = E tot ∗E 0 ; %convert back to e l e c t r i c f i e l d un i t s

146 p lo t ( pos , E) ;

147 t i t l e ( ’E f i e l d vs . p o s i t i o n ’ )

79

Page 80: Random Walk Simulation of p-n Junctions

148

149 f i g u r e (4 ) ;

150 V = cumtrapz(−E∗dx ) ;

151 p lo t ( pos , V) ;

152 t i t l e ( ’ Voltage vs . p o s i t i o n ’ )

153 V sim = trapz(−E∗dx )

154

155 %Deplet ion Width

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

156 na = N a /(A∗dx ) ;

157 nd = N d/(A∗dx ) ; %back in to un i t s o f meters

158 V t = the rma l vo l tage ∗ l og ( na∗nd/ n i 2 )

159

160 %simulated d e p l e t i o n width

161 h = max( to t ) /2 ;

162 ab s t o t = abs ( to t ) ;

163 idx1=f i n d ( abs tot>h , 1 ) +[−1 0 ] ;

164 idx2=f i n d ( abs tot>h , 1 , ’ l a s t ’ ) +[0 1 ] ;

165 x1 = in t e rp1 ( ab s t o t ( idx1 ) , pos ( idx1 ) ,h ) ;

166 x2 = in t e rp1 ( ab s t o t ( idx2 ) , pos ( idx2 ) ,h ) ;

167 w sim dim = x2 − x1

168

169 %t h e o r e t i c a l d e p l e t i o n width

170 w = s q r t (2∗ e p s s ∗V t ∗( na + nd) /( na∗nd∗e ) ) ;

171 w t dim = w/dx

B.2 Compound p-n junction

Note that graphing instructions for the concentration profile, electric field, and

potential are identical to the graphing instructions in section B.1 and are thus not

80

Page 81: Random Walk Simulation of p-n Junctions

reproduced below.

1 %PHYS 370 , J e n n i f e r Wang, 5/5/20

2 %compound random walk to s imulate pn junc t i on at equ i l i b r ium

3

4 %v a r i a b l e s

5 numSteps = 20000 ;

6 N = 100 ; % number o f sheet s , assume even

7

8 i n i t = 2000 ;

9 dt = 5.88 e−14; %time step

10 dx = 2e−8; %p o s i t i o n step

11 A = 1e−11;

12 N a = i n i t ; % un i t s o f e , number o f negat ive charges due to

nuc leus o f acceptor atom

13 N d = i n i t ;

14 h o l e s i n i t = i n i t ;

15 e l e c s i n i t = i n i t ;

16 m i n c a r r i e r s = 2 ; %r e s u l t i n g in i n t r i n s i c concent ra t i on about

1 e13

17

18 mob p = 0 . 1 3 ; %f o r ho les , SI un i t s

19 mob n = 0 . 1 3 ; %f o r e l e c t r o n s , SI un i t s

20 e p s s = 12∗8.85 e−12;

21 e = 1 .6 e−19;

22 E 0 = e /( e p s s ∗A) ;

23 the rma l vo l tage = 0 . 02586 ; %vo l t s , kT/e

24

25 %p r o b a b i l i t y c o e f f i c i e n t s

26 c1 p = mob p∗E 0∗dt /(2∗dx ) ;

27 c2 p = 0 . 5 ; %( the rma l vo l tage ∗mob p)∗dt /( dx ˆ2) ;

81

Page 82: Random Walk Simulation of p-n Junctions

28 c1 n = mob n∗E 0∗dt /(2∗dx ) ;

29 c2 n = 0 . 5 ; %( the rma l vo l tage ∗mob n)∗dt /( dx ˆ2) ;

30

31 %i n i t i a l i z e data s t r u c t u r e s

32 Na = cat (2 , −ones (1 ,N/2)∗N a , z e r o s (1 ,N/2) ) ;

33 Nd = cat (2 , z e r o s (1 ,N/2) , ones (1 ,N/2)∗N d) ;

34 ho l e s = cat (2 , ones (1 ,N/2)∗ h o l e s i n i t , ones (1 ,N/2)∗

m i n c a r r i e r s ) ;

35 e l e c s = cat (2 , ones (1 ,N/2)∗min ca r r i e r s , ones (1 ,N/2)∗

e l e c s i n i t ) ;

36

37 E = ze ro s (1 ,N) ;

38 r h o l e s = ze ro s (1 ,N) ;

39 r e l e c s = ze ro s (1 ,N) ;

40

41 %cumulat ive data s t r u c t u r e s

42 h o l e s t o t = ze ro s (1 ,N) ;

43 e l e c s t o t = ze ro s (1 ,N) ;

44 E tot = ze ro s (1 ,N) ;

45

46 loop = 2000 ;

47

48 t i c

49

50 %biased random walk loop

51 f o r n = 1 : numSteps %f o r every step

52 tempH = ze ro s (1 ,N) ;

53 tempE = ze ro s (1 ,N) ;

54 f o r i = 1 :N %f o r every s l i c e

55 %c a l c u l a t e E f i e l d and p r o b a b i l i t y on each s l i c e

82

Page 83: Random Walk Simulation of p-n Junctions

56 i f i == 1

57 E( i ) = −sum( ho l e s ( 2 :N)−e l e c s ( 2 :N)+Na ( 2 :N)+Nd( 2 :N)

) /2 ;

58 e l s e i f i == N

59 E( i ) = sum( ho l e s ( 1 :N−1)−e l e c s ( 1 :N−1)+Na ( 1 :N−1)+Nd

( 1 :N−1) ) /2 ;

60 e l s e

61 pos = 1 : i −1;

62 neg = i +1:N;

63 p o s f i e l d = sum( ho l e s ( pos )−e l e c s ( pos )+Na( pos )+Nd(

pos ) ) ;

64 n e g f i e l d = sum( ho l e s ( neg )−e l e c s ( neg )+Na( neg )+Nd(

neg ) ) ;

65 E( i ) = ( p o s f i e l d − n e g f i e l d ) /2 ;

66 end

67 r h o l e s ( i ) = E( i )∗ c1 p + c2 p ;

68 l h o l e s ( i ) = −E( i )∗ c1 p + c2 p ;

69 r e l e c s ( i ) = −E( i )∗ c1 n + c2 n ;

70 l e l e c s ( i ) = E( i )∗ c1 n + c2 n ;

71

72 %%%% HOLES %%%%

73 numH = ho l e s ( i ) ; % num ho l e s in t h i s s l i c e

74 prob = rand (1 , numH) ; % generate random p r o b a b i l i t y

f o r each ho le in t h i s s l i c e

75 numRight = sum( prob<r h o l e s ( i ) ) ;

76 numLeft = sum( prob>(1− l h o l e s ( i ) ) ) ;

77 numStay = numH − numRight − numLeft ;

78 i f i==1 % l e f t m o s t s l i c e

79 tempH(2) = tempH(2) + numRight ; %move r i g h t

83

Page 84: Random Walk Simulation of p-n Junctions

80 tempH(1) = tempH(1) + numLeft + numStay ; %can ’ t

move l e f t

81 e l s e i f i==N % rightmost s l i c e

82 tempH(N−1) = tempH(N−1) + numLeft ; %move l e f t

83 tempH(N) = tempH(N) + numRight + numStay ; %can ’ t

move r i g h t

84 e l s e % any other s l i c e

85 tempH( i ) = tempH( i ) + numStay ;

86 tempH( i +1) = tempH( i +1) + numRight ; %move r i g h t

87 tempH( i −1) = tempH( i −1) + numLeft ; %move l e f t

88 end

89 %%%% ELECTRONS %%%%

90 numE = e l e c s ( i ) ; % num e l e c t r o n s in t h i s s l i c e

91 prob = rand (1 , numE) ; % generate random p r o b a b i l i t y

f o r each e l e c t r o n in t h i s s l i c e

92 numRight = sum( prob<r e l e c s ( i ) ) ;

93 numLeft = sum( prob>(1− l e l e c s ( i ) ) ) ;

94 numStay = numE − numRight − numLeft ;

95 i f i==1 % l e f t m o s t s l i c e

96 tempE (2) = tempE (2) + numRight ; %move r i g h t

97 tempE (1) = tempE (1) + numLeft + numStay ; %can ’ t

move l e f t

98 e l s e i f i==N % rightmost s l i c e

99 tempE(N−1) = tempE(N−1) + numLeft ; %move l e f t

100 tempE(N) = tempE(N) + numRight + numStay ; %can ’ t

move r i g h t

101 e l s e % any other s l i c e

102 tempE( i ) = tempE( i ) + numStay ;

103 tempE( i +1) = tempE( i +1) + numRight ; %move r i g h t

104 tempE( i −1) = tempE( i −1) + numLeft ; %move l e f t

84

Page 85: Random Walk Simulation of p-n Junctions

105 end

106 end

107 % update ho le and e l e c t r o n p o s i t i o n ar rays

108 ho l e s = tempH ;

109 e l e c s = tempE ;

110

111 i f n > ( numSteps−loop )

112 h o l e s t o t = h o l e s t o t + ho l e s ;

113 e l e c s t o t = e l e c s t o t + e l e c s ;

114 E tot = E tot + E;

115 end

116 end

117

118 toc

119

120 h o l e s t o t = h o l e s t o t / loop ;

121 e l e c s t o t = e l e c s t o t / loop ;

122 E tot = E tot / loop ;

123 to t = h o l e s t o t−e l e c s t o t+Nd+Na ;

85

Page 86: Random Walk Simulation of p-n Junctions

Bibliography

[1] David Halliday, Robert Resnick, and Jearl Walker. Fundamentals of Physics.Wiley, 2010.

[2] Chenming C. Hu. Modern semiconductor devices for integrated circuits. Boston:Pearson, 2010.

[3] p–n junction. Wikipedia. Retrived from https://en.wikipedia.org/wiki/P-n junction.

[4] Rebecca Belisle. Phys 331: Modern materials. Wellesley College, Fall 2019. Fromlecture slides.

[5] Emmanuel Gobet. Monte-Carlo Methods and Stochastic Processes. CRC Press,2016.

[6] J. P. Gonzalez-Vazquez, Juan A. Anta, and Juan Bisquert. Determination ofthe electron diffusion length in dye-sensitized solar cells by random walk simu-lation: Compensation effects and voltage dependence. The Journal of PhysicalChemistry C, 114:8552–8558, May 2010.

[7] Casino software. Software for Monte Carlo simulation of electron trajectory insolids. Retrieved from https://www.gel.usherbrooke.ca/casino/index.html.

[8] Camilla Nestande Kirkemo. Monte carlo simulation of p-n junctions. Retrievedfrom https://www.duo.uio.no/handle/10852/11062.

[9] Dragica Vasileska, Katarina Raleva, and Stephen M. Goodnick. Monte carlodevice simulations. Handbook of Optoelectronic Device Modeling and Simulation,2017.

[10] D.Munteanu S. Clerc G. Gasiot M. Glorieux, J. L.Autran and P. Roche. Random-walk drift-diffusion charge-collection model for reverse-biased junctions embed-ded in circuits. IEEE Transactions on Nuclear Science, 61:3527–3534, December2014.

[11] Jesus del Alamo. 6.012 microelectronic devices and circuits. Mas-sachusetts Institute of Technology: MIT OpenCourseWare., Fall 2005. Re-trieved from https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-012-microelectronic-devices-and-circuits-fall-2005/.

86

Page 87: Random Walk Simulation of p-n Junctions

[12] Benjamin A. Stickler and Ewald Schachinger. Basic Concepts in ComputationalPhysics. Springer International Publishing, 2016.

[13] Luca Bertoluzzi, Caleb C. Boyd, Nicholas Rolston, Jixian Xu, Rohit Prasanna,Brian C. O’Regan, and Michael D. McGehee. Mobile ion concentration measure-ment and open-access band diagram simulation platform for halide perovskitesolar cells. Joule, 1:109–127, January 2020.

87