# qpv-research-group/solcore5 architecture

> Architecture diagram of the GitHub repository qpv-research-group/solcore5, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/qpv-research-group/solcore5
- Repository: https://github.com/qpv-research-group/solcore5

## Overview

#### Purpose and entry points
Solcore is a Python semiconductor-device simulation library for optical and electrical modeling of quantum-well, single-junction, and multijunction solar cells. Primary user APIs are the package root and solar-cell model/dispatcher: `solcore/__init__.py`, `solcore/solar_cell.py`, `solcore/solar_cell_solver.py`. Script and notebook entry points in `examples/` demonstrate composed simulations rather than a server or CLI application.

#### Device model and solver orchestration
`SolarCell` structures are assembled from layers, junctions, and tunnel junctions, then dispatched by solver action through the central coordinator. `solcore/structure.py` supplies generic layered structures; `solcore/solar_cell.py` specializes them for devices; `solcore/solar_cell_solver.py` selects and combines optical and electrical solving stages. This is the principal control boundary between a user-defined device and pluggable numerical models.

#### Materials, parameters, and units
Material construction and parameter lookup underpin every physics model. `solcore/material_system/material_system.py` and `solcore/parameter_system/parameter_system.py` provide material and semiconductor-property access, backed by bundled datasets in `solcore/material_data/`. `solcore/units_system/units_system.py` normalizes physical-unit inputs. Material data is local/package-managed, including refractive-index and SOPRA datasets; user-defined materials are supported by `solcore/material_system/create_new_material.py`.

#### Optical and light-generation pipeline
A light source supplies wavelength-dependent illumination, then optics solvers calculate reflection, absorption, transmission, and generation profiles for the layered cell. `solcore/light_source/light_source.py` provides spectra including bundled ASTM data. `solcore/optics/tmm.py`, `solcore/optics/rcwa.py`, and `solcore/optics/beer_lambert.py` expose alternative optical methods; their lower-level implementations include `solcore/absorption_calculator/transfer_matrix.py` and `solcore/absorption_calculator/rigorous_coupled_wave.py`. Optical outputs form key inputs to junction quantum-efficiency and transport calculations.

#### Electrical solver families
The package supports interchangeable electrical fidelity levels. Analytic/depletion, detailed-balance, diode, IV, QE, and tunnel-junction models live in `solcore/analytic_solar_cells/`. Poisson–drift–diffusion support uses Python structure/utility layers in `solcore/poisson_drift_diffusion/DeviceStructure.py` and `solcore/poisson_drift_diffusion/DriftDiffusionUtilities.py`, with a compiled Fortran current solver at `solcore/poisson_drift_diffusion/DDmodel-current.f95`. A separate Sesame-backed drift-diffusion adapter processes structures and solves them through `solcore/sesame_drift_diffusion/process_structure.py` and `solcore/sesame_drift_diffusion/solve_pdd.py`.

#### Quantum and multijunction coupling
Quantum-well calculations provide band alignment, strain, k·p states, and quantum-well absorption used by appropriate structures and optical/electrical paths. Core modules are `solcore/quantum_mechanics/high_level_kp_QW.py`, `solcore/quantum_mechanics/heterostructure_alignment.py`, and `solcore/absorption_calculator/absorption_QW.py`. Multijunction devices combine junction-level outputs through the main solar-cell solver and analytic IV machinery, while radiative-coupling examples illustrate cross-junction optical/electrical feedback.

#### Systems-scale, optimization, and runtime boundaries
Optimization wraps simulations via differential evolution in `solcore/optimization/differential_evolution.py`. Module and quasi-3D panel modeling use a SPICE integration boundary: `solcore/spice/pv_module_solver.py`, `solcore/spice/quasi_3D_solver.py`, and `solcore/spice/spice.py`. The runtime is primarily Python; Meson build definitions (`meson.build`, `solcore/poisson_drift_diffusion/meson.build`) compile native Fortran components. CI builds/tests and publishes wheels via `.github/workflows/build_deploy_wheels.yml`; documentation is Sphinx-based under `docs/source/`.

Main entry points: [`solcore/solar_cell_solver.py`](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/solar_cell_solver.py) (Solar-cell solver), [`solcore/optics/tmm.py`](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/optics/tmm.py) (Optics methods), [`solcore/solar_cell.py`](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/solar_cell.py) (Solar cell), [`solcore/material_system/material_system.py`](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/material_system/material_system.py) (Material system)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Device orchestration"]
  node_api["Solcore API<br/>Python package<br/>[__init__.py]"]
  node_structure["Layer structures<br/>model<br/>[structure.py]"]
  node_solar_cell["Solar cell<br/>device model<br/>[solar_cell.py]"]
  node_dispatcher{{"Solar-cell solver<br/>orchestrator"}}
