Skip to content
An open source drift diffusion code based in MATLAB for simulating solar cells
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Core removed clf from dfplot to allow overlays Sep 27, 2019
Helper Updated calcR0 Sep 12, 2019
Libraries Checked names in Index of Refraction library Jul 31, 2019
Optical Set generation to zero at the interfaces in beerlambert Aug 16, 2019
Protocols Added SPV functions Aug 16, 2019
Scripts changed name .no_ion to .el Sep 24, 2019
.DS_Store Improvements to interface properties Sep 6, 2019


An open source drift diffusion code based in MATLAB for simulating solar cells


Authors: Philip Calado, Piers RF Barnes, Ilario Gelmetti, Mohammed Azzouzi, Benjamin Hilton

Imperial College London, 2019

If you use Driftfusion please let us know by emailing:

Please log bugs through GitHub.

QuickStart Guide

To get started do the following:

  1. If you are new to GitHub it is highly recommended that you download GitHub desktop at: Alternatively, you can download Driftfusion standalone as a folder but you won’t easily be able to synch to the latest version.

  2. Fork the Driftfusion GitHub repository (project). Instructions can be found here:

  3. Navigate to your repository/project folder in MATLAB.

  4. Type initialise_df into the command prompt. This adds the subfolders and associated functions to the file path.

  5. The parameters class pc defines all the parameters for your device. You can edit the parameters directly in pc (found in the /Core folder and create a parameters object by typing:

par = pc;

The names of properties and their units are given in the commented code in the pc class.

  1. A better way of defining your device is to use the .csv files contained in the /Input_files folder. For example, to create a parameters object with default parameters to simulate an inverted PTPD/perovskite/PCBM stack type:

par = pc('Input_files/ptpd_mapi_pcbm.csv');

It is recommended to duplicate the existing .csv files to define your own device and use a programme like Excel or Open Office to edit them. Ensure that the material name given in the 'stack' column matches with one of the materials in the Libraries/Index_of_Refraction_library.xls if you wish to use the Beer-Lambert optical model.

  1. Obtain equilibrium solutions for your device by typing:

soleq = equilibrate(par)

Inside soleq are 2 solutions: soleq.el and soleq.ion. For perovskites you should generally use soleq.ion. soleq.el is the same device at equilibrium without mobile ions.

  1. Try running a JV using:

JVsol = doJV(soleq.ion, 1e-2, 100, 1, 1, 0, 1.4, 3)

The various input arguments are discussed in the comments of each code. At any time you can plot the JV using dfplot.JV(JVsol,3). Try using doJV as a model for writing functions of your own.

The example script shows you how to produce two devices with different transport layers and scan current-voltage scans at 50 mVs-1 for each and plot the current-voltage curve, an energy level diagram and the currents using dfplot.

Good luck!

Replicating published paper's data

Impedance Spectroscopy on homojunction model, applying an oscillating voltage profile

Submitted on arXiv on may 2018, published on Energy & Environmental Science on march 2019.

Check out the 2018-EIS branch of this repository or download directly just this branch.

Then follow the instructions in the branch readme or on this wiki page.

You can’t perform that action at this time.