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: docs/source/advance.rst
+61-1Lines changed: 61 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -219,6 +219,66 @@ Please refer to :py:meth:`tensorcircuit.templates.measurements.sparse_expectatio
219
219
220
220
For different representations to evaluate Hamiltonian expectation in tensorcircuit, please refer to :doc:`tutorials/tfim_vqe_diffreph`.
221
221
222
+
223
+
Fermion Gaussian State Simulator
224
+
--------------------------------
225
+
226
+
TensorCircuit-NG provides a powerful Fermion Gaussian State (FGS) simulator for efficient simulation of non-interacting fermionic systems (with or without U(1) symmtery). The simulator is particularly useful for studying quantum many-body physics and entanglement properties.
227
+
228
+
229
+
.. code-block:: python
230
+
231
+
import tensorcircuit as tc
232
+
import numpy as np
233
+
234
+
# Initialize a 4-site system with sites 0 and 2 occupied
235
+
sim = tc.FGSSimulator(L=4, filled=[0, 2])
236
+
237
+
# Evolve with hopping terms
238
+
sim.evol_hp(i=0, j=1, chi=1.0) # hopping between sites 0 and 1
239
+
240
+
# Calculate entanglement entropy for subsystem of sites 0, 1
241
+
entropy = sim.entropy([2, 3])
242
+
243
+
244
+
The simulator supports various operations including:
245
+
246
+
1. State initialization from quadratic Hamiltonians ground states
247
+
2. Time evolution (real and imaginary)
248
+
3. Entanglement measures (von Neumann, Renyi entropies and entanglement asymmetry)
249
+
4. Correlation matrix calculations
250
+
5. Measurements
251
+
252
+
253
+
Here's an example studying entanglement asymmetry in tilted ferromagnet states:
254
+
255
+
.. code-block:: python
256
+
257
+
defxy_hamiltonian(theta, L):
258
+
# XY model with tilted field
259
+
gamma =2/ (np.cos(theta) **2+1) -1
260
+
mu =4* np.sqrt(1- gamma**2) * np.ones([L])
261
+
262
+
# Construct Hamiltonian terms
263
+
h = (generate_hopping_h(2.0, L) +
264
+
generate_pairing_h(gamma *2, L) +
265
+
generate_chemical_h(mu))
266
+
return h
267
+
268
+
defget_saq_sa(theta, l, L, k, batch=1024):
269
+
# Calculate entanglement asymmetry in the middle subsystem with size l
270
+
traceout = [i for i inrange(0, L//2- l//2)] + \
271
+
[i for i inrange(L//2+ l//2, L)]
272
+
273
+
# Get Hamiltonian ground state which is within FGS
274
+
hi = xy_hamiltonian(theta, L)
275
+
sim = tc.FGSSimulator(L, hc=hi)
276
+
277
+
# Get both symmetry-resolved and standard entanglement
@@ -310,4 +370,4 @@ It is worth noting that since ``Circuit.unitary_kraus`` and ``Circuit.general_kr
310
370
311
371
One may wonder why random numbers are dealt in such a complicated way, please refer to the `Jax design note <https://github.com/google/jax/blob/main/docs/design_notes/prng.md>`_ for some hints.
312
372
313
-
If vmap is also involved apart from jit, I currently find no way to maintain the backend agnosticity as TensorFlow seems to have no support of vmap over random keys (ping me on GitHub if you think you have a way to do this). I strongly recommend the users using Jax backend in the vmap+random setup.
373
+
If vmap is also involved apart from jit, I currently find no way to maintain the backend agnosticity as TensorFlow seems to have no support of vmap over random keys (ping me on GitHub if you think you have a way to do this). I strongly recommend the users using Jax backend in the vmap+random setup.
0 commit comments