I am new to TeNPy and currently working on a project involving spin-half fermions. I’ve come across an issue with the output format from the all_coupling_terms().to_TermList() when using the add_coupling function for defining hopping terms.
Description of the Issue:
The output seems to correctly incorporate Jordan-Wigner strings and represents the intended couplings, but I noticed that the fermionic creation operator Cdd does not display subscripts in some cases where I would expect them. For example, I see Cdd JW_0 Cd_1 instead of the expected Cdd_0 JW_0 Cd_1 and similarly, Cdd JW_1 Cd_2 instead of Cdd_1 JW_1 Cd_2. Interestingly, the 'N' operators do have the correct subscripts.
This inconsistency has left me unsure whether this is just a cosmetic issue in the printout or if it suggests a deeper issue with how the model setup or the library handles fermionic terms (or my understanding of the output

Below I have provided example of a code.
Code:
Python: Select all
import numpy as np
from tenpy.models.lattice import Chain
from tenpy.models.model import CouplingMPOModel
class test(CouplingMPOModel):
default_lattice = Chain
force_default_lattice = True
def init_sites(self, model_params):
return site.SpinHalfFermionSite(cons_N=None,cons_Sz=None)
def init_terms(self, model_params):
J = 1.
lambd=model_params.get('lambd',0) #get the lambda value from parameters
self.add_coupling(lambd, 0, 'Cdd', 0, 'Cd', [1],plus_hc=True)
self.add_coupling(1,0,'Nd',0,'Nd',[1],plus_hc=False)
test = test({'lambd':5,'L':3})
print(test.all_coupling_terms().to_TermList())
Python: Select all
5.00000 * Cdd JW_0 Cd_1 +
5.00000 * JW Cd_0 Cdd_1 +
1.00000 * Nd_0 Nd_1 +
5.00000 * Cdd JW_1 Cd_2 +
5.00000 * JW Cd_1 Cdd_2 +
1.00000 * Nd_1 Nd_2