Skip to content

Commit

Permalink
added a routine that performs a random gauge transformation
Browse files Browse the repository at this point in the history
  • Loading branch information
urbach committed Jan 28, 2013
1 parent f918c3b commit ed1c93a
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ MODULES = read_input gamma measure_gauge_action start \
mpi_init deriv_Sb deriv_Sb_D_psi ranlxs \
geometry_eo invert_overlap \
prepare_source chebyshev_polynomial_nd Ptilde_nd \
reweighting_factor_nd \
reweighting_factor_nd rnd_gauge_trafo \
online_measurement update_momenta integrator phmc \
little_D block operator measurements pion_norm \
temporalgauge spinor_fft X_psi P_M_eta \
Expand Down
2 changes: 1 addition & 1 deletion benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ int main(int argc,char *argv[])
#endif

start_ranlux(1, 123456);
random_gauge_field(reproduce_randomnumber_flag);
random_gauge_field(reproduce_randomnumber_flag, g_gauge_field);

#ifdef MPI
/*For parallelization: exchange the gaugefield */
Expand Down
2 changes: 1 addition & 1 deletion hmc_tm.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ int main(int argc,char *argv[]) {
}
else if (startoption == 1) {
/* hot */
random_gauge_field(reproduce_randomnumber_flag);
random_gauge_field(reproduce_randomnumber_flag, g_gauge_field);
}
else if(startoption == 0) {
/* cold */
Expand Down
2 changes: 1 addition & 1 deletion hopping_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ int main(int argc,char *argv[])

xlfInfo = construct_paramsXlfInfo(0.5, 0);

random_gauge_field(reproduce_randomnumber_flag);
random_gauge_field(reproduce_randomnumber_flag, g_gauge_field);
if ( startoption == 2 ) { /* restart */
write_gauge_field(gauge_input_filename,gauge_precision_write_flag,xlfInfo);
} else if ( startoption == 0 ) { /* cold */
Expand Down
72 changes: 72 additions & 0 deletions rnd_gauge_trafo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/***********************************************************************
*
* Copyright (C) 2003 Mauro Papinutto
*
* This file is part of tmLQCD.
*
* tmLQCD is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* tmLQCD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with tmLQCD. If not, see <http://www.gnu.org/licenses/>.
*
* perform a random gauge transformation
*
*
*******************************************************************************/

#if HAVE_CONFIG_H
#include<config.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include "global.h"
#include "su3.h"
#include "start.h"
#include "rnd_gauge_trafo.h"

void rnd_gauge_trafo(const int repro, su3 ** const gf){
int ix,iy,mu;
static su3 u,v,w,x,y;
su3 * _gauge_trafo = NULL;
su3 * gauge_trafo = NULL;

if((_gauge_trafo = calloc(VOLUMEPLUSRAND+1, sizeof(su3))) == NULL) {
fprintf(stderr, "Could not allocate memory in rnd_gauge_trafo. Exiting!\n");
exit(0);
}
gauge_trafo = (su3*)(((unsigned long int)(gauge_trafo)+ALIGN_BASE)&~ALIGN_BASE);

random_gauge_field(repro, gauge_trafo);

#ifdef MPI
xchange_gauge(gauge_trafo);
#endif

for (ix=0;ix<VOLUME;ix++){

u=gauge_trafo[ix];

for (mu=0;mu<4;mu++){
iy=g_iup[ix][mu];
w=gauge_trafo[iy];
_su3_dagger(v,w);
w=g_gauge_field[ix][mu];

_su3_times_su3(x,w,v);
_su3_times_su3(y,u,x);

gf[ix][mu]=y;
}
}

free(_gauge_trafo);
}

7 changes: 7 additions & 0 deletions rnd_gauge_trafo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* $Id: rnd_gauge_transf.h,v 1.1 2003/02/27 13:21:09 papinutt Exp $ */
#ifndef _RND_GAUGE_TRAFO_H
#define _RND_GAUGE_TRAFO_H

extern void rnd_gauge_trafo();

#endif
6 changes: 3 additions & 3 deletions start.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ void unit_g_gauge_field(void)
}


void random_gauge_field(const int repro) {
void random_gauge_field(const int repro, su3 ** const gf) {

int ix, mu, t0, t, x, X, y, Y, z, Z;
int id = 0; /* May not be initialized for scalar builds! */
Expand Down Expand Up @@ -465,7 +465,7 @@ void random_gauge_field(const int repro) {
for(mu = 0; mu < 4; mu++) {
if(g_cart_id == id) {
ix = g_ipt[t][X][Y][Z];
random_su3(&g_gauge_field[ix][mu]);
random_su3(&gf[ix][mu]);
}
else {
random_su3(&tmp);
Expand All @@ -484,7 +484,7 @@ void random_gauge_field(const int repro) {
else {
for (ix = 0; ix < VOLUME; ix++) {
for (mu = 0; mu < 4; mu++) {
random_su3(&g_gauge_field[ix][mu]);
random_su3(&gf[ix][mu]);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion start.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void random_spinor_field_eo(spinor * const k, const int repro, const enum RN_TYP

void unit_g_gauge_field(void);

void random_gauge_field(const int repro);
void random_gauge_field(const int repro, su3 ** const gf);

double random_su3adj_field(const int repro, su3adj ** const momenta);

Expand Down
2 changes: 1 addition & 1 deletion test_lemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ int main(int argc,char *argv[]) {

/* generate a random gauge field */
start_ranlux(1, 123456);
random_gauge_field(reproduce_randomnumber_flag);
random_gauge_field(reproduce_randomnumber_flag, g_gauge_field);

#ifdef MPI
/*For parallelization: exchange the gaugefield */
Expand Down

0 comments on commit ed1c93a

Please sign in to comment.