Adding an operator composed of an onsite and coupling term

How do I use this algorithm? What does that parameter do?
Post Reply
jmasur
Posts: 3
Joined: 05 Apr 2022, 22:43

Adding an operator composed of an onsite and coupling term

Post by jmasur »

Hello,

I am trying to calculate an Ehrenfest theorem for the Fermi-Hubbard model which requires the expectation value of a commutator of onsite and hopping terms. I have determined what seems to be the simplest form of this commutator which is

\( \sum_{1 \leq k \leq L - 1} -\hat{n}_{k+1,\uparrow} \hat{c}^\dag_{k,\downarrow} \hat{c}_{k+1,\downarrow} + \hat{n}_{k,\uparrow} \hat{c}^\dag_{k,\downarrow} \hat{c}_{k+1,\downarrow} - \hat{c}^\dag_{k,\uparrow} \hat{c}_{k+1,\uparrow} \hat{n}_{k+1,\downarrow} + \hat{c}^\dag_{k,\uparrow} \hat{c}_{k+1,\uparrow} \hat{n}_{k,\downarrow} \)

but I cannot figure out how to create an operator of this form in Tenpy. My current attempt is defining my own operator with:

Code: Select all

     def init_terms(self, model_params):
        L = model_params.get('L', 10)

        for i in range(L-1):
            self.add_local_term(-1., [("Nu", [i+1, 0]), ("Cdd", [i, 0]), ("Cd", [i+1, 0])])
            self.add_local_term(1., [("Nu", [i, 0]), ("Cdd", [i, 0]), ("Cd", [i+1, 0])])
            self.add_local_term(-1., [("Cdu", [i, 0]), ("Cu", [i+1, 0]), ("Nd", [i+1, 0])])
            self.add_local_term(1., [("Cdu", [i, 0]), ("Cu", [i+1, 0]), ("Nd", [i, 0])]) 
But I get the error:
File "/opt/anaconda3/envs/tenpy/lib/python3.10/site-packages/tenpy/models/model.py", line 1669, in add_term_function
res = f(self, *args, **kwargs)
File "/opt/anaconda3/envs/tenpy/lib/python3.10/site-packages/tenpy/models/model.py", line 777, in add_local_term
args = ct.multi_coupling_term_handle_JW(strength, term, sites)
File "/opt/anaconda3/envs/tenpy/lib/python3.10/site-packages/tenpy/networks/terms.py", line 974, in multi_coupling_term_handle_JW
assert all([i < j for i, j in zip(ijkl, ijkl[1:])]) # ascending?
AssertionError

Am I just doing something simple wrong? Am I using the wrong method for adding this term? Do I need to handle to Jordan-Wigner strings myself? Is this just not currently possible in Tenpy?

I appreciate any help I can get.

Thanks,
Jacob
jmasur
Posts: 3
Joined: 05 Apr 2022, 22:43

Re: Adding an operator composed of an onsite and coupling term

Post by jmasur »

Turns out it was that I am doing something simple wrong. You can add products of operators in add_coupling just by writing their op strings with a space between (in my case something like "Nup Cd"). I hope my idiocy can at least help someone in the future.
Post Reply