TRIQS / triqs

a Toolbox for Research on Interacting Quantum Systems
https://triqs.github.io
GNU General Public License v3.0
139 stars 72 forks source link

No mesh compatibility check on β when assigning Green's function defined by blocks #881

Closed Crampon16 closed 1 year ago

Crampon16 commented 1 year ago

Description

When two Green's functions are defined by block (e.g. "up", "dn") and have different temperatures, assigning the content of one to the other does not raise an exception.

Steps to Reproduce

from triqs.gf import *

g1 = GfImFreq(beta=10, indices=[0])
g2 = GfImFreq(beta=20, indices=[0])

G1 = BlockGf(block_list=[g1,g1], name_list=['up','dn'], make_copies=True)
G2 = BlockGf(block_list=[g2,g2], name_list=['up','dn'], make_copies=True)

G1['up'] << G2['dn']  # complains
G1 << G2              # does not complain !!

Expected behavior: an Assertion Error because of mesh compatibility is raised

Actual behavior: G2's data is copied to G1, (without altering the original mesh's temperature).

Versions

You are using the TRIQS library version 3.0.0

You are using the git hash 

I am using MacOS Mojave v 10.14.6, and have also been able to reproduce on various Ubuntus.

Additional Information

Jupyter notebook to quickly reproduce the error: bug_no_beta_check.ipynb.zip

the-hampel commented 1 year ago

Dear @Crampon16, this is indeed a problem I would say. I don't see why this would be the desired behavior to overwrite the block gf with a different mesh. The problem is also existent in TRIQS 3.1.x and on the current unstable branch.

Wentzell commented 1 year ago

Fixed by d64d76754