# MPO flux not equal when it is symmetric but contains non-zero flux

**URL:** <https://itensor.discourse.group/t/mpo-flux-not-equal-when-it-is-symmetric-but-contains-non-zero-flux/2594>\
**Category:** DMRG and Numerical Methods\
**Created:** [March 8, 2026, 3:37pm UTC](https://itensor.discourse.group/t/mpo-flux-not-equal-when-it-is-symmetric-but-contains-non-zero-flux/2594 "2026-03-08T15:37:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZhouGD2000](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/zhougd2000/32/669_2.png) [@ZhouGD2000](https://itensor.discourse.group/u/ZhouGD2000)\
**Post date:** [March 8, 2026, 3:37pm UTC](https://itensor.discourse.group/t/mpo-flux-not-equal-when-it-is-symmetric-but-contains-non-zero-flux/2594/1 "2026-03-08T15:37:58Z")

</div>

I would like to act a pair of electron annihilation operator on a state and calculate some properties based on it. Therefore, I create an MPO using the OpSum() and apply it to the MPS I want. However, I find that the obtained MPO does not obey the symmetry.

```auto
using ITensors,ITensorMPS
N = 2;
sites = siteinds("Fermion", N; conserve_qns=true);
os = OpSum();
os += "C", 1, "C", 2;
H = MPO(os, sites);
checkflux(H) # will raise error

```

and these cause some problem. I find that in the post

> [@apply MPO to MPS that changes quantum number](https://itensor.discourse.group/t/apply-mpo-to-mps-that-changes-quantum-number/143):
>
> Hi Miles and Matt, I would like to construct an MPO that has a definite change of quantum number (e.g. a sum of C^dag\_i C^dag\_j terms) and apply it to an MPS that has this quantum number. One way I can do it is change MPS to dense which removes all quantum numbers and makes subsequent calculations very slow. Is there a better way to do this currently? Best, Shengtao

the OP mt similar problem and received the reply

> Unfortunately it is a known issue that the OpSum to MPO constructor doesn’t work when the MPO has nonzero flux (in principle it could, but we haven’t gotten around to implementing it).

As the pair of electrons I am going to remove is rather complicated, it would be hard and computationally inefficient to write down the string of `op` directly. Meanwhile, I find that that OP received error when he run

```auto
cdagmpo=MPO(ampo,sites)

```

but I do not met this error when I constructed the MPO. So I guess the developers have made changes to the related code, and I would like to ask if there is a possibility that this will be implemented in the near future.  
Besides, if I want to fix it myself, are there any suggestions?

---

<div class="post-metadata">

**Author:** ![corbett5](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/corbett5/32/886_2.png) [@corbett5](https://itensor.discourse.group/u/corbett5)\
**Post date:** [March 9, 2026, 12:52am UTC](https://itensor.discourse.group/t/mpo-flux-not-equal-when-it-is-symmetric-but-contains-non-zero-flux/2594/2 "2026-03-09T00:52:13Z")

</div>

The library I wrote [ITensorMPOConstruction](https://github.com/ITensor/ITensorMPOConstruction.jl) should be able to handle this just fine, but disclaimer I haven’t tested this behavior very much so let me know how it goes.

```julia
using ITensors,ITensorMPS, ITensorMPOConstruction
N = 2;
sites = siteinds("Fermion", N; conserve_qns=true);
os = OpSum();
os += "C", 1, "C", 2;
H = MPO_new(os, sites);
checkflux(H)

```

---

<div class="post-metadata">

**Author:** ![ZhouGD2000](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/zhougd2000/32/669_2.png) [@ZhouGD2000](https://itensor.discourse.group/u/ZhouGD2000)\
**Post date:** [March 9, 2026, 1:33pm UTC](https://itensor.discourse.group/t/mpo-flux-not-equal-when-it-is-symmetric-but-contains-non-zero-flux/2594/3 "2026-03-09T13:33:48Z")

</div>

Thanks！It works for me.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/itensor/original/1X/d3072b13e047cd06df7f3981547c0917d940dfa4.png) [@system](https://itensor.discourse.group/u/system)\
**Post date:** [March 19, 2026, 1:34pm UTC](https://itensor.discourse.group/t/mpo-flux-not-equal-when-it-is-symmetric-but-contains-non-zero-flux/2594/4 "2026-03-19T13:34:26Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
