hamop 0.1.0__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.
- hamop-0.1.0/LICENSE +202 -0
- hamop-0.1.0/PKG-INFO +208 -0
- hamop-0.1.0/README.md +183 -0
- hamop-0.1.0/pyproject.toml +33 -0
- hamop-0.1.0/setup.cfg +4 -0
- hamop-0.1.0/src/hamop/__init__.py +29 -0
- hamop-0.1.0/src/hamop/eigsolve.py +42 -0
- hamop-0.1.0/src/hamop/kubo.py +96 -0
- hamop-0.1.0/src/hamop/lattices.py +67 -0
- hamop-0.1.0/src/hamop/model.py +209 -0
- hamop-0.1.0/src/hamop/negf.py +163 -0
- hamop-0.1.0/src/hamop/spectrum.py +100 -0
- hamop-0.1.0/src/hamop.egg-info/PKG-INFO +208 -0
- hamop-0.1.0/src/hamop.egg-info/SOURCES.txt +19 -0
- hamop-0.1.0/src/hamop.egg-info/dependency_links.txt +1 -0
- hamop-0.1.0/src/hamop.egg-info/requires.txt +5 -0
- hamop-0.1.0/src/hamop.egg-info/top_level.txt +1 -0
- hamop-0.1.0/tests/test_kubo.py +61 -0
- hamop-0.1.0/tests/test_model.py +89 -0
- hamop-0.1.0/tests/test_negf.py +83 -0
- hamop-0.1.0/tests/test_spectrum.py +50 -0
hamop-0.1.0/LICENSE
ADDED
|
@@ -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.
|
hamop-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hamop
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: One tight-binding Hamiltonian, every observable: bands, DOS, Kubo optical conductivity and NEGF transmission from the same real-space blocks, nonorthogonal bases included
|
|
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/hamop
|
|
9
|
+
Project-URL: Issues, https://github.com/TaN-MM-Org/hamop/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/TaN-MM-Org/hamop/releases
|
|
11
|
+
Keywords: tight binding,Kubo-Greenwood,NEGF,Landauer,optical conductivity,quantum transport,LCAO
|
|
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
|
+
Requires-Dist: scipy>=1.8
|
|
22
|
+
Provides-Extra: test
|
|
23
|
+
Requires-Dist: pytest; extra == "test"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# hamop
|
|
27
|
+
|
|
28
|
+
[](https://github.com/TaN-MM-Org/hamop/actions/workflows/ci.yml)
|
|
29
|
+
[](https://pypi.org/project/hamop/)
|
|
30
|
+
[](LICENSE)
|
|
31
|
+
|
|
32
|
+
**One tight-binding Hamiltonian, every observable, strictly
|
|
33
|
+
consistent.** Build a Hamiltonian once, as real-space blocks in an
|
|
34
|
+
orthogonal or nonorthogonal basis, and compute its band structure,
|
|
35
|
+
density of states, Kubo-Greenwood optical conductivity and Landauer
|
|
36
|
+
(NEGF) transmission from the same matrices.
|
|
37
|
+
|
|
38
|
+
The point of the package is the consistency, not any single solver.
|
|
39
|
+
When the optics of a model and its spectrum are computed by different
|
|
40
|
+
codes with different conventions, they drift: a different gauge for the
|
|
41
|
+
velocity operator, a different treatment of the overlap matrix, a
|
|
42
|
+
different broadening, and suddenly the absorption edge no longer sits
|
|
43
|
+
at the band gap. Here every observable diagonalizes the same Bloch
|
|
44
|
+
matrices through the same canonically orthogonalized solver, and the
|
|
45
|
+
Kubo velocity operator is built from the exact k-derivative of the same
|
|
46
|
+
assembly, so spectral, optical and transport statements about one model
|
|
47
|
+
cannot disagree with each other.
|
|
48
|
+
|
|
49
|
+
## What it does
|
|
50
|
+
|
|
51
|
+
- **`TightBindingModel`**: sites with any number of orbitals, directed
|
|
52
|
+
hopping blocks with automatic Hermitian completion, optional overlap
|
|
53
|
+
blocks (LCAO-style nonorthogonal bases), periodic in any dimension or
|
|
54
|
+
finite. Assembles H(k), S(k) and their exact k-derivatives in the
|
|
55
|
+
atomic gauge.
|
|
56
|
+
- **Spectrum** (`bands`, `dos`, `fermi_level`, `band_edges`): band
|
|
57
|
+
structures along arbitrary k-lists, Gaussian-broadened densities of
|
|
58
|
+
states, chemical potential at a given filling by bisection, band
|
|
59
|
+
edges and gap about a chemical potential.
|
|
60
|
+
- **Optics** (`sigma_optical`): Kubo-Greenwood real sheet conductivity
|
|
61
|
+
in units of e²/(4ℏ), with the nonorthogonal velocity correction
|
|
62
|
+
`v = dH/dk − (eₙ+eₘ)/2 dS/dk` that makes the result exactly
|
|
63
|
+
invariant under a shift of the energy zero.
|
|
64
|
+
- **Transport** (`sancho_rubio`, `transmission`,
|
|
65
|
+
`transmission_direct`): two-probe Landauer transmission with
|
|
66
|
+
Sancho-Rubio lead surface Green functions and a recursive Green
|
|
67
|
+
function sweep, nonorthogonal bases included, plus a dense
|
|
68
|
+
direct-inversion reference implementation of the same quantity.
|
|
69
|
+
- **`gen_eigh`**: generalized eigensolver with canonical
|
|
70
|
+
orthogonalization (Szabo and Ostlund, *Modern Quantum Chemistry*,
|
|
71
|
+
sec. 3.4.5), so mildly overcomplete overlaps cannot blow up the
|
|
72
|
+
spectrum — the standard remedy used inside electronic-structure
|
|
73
|
+
codes.
|
|
74
|
+
|
|
75
|
+
Dependencies: NumPy and SciPy. Nothing else.
|
|
76
|
+
|
|
77
|
+
## Validation against closed forms
|
|
78
|
+
|
|
79
|
+
Every physical claim in the package is pinned by a test against an
|
|
80
|
+
exact result, not a stored number:
|
|
81
|
+
|
|
82
|
+
- the single-orbital chain reproduces E(k) = e₀ + 2t cos ka to machine
|
|
83
|
+
precision, and its nonorthogonal variant reproduces
|
|
84
|
+
E(k) = 2t cos ka / (1 + 2s cos ka);
|
|
85
|
+
- the chain density of states matches 1/(π√(4t² − E²)) and integrates
|
|
86
|
+
to the orbital count;
|
|
87
|
+
- graphene's nearest-neighbour model gives Dirac-point closure at K
|
|
88
|
+
exactly, ±3|t| at Γ exactly, and the **universal optical sheet
|
|
89
|
+
conductivity e²/(4ℏ)** on the interband plateau (Kuzmenko et al.,
|
|
90
|
+
Phys. Rev. Lett. 100, 117401 (2008)) — which is also the absolute
|
|
91
|
+
anchor for the package's conductivity unit;
|
|
92
|
+
- the two-site molecule absorbs at exactly 2|t| with the hand-derived
|
|
93
|
+
velocity matrix element |M| = |a t|;
|
|
94
|
+
- σ(ω) is invariant to 10⁻¹⁰ under H → H + cS with μ → μ + c, which
|
|
95
|
+
pins the nonorthogonal velocity term;
|
|
96
|
+
- the chain's lead surface Green function matches its closed form
|
|
97
|
+
(E − i√(4t² − E²))/(2t²); a pristine chain transmits exactly one
|
|
98
|
+
channel inside the band and nothing outside; two decoupled chains
|
|
99
|
+
transmit two; an on-site impurity ε reproduces
|
|
100
|
+
T = (4t² − E²)/((4t² − E²) + ε²);
|
|
101
|
+
- the recursive Green function sweep agrees with dense direct inversion
|
|
102
|
+
to machine precision, disorder and overlap included.
|
|
103
|
+
|
|
104
|
+
Run them yourself: `pip install -e .[test]` then `pytest`.
|
|
105
|
+
|
|
106
|
+
## Install and use
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
pip install hamop
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
import numpy as np
|
|
114
|
+
from hamop import graphene, bands, dos, sigma_optical
|
|
115
|
+
|
|
116
|
+
g = graphene(t=-2.7, a=2.46) # eV, Angstrom
|
|
117
|
+
omega = np.linspace(0.5, 2.0, 60)
|
|
118
|
+
sigma = sigma_optical(g, omega, mu=0.0, mesh=120, eta=0.12)
|
|
119
|
+
# sigma is ~1.0 on the plateau: the universal e^2/(4 hbar)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Building your own model:
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
from hamop import TightBindingModel, band_edges
|
|
126
|
+
|
|
127
|
+
m = TightBindingModel(positions=[[0.0], [0.7]], norb=1, cell=[[2.0]])
|
|
128
|
+
m.add_hop(0, 1, (0,), [[-1.0]]) # intra-cell bond
|
|
129
|
+
m.add_hop(1, 0, (1,), [[-0.6]]) # inter-cell bond
|
|
130
|
+
print(band_edges(m, mu=0.0, mesh=2001)) # the SSH gap, 2|t1 - t2|
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Conventions, stated once: energies in eV, positions in Angstrom, k in
|
|
134
|
+
1/Angstrom, Cartesian. Each directed hopping block is added once and
|
|
135
|
+
its Hermitian partner is implied. Optical conductivity is the real
|
|
136
|
+
sheet conductivity in units of e²/(4ℏ) with spin degeneracy as an
|
|
137
|
+
explicit factor (default 2). The velocity operator uses the standard
|
|
138
|
+
atomistic position gauge (position operator diagonal at the sites);
|
|
139
|
+
the intra-atomic dipole contribution is neglected, the common
|
|
140
|
+
approximation in tight-binding optics.
|
|
141
|
+
|
|
142
|
+
## Relation to existing tools
|
|
143
|
+
|
|
144
|
+
Excellent tools cover parts of this space: [PythTB](https://www.physics.rutgers.edu/pythtb/) and [pybinding](https://docs.pybinding.site/) build tight-binding models and their spectra, and [Kwant](https://kwant-project.org/) is the standard for quantum transport. hamop does not replace any of them, and for their core use cases they are more capable. Its niche is the combination they leave open: nonorthogonal (LCAO-style) overlap matrices as first-class citizens across *all* observables, optics and transport computed from the same Bloch assembly as the spectrum so the three can never disagree, and a deliberately small NumPy/SciPy-only core validated line by line against closed forms -- the shape of engine an LCAO electronic-structure pipeline exports its Hamiltonians into.
|
|
145
|
+
|
|
146
|
+
## Status
|
|
147
|
+
|
|
148
|
+
v0.1.0 (alpha). Implemented and tested: the model container with exact
|
|
149
|
+
k-derivatives, canonical-orthogonalization eigensolver, band
|
|
150
|
+
structures, densities of states, filling-resolved chemical potentials,
|
|
151
|
+
band edges, Kubo-Greenwood optical conductivity for periodic and finite
|
|
152
|
+
systems, Sancho-Rubio surface Green functions, and recursive plus
|
|
153
|
+
direct-inversion Landauer transmission.
|
|
154
|
+
|
|
155
|
+
Not yet implemented, stated plainly: k-space symmetry reduction (grids
|
|
156
|
+
are full Monkhorst-Pack), Lorentzian and adaptive broadenings, the
|
|
157
|
+
Drude (intraband) term of the conductivity, spin-orbit-coupled blocks
|
|
158
|
+
as a first-class convention (complex blocks work, but no helper),
|
|
159
|
+
Hall/off-diagonal conductivity tensors, and interaction self-energies
|
|
160
|
+
in the transport module. Sparse or very large models are out of scope
|
|
161
|
+
for now: matrices are dense.
|
|
162
|
+
|
|
163
|
+
## Where it comes from
|
|
164
|
+
|
|
165
|
+
Methodological basis:
|
|
166
|
+
|
|
167
|
+
> "Learning the quantum Hamiltonian of defective monolayer MoS2
|
|
168
|
+
> reveals collective vacancy brightness decoupled from defect count";
|
|
169
|
+
> code for the paper:
|
|
170
|
+
> https://github.com/Tanvir-Mahmud-Mahim/mos2-vacancy-optics
|
|
171
|
+
|
|
172
|
+
That study computes the optics, the electronic structure and the
|
|
173
|
+
transport of vacancy-disordered MoS2 supercells from one
|
|
174
|
+
density-functional Hamiltonian, so that a defect configuration's
|
|
175
|
+
optical and electronic signatures are strictly consistent — and its
|
|
176
|
+
conclusions depend on that consistency. This package is the
|
|
177
|
+
general-purpose engine distilled from that pipeline: the same
|
|
178
|
+
observables for any Hamiltonian a user supplies, with the
|
|
179
|
+
material-specific machinery (DFT extraction, machine-learned
|
|
180
|
+
Hamiltonians, MoS2 structures) left in the paper repository.
|
|
181
|
+
|
|
182
|
+
## Support and governance
|
|
183
|
+
|
|
184
|
+
The package is written and maintained by Tanvir Mahmud Mahim
|
|
185
|
+
(Department of Electrical and Electronic Engineering, BRAC University),
|
|
186
|
+
who reviews every change and takes the final decision on scope and
|
|
187
|
+
releases. There is no separate governance body; design questions are
|
|
188
|
+
discussed in the open in issues and pull requests, and the standing
|
|
189
|
+
rule of [CONTRIBUTING.md](CONTRIBUTING.md) binds the maintainer exactly
|
|
190
|
+
as it binds contributors: a change that touches physics arrives with a
|
|
191
|
+
test, and a constant arrives with its source.
|
|
192
|
+
|
|
193
|
+
Support runs through the issue tracker at
|
|
194
|
+
https://github.com/TaN-MM-Org/hamop/issues. Usage questions are welcome
|
|
195
|
+
there alongside bug reports; a docstring that left a unit or a sign
|
|
196
|
+
convention unclear is treated as a documentation bug, not as user
|
|
197
|
+
error. The maintainer aims to respond within a week.
|
|
198
|
+
|
|
199
|
+
While the version is below 1.0 the API may still move between minor
|
|
200
|
+
versions; such changes are called out in the release notes. The
|
|
201
|
+
limitations named under Status are deliberate scope, recorded there
|
|
202
|
+
precisely so that a user can tell a designed-out feature from an
|
|
203
|
+
oversight.
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
Apache-2.0 (see [LICENSE](LICENSE)). Citation metadata is in
|
|
208
|
+
[CITATION.cff](CITATION.cff).
|
hamop-0.1.0/README.md
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# hamop
|
|
2
|
+
|
|
3
|
+
[](https://github.com/TaN-MM-Org/hamop/actions/workflows/ci.yml)
|
|
4
|
+
[](https://pypi.org/project/hamop/)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
**One tight-binding Hamiltonian, every observable, strictly
|
|
8
|
+
consistent.** Build a Hamiltonian once, as real-space blocks in an
|
|
9
|
+
orthogonal or nonorthogonal basis, and compute its band structure,
|
|
10
|
+
density of states, Kubo-Greenwood optical conductivity and Landauer
|
|
11
|
+
(NEGF) transmission from the same matrices.
|
|
12
|
+
|
|
13
|
+
The point of the package is the consistency, not any single solver.
|
|
14
|
+
When the optics of a model and its spectrum are computed by different
|
|
15
|
+
codes with different conventions, they drift: a different gauge for the
|
|
16
|
+
velocity operator, a different treatment of the overlap matrix, a
|
|
17
|
+
different broadening, and suddenly the absorption edge no longer sits
|
|
18
|
+
at the band gap. Here every observable diagonalizes the same Bloch
|
|
19
|
+
matrices through the same canonically orthogonalized solver, and the
|
|
20
|
+
Kubo velocity operator is built from the exact k-derivative of the same
|
|
21
|
+
assembly, so spectral, optical and transport statements about one model
|
|
22
|
+
cannot disagree with each other.
|
|
23
|
+
|
|
24
|
+
## What it does
|
|
25
|
+
|
|
26
|
+
- **`TightBindingModel`**: sites with any number of orbitals, directed
|
|
27
|
+
hopping blocks with automatic Hermitian completion, optional overlap
|
|
28
|
+
blocks (LCAO-style nonorthogonal bases), periodic in any dimension or
|
|
29
|
+
finite. Assembles H(k), S(k) and their exact k-derivatives in the
|
|
30
|
+
atomic gauge.
|
|
31
|
+
- **Spectrum** (`bands`, `dos`, `fermi_level`, `band_edges`): band
|
|
32
|
+
structures along arbitrary k-lists, Gaussian-broadened densities of
|
|
33
|
+
states, chemical potential at a given filling by bisection, band
|
|
34
|
+
edges and gap about a chemical potential.
|
|
35
|
+
- **Optics** (`sigma_optical`): Kubo-Greenwood real sheet conductivity
|
|
36
|
+
in units of e²/(4ℏ), with the nonorthogonal velocity correction
|
|
37
|
+
`v = dH/dk − (eₙ+eₘ)/2 dS/dk` that makes the result exactly
|
|
38
|
+
invariant under a shift of the energy zero.
|
|
39
|
+
- **Transport** (`sancho_rubio`, `transmission`,
|
|
40
|
+
`transmission_direct`): two-probe Landauer transmission with
|
|
41
|
+
Sancho-Rubio lead surface Green functions and a recursive Green
|
|
42
|
+
function sweep, nonorthogonal bases included, plus a dense
|
|
43
|
+
direct-inversion reference implementation of the same quantity.
|
|
44
|
+
- **`gen_eigh`**: generalized eigensolver with canonical
|
|
45
|
+
orthogonalization (Szabo and Ostlund, *Modern Quantum Chemistry*,
|
|
46
|
+
sec. 3.4.5), so mildly overcomplete overlaps cannot blow up the
|
|
47
|
+
spectrum — the standard remedy used inside electronic-structure
|
|
48
|
+
codes.
|
|
49
|
+
|
|
50
|
+
Dependencies: NumPy and SciPy. Nothing else.
|
|
51
|
+
|
|
52
|
+
## Validation against closed forms
|
|
53
|
+
|
|
54
|
+
Every physical claim in the package is pinned by a test against an
|
|
55
|
+
exact result, not a stored number:
|
|
56
|
+
|
|
57
|
+
- the single-orbital chain reproduces E(k) = e₀ + 2t cos ka to machine
|
|
58
|
+
precision, and its nonorthogonal variant reproduces
|
|
59
|
+
E(k) = 2t cos ka / (1 + 2s cos ka);
|
|
60
|
+
- the chain density of states matches 1/(π√(4t² − E²)) and integrates
|
|
61
|
+
to the orbital count;
|
|
62
|
+
- graphene's nearest-neighbour model gives Dirac-point closure at K
|
|
63
|
+
exactly, ±3|t| at Γ exactly, and the **universal optical sheet
|
|
64
|
+
conductivity e²/(4ℏ)** on the interband plateau (Kuzmenko et al.,
|
|
65
|
+
Phys. Rev. Lett. 100, 117401 (2008)) — which is also the absolute
|
|
66
|
+
anchor for the package's conductivity unit;
|
|
67
|
+
- the two-site molecule absorbs at exactly 2|t| with the hand-derived
|
|
68
|
+
velocity matrix element |M| = |a t|;
|
|
69
|
+
- σ(ω) is invariant to 10⁻¹⁰ under H → H + cS with μ → μ + c, which
|
|
70
|
+
pins the nonorthogonal velocity term;
|
|
71
|
+
- the chain's lead surface Green function matches its closed form
|
|
72
|
+
(E − i√(4t² − E²))/(2t²); a pristine chain transmits exactly one
|
|
73
|
+
channel inside the band and nothing outside; two decoupled chains
|
|
74
|
+
transmit two; an on-site impurity ε reproduces
|
|
75
|
+
T = (4t² − E²)/((4t² − E²) + ε²);
|
|
76
|
+
- the recursive Green function sweep agrees with dense direct inversion
|
|
77
|
+
to machine precision, disorder and overlap included.
|
|
78
|
+
|
|
79
|
+
Run them yourself: `pip install -e .[test]` then `pytest`.
|
|
80
|
+
|
|
81
|
+
## Install and use
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
pip install hamop
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
import numpy as np
|
|
89
|
+
from hamop import graphene, bands, dos, sigma_optical
|
|
90
|
+
|
|
91
|
+
g = graphene(t=-2.7, a=2.46) # eV, Angstrom
|
|
92
|
+
omega = np.linspace(0.5, 2.0, 60)
|
|
93
|
+
sigma = sigma_optical(g, omega, mu=0.0, mesh=120, eta=0.12)
|
|
94
|
+
# sigma is ~1.0 on the plateau: the universal e^2/(4 hbar)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Building your own model:
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
from hamop import TightBindingModel, band_edges
|
|
101
|
+
|
|
102
|
+
m = TightBindingModel(positions=[[0.0], [0.7]], norb=1, cell=[[2.0]])
|
|
103
|
+
m.add_hop(0, 1, (0,), [[-1.0]]) # intra-cell bond
|
|
104
|
+
m.add_hop(1, 0, (1,), [[-0.6]]) # inter-cell bond
|
|
105
|
+
print(band_edges(m, mu=0.0, mesh=2001)) # the SSH gap, 2|t1 - t2|
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Conventions, stated once: energies in eV, positions in Angstrom, k in
|
|
109
|
+
1/Angstrom, Cartesian. Each directed hopping block is added once and
|
|
110
|
+
its Hermitian partner is implied. Optical conductivity is the real
|
|
111
|
+
sheet conductivity in units of e²/(4ℏ) with spin degeneracy as an
|
|
112
|
+
explicit factor (default 2). The velocity operator uses the standard
|
|
113
|
+
atomistic position gauge (position operator diagonal at the sites);
|
|
114
|
+
the intra-atomic dipole contribution is neglected, the common
|
|
115
|
+
approximation in tight-binding optics.
|
|
116
|
+
|
|
117
|
+
## Relation to existing tools
|
|
118
|
+
|
|
119
|
+
Excellent tools cover parts of this space: [PythTB](https://www.physics.rutgers.edu/pythtb/) and [pybinding](https://docs.pybinding.site/) build tight-binding models and their spectra, and [Kwant](https://kwant-project.org/) is the standard for quantum transport. hamop does not replace any of them, and for their core use cases they are more capable. Its niche is the combination they leave open: nonorthogonal (LCAO-style) overlap matrices as first-class citizens across *all* observables, optics and transport computed from the same Bloch assembly as the spectrum so the three can never disagree, and a deliberately small NumPy/SciPy-only core validated line by line against closed forms -- the shape of engine an LCAO electronic-structure pipeline exports its Hamiltonians into.
|
|
120
|
+
|
|
121
|
+
## Status
|
|
122
|
+
|
|
123
|
+
v0.1.0 (alpha). Implemented and tested: the model container with exact
|
|
124
|
+
k-derivatives, canonical-orthogonalization eigensolver, band
|
|
125
|
+
structures, densities of states, filling-resolved chemical potentials,
|
|
126
|
+
band edges, Kubo-Greenwood optical conductivity for periodic and finite
|
|
127
|
+
systems, Sancho-Rubio surface Green functions, and recursive plus
|
|
128
|
+
direct-inversion Landauer transmission.
|
|
129
|
+
|
|
130
|
+
Not yet implemented, stated plainly: k-space symmetry reduction (grids
|
|
131
|
+
are full Monkhorst-Pack), Lorentzian and adaptive broadenings, the
|
|
132
|
+
Drude (intraband) term of the conductivity, spin-orbit-coupled blocks
|
|
133
|
+
as a first-class convention (complex blocks work, but no helper),
|
|
134
|
+
Hall/off-diagonal conductivity tensors, and interaction self-energies
|
|
135
|
+
in the transport module. Sparse or very large models are out of scope
|
|
136
|
+
for now: matrices are dense.
|
|
137
|
+
|
|
138
|
+
## Where it comes from
|
|
139
|
+
|
|
140
|
+
Methodological basis:
|
|
141
|
+
|
|
142
|
+
> "Learning the quantum Hamiltonian of defective monolayer MoS2
|
|
143
|
+
> reveals collective vacancy brightness decoupled from defect count";
|
|
144
|
+
> code for the paper:
|
|
145
|
+
> https://github.com/Tanvir-Mahmud-Mahim/mos2-vacancy-optics
|
|
146
|
+
|
|
147
|
+
That study computes the optics, the electronic structure and the
|
|
148
|
+
transport of vacancy-disordered MoS2 supercells from one
|
|
149
|
+
density-functional Hamiltonian, so that a defect configuration's
|
|
150
|
+
optical and electronic signatures are strictly consistent — and its
|
|
151
|
+
conclusions depend on that consistency. This package is the
|
|
152
|
+
general-purpose engine distilled from that pipeline: the same
|
|
153
|
+
observables for any Hamiltonian a user supplies, with the
|
|
154
|
+
material-specific machinery (DFT extraction, machine-learned
|
|
155
|
+
Hamiltonians, MoS2 structures) left in the paper repository.
|
|
156
|
+
|
|
157
|
+
## Support and governance
|
|
158
|
+
|
|
159
|
+
The package is written and maintained by Tanvir Mahmud Mahim
|
|
160
|
+
(Department of Electrical and Electronic Engineering, BRAC University),
|
|
161
|
+
who reviews every change and takes the final decision on scope and
|
|
162
|
+
releases. There is no separate governance body; design questions are
|
|
163
|
+
discussed in the open in issues and pull requests, and the standing
|
|
164
|
+
rule of [CONTRIBUTING.md](CONTRIBUTING.md) binds the maintainer exactly
|
|
165
|
+
as it binds contributors: a change that touches physics arrives with a
|
|
166
|
+
test, and a constant arrives with its source.
|
|
167
|
+
|
|
168
|
+
Support runs through the issue tracker at
|
|
169
|
+
https://github.com/TaN-MM-Org/hamop/issues. Usage questions are welcome
|
|
170
|
+
there alongside bug reports; a docstring that left a unit or a sign
|
|
171
|
+
convention unclear is treated as a documentation bug, not as user
|
|
172
|
+
error. The maintainer aims to respond within a week.
|
|
173
|
+
|
|
174
|
+
While the version is below 1.0 the API may still move between minor
|
|
175
|
+
versions; such changes are called out in the release notes. The
|
|
176
|
+
limitations named under Status are deliberate scope, recorded there
|
|
177
|
+
precisely so that a user can tell a designed-out feature from an
|
|
178
|
+
oversight.
|
|
179
|
+
|
|
180
|
+
## License
|
|
181
|
+
|
|
182
|
+
Apache-2.0 (see [LICENSE](LICENSE)). Citation metadata is in
|
|
183
|
+
[CITATION.cff](CITATION.cff).
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "hamop"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "One tight-binding Hamiltonian, every observable: bands, DOS, Kubo optical conductivity and NEGF transmission from the same real-space blocks, nonorthogonal bases included"
|
|
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 = ["tight binding", "Kubo-Greenwood", "NEGF", "Landauer", "optical conductivity", "quantum transport", "LCAO"]
|
|
14
|
+
dependencies = ["numpy>=1.22", "scipy>=1.8"]
|
|
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/hamop"
|
|
29
|
+
Issues = "https://github.com/TaN-MM-Org/hamop/issues"
|
|
30
|
+
Changelog = "https://github.com/TaN-MM-Org/hamop/releases"
|
|
31
|
+
|
|
32
|
+
[tool.setuptools.packages.find]
|
|
33
|
+
where = ["src"]
|
hamop-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""hamop: one tight-binding Hamiltonian, every observable, strictly consistent.
|
|
2
|
+
|
|
3
|
+
Build a Hamiltonian once, as real-space blocks in an orthogonal or
|
|
4
|
+
nonorthogonal basis, and compute its band structure, density of states,
|
|
5
|
+
Kubo-Greenwood optical conductivity and Landauer transmission from the
|
|
6
|
+
same matrices, so that spectral, optical and transport statements about
|
|
7
|
+
one model can never drift apart.
|
|
8
|
+
|
|
9
|
+
Methodological basis: the study "Learning the quantum Hamiltonian of
|
|
10
|
+
defective monolayer MoS2 reveals collective vacancy brightness
|
|
11
|
+
decoupled from defect count" (code:
|
|
12
|
+
https://github.com/Tanvir-Mahmud-Mahim/mos2-vacancy-optics); this
|
|
13
|
+
package is the general-purpose engine distilled from that pipeline.
|
|
14
|
+
"""
|
|
15
|
+
from .eigsolve import gen_eigh
|
|
16
|
+
from .kubo import carrier_count, sigma_optical
|
|
17
|
+
from .lattices import chain_lead_blocks, graphene, linear_chain, two_site
|
|
18
|
+
from .model import TightBindingModel
|
|
19
|
+
from .negf import sancho_rubio, transmission, transmission_direct
|
|
20
|
+
from .spectrum import band_edges, bands, dos, fermi_level
|
|
21
|
+
|
|
22
|
+
__version__ = "0.1.0"
|
|
23
|
+
__all__ = [
|
|
24
|
+
"TightBindingModel", "gen_eigh",
|
|
25
|
+
"bands", "dos", "fermi_level", "band_edges",
|
|
26
|
+
"sigma_optical", "carrier_count",
|
|
27
|
+
"sancho_rubio", "transmission", "transmission_direct",
|
|
28
|
+
"linear_chain", "two_site", "graphene", "chain_lead_blocks",
|
|
29
|
+
]
|