diff --git a/pyquda_io/_field_utils.py b/pyquda_io/_field_utils.py index 898cf65..72f63f8 100644 --- a/pyquda_io/_field_utils.py +++ b/pyquda_io/_field_utils.py @@ -173,7 +173,7 @@ def gaugeProject(gauge: numpy.ndarray): pass -def gaugeReunitarize(gauge: numpy.ndarray, reunitarize_sigma: bool = True): +def gaugeReunitarize(gauge: numpy.ndarray, reunitarize_sigma: float): gauge = numpy.ascontiguousarray(gauge.transpose(5, 6, 0, 1, 2, 3, 4)) row0_abs = numpy.linalg.norm(gauge[0], axis=0) gauge[0] /= row0_abs @@ -182,7 +182,7 @@ def gaugeReunitarize(gauge: numpy.ndarray, reunitarize_sigma: bool = True): row1_abs = numpy.linalg.norm(gauge[1], axis=0) gauge[1] /= row1_abs row2 = numpy.cross(gauge[0], gauge[1], axis=0).conjugate() - if reunitarize_sigma: + if reunitarize_sigma > 0: assert ( MPI.COMM_WORLD.allreduce( numpy.sqrt( @@ -193,13 +193,13 @@ def gaugeReunitarize(gauge: numpy.ndarray, reunitarize_sigma: bool = True): ).max(), MPI.MAX, ) - < 2e-7 # sqrt(Nc) * fp32 machine epsilon + < reunitarize_sigma ) gauge[2] = row2 return gauge.transpose(2, 3, 4, 5, 6, 0, 1) -def gaugeReunitarizeReconstruct12(gauge: numpy.ndarray, reunitarize_sigma: bool = True): +def gaugeReunitarizeReconstruct12(gauge: numpy.ndarray, reunitarize_sigma: float): """gauge shape (Nd, Lt, Lz, Ly, Lx, Nc - 1, Nc)""" gauge_ = gauge.transpose(5, 6, 0, 1, 2, 3, 4) gauge = numpy.empty((Nc, *gauge_.shape[1:]), " 0: assert ( MPI.COMM_WORLD.allreduce( numpy.sqrt((1 - row0_abs) ** 2 + numpy.abs(row0_row1) ** 2 + (1 - row1_abs) ** 2).max(), MPI.MAX, ) - < 2e-7 # sqrt(Nc) * fp32 machine epsilon + < reunitarize_sigma ) gauge[2] = row2 return gauge.transpose(2, 3, 4, 5, 6, 0, 1) diff --git a/pyquda_io/chroma.py b/pyquda_io/chroma.py index 3fa4eb2..58f8ad7 100644 --- a/pyquda_io/chroma.py +++ b/pyquda_io/chroma.py @@ -34,7 +34,7 @@ def checksum_qio(latt_size: List[int], grid_size: List[int], data): return sum29, sum31 -def readQIOGauge(filename: str, grid_size: List[int], checksum: bool = True): +def readQIOGauge(filename: str, grid_size: List[int], checksum: bool = True, reunitarize_sigma: float = 2e-7): from .lime import Lime lime = Lime(filename) @@ -68,7 +68,7 @@ def readQIOGauge(filename: str, grid_size: List[int], checksum: bool = True): ), f"Bad checksum for {filename}" gauge = gauge.transpose(4, 0, 1, 2, 3, 5, 6).astype("