Skip to content
Snippets Groups Projects
Commit 0e4871c1 authored by Kostas Vilkelis's avatar Kostas Vilkelis :flamingo:
Browse files

evaluate mfModels on a kgrid

parent 75dc86c1
No related branches found
No related tags found
1 merge request!4Interface refactoring
This commit is part of merge request !4. Comments created here will be created in the context of that merge request.
from . import utils from . import utils, hf
import numpy as np import numpy as np
import hf
class BaseMfModel: class BaseMfModel:
""" """
...@@ -15,7 +15,7 @@ class BaseMfModel: ...@@ -15,7 +15,7 @@ class BaseMfModel:
Interaction potential V(k) evaluated on a k-point grid. Interaction potential V(k) evaluated on a k-point grid.
filling : float filling : float
Filling factor of the system. Filling factor of the system.
Methods Methods
------- -------
densityMatrix(mf_k) densityMatrix(mf_k)
...@@ -24,6 +24,7 @@ class BaseMfModel: ...@@ -24,6 +24,7 @@ class BaseMfModel:
meanField(rho) meanField(rho)
Calculates the mean-field correction from a given density matrix. Calculates the mean-field correction from a given density matrix.
""" """
def __init__(self, H0_k, V_k, filling): def __init__(self, H0_k, V_k, filling):
""" """
Parameters Parameters
...@@ -45,7 +46,7 @@ class BaseMfModel: ...@@ -45,7 +46,7 @@ class BaseMfModel:
---------- ----------
mf_k : nd-array mf_k : nd-array
Mean-field correction to the non-interacting hamiltonian. Mean-field correction to the non-interacting hamiltonian.
Returns Returns
------- -------
rho : nd-array rho : nd-array
...@@ -70,13 +71,15 @@ class BaseMfModel: ...@@ -70,13 +71,15 @@ class BaseMfModel:
""" """
return hf.compute_mf(rho, self.V_k) return hf.compute_mf(rho, self.V_k)
class MfModel(BaseMfModel): class MfModel(BaseMfModel):
""" """
BaseMfModel with the non-interacting hamiltonian and the interaction BaseMfModel with the non-interacting hamiltonian and the interaction
potential given as tight-binding models. potential given as tight-binding models.
The model is defined on a regular k-point grid.
""" """
def __init__(self, tb_model, filling, int_model): def __init__(self, tb_model, int_model, filling, nk=100):
""" """
Parameters Parameters
---------- ----------
...@@ -91,8 +94,8 @@ class MfModel(BaseMfModel): ...@@ -91,8 +94,8 @@ class MfModel(BaseMfModel):
self.filling = filling self.filling = filling
dim = len([*tb_model.keys()][0]) dim = len([*tb_model.keys()][0])
if dim > 0: if dim > 0:
self.H0_k = utils.model2hk(tb_model=tb_model) self.H0_k = utils.tb2grid(tb_model, nk=nk)
self.V_k = utils.model2hk(tb_model=int_model) self.V_k = utils.tb2grid(int_model, nk=nk)
if dim == 0: if dim == 0:
self.H0_k = tb_model[()] self.H0_k = tb_model[()]
self.V_k = int_model[()] self.V_k = int_model[()]
\ No newline at end of file
...@@ -229,6 +229,26 @@ def kgrid_hamiltonian(nk, hk, dim, return_ks=False, hermitian=True): ...@@ -229,6 +229,26 @@ def kgrid_hamiltonian(nk, hk, dim, return_ks=False, hermitian=True):
return ham.reshape(*shape), ks return ham.reshape(*shape), ks
else: else:
return ham.reshape(*shape) return ham.reshape(*shape)
def tb2grid(tb_model, nk):
"""
Fourier transforms and evaluates the model on a regular k-point grid.
Parameters
----------
tb_model : dict
Tight-binding model.
nk : int
Number of k-points per dimension.
Returns
-------
H_k : nd-array
Model evaluated on a k-point grid.
"""
dim = len([*tb_model.keys()][0])
return kgrid_hamiltonian(nk, model2hk(tb_model), dim)
def build_interacting_syst(builder, lattice, func_onsite, func_hop, max_neighbor=1): def build_interacting_syst(builder, lattice, func_onsite, func_hop, max_neighbor=1):
......
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