TRIQS / triqs

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

Set Gf.data from an external text file #923

Closed jwyan1126 closed 10 months ago

jwyan1126 commented 10 months ago

Hello,

I am using Triqs. 3.1.x, python API. I want to create a green's function and set its data from an external text file. However, when I use

g0.data = external_data

I got an error message "property 'data' of 'Gf' object has no setter"

How can I resolve this issue? Thanks in advance.

the-hampel commented 10 months ago

Hi @jwyan1126,

Assuming that external_data is a numpy like array you have to explicitly tell triqs what part of the data view you want to write in:

g0.data[:,:,:] = external_data

Let me know if that solves the problem

jwyan1126 commented 10 months ago

Hi @the-hampel

It works. Thank you very much!

Wentzell commented 10 months ago

@jwyan1126 Please close this issue if resolved