diff --git a/meanfi/kwant_helper/utils.py b/meanfi/kwant_helper/utils.py index 7983e4ab6832c36583f80a943711cff288b73769..7e0924963d18bed188c5d1365272365042988afa 100644 --- a/meanfi/kwant_helper/utils.py +++ b/meanfi/kwant_helper/utils.py @@ -1,5 +1,5 @@ from itertools import product -from typing import Callable +from typing import Callable, Optional import inspect import numpy as np @@ -172,7 +172,7 @@ def build_interacting_syst( builder: kwant.builder.Builder, lattice: kwant.lattice.Polyatomic, func_onsite: Callable, - func_hop: Callable, + func_hop: Optional[Callable] = None, max_neighbor: int = 1, ) -> kwant.builder.Builder: """ @@ -201,6 +201,7 @@ def build_interacting_syst( kwant.lattice.TranslationalSymmetry(*builder.symmetry.periods) ) int_builder[builder.sites()] = func_onsite - for neighbors in range(max_neighbor): - int_builder[lattice.neighbors(neighbors + 1)] = func_hop + if func_hop is not None: + for neighbors in range(max_neighbor): + int_builder[lattice.neighbors(neighbors + 1)] = func_hop return int_builder