You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+1-128
Original file line number
Diff line number
Diff line change
@@ -130,131 +130,4 @@ The imaginary-time Green's function after the Fourier transform shoud be consist
130
130
131
131
TRIQS (Toolbox for Research on Interacting Quantum Systems) is a scientific project providing a set of C++ and Python libraries for the study of interacting quantum systems. We provide a direct interface to convert TRIQS objects, such as the temporal meshes, the Brillouin zone meshes, and the multi-dimensional (blocked) Green's functions, to the equivalent objects in our package. It would help TRIQS users to make use of our package without worrying about the different internal data structures.
132
132
133
-
We rely on the package [`PythonCall.jl`](https://github.com/cjdoris/PythonCall.jl) to interface with the python language. You need to install TRIQS package from the python environment that `PythonCall` calls. We recommand you to check the sections [`Configuration`](https://cjdoris.github.io/PythonCall.jl/stable/pythoncall/#pythoncall-config) and [`Installing Python Package`](https://cjdoris.github.io/PythonCall.jl/stable/pythoncall/#python-deps) in the `PythonCall` documentation.
134
-
135
-
### Example 5: Load Triqs Temporal Mesh
136
-
First we show how to import an imaginary-time mesh from TRIQS.
@assert mjt[i] ≈pyconvert(Float64, x) # make sure mjt is what we want
146
-
end
147
-
148
-
```
149
-
- With the `PythonCall` package, one can import python packages with `pyimport` and directly exert python code in Julia. Here we import the Green's function module `triqs.gf` and generate a uniform imaginary-time mesh with `MeshImTime`. The user has to specify the inverse temperature, whether the particle is fermion or boson, and the number of grid points.
150
-
151
-
- Once a TRIQS object is prepared, one can simply convert it to an equivalent object in our package with `from_triqs`. The object can be a mesh, a Green's function, or a block Green's function. In this example, the TRIQS imaginary time grid is converted to an identical `ImTime` grid.
152
-
153
-
### Example 6: Load Triqs BrillouinZone
154
-
155
-
In this example, we show how the Brillouin zone mesh from TRIQS can be converted to a UniformMesh from the `BrillouinZoneMeshes` package and clarify the convention we adopted to convert a Python data structure to its Julia counterpart.
# notice that TRIQS always return a 3D point, even for 2D case(where z is always 0)
174
-
# notice also that Julia index starts from 1 while Python from 0
175
-
# points of the same linear index has the same value
176
-
ilin =pyconvert(Int, p.linear_index) +1
177
-
@assert pval[1:2] ≈ mkj[ilin]
178
-
# points with the same linear index corresponds to REVERSED cartesian index
179
-
inds =pyconvert(Array, p.index)[1:2] .+1
180
-
@assert pval[1:2] ≈ mkj[reverse(inds)...]
181
-
end
182
-
```
183
-
184
-
- Julia uses column-major layout for multi-dimensional array similar as Fortran and matlab, whereas python uses row-major layout. The converted Julias Brillouin zone mesh wll be indexed differently from that in TRIQS.
185
-
- We adopted the convention so that the grid point and linear index are consistent with TRIQS counterparts, while the orders of Cartesian index
186
-
and lattice vector are reversed.
187
-
- Here's a table of 2D converted mesh v.s. the Triqs counterpart:
| Linear index | mk[i]=(x, y, 0) | mkj[i]= (x, y) |
192
-
| Cartesian index | mk[i,j]=(x, y, 0) | mkj[j,i]=(x,y) |
193
-
| Lattice vector | (a1, a2) | (a2, a1) |
194
-
195
-
### Example 7: Load Triqs Greens function of a Hubbard Lattice
196
-
197
-
A TRIQS Green's function is defined on a set of meshes of continuous variables, together with the discrete inner states specified by the `target_shape`. The structure is immediately representable by `MeshArray`. In the following example, we reimplement the example 3 to first show how to generate a TRIQS Green's function of a Hubbard lattice within Julia, then convert the TRIQS Green's function to a julia `MeshArray` object. The Green's function is given by $G(q, \omega_n) = \frac{1}{i\omega_n - \epsilon_q}$ with $\epsilon_q = -2t(\cos(q_x)+\cos(q_y))$.
198
-
199
-
```julia
200
-
using PythonCall, GreenFunc
201
-
202
-
np =pyimport("numpy")
203
-
lat =pyimport("triqs.lattice")
204
-
gf =pyimport("triqs.gf")
205
-
206
-
BL = lat.BravaisLattice(units=((2, 0, 0), (1, sqrt(3), 0))) # testing with a triangular lattice so that exchanged index makes a difference
#alternatively, you can use the MeshArray constructor to convert TRIQS Green's function to a MeshArray
227
-
g_k_w2 =MeshArray(G_k_w)
228
-
@assert g_k_w2 ≈ g_k_w
229
-
230
-
#Use the << operator to import python data into an existing MeshArray
231
-
g_k_w2 << G_k_w
232
-
@assert g_k_w2 ≈ g_k_w
233
-
234
-
```
235
-
- When converting a TRIQS Green's function into a `MeshArray` julia object, the `MeshProduct` from TRIQS is decomposed into separate meshes and converted to the corresponding Julia meshes. The `MeshArray` stores the meshes as a tuple object, not as a `MeshProduct`.
236
-
- The `target_shape` in TRIQS Green's function is converted to a tuple of `UnitRange{Int64}` objects that represents the discrete degrees of freedom. Data slicing with `:` is not available in `PythonCall`. One needs to use `pyslice` instead.
237
-
- As explained in Example 6, the cartesian index order of data has to be inversed during the conversion.
238
-
- We support three different interfaces for the conversion of TRIQS Green's function. One can construct a new MeshArray with `from_triqs` or `MeshArray` constructor. One can also load TRIQS Green's function into an existing `MeshArray` with the `<<` operator.
239
-
240
-
### Example 8: Load Triqs block Greens function
241
-
242
-
The block Greens function in TRIQS can be converted to a dictionary of `MeshArray` objects in julia.
#The converted block Green's function is a dictionary of MeshArray corresponding to TRIQS block Green's function. The mapping between them is: jblockG["name"][i1, i2, t] = blockG["name"].data[t-1, i2-1, i1-1]
258
-
259
-
```
260
-
133
+
The interface is provided by an independent package [`NEFTInterface.jl`](https://github.com/numericalEFT/NEFTInterface.jl). We provide several examples of interfacing TRIQS and `GreenFunc.jl` in the [`NEFTInterface.jl` README](https://github.com/numericalEFT/NEFTInterface.jl).
0 commit comments