end

subgraph group_inputs["Materials and illumination"]
  node_materials["Material system<br/>material API<br/>[material_system.py]"]
  node_parameters["Parameter system<br/>property lookup"]
  node_material_data[("Material datasets<br/>package data<br/>[__init__.py]")]
  node_units["Units system<br/>unit normalization<br/>[units_system.py]"]
  node_light["Light source<br/>spectrum provider<br/>[light_source.py]"]
end

subgraph group_optics["Optical pipeline"]
  node_optics{{"Optics methods<br/>optical solver<br/>[tmm.py]"}}
  node_tmm_engine["Transfer-matrix engine<br/>optical kernel<br/>[transfer_matrix.py]"]
  node_rcwa_engine["RCWA engine<br/>optical kernel"]
  node_quantum["Quantum-well model<br/>quantum solver"]
  node_qw_absorption["QW absorption<br/>absorption model<br/>[absorption_QW.py]"]
end

subgraph group_electrical["Electrical models"]
  node_analytic{{"Analytic cell models<br/>electrical solver family<br/>[__init__.py]"}}
  node_pdd_python["PDD structure layer<br/>PDD adapter<br/>[DeviceStructure.py]"]
  node_pdd_fortran["Fortran PDD solver<br/>native solver"]
  node_sesame["Sesame PDD adapter<br/>external solver adapter<br/>[solve_pdd.py]"]
end

subgraph group_advanced["Advanced runtimes"]
  node_optimization["Differential evolution<br/>optimization wrapper"]
  node_spice["SPICE module solver<br/>systems solver"]
end

node_api -->|"builds"| node_solar_cell
node_api -->|"accesses"| node_materials
node_structure -->|"specialized by"| node_solar_cell
node_solar_cell -->|"solved by"| node_dispatcher
node_units -->|"normalizes inputs"| node_materials
node_material_data -->|"backs"| node_materials
node_parameters -->|"supplies properties"| node_materials
node_solar_cell -->|"layer stack"| node_optics
node_light -->|"illumination"| node_optics
node_dispatcher -->|"runs"| node_optics
node_optics -->|"TMM path"| node_tmm_engine
node_optics -->|"RCWA path"| node_rcwa_engine
node_quantum -->|"states for"| node_qw_absorption
node_qw_absorption -->|"QW optical properties"| node_optics
node_optics -->|"generation and QE inputs"| node_analytic
node_dispatcher -->|"runs junction and IV models"| node_analytic
node_dispatcher -->|"runs PDD path"| node_pdd_python
node_pdd_python -->|"calls"| node_pdd_fortran
node_dispatcher -->|"runs alternate PDD"| node_sesame
node_optimization -->|"evaluates simulations"| node_dispatcher
node_spice -->|"uses cell results"| node_dispatcher

