_check_geometry added

This commit is contained in:
Fabian Joswig 2021-10-20 13:32:38 +01:00
parent 7a55413b0e
commit 078ee76b29

View file

@ -111,15 +111,24 @@ class Npr_matrix(np.ndarray):
self.mom_out = getattr(obj, 'mom_out', None) self.mom_out = getattr(obj, 'mom_out', None)
def _check_geometry():
if L is None:
raise Exception("Spatial extent 'L' not set.")
else:
if not isinstance(L, int):
raise Exception("Spatial extent 'L' must be an integer.")
if T is None:
raise Exception("Temporal extent 'T' not set.")
if not isinstance(T, int):
raise Exception("Temporal extent 'T' must be an integer.")
def _invert_propagator(prop): def _invert_propagator(prop):
return Npr_matrix(mat_mat_op(anp.linalg.inv, prop), prop.mom_in) return Npr_matrix(mat_mat_op(anp.linalg.inv, prop), prop.mom_in)
def Zq(prop, fermion='Wilson'): def Zq(prop, fermion='Wilson'):
if L is None: _check_geometry()
raise Exception("Spatial extent 'L' not set.")
if T is None:
raise Exception("Spatial extent 'T' not set.")
mom = prop.mom_in mom = prop.mom_in
mom[3] /= T / L mom[3] /= T / L
sin_mom = np.sin(2 * np.pi / L * mom) sin_mom = np.sin(2 * np.pi / L * mom)