From 5c0dbc3a930106e38a958d14a291013744963206 Mon Sep 17 00:00:00 2001 From: Kostas Vilkelis <kostasvilkelis@gmail.com> Date: Sat, 18 May 2024 00:32:29 +0200 Subject: [PATCH] make func_hop optional --- meanfi/kwant_helper/utils.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/meanfi/kwant_helper/utils.py b/meanfi/kwant_helper/utils.py index 7983e4a..7e09249 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 -- GitLab