click node_api "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/__init__.py"
click node_structure "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/structure.py"
click node_solar_cell "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/solar_cell.py"
click node_dispatcher "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/solar_cell_solver.py"
click node_materials "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/material_system/material_system.py"
click node_parameters "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/parameter_system/parameter_system.py"
click node_material_data "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/material_data/__init__.py"
click node_units "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/units_system/units_system.py"
click node_light "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/light_source/light_source.py"
click node_optics "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/optics/tmm.py"
click node_tmm_engine "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/absorption_calculator/transfer_matrix.py"
click node_rcwa_engine "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/absorption_calculator/rigorous_coupled_wave.py"
click node_quantum "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/quantum_mechanics/high_level_kp_QW.py"
click node_qw_absorption "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/absorption_calculator/absorption_QW.py"
click node_analytic "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/analytic_solar_cells/__init__.py"
click node_pdd_python "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/poisson_drift_diffusion/DeviceStructure.py"
click node_pdd_fortran "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/poisson_drift_diffusion/DDmodel-current.f95"
click node_sesame "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/sesame_drift_diffusion/solve_pdd.py"
click node_optimization "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/optimization/differential_evolution.py"
click node_spice "https://github.com/qpv-research-group/solcore5/blob/develop/solcore/spice/pv_module_solver.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_structure,node_solar_cell,node_dispatcher toneBlue
class node_materials,node_parameters,node_material_data,node_units,node_light toneAmber
class node_optics,node_tmm_engine,node_rcwa_engine,node_quantum,node_qw_absorption toneMint
class node_analytic,node_pdd_python,node_pdd_fortran,node_sesame toneRose
class node_optimization,node_spice toneIndigo
```

## Components

### Device orchestration

- [Solcore API](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/__init__.py): Python package · `solcore/__init__.py`
- [Layer structures](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/structure.py): model · `solcore/structure.py`
- [Solar cell](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/solar_cell.py): device model · `solcore/solar_cell.py`
- [Solar-cell solver](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/solar_cell_solver.py): orchestrator · Dispatches optical and electrical actions for a device. · `solcore/solar_cell_solver.py`

### Materials and illumination

- [Material system](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/material_system/material_system.py): material API · `solcore/material_system/material_system.py`
- [Parameter system](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/parameter_system/parameter_system.py): property lookup · `solcore/parameter_system/parameter_system.py`
- [Material datasets](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/material_data/__init__.py): package data · Bundled semiconductor, refractive-index, and SOPRA data. · `solcore/material_data/__init__.py`
- [Units system](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/units_system/units_system.py): unit normalization · `solcore/units_system/units_system.py`
- [Light source](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/light_source/light_source.py): spectrum provider · `solcore/light_source/light_source.py`

### Optical pipeline

- [Optics methods](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/optics/tmm.py): optical solver · Selects TMM, RCWA, or Beer–Lambert optics. · `solcore/optics/tmm.py`
- [Transfer-matrix engine](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/absorption_calculator/transfer_matrix.py): optical kernel · `solcore/absorption_calculator/transfer_matrix.py`
- [RCWA engine](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/absorption_calculator/rigorous_coupled_wave.py): optical kernel · `solcore/absorption_calculator/rigorous_coupled_wave.py`
- [Quantum-well model](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/quantum_mechanics/high_level_kp_QW.py): quantum solver · Computes alignment, strain, and k·p states. · `solcore/quantum_mechanics/high_level_kp_QW.py`
- [QW absorption](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/absorption_calculator/absorption_QW.py): absorption model · `solcore/absorption_calculator/absorption_QW.py`

### Electrical models

- [Analytic cell models](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/analytic_solar_cells/__init__.py): electrical solver family · Provides depletion, detailed-balance, diode, IV, QE, and tunnel-junction models. · `solcore/analytic_solar_cells/__init__.py`
- [PDD structure layer](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/poisson_drift_diffusion/DeviceStructure.py): PDD adapter · `solcore/poisson_drift_diffusion/DeviceStructure.py`
- [Fortran PDD solver](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/poisson_drift_diffusion/DDmodel-current.f95): native solver · `solcore/poisson_drift_diffusion/DDmodel-current.f95`
- [Sesame PDD adapter](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/sesame_drift_diffusion/solve_pdd.py): external solver adapter · `solcore/sesame_drift_diffusion/solve_pdd.py`

### Advanced runtimes

- [Differential evolution](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/optimization/differential_evolution.py): optimization wrapper · `solcore/optimization/differential_evolution.py`
- [SPICE module solver](https://github.com/qpv-research-group/solcore5/blob/develop/solcore/spice/pv_module_solver.py): systems solver · Supports module and quasi-3D panel simulation. · `solcore/spice/pv_module_solver.py`

## Connections

- Solcore API → Solar cell: builds
- Solcore API → Material system: accesses
- Layer structures → Solar cell: specialized by
- Solar cell → Solar-cell solver: solved by
- Units system → Material system: normalizes inputs
- Material datasets → Material system: backs
- Parameter system → Material system: supplies properties
- Solar cell → Optics methods: layer stack
- Light source → Optics methods: illumination
- Solar-cell solver → Optics methods: runs
- Optics methods → Transfer-matrix engine: TMM path
- Optics methods → RCWA engine: RCWA path
- Quantum-well model → QW absorption: states for
- QW absorption → Optics methods: QW optical properties
- Optics methods → Analytic cell models: generation and QE inputs
- Solar-cell solver → Analytic cell models: runs junction and IV models
- Solar-cell solver → PDD structure layer: runs PDD path
- PDD structure layer → Fortran PDD solver: calls
- Solar-cell solver → Sesame PDD adapter: runs alternate PDD
- Differential evolution → Solar-cell solver: evaluates simulations
- SPICE module solver → Solar-cell solver: uses cell results
