z2packdev / tbmodels Goto Github PK
View Code? Open in Web Editor NEWA tool for creating and manipulating tight-binding models.
Home Page: https://tbmodels.greschd.ch
License: Apache License 2.0
A tool for creating and manipulating tight-binding models.
Home Page: https://tbmodels.greschd.ch
License: Apache License 2.0
In the function MODEL_TB.construct_kdotp(k_star, order=2), the program will construct the kp model with same band number as the given TB model.
Is it possible to construct a kp model with much less band number, for example 3 bands around Gamma from a multy-band W90 model?
Thank you very much,
Yang
Currently, the hopping matrices can either all be stored as dense matrices, or all sparse. It might make sense to mix sparse and dense matrices though.
Since there's anyway a compatibility layer in the form of _array_cast
and empty_matrix
, it might not be too hard to implement.
What's more difficult is probably adjusting the sparsity dynamically. A good starting point could be analyzing the matrices in set_sparse
, and then set each according to some heuristic for the filling factor (adjustable?).
To be checked:
Currently, setting pos=None
in the constructor will set all positions to the origin. There are few places in the code that rely on this behavior, but also some places where pos is not None
is explicitly checked.
We need to decide if pos=None
should be possible, and then either remove the pos is None
checks or add them where they are missing.
TODO: documentation
I'm not sure if that's the desired behavior, but running pytest
from the base directory gives many test failures as the sample data from tests/samples
is not found.
Related to #11.
Hi,
By using the following commands I have tried to produce wannier_hr.dat file for silicon supercell. the file is produced in model3.
But the values are different. The model2 file is differing from wannier_hr.dat file of the silicon unit cell, too.
The next problem is belonging to model4, this command does not run.
I would appreciate your comments.
import tbmodels
import numpy as np
model = tbmodels.Model.from_wannier_folder(folder='/d......./TBmodels-trunk/examples/silicon/build/', prefix='silicon')
supercell_model = model.supercell((4, 4, 1))
model2=model.to_hr_file('model_hr.dat')
model3=supercell_model.to_hr_file('supercell_model_hr.dat')
model4 = tbmodels.Model.from_hr_file('model_hr.dat')
Needs checking if the more complicated "comparison" features are easily portable.
Now, if units are specified, the win parser fails.
E.g. with this in the .win:
begin atoms_cart
ang
W 0. 0. 0.
end atoms_cart
it fails. The same for begin unit_cell_cart
.
For now, as we only use ang
(that anyway is the default) we just strip in the parser the following lines:
lines = (l for l in lines if 'ang' != l)
but of course it is subideal.
One should read the first line after 'begin', that could be already a value, or contain either bohr
or ang
.
If specified, one should use this as units (and convert the values where needed).
If not specified, one should check the global flag that specifies units for the whole file, and if not specified, assume the default is angstrom.
JSON / msgpack is sub-optimal because the complex data type has a lot of overhead. Write generic from_file
and to_file
functions that dispatch according to the file ending.
Use unit cell vectors as rows. This will become important when implementing the new features (from full_feature branch).
The returned position should be close to the Wannier position (not the original atomic position), so that the overlap matrices are still correct.
Test the performance impact of skipping the unused parts of the change_unit_cell
method when either the unit cell shape does not change, or there is no offset. Especially the former could be important, because it involves solving a few matrix equations.
Right now, it only considers the first power of the generators. However, this does not necessarily produce all symmetries in the group. Instead, all powers up to the order of the symmetry should be included.
Match the closest possible position when symmetrizing, to avoid having to set the positions manually (or to zero) for symmetrization to work.
In many places, there is now code which deals with unit cells / structures (related to the uc
and pos
parameters), and how they transform. This should be factored out to a separate module, since it is not specific to TBmodels
.
Examples:
Model.__add__
: checks if the UC / positions matchreciprocal_lattice
pymatgen
as an intermediate parsing step, and then go from there to our type.pymatgen.Lattice
and pymatgen.Structure
unfortunately only support 3D systems, so they are not an option to simply use.
Read the positions from the .xyz file (see the PythTB Wannier90 interface).
To easily print the current version.
Add custom exceptions for known errors, and handle them in the CLI in a way that makes it easy to parse.
Add an option to store the parsed tight-binding model in sparse format, since this can be significantly cheaper in terms of storage.
Hi Dominik,
I just found that your Tbmodels code group all the orbitals into one site when interfacing with kwant.
Is there a way to deal with Polyatomic case that simulate the real system which has different sites and different orbitals on each site?
Thanks
Xiangru
I have written a little modification that can read wannier90's *_r.dat
output and create the transition dipole elements. If this is relevant, I could try to match the style of the project and create a pull request. I might need some help with the proper implementation, since I'am unsure if I should also go for the possibility of sparse matrices and how to deal with iterators properly.
For example, some of the serialization code might warrant being moved to a separate (hidden) module.
Regression test for merge #30.
Currently, it is possible to select a nonsensical new unit cell without feedback. The code will just not populate the hoppings.
The sanity check should be configurable, such that inexact supercells can still be folded.
This is mostly due to explicit sympy
imports (via symmetry-representation
, I believe). To create a profile (py3.7+):
python -X importtime -c "import tbmodels" 2> out.log
tuna out.log
Requires https://pypi.org/project/tuna/
Might not be worth it (most probably a very small improvement).
Implement reading the orbital positions from the atomic positions. For this, the orbital - atom correspondence needs to be made from the projections in the .win file.
When using the new "listable" mode of the Hamiltonian evaluation for large matrices, the multiplication between the exponential and hopping matrices seems to scale badly.
This needs to be investigated and fixed, without affecting the performance for many k-points on small models too much.
Can use fsc.hdf5_io
once it is published.
Dear Developers,
Thanks for making the code available for users.
May I ask if it is possible to obtain real-space eigenfunctions from wannier90 output using TB models?
Thanks in advance!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.