TBpack is a package for tight-binding calculations in Wolfram Language.
Hands-on Trial
Try our Cloud based demo -- TBpackDemo. TBpackDemo contains all fully functional core functions, excluding visualization and data currating functions.
Get TBpackDemo immediately in your notebook from Wolfram Cloud by evaluating in Mathematica 10.0+:
CloudGet["https://www.wolframcloud.com/obj/vasil.saroka/TBpack/Demo/TBpackDemo.wl"]
TBpackDemo does not have documentation built-in into Wolfram Documentation Center, only user information messages can be invoked for the core functions. The available functions are Hamiltonian
, ElectronicStructure
, ElectronicBands1D
. To get informaiton on the usage of Hamiltonian
core function, try
?Hamiltonian
For a flawless start, you can use our Cloud based demo examples shown at the last part of this post.
Installation guide
- The recommended option for TBpack paclet management in Mathematica 11.3+ is to use the resource function:
To install the latest version of the TBpack from this GitHub repo, evaluate
ResourceFunction["InstallTBpack"][]
To find all installed versions on your PC and to uninstall chosen (all) version (s), evaluate
ResourceFunction["InstallTBpack"][Method->"Uninstall"]
- The automated management of TBpack paclet in Mathematica 10.0+:
To install the latest version of the TBpack from this GitHub repo, evaluate
CloudGet["https://www.wolframcloud.com/obj/vasil.saroka/TBpack/Services/InstallTBpack"];
InstallTBpack[]
To find all installed versions on your PC and to uninstall chosen (all) version (s), evaluate
CloudGet["https://www.wolframcloud.com/obj/vasil.saroka/TBpack/Services/InstallTBpack"];
InstallTBpack[Method->"Uninstall"]
- The automated installation option for Mathematica 10.0+:
Copy-paste the below function into a Mathematica notebook cell. Evaluate the cell to make the definition of this function known to Mathematica. In the next cell type and evaluate InstallTBpack[]
.
InstallTBpack[] := Block[{jsonreleases, info, url, message,tempfile,fpath},
jsonreleases = Import["https://api.github.com/repos/vasilsaroka/TBpack/releases","JSON"];
If[jsonreleases === $Failed, Return[$Failed]];
info = "Downloading TBpack " <> First@Lookup[jsonreleases, "tag_name"];
If[
$Notebooks,
PrintTemporary@Row[{info,ProgressIndicator[Appearance -> "Percolate"]},Frame -> True,RoundingRadius -> 9],
Print[info <> "..."]
];
url = First@Lookup[First[Lookup[jsonreleases, "assets"]],"browser_download_url"];
message = "TBpack is succefully installed.";
If[
$VersionNumber >= 12.1,
Check[PacletInstall[url, ForceVersionInstall -> True],Return[$Failed]];
Print[message],
If[
$VersionNumber >= 11.0,
tempfile = FileNameJoin[{$TemporaryDirectory,FileNameTake[url]}];
Check[fpath = URLDownload[url, tempfile],Return[$Failed]];
If[
FileExistsQ[fpath],
Check[PacletManager\`PacletInstall[fpath,"IgnoreVersion" -> True],Return[$Failed]];
DeleteFile[fpath];
Print[message],
$Failed
],
If[
$VersionNumber >= 10.0,
tempfile = FileNameJoin[{$TemporaryDirectory,FileNameTake[url]}];
Check[fpath = URLSave[url,tempfile],Return[$Failed]];
If[
FileExistsQ[fpath],
Check[PacletManager\`PacletInstall[fpath,"IgnoreVersion" -> True],Return[$Failed]];
DeleteFile[fpath];
Print[message],
$Failed
],
$Failed
](* end If *)
](* end If *)
](* end If *)
](* end Block *)
An alternative manual installation option for Mathematica 10.0+ is the following. Download the latest release, distributed as a .paclet
file, and install it using the PacletInstall
function in Mathematica:
Needs["PacletManager`"]
PacletInstall["path2paclet"]
Insert path2paclet
via Mathematica's Insert ? File Path... menu command.
where <version>
stands for any existing version of the application. For example,
PacletInstall["https://github.com/vasilsaroka/TBpack/releases/download/v0.2.0/TBpack-0.2.0.paclet"]
Demo
- Evaluate
<<TBpack`
to load the application into the Mathematica session.
- Test TBpack using
AtomicStructure[Nanotube[10, 10]]
.
- Test MaTeX using
MaTeX["x^2"]
.
Test CustomTicks using
Plot[Sin[x], {x, 0, 3}, Ticks -> {LinTicks[-1, 3, 1, 5], LinTicks[0, 1, 1, 5]}]
Test MaTeX and CustomTicks altogether using
Plot[Sin[x], {x, -1, 3},
Axes -> {MaTeX["x"],MaTeX["\sin(x)"]},
AxesStyle -> BlackFrame,
Ticks -> {
LinTicks[-1, 3, 1, 5, MinorTickLength -> 0.015, MajorTickLength -> 0.025],
LinTicks[-1, 1, 1, 5, MinorTickLength -> 0.015, MajorTickLength -> 0.025]
}
]
Packages MaTeX by Szabolcs Horvát and CustomTicks by Mark A. Caprio are integral parts of TBpack
.
- Open the documentation center and search for "Hamiltonian" to get started.
Note: Compilation to C code is used in TBpack to speed up optical absorption spectra calculations. See how to make Mathematica working with C compiler on Windows. If compiler is not available Mathematica will run uncompiled function.
Supporting the project
We believe everyone deserves access to knowledge that is grounded in science and integrity. That is why we keep our code open for all users, regardless of where they live or what they can afford to pay. This means more people can be better educated and inspired to make an impact on the global wellbeing. We have no shareholders or billionaire owner, meaning only your donations power our work and ensure it can remain open for all. Every contribution, however big or small, makes a real difference for TBpack
future. If you find it useful, consider supporting the project.