Skip to content
Snippets Groups Projects
Commit e9d1adf2 authored by Antonio Manesco's avatar Antonio Manesco
Browse files

Combine with draft for `index.md`

parent 7549a990
No related branches found
No related tags found
1 merge request!12Create readme file
Pipeline #179841 passed
......@@ -10,10 +10,9 @@ pip install pymf
## Usage
The algorithm consists of a few simple steps. We exemplify with the one-dimensional Hubbard model with two atoms per unit cell.
1. Define the Hamiltonian
Finding a mean-field groundstate Hamiltonian is a 4-step process. We exemplify with the one-dimensional Hubbard model with two atoms per unit cell.
1. Define the non-interacting and interacting part of the Hamiltonian separately as hopping dictionaries.
```python
# Hopping matrix
hopp = np.kron(np.array([[0, 1], [0, 0]]), np.eye(2))
......@@ -24,23 +23,23 @@ U=2
s_x = np.array([[0, 1], [1, 0]])
h_int = {(0,): U * np.kron(np.eye(2), s_x),}
```
2. Combine non-interacting and interacting Hamiltonians into a model.
2. Import `pymf` and combine the non-interacting and interacting Hamiltonians into a `Model` object.
```python
# Number of electrons per unit cell
filling = 2
# Define model
model = pymf.Model(h_0, h_int, filling)
```
3. Compute the groundstate Hamiltonian.
3. Provide a starting guess and the number of k-points to use the `solver` function and find the mean-field Hamiltonian.
```python
# Generate a random guess
guess = pymf.generate_guess(frozenset(h_int), ndof=4)
# Compute groundstate Hamiltonian
gs_hamiltonian = pymf.solver(model, guess, nk=nk)
mf_sol = pymf.solver(model, guess, nk=nk)
```
4. Add the mean-field correction to the non-interacting part to calculate the total Hamiltonian.
```python
h_mf = pymf.add_tb(h_0, mf_sol)
```
# Citing `pymf`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment