Skip to content

Commit

Permalink
add look-up table for gauge and spinor indices to D_psi_BSM2 operator…
Browse files Browse the repository at this point in the history
…, predefine squared phases, premultiply gauge links for two-hop terms
  • Loading branch information
kostrzewa committed Apr 29, 2016
1 parent 12ac56d commit 44de6df
Show file tree
Hide file tree
Showing 10 changed files with 396 additions and 191 deletions.
5 changes: 5 additions & 0 deletions boundary.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

_Complex double ALIGN ka0, ka1, ka2, ka3;
_Complex double ALIGN phase_0, phase_1, phase_2, phase_3;
_Complex double ALIGN phase_00, phase_11, phase_22, phase_33;
const double PI_ = 3.14159265358979;
double X0, X1, X2, X3;

Expand All @@ -52,4 +53,8 @@ void boundary(const double kappa)
phase_1 = -ka1;
phase_2 = -ka2;
phase_3 = -ka3;
phase_00 = phase_0*phase_0;
phase_11 = phase_1*phase_1;
phase_22 = phase_2*phase_2;
phase_33 = phase_3*phase_3;
}
2 changes: 1 addition & 1 deletion boundary.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "su3.h"

extern _Complex double ka0, ka1, ka2, ka3;
extern _Complex double phase_0, phase_1, phase_2, phase_3;
extern _Complex double phase_0, phase_1, phase_2, phase_3, phase_00, phase_11, phase_22, phase_33;
void boundary(const double kappa);

#endif
1 change: 1 addition & 0 deletions global.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ EXTERN int ** g_iup_eo; /* NEW GIUPDNEO */
EXTERN int ** g_idn_eo;
EXTERN int ** g_coord;
EXTERN int * g_hi;
EXTERN int * g_bsm_2hop_lookup;


EXTERN int * g_field_z_ipt_even;
Expand Down
3 changes: 2 additions & 1 deletion init/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ libinit_TARGETS = init_moment_field init_gauge_tmp init_gauge_field \
init_geometry_indices init_spinor_field init_dirac_halfspinor \
init_chi_spinor_field init_bispinor_field init_jacobi_field \
init_scalar_field \
init_omp_accumulators init_openmp
init_omp_accumulators init_openmp \
init_bsm_2hop_lookup

libinit_STARGETS =

Expand Down
84 changes: 84 additions & 0 deletions init/init_bsm_2hop_lookup.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/***********************************************************************
* Copyright (C) 2016 Bartosz Kostrzewa
*
* 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/>.
***********************************************************************/

#ifdef HAVE_CONFIG_H
# include<config.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include "global.h"
#include "operator/bsm_2hop_dirs.h"
#include "init_bsm_2hop_lookup.h"
#include "fatal_error.h"

int init_bsm_2hop_lookup(const int V) {
g_bsm_2hop_lookup = malloc(V*32*sizeof(int));

if((void*)g_bsm_2hop_lookup == NULL) fatal_error("malloc failed","init_bsm_2hop_lookup");

for(int ix = 0; ix < V; ++ix){
g_bsm_2hop_lookup[32*ix + BSM_2HOP_S_P0 ] = g_iup[ix][0];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_S_PP0 ] = g_iup[ g_iup[ix][0] ][0];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_U_0 ] = ix;
g_bsm_2hop_lookup[32*ix + BSM_2HOP_U_P0 ] = g_iup[ix][0];

g_bsm_2hop_lookup[32*ix + BSM_2HOP_S_M0 ] = g_idn[ix][0];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_S_MM0 ] = g_idn[ g_idn[ix][0] ][0];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_U_M0 ] = g_idn[ix][0];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_U_MM0 ] = g_idn[ g_idn[ix][0] ][0];

g_bsm_2hop_lookup[32*ix + BSM_2HOP_S_P1 ] = g_iup[ix][1];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_S_PP1 ] = g_iup[ g_iup[ix][1] ][1];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_U_1 ] = ix;
g_bsm_2hop_lookup[32*ix + BSM_2HOP_U_P1 ] = g_iup[ix][1];

g_bsm_2hop_lookup[32*ix + BSM_2HOP_S_M1 ] = g_idn[ix][1];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_S_MM1 ] = g_idn[ g_idn[ix][1] ][1];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_U_M1 ] = g_idn[ix][1];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_U_MM1 ] = g_idn[ g_idn[ix][1] ][1];

g_bsm_2hop_lookup[32*ix + BSM_2HOP_S_P2 ] = g_iup[ix][2];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_S_PP2 ] = g_iup[ g_iup[ix][2] ][2];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_U_2 ] = ix;
g_bsm_2hop_lookup[32*ix + BSM_2HOP_U_P2 ] = g_iup[ix][2];

g_bsm_2hop_lookup[32*ix + BSM_2HOP_S_M2 ] = g_idn[ix][2];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_S_MM2 ] = g_idn[ g_idn[ix][2] ][2];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_U_M2 ] = g_idn[ix][2];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_U_MM2 ] = g_idn[ g_idn[ix][2] ][2];

g_bsm_2hop_lookup[32*ix + BSM_2HOP_S_P3 ] = g_iup[ix][3];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_S_PP3 ] = g_iup[ g_iup[ix][3] ][3];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_U_3 ] = ix;
g_bsm_2hop_lookup[32*ix + BSM_2HOP_U_P3 ] = g_iup[ix][3];

g_bsm_2hop_lookup[32*ix + BSM_2HOP_S_M3 ] = g_idn[ix][3];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_S_MM3 ] = g_idn[ g_idn[ix][3] ][3];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_U_M3 ] = g_idn[ix][3];
g_bsm_2hop_lookup[32*ix + BSM_2HOP_U_MM3 ] = g_idn[ g_idn[ix][3] ][3];
}

return(0);
}

void free_bsm_2hop_lookup() {
if((void*)g_bsm_2hop_lookup != NULL)
free(g_bsm_2hop_lookup);
}
34 changes: 34 additions & 0 deletions init/init_bsm_2hop_lookup.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/***********************************************************************
* Copyright (C) 2016 Bartosz Kostrzewa
*
* 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/>.
***********************************************************************/

/*********************************************************************************
*
* allocate memory and initialise index lookup table for 2-hop Frezzotti-Rossi BSM
* operator
* must be called after geometry()! (geometry_eo.h)
*
*********************************************************************************/

#ifndef _INIT_BSM_2HOP_LOOKUP_H
#define _INIT_BSM_2HOP_LOOKUP_H

int init_bsm_2hop_lookup(const int V);
void free_bsm_2hop_lookup();

#endif
5 changes: 5 additions & 0 deletions operator.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "invert_overlap.h"
#include "invert_clover_eo.h"
#include "init/init_scalar_field.h"
#include "init/init_bsm_2hop_lookup.h"
#include "boundary.h"
#include "start.h"
#include "solver/eigenvalues.h"
Expand Down Expand Up @@ -215,6 +216,10 @@ int init_operators() {
optr->even_odd_flag = 1;
optr->applyDbQsq = &Qtm_pm_ndpsi;
}
if( optr->type == BSM2 ){
// initialise lookup table
init_bsm_2hop_lookup(VOLUME);
}
else if(optr->type == BSM || optr->type == BSM2 ) {
// for the BSM operator we don't use kappa normalistion
// as a result, when twisted boundary conditions are applied this needs to be unity
Expand Down
Loading

0 comments on commit 44de6df

Please sign in to comment.