kpenvelope 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,141 @@
1
+ Metadata-Version: 2.4
2
+ Name: kpenvelope
3
+ Version: 0.2.1
4
+ Summary: Six-band k.p envelope-function solver for wurtzite heterostructures, self-consistent with Poisson
5
+ Author-email: "Tanvir M. Mahim" <tanvir.mahim@bracu.ac.bd>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://tanvir-mahmud-mahim.github.io/software/
8
+ Project-URL: Repository, https://github.com/TaN-MM-Org/kpenvelope
9
+ Project-URL: Issues, https://github.com/TaN-MM-Org/kpenvelope/issues
10
+ Project-URL: Changelog, https://github.com/TaN-MM-Org/kpenvelope/releases
11
+ Keywords: k.p,envelope function,wurtzite,GaN,2DHG,subband,semiconductor
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Scientific/Engineering :: Physics
17
+ Requires-Python: >=3.9
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: numpy>=1.22
21
+ Provides-Extra: test
22
+ Requires-Dist: pytest; extra == "test"
23
+ Dynamic: license-file
24
+
25
+ # kpenvelope
26
+
27
+ [![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.22015269-blue)](https://doi.org/10.5281/zenodo.22015269) [![tests](https://github.com/TaN-MM-Org/kpenvelope/actions/workflows/ci.yml/badge.svg)](https://github.com/TaN-MM-Org/kpenvelope/actions)
28
+
29
+ A six-band **k.p envelope-function solver** for wurtzite heterostructures,
30
+ solved **self-consistently with Poisson's equation** on a 1D grid. Built
31
+ for polarization-induced two-dimensional hole gases (GaN/AlN and related
32
+ systems), where the confining potential is not imposed but emerges from
33
+ the balance between the fixed polarization charge and the gas itself.
34
+
35
+ ## Status
36
+
37
+ v0.2.0 (alpha). Implemented and tested:
38
+
39
+ - six-band wurtzite valence Hamiltonian (standard Chuang-Chang form),
40
+ discretized with symmetrized operator ordering so the matrix is exactly
41
+ Hermitian for position-dependent parameters
42
+ - envelope eigen-solution at arbitrary in-plane k
43
+ - Gauss-law hole potential from the density profile
44
+ - self-consistent loop with T = 0 subband filling using numeric in-plane
45
+ edge masses, converging to charge neutrality
46
+ - cited GaN and AlN parameter sets with closed-form verification
47
+ (new in v0.2, see below)
48
+
49
+ Not yet implemented, stated plainly because they matter physically:
50
+
51
+ - **finite barriers.** Hard walls one grid spacing outside the grid ends.
52
+ A hard wall forces the envelope to vanish at the interface and pushes
53
+ the gas outward, which shifts subband energies and masses; a finite AlN
54
+ barrier treated as position-dependent material parameters is the v0.3
55
+ gate before research-grade use.
56
+ - strain terms, full k-grid (non-parabolic) filling, spin splitting
57
+ analysis, transport lifetimes.
58
+
59
+ ## Cited parameter sets (new in v0.2)
60
+
61
+ - `gan_rinke2008()`: the consistent GW-based GaN valence set of Rinke et
62
+ al., Phys. Rev. B 77, 075202 (2008) (A1..A6, Delta_CR = 10 meV,
63
+ Delta_SO = 17 meV, delta2 = delta3 = Delta_SO/3), as tabulated in
64
+ Extended Data Table 1 of Chang et al., Nature Electronics 9, 346 (2026)
65
+ and used in the source paper below. eps_r = 10.4 (E parallel to c) from
66
+ Barker and Ilegems, Phys. Rev. B 7, 743 (1973).
67
+ - `aln_rinke2008()`: the matching AlN set (Delta_CR = -295 meV from Rinke
68
+ et al.; Delta_SO = 22 meV from de Carvalho et al., Appl. Phys. Lett.
69
+ 97, 232101 (2010)), intended as a barrier material. Its permittivity is
70
+ deliberately NaN, and the self-consistent solver refuses to run on it,
71
+ because no vetted value is shipped and none is needed for a barrier.
72
+
73
+ The test-suite locks every number and checks the GaN set against closed
74
+ forms: the zone-center splittings come out at 5.20 and 21.80 meV (against
75
+ accepted experimental values near 5-6 and 22 meV), and the asymptotic
76
+ in-plane masses at m0/|A2+A4-A5| = 1.89 m0 and m0/|A2+A4+A5| = 0.18 m0,
77
+ the quasi-cubic values quoted in the source paper's Supplemental
78
+ Material.
79
+
80
+ For any other material or parameterization, populate
81
+ `WurtziteParameters` from the literature (e.g. Vurgaftman and Meyer,
82
+ J. Appl. Phys. 94, 3675 (2003)) and record the source in the mandatory
83
+ `reference` field. The shipped `demo_single_band()` set is a decoupled,
84
+ non-physical configuration used by the test-suite, chosen because it has
85
+ closed-form well solutions to test against.
86
+
87
+ ## Install and use
88
+
89
+ ```
90
+ pip install -e .
91
+ ```
92
+
93
+ ```python
94
+ import numpy as np
95
+ from kpenvelope import gan_rinke2008, solve_self_consistent
96
+
97
+ p = gan_rinke2008() # cited set; or your own WurtziteParameters
98
+ z = np.linspace(0.0, 6.0, 97) # nm, from the interface
99
+ res = solve_self_consistent(p, z, ps=0.46) # ps in nm^-2; 4.6e13 cm^-2 = 0.46
100
+ # res.energies, res.masses, res.density, res.potential, res.occupations
101
+ ```
102
+
103
+ Convention: valence-electron energies, holes occupy the highest
104
+ eigenvalues; energies in eV, lengths in nm, sheet densities in nm^-2.
105
+
106
+ ## Verification
107
+
108
+ The test-suite checks Hermiticity with every coupling switched on, the
109
+ decoupled square-well limit against the analytic spectrum, the uniform
110
+ slab against the analytic Gauss-law potential, convergence plus exact
111
+ charge neutrality of the self-consistent loop, and (new in v0.2) the
112
+ cited GaN set against the closed-form quasi-cubic splittings and masses
113
+ above.
114
+
115
+ One comparison against the source paper is on record and stated honestly:
116
+ a hard-wall self-consistent run at the measured sheet density
117
+ (4.6e13 cm^-2, 97 points over 6 nm) puts the gas centroid at 0.62 nm
118
+ against 0.568 nm for the hard-wall row of the paper's Table S1, with the
119
+ same subband structure (two heavy branches filled, the light branch a
120
+ minority). The difference comes from the filling model: this package
121
+ fills parabolic edge-mass subbands, while the paper fills the computed
122
+ non-parabolic dispersions, and the light branch is strongly
123
+ non-parabolic. Together with the hard-wall boundary this is why the same
124
+ warning stands: do not use these numbers in publications before the
125
+ finite-barrier, dispersion-filled v0.3.
126
+
127
+ ## Methodological basis
128
+
129
+ > T. M. Mahim, A. S. M. Mohsin and M. M. Rahman, "Origin of the
130
+ > conflicting hole masses in the GaN/AlN two-dimensional hole gas"
131
+ > (under review); code for the paper:
132
+ > https://github.com/Tanvir-Mahmud-Mahim/gan-2dhg-masses-lifetimes
133
+
134
+ and S. L. Chuang and C. S. Chang, Phys. Rev. B 54, 2491 (1996). This
135
+ package is the general-purpose tool; the paper repository reproduces the
136
+ specific published study, including the finite-barrier physics that this
137
+ package does not yet have.
138
+
139
+ ## License
140
+
141
+ Apache-2.0
@@ -0,0 +1,117 @@
1
+ # kpenvelope
2
+
3
+ [![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.22015269-blue)](https://doi.org/10.5281/zenodo.22015269) [![tests](https://github.com/TaN-MM-Org/kpenvelope/actions/workflows/ci.yml/badge.svg)](https://github.com/TaN-MM-Org/kpenvelope/actions)
4
+
5
+ A six-band **k.p envelope-function solver** for wurtzite heterostructures,
6
+ solved **self-consistently with Poisson's equation** on a 1D grid. Built
7
+ for polarization-induced two-dimensional hole gases (GaN/AlN and related
8
+ systems), where the confining potential is not imposed but emerges from
9
+ the balance between the fixed polarization charge and the gas itself.
10
+
11
+ ## Status
12
+
13
+ v0.2.0 (alpha). Implemented and tested:
14
+
15
+ - six-band wurtzite valence Hamiltonian (standard Chuang-Chang form),
16
+ discretized with symmetrized operator ordering so the matrix is exactly
17
+ Hermitian for position-dependent parameters
18
+ - envelope eigen-solution at arbitrary in-plane k
19
+ - Gauss-law hole potential from the density profile
20
+ - self-consistent loop with T = 0 subband filling using numeric in-plane
21
+ edge masses, converging to charge neutrality
22
+ - cited GaN and AlN parameter sets with closed-form verification
23
+ (new in v0.2, see below)
24
+
25
+ Not yet implemented, stated plainly because they matter physically:
26
+
27
+ - **finite barriers.** Hard walls one grid spacing outside the grid ends.
28
+ A hard wall forces the envelope to vanish at the interface and pushes
29
+ the gas outward, which shifts subband energies and masses; a finite AlN
30
+ barrier treated as position-dependent material parameters is the v0.3
31
+ gate before research-grade use.
32
+ - strain terms, full k-grid (non-parabolic) filling, spin splitting
33
+ analysis, transport lifetimes.
34
+
35
+ ## Cited parameter sets (new in v0.2)
36
+
37
+ - `gan_rinke2008()`: the consistent GW-based GaN valence set of Rinke et
38
+ al., Phys. Rev. B 77, 075202 (2008) (A1..A6, Delta_CR = 10 meV,
39
+ Delta_SO = 17 meV, delta2 = delta3 = Delta_SO/3), as tabulated in
40
+ Extended Data Table 1 of Chang et al., Nature Electronics 9, 346 (2026)
41
+ and used in the source paper below. eps_r = 10.4 (E parallel to c) from
42
+ Barker and Ilegems, Phys. Rev. B 7, 743 (1973).
43
+ - `aln_rinke2008()`: the matching AlN set (Delta_CR = -295 meV from Rinke
44
+ et al.; Delta_SO = 22 meV from de Carvalho et al., Appl. Phys. Lett.
45
+ 97, 232101 (2010)), intended as a barrier material. Its permittivity is
46
+ deliberately NaN, and the self-consistent solver refuses to run on it,
47
+ because no vetted value is shipped and none is needed for a barrier.
48
+
49
+ The test-suite locks every number and checks the GaN set against closed
50
+ forms: the zone-center splittings come out at 5.20 and 21.80 meV (against
51
+ accepted experimental values near 5-6 and 22 meV), and the asymptotic
52
+ in-plane masses at m0/|A2+A4-A5| = 1.89 m0 and m0/|A2+A4+A5| = 0.18 m0,
53
+ the quasi-cubic values quoted in the source paper's Supplemental
54
+ Material.
55
+
56
+ For any other material or parameterization, populate
57
+ `WurtziteParameters` from the literature (e.g. Vurgaftman and Meyer,
58
+ J. Appl. Phys. 94, 3675 (2003)) and record the source in the mandatory
59
+ `reference` field. The shipped `demo_single_band()` set is a decoupled,
60
+ non-physical configuration used by the test-suite, chosen because it has
61
+ closed-form well solutions to test against.
62
+
63
+ ## Install and use
64
+
65
+ ```
66
+ pip install -e .
67
+ ```
68
+
69
+ ```python
70
+ import numpy as np
71
+ from kpenvelope import gan_rinke2008, solve_self_consistent
72
+
73
+ p = gan_rinke2008() # cited set; or your own WurtziteParameters
74
+ z = np.linspace(0.0, 6.0, 97) # nm, from the interface
75
+ res = solve_self_consistent(p, z, ps=0.46) # ps in nm^-2; 4.6e13 cm^-2 = 0.46
76
+ # res.energies, res.masses, res.density, res.potential, res.occupations
77
+ ```
78
+
79
+ Convention: valence-electron energies, holes occupy the highest
80
+ eigenvalues; energies in eV, lengths in nm, sheet densities in nm^-2.
81
+
82
+ ## Verification
83
+
84
+ The test-suite checks Hermiticity with every coupling switched on, the
85
+ decoupled square-well limit against the analytic spectrum, the uniform
86
+ slab against the analytic Gauss-law potential, convergence plus exact
87
+ charge neutrality of the self-consistent loop, and (new in v0.2) the
88
+ cited GaN set against the closed-form quasi-cubic splittings and masses
89
+ above.
90
+
91
+ One comparison against the source paper is on record and stated honestly:
92
+ a hard-wall self-consistent run at the measured sheet density
93
+ (4.6e13 cm^-2, 97 points over 6 nm) puts the gas centroid at 0.62 nm
94
+ against 0.568 nm for the hard-wall row of the paper's Table S1, with the
95
+ same subband structure (two heavy branches filled, the light branch a
96
+ minority). The difference comes from the filling model: this package
97
+ fills parabolic edge-mass subbands, while the paper fills the computed
98
+ non-parabolic dispersions, and the light branch is strongly
99
+ non-parabolic. Together with the hard-wall boundary this is why the same
100
+ warning stands: do not use these numbers in publications before the
101
+ finite-barrier, dispersion-filled v0.3.
102
+
103
+ ## Methodological basis
104
+
105
+ > T. M. Mahim, A. S. M. Mohsin and M. M. Rahman, "Origin of the
106
+ > conflicting hole masses in the GaN/AlN two-dimensional hole gas"
107
+ > (under review); code for the paper:
108
+ > https://github.com/Tanvir-Mahmud-Mahim/gan-2dhg-masses-lifetimes
109
+
110
+ and S. L. Chuang and C. S. Chang, Phys. Rev. B 54, 2491 (1996). This
111
+ package is the general-purpose tool; the paper repository reproduces the
112
+ specific published study, including the finite-barrier physics that this
113
+ package does not yet have.
114
+
115
+ ## License
116
+
117
+ Apache-2.0
@@ -0,0 +1,33 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "kpenvelope"
7
+ version = "0.2.1"
8
+ description = "Six-band k.p envelope-function solver for wurtzite heterostructures, self-consistent with Poisson"
9
+ readme = "README.md"
10
+ license = { text = "Apache-2.0" }
11
+ authors = [{ name = "Tanvir M. Mahim", email = "tanvir.mahim@bracu.ac.bd" }]
12
+ requires-python = ">=3.9"
13
+ keywords = ["k.p", "envelope function", "wurtzite", "GaN", "2DHG", "subband", "semiconductor"]
14
+ dependencies = ["numpy>=1.22"]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Intended Audience :: Science/Research",
18
+ "License :: OSI Approved :: Apache Software License",
19
+ "Programming Language :: Python :: 3",
20
+ "Topic :: Scientific/Engineering :: Physics",
21
+ ]
22
+
23
+ [project.optional-dependencies]
24
+ test = ["pytest"]
25
+
26
+ [project.urls]
27
+ Homepage = "https://tanvir-mahmud-mahim.github.io/software/"
28
+ Repository = "https://github.com/TaN-MM-Org/kpenvelope"
29
+ Issues = "https://github.com/TaN-MM-Org/kpenvelope/issues"
30
+ Changelog = "https://github.com/TaN-MM-Org/kpenvelope/releases"
31
+
32
+ [tool.setuptools.packages.find]
33
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,23 @@
1
+ """kpenvelope: multiband k.p envelope-function solver for wurtzite heterostructures.
2
+
3
+ Solves the six-band valence envelope-function problem on a 1D grid,
4
+ self-consistently with Poisson's equation, for polarization-induced
5
+ two-dimensional hole gases and related wurtzite heterostructures.
6
+
7
+ Methodological basis: T. M. Mahim, A. S. M. Mohsin and M. M. Rahman,
8
+ "Origin of the conflicting hole masses in the GaN/AlN two-dimensional
9
+ hole gas" (under review), and the standard wurtzite k.p formulation of
10
+ Chuang and Chang, Phys. Rev. B 54, 2491 (1996).
11
+ """
12
+ from .params import (WurtziteParameters, aln_rinke2008, demo_single_band,
13
+ gan_rinke2008)
14
+ from .hamiltonian import assemble_hamiltonian, HBAR2_OVER_2M0
15
+ from .solver import solve_subbands
16
+ from .selfconsistent import solve_self_consistent, SelfConsistentResult
17
+
18
+ __version__ = "0.2.1"
19
+ __all__ = [
20
+ "WurtziteParameters", "demo_single_band", "gan_rinke2008",
21
+ "aln_rinke2008", "assemble_hamiltonian", "solve_subbands",
22
+ "solve_self_consistent", "SelfConsistentResult", "HBAR2_OVER_2M0",
23
+ ]
@@ -0,0 +1,105 @@
1
+ """Assembly of the six-band wurtzite envelope Hamiltonian on a 1D grid.
2
+
3
+ The bulk Hamiltonian follows the standard wurtzite six-band form (Chuang
4
+ and Chang, Phys. Rev. B 54, 2491 (1996)), written here as
5
+
6
+ H(k) = H0(kx, ky) + H1(kx, ky) * kz + H2 * kz^2
7
+
8
+ The envelope operator is obtained by kz -> -i d/dz with the symmetrized
9
+ (Ben Daniel-Duke) discretization for the kz^2 terms and the symmetrized
10
+ first-difference for terms linear in kz, which keeps the discrete matrix
11
+ exactly Hermitian, including for position-dependent parameters.
12
+
13
+ Off-diagonal phase conventions differ between papers; eigenvalues are
14
+ invariant under those phase choices.
15
+
16
+ Energies in eV, lengths in nm. Valence-electron energy convention: holes
17
+ occupy the HIGHEST eigenvalues.
18
+ """
19
+ from __future__ import annotations
20
+
21
+ import numpy as np
22
+
23
+ # hbar^2 / (2 m0) in eV nm^2
24
+ HBAR2_OVER_2M0 = 0.0380998
25
+
26
+
27
+ def bulk_blocks(p, kx: float, ky: float):
28
+ """Return (H0, H1, H2): 6x6 complex blocks for the given in-plane k.
29
+
30
+ H(k) = H0 + H1*kz + H2*kz^2, with kz in nm^-1 and energies in eV.
31
+ """
32
+ c = HBAR2_OVER_2M0
33
+ kt2 = kx * kx + ky * ky
34
+ kplus = kx + 1j * ky
35
+
36
+ lam0 = c * p.A2 * kt2 # kz-independent part of lambda
37
+ th0 = c * p.A4 * kt2 # kz-independent part of theta
38
+ F0 = p.delta1 + p.delta2 + lam0 + th0
39
+ G0 = p.delta1 - p.delta2 + lam0 + th0
40
+ K0 = c * p.A5 * kplus * kplus # K term, no kz dependence
41
+ D = np.sqrt(2.0) * p.delta3
42
+
43
+ H0 = np.array([
44
+ [F0, -np.conj(K0), 0, 0, 0, 0],
45
+ [-K0, G0, 0, 0, 0, D],
46
+ [0, 0, lam0, 0, D, 0],
47
+ [0, 0, 0, F0, -K0, 0],
48
+ [0, 0, D, -np.conj(K0), G0, 0],
49
+ [0, D, 0, 0, 0, lam0],
50
+ ], dtype=complex)
51
+
52
+ # terms linear in kz: Ht = A6 k+ kz enters the (1,3)/(2,3) pattern
53
+ Ht = c * p.A6 * kplus
54
+ H1 = np.zeros((6, 6), dtype=complex)
55
+ H1[0, 2] = -np.conj(Ht)
56
+ H1[2, 0] = -Ht
57
+ H1[1, 2] = Ht
58
+ H1[2, 1] = np.conj(Ht)
59
+ H1[3, 5] = np.conj(Ht)
60
+ H1[5, 3] = Ht
61
+ H1[4, 5] = -Ht
62
+ H1[5, 4] = -np.conj(Ht)
63
+
64
+ # kz^2 coefficients: lambda gains A1 kz^2, theta gains A3 kz^2
65
+ lam2 = c * p.A1
66
+ th2 = c * p.A3
67
+ H2 = np.diag([lam2 + th2, lam2 + th2, lam2, lam2 + th2, lam2 + th2, lam2]).astype(complex)
68
+ return H0, H1, H2
69
+
70
+
71
+ def assemble_hamiltonian(p, z, kx: float = 0.0, ky: float = 0.0, potential=None):
72
+ """Dense 6N x 6N envelope Hamiltonian on grid z (uniform, nm).
73
+
74
+ potential : optional array of the HOLE potential energy V_h(z) in eV;
75
+ it enters the valence-electron Hamiltonian as -V_h on the diagonal.
76
+ Hard-wall boundaries at both ends of the grid (v0.1 limitation; a
77
+ finite barrier treated as a position-dependent material is the v0.2
78
+ gate, and matters: a hard wall pushes the gas away from the interface).
79
+ """
80
+ z = np.asarray(z, dtype=float)
81
+ n = z.size
82
+ dz = z[1] - z[0]
83
+ if not np.allclose(np.diff(z), dz):
84
+ raise ValueError("z grid must be uniform")
85
+
86
+ H0, H1, H2 = bulk_blocks(p, kx, ky)
87
+ H = np.zeros((6 * n, 6 * n), dtype=complex)
88
+
89
+ idx = lambda i: slice(6 * i, 6 * i + 6)
90
+ inv_dz2 = 1.0 / (dz * dz)
91
+ inv_2dz = 1.0 / (2.0 * dz)
92
+
93
+ for i in range(n):
94
+ diag = H0.copy()
95
+ # kz^2 term: -d/dz H2 d/dz -> +2 H2 / dz^2 on the diagonal
96
+ diag += 2.0 * H2 * inv_dz2
97
+ if potential is not None:
98
+ diag -= potential[i] * np.eye(6)
99
+ H[idx(i), idx(i)] = diag
100
+ if i + 1 < n:
101
+ # kz^2 off-diagonal: -H2/dz^2 ; kz linear: -i H1 * (D_central)
102
+ off = -H2 * inv_dz2 + (-1j) * H1 * inv_2dz
103
+ H[idx(i), idx(i + 1)] = off
104
+ H[idx(i + 1), idx(i)] = off.conj().T
105
+ return H
@@ -0,0 +1,143 @@
1
+ """Band-structure parameter sets.
2
+
3
+ This module ships two CITED parameter sets, gan_rinke2008() and
4
+ aln_rinke2008(), plus a synthetic set for the test-suite. Every number in
5
+ the cited sets is traceable to the source given in its `reference` field,
6
+ and the test-suite checks the GaN set against closed-form quasi-cubic
7
+ results (zone-center splittings of 5.20 and 21.80 meV; asymptotic in-plane
8
+ masses m0/|A2+A4-A5| and m0/|A2+A4+A5|).
9
+
10
+ The general warning stands: A parameters and splittings differ between
11
+ first-principles parameterizations, and the choice materially affects
12
+ computed masses. For any other material or parameterization, populate
13
+ WurtziteParameters from the literature (e.g. Vurgaftman and Meyer,
14
+ J. Appl. Phys. 94, 3675 (2003)) and record the source in the mandatory
15
+ `reference` field.
16
+
17
+ demo_single_band() returns a degenerate, decoupled parameter set used by
18
+ the test-suite; it is numerically convenient and physically meaningless.
19
+ """
20
+ from __future__ import annotations
21
+
22
+ import dataclasses
23
+
24
+
25
+ @dataclasses.dataclass
26
+ class WurtziteParameters:
27
+ """Six-band wurtzite valence parameters (Chuang-Chang convention).
28
+
29
+ A1..A6 : dimensionless valence-band effective-mass parameters.
30
+ delta1 : crystal-field splitting (eV).
31
+ delta2, delta3 : spin-orbit parameters (eV); for the common isotropic
32
+ approximation delta2 = delta3 = Delta_so / 3.
33
+ eps_r : static relative permittivity (used by the Poisson solver).
34
+ May be NaN for a set intended only as a barrier material; the
35
+ self-consistent solver refuses to run on a NaN permittivity.
36
+ reference : provenance of the numbers. Required, on purpose.
37
+ """
38
+
39
+ A1: float
40
+ A2: float
41
+ A3: float
42
+ A4: float
43
+ A5: float
44
+ A6: float
45
+ delta1: float
46
+ delta2: float
47
+ delta3: float
48
+ eps_r: float
49
+ reference: str
50
+
51
+
52
+ def demo_single_band(A: float = -2.0) -> WurtziteParameters:
53
+ """A decoupled, NON-PHYSICAL parameter set for tests.
54
+
55
+ With A1 = A2 = A and every other coupling zero, the six-band
56
+ Hamiltonian reduces to six identical parabolic bands with
57
+ E = A * (hbar^2/2m0) * k^2, which has closed-form well solutions.
58
+ """
59
+ return WurtziteParameters(
60
+ A1=A, A2=A, A3=0.0, A4=0.0, A5=0.0, A6=0.0,
61
+ delta1=0.0, delta2=0.0, delta3=0.0,
62
+ eps_r=10.0,
63
+ reference="synthetic single-band demonstration values; not physical",
64
+ )
65
+
66
+
67
+ def gan_rinke2008() -> WurtziteParameters:
68
+ """GaN valence parameters of Rinke et al., Phys. Rev. B 77, 075202 (2008).
69
+
70
+ A1..A6 and the crystal-field splitting Delta_CR = 10 meV and spin-orbit
71
+ splitting Delta_SO = 17 meV are the consistent GW-based set of Rinke
72
+ et al., as tabulated in Extended Data Table 1 of Chang et al., Nature
73
+ Electronics 9, 346 (2026), and as used in the self-consistent analysis
74
+ of Mahim, Mohsin and Rahman (gan-2dhg-masses-lifetimes). The isotropic
75
+ quasi-cubic convention delta2 = delta3 = Delta_SO / 3 is applied.
76
+
77
+ With these numbers the k = 0 splittings of the six-band Hamiltonian
78
+ are 5.20 and 21.80 meV (against accepted experimental values near
79
+ 5 to 6 and 22 meV), and the asymptotic in-plane masses are
80
+ m0/|A2+A4-A5| = 1.89 m0 and m0/|A2+A4+A5| = 0.18 m0; the test-suite
81
+ checks both from the assembled Hamiltonian.
82
+
83
+ eps_r = 10.4 is the static dielectric constant of GaN for fields along
84
+ the c axis (the growth axis of a c-plane heterostructure), from the
85
+ infrared oscillator fit of Barker and Ilegems, Phys. Rev. B 7, 743
86
+ (1973); it is the value used by the analysis of Mahim et al.
87
+ """
88
+ return WurtziteParameters(
89
+ A1=-5.947, A2=-0.528, A3=5.414,
90
+ A4=-2.512, A5=-2.510, A6=-3.202,
91
+ delta1=0.010,
92
+ delta2=0.017 / 3.0,
93
+ delta3=0.017 / 3.0,
94
+ eps_r=10.4,
95
+ reference=(
96
+ "A1-A6, Delta_CR = 0.010 eV, Delta_SO = 0.017 eV: P. Rinke "
97
+ "et al., Phys. Rev. B 77, 075202 (2008), as tabulated in "
98
+ "Extended Data Table 1 of C. F. C. Chang et al., Nature "
99
+ "Electronics 9, 346 (2026) and used in T. M. Mahim, "
100
+ "A. S. M. Mohsin and M. M. Rahman (under review; code: "
101
+ "github.com/Tanvir-Mahmud-Mahim/gan-2dhg-masses-lifetimes, "
102
+ "doi:10.5281/zenodo.21798022). delta2 = delta3 = Delta_SO/3. "
103
+ "eps_r = 10.4 (E parallel c): A. S. Barker and M. Ilegems, "
104
+ "Phys. Rev. B 7, 743 (1973)."
105
+ ),
106
+ )
107
+
108
+
109
+ def aln_rinke2008() -> WurtziteParameters:
110
+ """AlN valence parameters, intended as a BARRIER material.
111
+
112
+ A1..A6 and Delta_CR = -295 meV are from Rinke et al., Phys. Rev. B 77,
113
+ 075202 (2008), the same source from which the GaN set descends. Rinke
114
+ et al. do not tabulate the spin-orbit splitting of AlN; Delta_SO =
115
+ 22 meV is the midpoint of the values computed by de Carvalho et al.,
116
+ Appl. Phys. Lett. 97, 232101 (2010) (21.7 meV parallel, 23.5 meV
117
+ perpendicular), following the treatment of Mahim, Mohsin and Rahman,
118
+ who verify that changing it from 22 to 19 meV changes nothing at four
119
+ figures in their barrier-sensitive results.
120
+
121
+ eps_r is deliberately NaN: this set is meant for barrier regions,
122
+ where the states are evanescent and the permittivity never enters the
123
+ supported calculations. The self-consistent solver refuses a NaN
124
+ permittivity rather than running with an unvetted number; supply your
125
+ own cited value if you need an AlN Poisson solve.
126
+ """
127
+ return WurtziteParameters(
128
+ A1=-3.991, A2=-0.311, A3=3.671,
129
+ A4=-1.147, A5=-1.329, A6=-1.952,
130
+ delta1=-0.295,
131
+ delta2=0.022 / 3.0,
132
+ delta3=0.022 / 3.0,
133
+ eps_r=float("nan"),
134
+ reference=(
135
+ "A1-A6, Delta_CR = -0.295 eV: P. Rinke et al., Phys. Rev. B "
136
+ "77, 075202 (2008). Delta_SO = 0.022 eV: midpoint of L. C. "
137
+ "de Carvalho et al., Appl. Phys. Lett. 97, 232101 (2010). "
138
+ "delta2 = delta3 = Delta_SO/3. As used in T. M. Mahim, "
139
+ "A. S. M. Mohsin and M. M. Rahman (under review; "
140
+ "doi:10.5281/zenodo.21798022). eps_r intentionally NaN: "
141
+ "barrier-only set, no vetted permittivity shipped."
142
+ ),
143
+ )
@@ -0,0 +1,33 @@
1
+ """Electrostatics of a polarization-bound hole gas.
2
+
3
+ The confining potential is not imposed: the gas is balanced by the fixed
4
+ polarization bound charge at the interface (z = 0), and Gauss's law gives
5
+ the hole potential energy
6
+
7
+ dV_h/dz = (e^2 / (eps_r eps_0)) * ( ps - integral_0^z p(z') dz' )
8
+
9
+ which is positive at the interface (holes are held against it) and
10
+ vanishes once the whole gas lies below z. Units: eV, nm, densities nm^-2
11
+ (sheet) and nm^-3 (volume).
12
+ """
13
+ from __future__ import annotations
14
+
15
+ import numpy as np
16
+
17
+ # e^2 / (4 pi eps0) = 1.4399645 eV nm -> e^2/eps0 = 4*pi*that
18
+ E2_OVER_EPS0 = 4.0 * np.pi * 1.4399645
19
+
20
+
21
+ def hole_potential(z, p_density, ps, eps_r):
22
+ """Integrate the hole potential energy V_h(z) from the density profile.
23
+
24
+ z : uniform grid (nm), starting at the interface z=0.
25
+ p_density : hole volume density on the grid (nm^-3).
26
+ ps : total sheet density (nm^-2).
27
+ """
28
+ z = np.asarray(z, dtype=float)
29
+ dz = z[1] - z[0]
30
+ cum = np.cumsum(p_density) * dz # integral_0^z p
31
+ field = (E2_OVER_EPS0 / eps_r) * (ps - cum)
32
+ vh = np.concatenate([[0.0], np.cumsum(0.5 * (field[1:] + field[:-1]) * dz)])
33
+ return vh
@@ -0,0 +1,118 @@
1
+ """Self-consistent solution of the coupled k.p and Poisson problem."""
2
+ from __future__ import annotations
3
+
4
+ import dataclasses
5
+
6
+ import numpy as np
7
+
8
+ from .poisson import hole_potential
9
+ from .solver import solve_subbands
10
+ from .hamiltonian import HBAR2_OVER_2M0
11
+
12
+
13
+ @dataclasses.dataclass
14
+ class SelfConsistentResult:
15
+ z: np.ndarray
16
+ potential: np.ndarray # hole potential energy V_h(z), eV
17
+ energies: np.ndarray # subband edges at k_t = 0 (valence eV, descending)
18
+ envelopes: np.ndarray # (n, 6, N)
19
+ density: np.ndarray # hole volume density (nm^-3)
20
+ occupations: np.ndarray # sheet density per subband (nm^-2)
21
+ masses: np.ndarray # numeric in-plane edge masses (units of m0)
22
+ iterations: int
23
+ residual: float
24
+
25
+
26
+ def _inplane_masses(p, z, potential, energies0, n_states, dk=0.02):
27
+ """Numeric in-plane effective masses at the subband edge along kx.
28
+
29
+ m*/m0 = (hbar^2/2m0) * (2 dk^2) / (E(0) - E(dk)) for a band curving
30
+ downward from the valence edge (hole mass positive).
31
+ """
32
+ e_k, _ = solve_subbands(p, z, kx=dk, ky=0.0, potential=potential,
33
+ n_states=n_states)
34
+ masses = []
35
+ for i in range(n_states):
36
+ curv = energies0[i] - e_k[i]
37
+ if curv <= 1e-12:
38
+ masses.append(np.inf)
39
+ else:
40
+ masses.append(HBAR2_OVER_2M0 * dk * dk / curv)
41
+ return np.asarray(masses)
42
+
43
+
44
+ def _fill_subbands(energies, masses, ps):
45
+ """T = 0 filling of hole subbands with parabolic in-plane dispersion.
46
+
47
+ Holes fill from the highest valence energy downward. Each state is a
48
+ single spin-resolved branch with 2D DOS m/(2 pi hbar^2) = m/(m0) /
49
+ (4 pi (hbar^2/2m0)). Solves for E_F by bisection so occupations sum
50
+ to ps. Returns per-subband sheet densities (nm^-2).
51
+ """
52
+ dos = (masses / HBAR2_OVER_2M0) / (4.0 * np.pi) # states nm^-2 eV^-1
53
+ finite = np.isfinite(dos)
54
+
55
+ def total(ef):
56
+ occ = np.where(finite, dos * np.clip(energies - ef, 0.0, None), 0.0)
57
+ return occ.sum()
58
+
59
+ lo, hi = energies.min() - 5.0, energies.max()
60
+ for _ in range(200):
61
+ mid = 0.5 * (lo + hi)
62
+ if total(mid) > ps:
63
+ lo = mid
64
+ else:
65
+ hi = mid
66
+ ef = 0.5 * (lo + hi)
67
+ occ = np.where(finite, dos * np.clip(energies - ef, 0.0, None), 0.0)
68
+ if occ.sum() > 0:
69
+ occ = occ * (ps / occ.sum()) # exact neutrality after bisection
70
+ return occ
71
+
72
+
73
+ def solve_self_consistent(p, z, ps, n_states=6, mixing=0.3, tol=1e-5,
74
+ max_iter=80):
75
+ """Iterate k.p and Poisson to self-consistency at sheet density ps.
76
+
77
+ p : WurtziteParameters. z : uniform grid from the interface (nm).
78
+ ps : hole sheet density (nm^-2). Note 1e13 cm^-2 = 0.1 nm^-2.
79
+
80
+ Returns SelfConsistentResult. Convergence is measured as the maximum
81
+ absolute change of V_h between iterations (eV).
82
+ """
83
+ if not (p.eps_r == p.eps_r): # NaN check without importing math
84
+ raise ValueError(
85
+ "this parameter set carries no vetted permittivity (eps_r is "
86
+ "NaN; barrier-only set). Supply a cited eps_r before running "
87
+ "a self-consistent Poisson solve."
88
+ )
89
+ z = np.asarray(z, dtype=float)
90
+ vh = np.zeros_like(z)
91
+ density = np.zeros_like(z)
92
+ residual = np.inf
93
+ for it in range(1, max_iter + 1):
94
+ energies, envelopes = solve_subbands(p, z, potential=vh,
95
+ n_states=n_states)
96
+ masses = _inplane_masses(p, z, vh, energies, n_states)
97
+ occ = _fill_subbands(energies, masses, ps)
98
+ new_density = np.zeros_like(z)
99
+ for i in range(n_states):
100
+ prob = (np.abs(envelopes[i]) ** 2).sum(axis=0)
101
+ new_density += occ[i] * prob
102
+ density = (1 - mixing) * density + mixing * new_density
103
+ new_vh = hole_potential(z, density, ps, p.eps_r)
104
+ residual = float(np.max(np.abs(new_vh - vh)))
105
+ vh = (1 - mixing) * vh + mixing * new_vh
106
+ if residual < tol:
107
+ break
108
+ # final consistent (unmixed) state at the converged potential
109
+ energies, envelopes = solve_subbands(p, z, potential=vh, n_states=n_states)
110
+ masses = _inplane_masses(p, z, vh, energies, n_states)
111
+ occ = _fill_subbands(energies, masses, ps)
112
+ density = np.zeros_like(z)
113
+ for i in range(n_states):
114
+ density += occ[i] * (np.abs(envelopes[i]) ** 2).sum(axis=0)
115
+ return SelfConsistentResult(z=z, potential=vh, energies=energies,
116
+ envelopes=envelopes, density=density,
117
+ occupations=occ, masses=masses,
118
+ iterations=it, residual=residual)
@@ -0,0 +1,28 @@
1
+ """Eigen-solution of the assembled envelope Hamiltonian."""
2
+ from __future__ import annotations
3
+
4
+ import numpy as np
5
+
6
+ from .hamiltonian import assemble_hamiltonian
7
+
8
+
9
+ def solve_subbands(p, z, kx=0.0, ky=0.0, potential=None, n_states=8):
10
+ """Solve for the top valence states (the ones holes occupy).
11
+
12
+ Returns (energies, envelopes):
13
+ energies : (n_states,) eV, sorted descending (highest first).
14
+ envelopes : (n_states, 6, N) complex envelope functions, normalized
15
+ such that sum_m integral |F_m|^2 dz = 1.
16
+ """
17
+ z = np.asarray(z, dtype=float)
18
+ H = assemble_hamiltonian(p, z, kx, ky, potential)
19
+ vals, vecs = np.linalg.eigh(H)
20
+ order = np.argsort(vals)[::-1][:n_states]
21
+ dz = z[1] - z[0]
22
+ energies = vals[order]
23
+ envelopes = np.empty((len(order), 6, z.size), dtype=complex)
24
+ for j, o in enumerate(order):
25
+ v = vecs[:, o].reshape(z.size, 6).T # (6, N)
26
+ norm = np.sqrt((np.abs(v) ** 2).sum() * dz)
27
+ envelopes[j] = v / norm
28
+ return energies, envelopes
@@ -0,0 +1,141 @@
1
+ Metadata-Version: 2.4
2
+ Name: kpenvelope
3
+ Version: 0.2.1
4
+ Summary: Six-band k.p envelope-function solver for wurtzite heterostructures, self-consistent with Poisson
5
+ Author-email: "Tanvir M. Mahim" <tanvir.mahim@bracu.ac.bd>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://tanvir-mahmud-mahim.github.io/software/
8
+ Project-URL: Repository, https://github.com/TaN-MM-Org/kpenvelope
9
+ Project-URL: Issues, https://github.com/TaN-MM-Org/kpenvelope/issues
10
+ Project-URL: Changelog, https://github.com/TaN-MM-Org/kpenvelope/releases
11
+ Keywords: k.p,envelope function,wurtzite,GaN,2DHG,subband,semiconductor
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Scientific/Engineering :: Physics
17
+ Requires-Python: >=3.9
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: numpy>=1.22
21
+ Provides-Extra: test
22
+ Requires-Dist: pytest; extra == "test"
23
+ Dynamic: license-file
24
+
25
+ # kpenvelope
26
+
27
+ [![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.22015269-blue)](https://doi.org/10.5281/zenodo.22015269) [![tests](https://github.com/TaN-MM-Org/kpenvelope/actions/workflows/ci.yml/badge.svg)](https://github.com/TaN-MM-Org/kpenvelope/actions)
28
+
29
+ A six-band **k.p envelope-function solver** for wurtzite heterostructures,
30
+ solved **self-consistently with Poisson's equation** on a 1D grid. Built
31
+ for polarization-induced two-dimensional hole gases (GaN/AlN and related
32
+ systems), where the confining potential is not imposed but emerges from
33
+ the balance between the fixed polarization charge and the gas itself.
34
+
35
+ ## Status
36
+
37
+ v0.2.0 (alpha). Implemented and tested:
38
+
39
+ - six-band wurtzite valence Hamiltonian (standard Chuang-Chang form),
40
+ discretized with symmetrized operator ordering so the matrix is exactly
41
+ Hermitian for position-dependent parameters
42
+ - envelope eigen-solution at arbitrary in-plane k
43
+ - Gauss-law hole potential from the density profile
44
+ - self-consistent loop with T = 0 subband filling using numeric in-plane
45
+ edge masses, converging to charge neutrality
46
+ - cited GaN and AlN parameter sets with closed-form verification
47
+ (new in v0.2, see below)
48
+
49
+ Not yet implemented, stated plainly because they matter physically:
50
+
51
+ - **finite barriers.** Hard walls one grid spacing outside the grid ends.
52
+ A hard wall forces the envelope to vanish at the interface and pushes
53
+ the gas outward, which shifts subband energies and masses; a finite AlN
54
+ barrier treated as position-dependent material parameters is the v0.3
55
+ gate before research-grade use.
56
+ - strain terms, full k-grid (non-parabolic) filling, spin splitting
57
+ analysis, transport lifetimes.
58
+
59
+ ## Cited parameter sets (new in v0.2)
60
+
61
+ - `gan_rinke2008()`: the consistent GW-based GaN valence set of Rinke et
62
+ al., Phys. Rev. B 77, 075202 (2008) (A1..A6, Delta_CR = 10 meV,
63
+ Delta_SO = 17 meV, delta2 = delta3 = Delta_SO/3), as tabulated in
64
+ Extended Data Table 1 of Chang et al., Nature Electronics 9, 346 (2026)
65
+ and used in the source paper below. eps_r = 10.4 (E parallel to c) from
66
+ Barker and Ilegems, Phys. Rev. B 7, 743 (1973).
67
+ - `aln_rinke2008()`: the matching AlN set (Delta_CR = -295 meV from Rinke
68
+ et al.; Delta_SO = 22 meV from de Carvalho et al., Appl. Phys. Lett.
69
+ 97, 232101 (2010)), intended as a barrier material. Its permittivity is
70
+ deliberately NaN, and the self-consistent solver refuses to run on it,
71
+ because no vetted value is shipped and none is needed for a barrier.
72
+
73
+ The test-suite locks every number and checks the GaN set against closed
74
+ forms: the zone-center splittings come out at 5.20 and 21.80 meV (against
75
+ accepted experimental values near 5-6 and 22 meV), and the asymptotic
76
+ in-plane masses at m0/|A2+A4-A5| = 1.89 m0 and m0/|A2+A4+A5| = 0.18 m0,
77
+ the quasi-cubic values quoted in the source paper's Supplemental
78
+ Material.
79
+
80
+ For any other material or parameterization, populate
81
+ `WurtziteParameters` from the literature (e.g. Vurgaftman and Meyer,
82
+ J. Appl. Phys. 94, 3675 (2003)) and record the source in the mandatory
83
+ `reference` field. The shipped `demo_single_band()` set is a decoupled,
84
+ non-physical configuration used by the test-suite, chosen because it has
85
+ closed-form well solutions to test against.
86
+
87
+ ## Install and use
88
+
89
+ ```
90
+ pip install -e .
91
+ ```
92
+
93
+ ```python
94
+ import numpy as np
95
+ from kpenvelope import gan_rinke2008, solve_self_consistent
96
+
97
+ p = gan_rinke2008() # cited set; or your own WurtziteParameters
98
+ z = np.linspace(0.0, 6.0, 97) # nm, from the interface
99
+ res = solve_self_consistent(p, z, ps=0.46) # ps in nm^-2; 4.6e13 cm^-2 = 0.46
100
+ # res.energies, res.masses, res.density, res.potential, res.occupations
101
+ ```
102
+
103
+ Convention: valence-electron energies, holes occupy the highest
104
+ eigenvalues; energies in eV, lengths in nm, sheet densities in nm^-2.
105
+
106
+ ## Verification
107
+
108
+ The test-suite checks Hermiticity with every coupling switched on, the
109
+ decoupled square-well limit against the analytic spectrum, the uniform
110
+ slab against the analytic Gauss-law potential, convergence plus exact
111
+ charge neutrality of the self-consistent loop, and (new in v0.2) the
112
+ cited GaN set against the closed-form quasi-cubic splittings and masses
113
+ above.
114
+
115
+ One comparison against the source paper is on record and stated honestly:
116
+ a hard-wall self-consistent run at the measured sheet density
117
+ (4.6e13 cm^-2, 97 points over 6 nm) puts the gas centroid at 0.62 nm
118
+ against 0.568 nm for the hard-wall row of the paper's Table S1, with the
119
+ same subband structure (two heavy branches filled, the light branch a
120
+ minority). The difference comes from the filling model: this package
121
+ fills parabolic edge-mass subbands, while the paper fills the computed
122
+ non-parabolic dispersions, and the light branch is strongly
123
+ non-parabolic. Together with the hard-wall boundary this is why the same
124
+ warning stands: do not use these numbers in publications before the
125
+ finite-barrier, dispersion-filled v0.3.
126
+
127
+ ## Methodological basis
128
+
129
+ > T. M. Mahim, A. S. M. Mohsin and M. M. Rahman, "Origin of the
130
+ > conflicting hole masses in the GaN/AlN two-dimensional hole gas"
131
+ > (under review); code for the paper:
132
+ > https://github.com/Tanvir-Mahmud-Mahim/gan-2dhg-masses-lifetimes
133
+
134
+ and S. L. Chuang and C. S. Chang, Phys. Rev. B 54, 2491 (1996). This
135
+ package is the general-purpose tool; the paper repository reproduces the
136
+ specific published study, including the finite-barrier physics that this
137
+ package does not yet have.
138
+
139
+ ## License
140
+
141
+ Apache-2.0
@@ -0,0 +1,16 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/kpenvelope/__init__.py
5
+ src/kpenvelope/hamiltonian.py
6
+ src/kpenvelope/params.py
7
+ src/kpenvelope/poisson.py
8
+ src/kpenvelope/selfconsistent.py
9
+ src/kpenvelope/solver.py
10
+ src/kpenvelope.egg-info/PKG-INFO
11
+ src/kpenvelope.egg-info/SOURCES.txt
12
+ src/kpenvelope.egg-info/dependency_links.txt
13
+ src/kpenvelope.egg-info/requires.txt
14
+ src/kpenvelope.egg-info/top_level.txt
15
+ tests/test_cited_params.py
16
+ tests/test_kpenvelope.py
@@ -0,0 +1,4 @@
1
+ numpy>=1.22
2
+
3
+ [test]
4
+ pytest
@@ -0,0 +1 @@
1
+ kpenvelope
@@ -0,0 +1,119 @@
1
+ """Tests of the cited GaN and AlN parameter sets.
2
+
3
+ The closed-form anchors come from the quasi-cubic limits of the six-band
4
+ Hamiltonian and are quoted in the Supplemental Material (Sec. S9) of
5
+ Mahim, Mohsin and Rahman, "Origin of the conflicting hole masses in the
6
+ GaN/AlN two-dimensional hole gas" (under review):
7
+
8
+ * zone-center splittings 5.20 and 21.80 meV for the GaN set
9
+ (closed form: E1 = d1+d2 against the eigenvalues of [[d1-d2, sqrt2 d3],
10
+ [sqrt2 d3, 0]]), against accepted experimental values near 5-6 and
11
+ 22 meV;
12
+ * asymptotic in-plane masses m0/|A2+A4-A5| = 1.89 m0 and
13
+ m0/|A2+A4+A5| = 0.18 m0.
14
+
15
+ If a transcription error ever enters the parameter tables, these tests
16
+ fail against the closed forms.
17
+ """
18
+ import math
19
+
20
+ import numpy as np
21
+ import pytest
22
+
23
+ from kpenvelope import (HBAR2_OVER_2M0, aln_rinke2008, gan_rinke2008,
24
+ solve_self_consistent)
25
+ from kpenvelope.hamiltonian import bulk_blocks
26
+
27
+
28
+ def _trapz(y, x):
29
+ """Trapezoidal integral on a uniform grid (works on NumPy 1 and 2)."""
30
+ dz = x[1] - x[0]
31
+ return dz * (y.sum() - 0.5 * (y[0] + y[-1]))
32
+
33
+
34
+ def test_gan_values_locked():
35
+ p = gan_rinke2008()
36
+ assert (p.A1, p.A2, p.A3) == (-5.947, -0.528, 5.414)
37
+ assert (p.A4, p.A5, p.A6) == (-2.512, -2.510, -3.202)
38
+ assert p.delta1 == 0.010
39
+ assert p.delta2 == p.delta3 == pytest.approx(0.017 / 3.0)
40
+ assert p.eps_r == 10.4
41
+ assert "Rinke" in p.reference and "Barker" in p.reference
42
+
43
+
44
+ def test_aln_values_locked():
45
+ p = aln_rinke2008()
46
+ assert (p.A1, p.A2, p.A3) == (-3.991, -0.311, 3.671)
47
+ assert (p.A4, p.A5, p.A6) == (-1.147, -1.329, -1.952)
48
+ assert p.delta1 == -0.295
49
+ assert p.delta2 == p.delta3 == pytest.approx(0.022 / 3.0)
50
+ assert math.isnan(p.eps_r)
51
+ assert "Rinke" in p.reference and "Carvalho" in p.reference
52
+
53
+
54
+ def test_gan_zone_center_splittings():
55
+ p = gan_rinke2008()
56
+ H0, _, _ = bulk_blocks(p, 0.0, 0.0)
57
+ e = np.sort(np.linalg.eigvalsh(H0))[::-1]
58
+ # Kramers degeneracy at k = 0
59
+ assert e[0] == pytest.approx(e[1], abs=1e-12)
60
+ assert e[2] == pytest.approx(e[3], abs=1e-12)
61
+ # closed-form quasi-cubic eigenvalues
62
+ d1, d2, d3 = p.delta1, p.delta2, p.delta3
63
+ top = d1 + d2
64
+ g = d1 - d2
65
+ pair_hi = 0.5 * (g + math.sqrt(g * g + 8 * d3 * d3))
66
+ pair_lo = 0.5 * (g - math.sqrt(g * g + 8 * d3 * d3))
67
+ assert e[0] == pytest.approx(top, abs=1e-12)
68
+ assert e[2] == pytest.approx(pair_hi, abs=1e-12)
69
+ assert e[4] == pytest.approx(pair_lo, abs=1e-12)
70
+ # the published values (Supplemental Material, Sec. S9)
71
+ assert (e[0] - e[2]) * 1e3 == pytest.approx(5.20, abs=0.01)
72
+ assert (e[0] - e[4]) * 1e3 == pytest.approx(21.80, abs=0.01)
73
+
74
+
75
+ def test_gan_asymptotic_inplane_masses():
76
+ p = gan_rinke2008()
77
+ c = HBAR2_OVER_2M0
78
+ k1, k2 = 4.0, 4.4
79
+ E1 = np.sort(np.linalg.eigvalsh(bulk_blocks(p, k1, 0.0)[0]))[::-1]
80
+ E2 = np.sort(np.linalg.eigvalsh(bulk_blocks(p, k2, 0.0)[0]))[::-1]
81
+ slope_top = (E1[0] - E2[0]) / (c * (k2 ** 2 - k1 ** 2))
82
+ slope_bot = (E1[5] - E2[5]) / (c * (k2 ** 2 - k1 ** 2))
83
+ # heavy branch -> m0/|A2+A4-A5| = 1.89 m0 (slope 0.53); at these
84
+ # wavevectors the top sorted band interleaves with the A2-only band
85
+ # (slope 0.528), which lies within the tolerance
86
+ assert 1.0 / slope_top == pytest.approx(1.89, abs=0.03)
87
+ # light branch -> m0/|A2+A4+A5| = 0.18 m0
88
+ assert 1.0 / slope_bot == pytest.approx(0.180, abs=0.003)
89
+
90
+
91
+ def test_aln_refuses_poisson_without_permittivity():
92
+ z = np.linspace(0.0, 4.0, 33)
93
+ with pytest.raises(ValueError, match="permittivity"):
94
+ solve_self_consistent(aln_rinke2008(), z, ps=0.1)
95
+
96
+
97
+ def test_gan_self_consistent_hard_wall():
98
+ """Hard-wall self-consistent GaN gas at the measured sheet density.
99
+
100
+ Compared against the hard-wall row of Table S1 of the source paper
101
+ (centroid 0.568 nm, light-pair sheet density 0.46e13 cm^-2). The
102
+ tolerances are loose on purpose: kpenvelope fills subbands with
103
+ parabolic edge masses (a documented approximation), while the source
104
+ fills the computed non-parabolic dispersions.
105
+ """
106
+ p = gan_rinke2008()
107
+ z = np.linspace(0.0, 6.0, 97)
108
+ res = solve_self_consistent(p, z, ps=0.46, n_states=4, mixing=0.5,
109
+ tol=2e-5)
110
+ # charge neutrality, exact by construction and preserved to the end
111
+ sheet = _trapz(res.density, z)
112
+ assert sheet == pytest.approx(0.46, rel=5e-3)
113
+ # the gas sits within a nanometer of the interface
114
+ centroid = _trapz(z * res.density, z) / sheet
115
+ assert 0.4 < centroid < 0.8
116
+ # two heavy branches dominate; the light branch is a minority
117
+ occ = np.sort(res.occupations)[::-1]
118
+ assert occ[0] + occ[1] > 3.0 * occ[2]
119
+ assert res.residual < 2e-5
@@ -0,0 +1,60 @@
1
+ import numpy as np
2
+
3
+ from kpenvelope import (assemble_hamiltonian, demo_single_band,
4
+ solve_subbands, solve_self_consistent,
5
+ HBAR2_OVER_2M0)
6
+ from kpenvelope.poisson import hole_potential, E2_OVER_EPS0
7
+
8
+
9
+ def test_hamiltonian_is_hermitian():
10
+ p = demo_single_band()
11
+ # switch on every coupling to test the discretization, not the demo
12
+ p.A3, p.A4, p.A5, p.A6 = 0.5, -0.3, 0.4, 0.7
13
+ p.delta1, p.delta2, p.delta3 = 0.02, 0.005, 0.005
14
+ z = np.linspace(0.0, 5.0, 40)
15
+ H = assemble_hamiltonian(p, z, kx=0.3, ky=0.2)
16
+ assert np.allclose(H, H.conj().T)
17
+
18
+
19
+ def test_square_well_matches_analytic():
20
+ # decoupled bands: E_n = A * (hbar^2/2m0) * (n pi / L)^2, A < 0 so the
21
+ # HIGHEST states are n = 1, 2, ... from the top.
22
+ A = -2.0
23
+ L = 8.0
24
+ p = demo_single_band(A)
25
+ z = np.linspace(0.0, L, 400)
26
+ energies, _ = solve_subbands(p, z, n_states=12)
27
+ # the discrete Dirichlet walls sit one grid spacing outside the
28
+ # endpoints, so the effective well width is L + 2 dz
29
+ dz = z[1] - z[0]
30
+ Leff = L + 2 * dz
31
+ analytic = [A * HBAR2_OVER_2M0 * (n * np.pi / Leff) ** 2 for n in (1, 2)]
32
+ # each level is 6-fold degenerate in the decoupled limit
33
+ np.testing.assert_allclose(energies[:6], analytic[0], rtol=1e-4)
34
+ np.testing.assert_allclose(energies[6:12], analytic[1], rtol=1e-4)
35
+
36
+
37
+ def test_poisson_uniform_slab():
38
+ # uniform density filling 0..L exactly cancels ps: field decreases
39
+ # linearly to zero, potential is parabolic with V'(0) set by ps
40
+ L, ps, eps_r = 4.0, 0.1, 10.0
41
+ z = np.linspace(0.0, L, 2001)
42
+ density = np.full_like(z, ps / L)
43
+ vh = hole_potential(z, density, ps, eps_r)
44
+ slope0 = (vh[1] - vh[0]) / (z[1] - z[0])
45
+ assert np.isclose(slope0, E2_OVER_EPS0 / eps_r * ps, rtol=1e-3)
46
+ # analytic: V(L) = (e^2 ps L / (2 eps)) for the uniform slab
47
+ assert np.isclose(vh[-1], E2_OVER_EPS0 / eps_r * ps * L / 2.0, rtol=1e-3)
48
+
49
+
50
+ def test_self_consistent_converges_and_is_neutral():
51
+ p = demo_single_band()
52
+ z = np.linspace(0.0, 6.0, 120)
53
+ ps = 0.046 # nm^-2, i.e. 4.6e12 cm^-2
54
+ res = solve_self_consistent(p, z, ps, n_states=4, tol=1e-5)
55
+ assert res.residual < 1e-5
56
+ dz = z[1] - z[0]
57
+ assert np.isclose(res.density.sum() * dz, ps, rtol=1e-6)
58
+ # the gas must be held toward the interface, not centered in the well
59
+ centroid = (res.z * res.density).sum() / res.density.sum()
60
+ assert centroid < 0.5 * z[-1]