NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo Models Library:
Sample Models/Chemistry & Physics/Materials Science

(back to the library)

Current in a Semiconductor

[screen shot]

If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web


This model shows a simplified microscopic process of electrical conduction inside of a semiconductor connected across a voltage. The model is based on an adaptation of Drude's free electron theory to semiconductors and shows how electrical current emerges from the collective movement of many electrons and holes (missing electrons from bonds) in a semiconductor.

The model also shows how the current depends on the number of available charge carriers. The number of "extrinsic" charge carriers is determined by "doping," adding impurities to the semiconductor that have either extra or fewer valence electrons than the main semiconducting element. The number of "intrinsic" charge carriers is determined by temperature. The higher the temperature is, the more likely it is for an electron to be excited into the conduction band, resulting in two charge carriers: a free electron and hole left behind in the valence band.

Furthermore, the model shows how current depends on the scattering probability of charge carriers, the probability of electrons and holes recombining when they encounter one another and, of course, the applied voltage.


General overview

The model is basically a molecular dynamics simulation of electrons and holes moving freely under the influence of an externally applied voltage. Charge carriers only respond to the external voltage. All charge carrier interactions are ignored except that electrons and holes have a probability of recombining (and therefore annihilating) when they meet. The current monitor shows the average current with the currently set parameters of band-gap, voltage, and temperature. If any of these are changed, the current resets. So, you can adjust these parameters in the middle of a simulation to see what happens. The current vs time plot shows how current changes with time and the # holes and free electrons plots shows how the number of holes and free electrons change over time.

The specific steps the model follows

The steps for each time step in the model are:

  1. generate electron-hole pairs: Each patch generates an electron-hole pair with probability based on the band-gap and temperature according to exp(- band-gap / temperature).
  2. charge carriers calculate force and velocity: all the charge carriers calculate the force they feel. In this model that is simply due to the applied voltage. Then they calculate their new velocity by updating based on the force they feel.
  3. charge carriers move: all charge carriers have a probability of scattering. This resets their velocity to random direction with speed based on temperature. Then all charge carriers move based on their current velocity. If a charge-carrier crosses the left or right boundary, it updates the charge-flow variable for calculating current. In this model, another charge carrier re-enters the system on the other side to retain charge-balance.
  4. electrons and holes annihilate: Any electrons and holes on the same patch annihilate each other.


Running the Model

Press the setup button to initialize the model. Then press go to watch it run.

What each element of the interface does.

The doping slider determines how many extrinsic charge carriers there are. A positive doping means there are excess holes. This corresponds to doping the semiconductor (e.g. Si) with an element with fewer valence electrons (e.g. Ga). A negative doping means there are excess electrons. This corresponds to doping the semiconductor with an element with more valence electrons (e.g. Sb). Note: this must be set prior to clicking the setup button.

The temperature slider sets the temperature (in arbitrary units). Temperature affects the initial speed of charge carriers and their speed after a scattering event. It also determines how likely it is for an intrinsic electron-hole pair to form.

The band-gap slider determines the band-gap between the valence and conduction bands for the semi-conductor. In the model, this determines how easy it is for an electron-hole pair to form.

The scatter-prob monitor displays the probability of each charge carrier scattering. It is determined by temperature.

The voltage slider determines the voltage applied across the semiconductor. Positive is defined left to right (positive charges will be pushed to the right if the voltage is positive).

The watch an electron and watch a hole buttons highlight a single charge carrier (chosen randomly) of that type and traces its trajectory. The stop watching button resets the perspective and erases any drawn trajectories.

The visualize-pair-generation? determines whether electron-hole pairs are visualized when they are generating by creating a temperorary link between them.

The restore-initial-settings button resets all the parameters to defaults.


Watch some electrons and holes and see that they move in opposite directions. This is because they have opposite charges. An electron has negative charge and hole has positive charge.


Try using the "watch an electron" and "watch a hole" buttons under different conditions. If the charge carrier annihilates, the "watching" will automatically stop. If most charge carriers annihilate before reaching the end of the circuit, why is current still produced?

Try changing each of the sliders and seeing how it affects the number of holes and free electrons and the current.


In reality, holes move more slowly than electrons. This can be modeled by giving them a larger mass than electrons. Currently, the model assumes mass = 1 for both types of charge carriers. Try giving the charge carriers different masses (you will need to change the accelerate-and-scatter procedure).

In real semiconductors, even extrinisic charge carriers need a little bit of energy to dissociate from their host atoms. At very low temperatures, they don't have enough energy to escape the attraction to their host atom and "freeze out" occurs, i.e., the material stops conducting. Try extending the model so that "freeze out" can happen in this model.


This model uses a charge-carriers reporter which uses the turtle-set primitive to construct a set of both electrons and holes so they can be asked to do things together.

The # free electrons and # holes monitors have notes placed in their upper right corners with the unicode black square character ■ (U+25A0) colored to match the lines in the plot instead of using the legend on the plot.


Current in a Wire


If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

Please cite the NetLogo software as:


Copyright 2023 Uri Wilensky.


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at

(back to the NetLogo Models Library)