mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 14:50:25 +01:00
feat: hadrons fourquark function can now read tensor operators
This commit is contained in:
parent
24a0df6a2a
commit
542296099f
1 changed files with 26 additions and 11 deletions
|
@ -4,6 +4,7 @@ import h5py
|
|||
import numpy as np
|
||||
from ..obs import Obs, CObs
|
||||
from ..correlators import Corr
|
||||
from ..dirac import epsilon_tensor_rank4
|
||||
|
||||
|
||||
def _get_files(path, filestem, idl):
|
||||
|
@ -280,10 +281,14 @@ def read_Fourquark_hd5(path, filestem, ens_id, idl=None, vertices=["VA", "AV"]):
|
|||
for vertex in vertices:
|
||||
lorentz_names = _get_lorentz_names(vertex)
|
||||
for v_name in lorentz_names:
|
||||
if vertex not in intermediate_dict:
|
||||
intermediate_dict[vertex] = np.array(corr_data[v_name])
|
||||
if v_name in [('SigmaXZ', 'SigmaYT'), ('SigmaYT', 'SigmaXZ')]:
|
||||
sign = -1
|
||||
else:
|
||||
intermediate_dict[vertex] += np.array(corr_data[v_name])
|
||||
sign = 1
|
||||
if vertex not in intermediate_dict:
|
||||
intermediate_dict[vertex] = sign * np.array(corr_data[v_name])
|
||||
else:
|
||||
intermediate_dict[vertex] += sign * np.array(corr_data[v_name])
|
||||
|
||||
result_dict = {}
|
||||
|
||||
|
@ -303,12 +308,27 @@ def read_Fourquark_hd5(path, filestem, ens_id, idl=None, vertices=["VA", "AV"]):
|
|||
|
||||
|
||||
def _get_lorentz_names(name):
|
||||
assert len(name) == 2
|
||||
lorentz_index = ['X', 'Y', 'Z', 'T']
|
||||
|
||||
res = []
|
||||
|
||||
if not set(name) <= set(['S', 'P', 'V', 'A', 'T']):
|
||||
raise Exception("Name can only contain 'S', 'P', 'V', 'A' or 'T'")
|
||||
if name == "TT":
|
||||
for i in range(4):
|
||||
for j in range(i + 1, 4):
|
||||
res.append(("Sigma" + lorentz_index[i] + lorentz_index[j], "Sigma" + lorentz_index[i] + lorentz_index[j]))
|
||||
return res
|
||||
|
||||
if name == "TTtilde":
|
||||
for i in range(4):
|
||||
for j in range(i + 1, 4):
|
||||
for k in range(4):
|
||||
for o in range(k + 1, 4):
|
||||
fac = epsilon_tensor_rank4(i, j, k, o)
|
||||
if not np.isclose(fac, 0.0):
|
||||
res.append(("Sigma" + lorentz_index[i] + lorentz_index[j], "Sigma" + lorentz_index[k] + lorentz_index[o]))
|
||||
return res
|
||||
|
||||
assert len(name) == 2
|
||||
|
||||
if 'S' in name or 'P' in name:
|
||||
if not set(name) <= set(['S', 'P']):
|
||||
|
@ -319,14 +339,9 @@ def _get_lorentz_names(name):
|
|||
|
||||
res.append((g_names[name[0]], g_names[name[1]]))
|
||||
|
||||
elif 'T' in name:
|
||||
if not set(name) <= set(['T']):
|
||||
raise Exception("'" + name + "' is not a Lorentz scalar")
|
||||
raise Exception("Tensor operators not yet implemented.")
|
||||
else:
|
||||
if not set(name) <= set(['V', 'A']):
|
||||
raise Exception("'" + name + "' is not a Lorentz scalar")
|
||||
lorentz_index = ['X', 'Y', 'Z', 'T']
|
||||
|
||||
for ind in lorentz_index:
|
||||
res.append(('Gamma' + ind + (name[0] == 'A') * 'Gamma5',
|
||||
|
|
Loading…
Add table
Reference in a new issue