Giter Site home page Giter Site logo

beebo021 / tbpack Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vasilsaroka/tbpack

0.0 0.0 0.0 23.88 MB

Tight-binding calculations in Mathematica

Home Page: https://sites.google.com/site/sarokavasil/home

License: MIT License

Mathematica 99.99% TeX 0.01%

tbpack's Introduction

GitHub (pre-)release Github All Releases License: MIT Support TBpack

TBpack

Tight-binding calculations in Mathematica

Hands-on Trial

Try our Cloud based demo -- TBpackDemo. TBpackDemo contains all fully functional core functions, excluding visualization and data currating functions. TBpackDemo_Logo

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 fucntions. The available functions are Hamiltonian, ElectronicStructure, ElectronicBands1D. To get informaiton on the usage of Hamiltonian core fucntion, try

   ?Hamiltonian

For a flawless start, you can use our Cloud based demo examples. Download ExamplesDemo.nb with examples and follow the instructions inside.

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 intallation 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.

  • In Mathematica 12.1+ PacletInstall["url"] can be used for the installation straight away:

     PacletInstall["https://github.com/vasilsaroka/TBpack/releases/download/v<version>/TBpack-<version>.paclet"]  
    

    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 .

tbpack's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.