Giter VIP home page Giter VIP logo

alejandrojuria / tightbinder Goto Github PK

View Code? Open in Web Editor NEW
12.0 1.0 6.0 21.81 MB

General purpose Slater-Koster tight-binding library for electronic structure calculations

Home Page: https://tightbinder.readthedocs.io

License: GNU General Public License v3.0

Python 97.76% TeX 2.24%
condensed-matter-physics python simulation tight-binding electronic-structure slater-koster solid-state-physics band-structure topology alloys

tightbinder's Introduction

logo Documentation Status contributions welcome License: GPL v3 PyPI - Downloads DOI

tightbinder is a Python library for electronic structure calculations based on the Slater-Koster approximation for tight-binding models. It provides all the necessary tools to build, modify and characterize any crystalline or disordered material.

The construction of a Slater-Koster model relies on the definition of a configuration file, which contains all the information needed to build the model. Namely, one has to specify completely the crystalline structure, i.e. the Bravais vectors and motif, and the electronic structure which amounts to the orbitals, onsite energies and hoppings between orbitals. The configuration file then fully characterizes the Slater-Koster models and constitutes the starting point for the majority of the calculations done with the library. Alternatively, it is also possible to define custom models that can still leverage the capabilities of the package.

The features of the library are:

  • Construction of Slater-Koster tight-binding models up to $d$ orbitals, with intraatomic spin-orbit coupling.
  • Construction of amorphous Slater-Koster models, with hoppings modified accordingly (power or exponential law) with respect to the crystalline model.
  • Methods to modify the system as desired: construction of supercells, finite systems, introduction of vacancies or impurities, amorphization of the lattice, application of electric or magnetic fields.
  • Complete topological characterization of materials: evolution of Wannier charge centers, $\mathbb{Z}_2$ invariant, Berry curvature, Chern number and marker, and spatial entanglement spectrum.
  • Transport calculations in two-terminal devices based on the Landauer-Buttiker formalism (conductance and transmission).
  • Computation of observables such as the band structure, expected value of the spin components, density of states (either using Green's functions or the KPM), local density of states, as well as the plotting routines for the corresponding quantities.
  • Predefined models (e.g. Haldane or BHZ) and ability to define custom ones.
  • Fitting module to obtain the Slater-Koster parameters of any user-defined model from some input band structure.
  • Additional classes for building models (define model bond by bond instead of relying on the Slater-Koster constructor, or stackings of 2d layers) (under development).

Features

For a complete description of the capabilities of the package, we refer to the documentation where several usage examples can be found together with the full API reference.

Installation

Usage of a virtual environment is recommended in general to avoid conflicts between packages.

To install the latest version of the package, simply run:

pip install tightbinder

Alternatively, you can clone the repository to get the most up-to-date version of the package.

git clone https://github.com/alejandrojuria/tightbinder.git

From the root folder of the repository, install the library (which will automatically install the required dependencies):

cd {path}/tightbinder
pip install .

Documentation

The documentation can be accessed online. To build it, you must have installed GNU Make and the library itself. Additional requirements to build documentation can be installed by specifying docs qualifier when installing tightbinder

cd {path}/tightbinder
pip install ".[docs]"

Then, cd docs/ and then, run make html to build the documentation. It will be created in docs/build/html, and can be accessed through index.html.

Contributing

The library is still under development as new features and optimizations are added. Therefore, any kind of contribution is welcome, from completing the documentation, bug fixing, adding new features or reporting bugs of the library. In general, any contribution should stick to the PEP style guidelines. If in doubt, do not hesitate to contact!

tightbinder's People

Contributors

alejandrojuria avatar dependabot[bot] avatar mbkumar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

tightbinder's Issues

Add dependencies to installation

I don't have to install the dependencies such as numpy, scipy, and matplotlib separately. You can specify them within the setup.py or pyproject.toml, so they are installed automatically along with tightbinder.

After #6 is addressed, please specify the dependencies within the pyproject.toml

Missing unit tests

Tests are missing. For code quality control, please consider adding unit tests. Python unit testing framework should be enough for your case.

Replace setup.py with pyproject.toml

@alejandrojuria

I am one of the reviewers for your JOSS paper. I'll open separate issues for each of the comments that I want to be addressed.

setup.py is deprecated and the new installation approach uses pyproject.toml. Your installation is simple enough that conversion shouldn't take much time after you understand the new build framework. Please replace setup.py with pyproject.toml.

[REVIEW comments] for the paper and code submitted to JOSS

Hello @alejandrojuria , thank you for your excellent work on this code.
Here are some comments that you may consider to improve the quality of the submitted manuscript (openjournals/joss-reviews#5810) and the features of the code.

  • The code, 'tightbinder', is reported to be an alternative tool that has some advantages over the popular tight binding code in the simulations of the realistic amorphous materials and the identification of the topological properties in the simulated systems. I didn't have experience with the other codes. Could you prepare a simple table or enumerated list to highlight the features of tightbinder that are not available or not easy to use in other codes? This highlight may be included in the README file. I know you have listed some functional features in the README, but let us know if these features are unique of tightbinder if you have already had the experience. I think it may help the upcoming new users to choose which codes they can take for their specific case.
  • In the manuscript, when mentioning the two Python classes designed for crystalline and amorphous solids, authors may include the specific names of the two classes.
  • On page 3 of the manuscript, change 'SK' to 'Slater-Koster' since it was only used once on line 83.
  • On line 95 of page 3, the authors are suggested to provide the website of the documentation which can be easily accessed by the readers.
  • I tested to build the documentation. I executed make html, but it raised the error: make: *** No rule to make target 'html'. Stop. make: *** No rule to make target 'html'. Stop.
    The "make'' refers to the version make-4.4.1 installed in my computer.
  • In all the tutorials, all paths for loading the files omit a dot (all my tests were run in a Linux mint system). However, if the paths are only shown for demo, it's okay and you don't need to change it.
  • In the tutorial for building the crystal https://tightbinder.readthedocs.io/en/latest/tutorial/crystal.html, execution of model.plot_wireframe() in Jupyter notebook raised an error TypeError: list indices must be integers or slices, not tuple'' that seems to come from ``File ~/tightbinder/tightbinder/system.py:520, in System.plot_wireframe(self, ax, linewidth, alpha, color)''.
  • In the tutorial for setting up the device (https://tightbinder.readthedocs.io/en/latest/tutorial/transport.html), these example codes all raised parsing error ValueError: Filling must be a number. I think there could be some errors in the examples/chain.txt.
  • Have you considered introducing ASE to this code (or Pymatgen or any other built-in methods in this code) so that the crystal can be built directly from the popular structure files in POSCAR and CIF? If it has been implemented, you're encouraged to mention it in the tutorial and the manuscript.
  • Automated tests are still lacking to verify the core functionalities (you can find below that these tests are required by Review Checklist of JOSS)

Here, I also linked this issue to the Review checklist openjournals/joss-reviews#5810 (comment) so that you can track the status of this review report.

Failing unit test

One of the tests, test_conductance is failing.

>       assert np.allclose(conductance, 6.064302600409135)
E       assert False
E        +  where False = <function allclose at 0x1027c3d30>(6.240297897758343, 6.064302600409135)
E        +    where <function allclose at 0x1027c3d30> = np.allclose

tests/test_observables.py:147: AssertionError

Small change in the layout

I recommend the following layout to prevent confusion

examples/*.txt -> examples/inputs/*.yaml (After you convert them to yaml)
scripts/examples/*.py -> examples/*.py

Archaic text based input file format

I looked at the input file format and the code used to parse the file. Both are, to be honest, not well implemented. Here are some thoughts on this.

  1. As the other reviewer mentioned, you could have used well-known formats such as ASE, pymatgen or VASP formats for the input crystal structure.
  2. The species type is missing in all the example input files.
  3. If you don't want to introduce big packages such as pymatgen as dependencies, the input file is essentially a dictionary/map. You could have used YAML or JSON for this. Those formats give you all the flexibility and you don't have write custom code to parse the text. For example GaSe.txt could be GaSe.yaml as follows
SystemName: GaSe
Dimensions: 2
Lattice: 
  - 3.30735 -1.90950  0.00000
  - 0.00000  3.81900  0.00000
Species: [Ga, Se] # Instead of 2, I am putting the species types
Motif: [
  -1.102  -1.910  1.235  0
  -1.102  -1.909 -1.235  0
  -2.205  -0.000  2.409  1
  ]
Filling: [0.5, 0.5]
Orbitals: [pz, pz]
OnsiteEnergy: [0.41, -0.41]
# OnSiteEnergyUnit, if you want to specify different units
SKAmplitudes: 
  - [0, 1; 1] 0 -2.33 # This line may not be parsed properly by yaml, but could be easily reformatted for yaml
  - [0, 1; 2] 0 0.61
  - [0, 0; 3] 0 0.07
  - [1, 1, 3] 0 0.07
  - [0, 1; 4] 0 0.13
  - [0, 0; 5] 0 -0.09
  - [1, 1, 5] 0 -0.09
Spin: False
SOC: [0, 0]
Mesh: [100, 100]
CriticalPoints: M 

and the code to parse the file would be very simple as below.

import yaml

# Read YAML file
with open("GaSe.yaml") as fp:
    data = yaml.safe_load(fp)
    configuration = shape_arguments(data)

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.