Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A standalone tutorial for TB_to_sympy. #16

Open
wants to merge 47 commits into
base: unstable
Choose a base branch
from

Conversation

Collins-kariuk
Copy link

I would like to contribute to the TRIQS tutorial repository, an accompanying tutorial I wrote with the help of my mentors Olivier Gingras and Sophie Beck regarding my TB_to_sympy which returns the analytical form of the momentum space Hamiltonian of the tight-binding model from a tight-binding lattice object by utilizing the Fourier series.

This function has already been merged into TRIQS and can be found in the utils.py file. The tutorial provides the user with a brief introduction to the tight-binding model and enables the user to interact with different parameters of my function; as well as comparing minimal tight-binding models.

@Wentzell Wentzell requested a review from the-hampel September 29, 2023 16:47
@the-hampel the-hampel force-pushed the feature/SymPyfy-analytic-expresser branch from 4995b13 to 8040a7b Compare October 3, 2023 21:36
…escription:

- Introduced an example where I call sympyfy on a simple-structured Lathanum Cuprate material under different scenarios.
- Changed the introduction to include the fact that w90 includes all hopping parameters but that the user has the option of using PythTB to include cutoffs on the hopping amplitude and hopping distance.
- Made sure to highlight the fact that the numerical expression isn't wholly numerical but depends on the k-space vector variables.
… of the full vs cutoff model of the Lanthanum cuprate compound
So that I could import it into my tutorial.
@the-hampel the-hampel force-pushed the feature/SymPyfy-analytic-expresser branch from 8040a7b to 94bc592 Compare October 3, 2023 21:38
@Collins-kariuk
Copy link
Author

Hello @the-hampel. Thanks for approving my changes. Shall I close this PR? What is remaining?

@the-hampel
Copy link
Member

Hi @Collins-kariuk, @Wentzell will have a final look and than we will merge the tutorial. So please leave it open for now. Thanks!

"cell_type": "markdown",
"metadata": {},
"source": [
"The ```TB_to_sympy``` function takes hopping amplitudes to generate a TB model. The hopping amplitudes are obtained from the Wannier90 package, which fits the band structure obtained from density functional theory (DFT) for a set of orbitals. The larger the hopping amplitude, the more significant it is. For instance, a hopping amplitude of 0.00005 eV does not contribute as much to the movement of an electron as a hopping amplitude of 0.05 eV. There is a need for a cutoff either in the hopping distances or the hopping amplitudes. A minimal model can neglect these smaller amplitudes. Using the PythTB package's ```model``` function, we select only the hopping amplitudes bigger than the cutoff or smaller than the cutoff distance, restricting the hopping processes to be closer."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not quite correct? It does not generate a TB model, it takes a pre-constructed one. Also it could be obtained out of a Wannier90 calculation or could just be a model Hamiltonian.
The output is an analytic expression of that same TB model.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

"cell_type": "markdown",
"metadata": {},
"source": [
"In second quantization, the TB Hamiltonian is given by:\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean 'a generic form of a TB Hamiltonian reads' ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

"- $\\sigma$ is the spin and $c^{\\dagger}$\n",
"- $c$ are creation and annihilation operators.\n",
"\n",
"In this tutorial, we examine a system with one orbital and one site per unit cell. By performing a Fourier transform of the Hamiltonian from real space to momentum space, we obtain $H(k)$, which is achieved using the ```TB_to_sympy``` function.\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would drop here the part ", which is achieved using the TB_to_sympy function."

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped.

"cell_type": "markdown",
"metadata": {},
"source": [
"```TB_to_sympy``` is defined as:"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to: 'The documentation of the TB_to_sympy function reads'

Also, why don't you use ?TB_to_sympy to generate documentation?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have also now used ?TB_to_sympy to generate documentation. Thank you for this. I did not know one could do this.

"cell_type": "markdown",
"metadata": {},
"source": [
"The only required parameter for our function is ```TBL```, a TRIQS TBLattice Object (Tight-Binding Lattice Object). To obtain ```TBL```, you can use TRIQS-provided functions that allow conversion of your model to a TRIQS TBLattice object. These functions are:\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TBL doesn't need to come out of a conversion, it can be directly defined.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

"cell_type": "markdown",
"metadata": {},
"source": [
"The main distinction between the analytical and numerical expressions is that the numerical expression depends on ```kx```, ```ky```, and ```kz```, while the analytical expression additionally depends on the lattice vectors, ```a1```, ```a2```, and ```a3```. The lattice vectors define the orientation and shape of the crystal unit cell and can be replaced with numerical values using the ```units``` function from the TRIQS TB lattice object."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not clear. You should state that the numerical expression is uses euclidian unit vectors and the analytical expression uses reciprocal basis vectors ai

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

"metadata": {},
"outputs": [],
"source": [
"def minimal_model(w90_input, fermi_ev, cutoff):\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of object is w90_input here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a docstring to the minimal_model function to make it clear.

This was done after the whole rebasing fiasco. Hopefully, it didn't alter anything major. I had to delete the tutorial notebook first as I was rebasing which is why I am adding the tutorial wholly now.
@Collins-kariuk
Copy link
Author

Collins-kariuk commented Dec 22, 2023

Hello @Wentzell , I have implemented your proposed changes. They are visible in the Sympyfy analytic expresser branch. I am not sure whether I should open another pull request so I have not. If you need me to, I will. Let me know if there are other things I can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants