Skip to content

Commit

Permalink
Merged last hirep changes from spn branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmesiti committed Jul 14, 2021
1 parent 13fec80 commit 8851576
Show file tree
Hide file tree
Showing 21 changed files with 685 additions and 152 deletions.
1 change: 1 addition & 0 deletions Include/dirac.h
Expand Up @@ -66,6 +66,7 @@ void Dphi_eopre_4f_flt(double m0, spinor_field_flt *out, spinor_field_flt *in);
void Dphi_eopre_4f_dagger_flt(double m0, spinor_field_flt *out, spinor_field_flt *in);
void Dphieopre_4f_sq_flt(double m0, spinor_field_flt *out, spinor_field_flt *in);

/* Dirac operators used in update */


#endif
Expand Down
29 changes: 13 additions & 16 deletions Include/memory.h
Expand Up @@ -11,30 +11,29 @@
*
*******************************************************************************/


#ifndef MEMORY_H
#define MEMORY_H

#include <stdlib.h>
#include "suN.h"
#include "spinor_field.h"
#include "suN.h"
#include <stdlib.h>

#ifdef P4
# define ALIGN 7
#define ALIGN 7
#else
# define ALIGN 5
#endif
#define ALIGN 5
#endif

void *amalloc(size_t size,int p);
void *amalloc(size_t size, int p);
void afree(void *addr);

void free_gfield(suNg_field *u);
suNg_field* alloc_gfield(geometry_descriptor* type);
suNg_field *alloc_gfield(geometry_descriptor *type);
void free_scalar_field(suNg_scalar_field *u);
void free_gfield_f(suNf_field *u);
suNf_field* alloc_gfield_f(geometry_descriptor* type);
suNf_field *alloc_gfield_f(geometry_descriptor *type);
void free_gfield_f_flt(suNf_field_flt *u);
suNf_field_flt* alloc_gfield_f_flt(geometry_descriptor* type);
suNf_field_flt *alloc_gfield_f_flt(geometry_descriptor *type);
void free_avfield(suNg_av_field *u);

ldl_field *alloc_clover_ldl(geometry_descriptor* type);
Expand All @@ -43,18 +42,16 @@ ldl_field *alloc_clover_ldl(geometry_descriptor* type);
suNffull_field* alloc_clover_term(geometry_descriptor* type);
suNffull_field* alloc_clover_force(geometry_descriptor* type);
#else
suNfc_field* alloc_clover_term(geometry_descriptor* type);
suNfc_field *alloc_clover_term(geometry_descriptor *type);
suNf_field* alloc_clover_force(geometry_descriptor* type);
#endif


void free_spinor_field_f(spinor_field *s);
spinor_field* alloc_spinor_field_f(unsigned int n, geometry_descriptor *type);
spinor_field *alloc_spinor_field_f(unsigned int n, geometry_descriptor *type);
void free_sfield(scalar_field *s);


spinor_field* create_spinor_mask(spinor_field* s, geometry_descriptor* masktype);
void free_spinor_mask(spinor_field* s);

spinor_field *create_spinor_mask(spinor_field *s, geometry_descriptor *masktype);
void free_spinor_mask(spinor_field *s);

#endif
4 changes: 3 additions & 1 deletion Include/observables.h
Expand Up @@ -125,6 +125,7 @@ void free_meson_observables();
void free_triplet_discon_observables();

void measure_mesons_core(spinor_field *psi0, spinor_field *psi1, spinor_field *eta, meson_observable *mo, int nm, int tau, int n_mom, int offset, int lt);

void measure_mesons(meson_observable *mo, spinor_field *psi0, spinor_field *eta, int nm, int tau);
void measure_diquarks(meson_observable *mo, spinor_field *psi0, spinor_field *psi1, spinor_field *eta, int nm, int tau);
void measure_conserved_currents(meson_observable *mo, spinor_field *psi0, spinor_field *eta, int nm, int tau);
Expand All @@ -133,6 +134,7 @@ void measure_point_mesons_momenta(meson_observable *mo, spinor_field *psi0, spin
void measure_point_mesons_momenta_ext(meson_observable *mo, spinor_field *psi0, spinor_field *eta, int nm, int tau, int n_mom, int begin);
void measure_formfactors(spinor_field *psi0, spinor_field *psi1, spinor_field *eta, int nm, int ti, int tf, int n_mom, int *pt);
void measure_formfactors_ext(spinor_field *psi0, spinor_field *psi1, spinor_field *eta, int nm, int ti, int tf, int n_mom, int begin);

void print_mesons(meson_observable *mo, double norm, int conf, int nm, double *mass, int lt, int n_mom, char *label);
void print_formfactor(int conf, int nm, double *mass, int n_mom, char *label, int tf);
void print_formfactor_ext(int conf, int nm, double *mass, int n_mom, char *label, int tf);
Expand All @@ -143,7 +145,7 @@ void measure_scattering_BC_core(meson_observable *mo, spinor_field *psi0, spinor
void measure_renormalization(spinor_field *psi_in, spinor_field *psi_out, int nm, int pt_in, int px_in, int py_in, int pz_in, int pt_out, int px_out, int py_out, int pz_out);
void print_renormalization(int conf, int nm, double *mass, char *label, int pt_in, int px_in, int py_in, int pz_in, int pt_out, int px_out, int py_out, int pz_out);

void contract_baryons(spinor_field *psi0, int tau);
void contract_baryons(spinor_field *psi0, int tau,storage_switch swc, data_storage_array **ret);
void measure_glueballs();

void id_correlator(double *out, int t0, spinor_field *qp);
Expand Down
3 changes: 2 additions & 1 deletion Include/random.h
Expand Up @@ -22,8 +22,9 @@

void random_suNg_unit_vector(suNg_vector *v);

void random_suNg(suNg *u);

void unit_u(suNg_field *gf);
void random_u(suNg_field *gf);



Expand Down
1 change: 1 addition & 0 deletions Include/ranlux.h
Expand Up @@ -14,6 +14,7 @@
*
*******************************************************************************/

extern void ranlxd(double r[],int n);
extern void rlxd_init(int level,int seed);

/*******************************************************************************
Expand Down
53 changes: 53 additions & 0 deletions Include/sp4.h
Expand Up @@ -37,6 +37,59 @@
_complex_0((u).c[7]);\


#define _suNg_expand(v,u)\
(v).c[0] = _complex_re((u).c[0]);\
(v).c[0]+= I*( _complex_im((u).c[0]));\
(v).c[10] = _complex_re((u).c[0]);\
(v).c[10]+= I*( -_complex_im((u).c[0]));\
(v).c[2] = _complex_re((u).c[2]);\
(v).c[2]+= I*( _complex_im((u).c[2]));\
(v).c[8] = -_complex_re((u).c[2]);\
(v).c[8]+= I*( _complex_im((u).c[2]));\
(v).c[1] = _complex_re((u).c[1]);\
(v).c[1]+= I*( _complex_im((u).c[1]));\
(v).c[11] = _complex_re((u).c[1]);\
(v).c[11]+= I*( -_complex_im((u).c[1]));\
(v).c[3] = _complex_re((u).c[3]);\
(v).c[3]+= I*( _complex_im((u).c[3]));\
(v).c[9] = -_complex_re((u).c[3]);\
(v).c[9]+= I*( _complex_im((u).c[3]));\
(v).c[4] = _complex_re((u).c[4]);\
(v).c[4]+= I*( _complex_im((u).c[4]));\
(v).c[14] = _complex_re((u).c[4]);\
(v).c[14]+= I*( -_complex_im((u).c[4]));\
(v).c[6] = _complex_re((u).c[6]);\
(v).c[6]+= I*( _complex_im((u).c[6]));\
(v).c[12] = -_complex_re((u).c[6]);\
(v).c[12]+= I*( _complex_im((u).c[6]));\
(v).c[5] = _complex_re((u).c[5]);\
(v).c[5]+= I*( _complex_im((u).c[5]));\
(v).c[15] = _complex_re((u).c[5]);\
(v).c[15]+= I*( -_complex_im((u).c[5]));\
(v).c[7] = _complex_re((u).c[7]);\
(v).c[7]+= I*( _complex_im((u).c[7]));\
(v).c[13] = -_complex_re((u).c[7]);\
(v).c[13]+= I*( _complex_im((u).c[7]));\


#define _suNgfull_unit(u)\
_complex_1((u).c[0]);\
_complex_0((u).c[1]);\
_complex_0((u).c[2]);\
_complex_0((u).c[3]);\
_complex_0((u).c[4]);\
_complex_1((u).c[5]);\
_complex_0((u).c[6]);\
_complex_0((u).c[7]);\
_complex_0((u).c[8]);\
_complex_0((u).c[9]);\
_complex_1((u).c[10]);\
_complex_0((u).c[11]);\
_complex_0((u).c[12]);\
_complex_0((u).c[13]);\
_complex_0((u).c[14]);\
_complex_1((u).c[15])

#define _vector_zero_f(r)\
_complex_0((r).c[0]);\
_complex_0((r).c[1]);\
Expand Down
53 changes: 53 additions & 0 deletions Include/sp4adj.h
Expand Up @@ -37,6 +37,59 @@
_complex_0((u).c[7]);\


#define _suNg_expand(v,u)\
(v).c[0] = _complex_re((u).c[0]);\
(v).c[0]+= I*( _complex_im((u).c[0]));\
(v).c[10] = _complex_re((u).c[0]);\
(v).c[10]+= I*( -_complex_im((u).c[0]));\
(v).c[2] = _complex_re((u).c[2]);\
(v).c[2]+= I*( _complex_im((u).c[2]));\
(v).c[8] = -_complex_re((u).c[2]);\
(v).c[8]+= I*( _complex_im((u).c[2]));\
(v).c[1] = _complex_re((u).c[1]);\
(v).c[1]+= I*( _complex_im((u).c[1]));\
(v).c[11] = _complex_re((u).c[1]);\
(v).c[11]+= I*( -_complex_im((u).c[1]));\
(v).c[3] = _complex_re((u).c[3]);\
(v).c[3]+= I*( _complex_im((u).c[3]));\
(v).c[9] = -_complex_re((u).c[3]);\
(v).c[9]+= I*( _complex_im((u).c[3]));\
(v).c[4] = _complex_re((u).c[4]);\
(v).c[4]+= I*( _complex_im((u).c[4]));\
(v).c[14] = _complex_re((u).c[4]);\
(v).c[14]+= I*( -_complex_im((u).c[4]));\
(v).c[6] = _complex_re((u).c[6]);\
(v).c[6]+= I*( _complex_im((u).c[6]));\
(v).c[12] = -_complex_re((u).c[6]);\
(v).c[12]+= I*( _complex_im((u).c[6]));\
(v).c[5] = _complex_re((u).c[5]);\
(v).c[5]+= I*( _complex_im((u).c[5]));\
(v).c[15] = _complex_re((u).c[5]);\
(v).c[15]+= I*( -_complex_im((u).c[5]));\
(v).c[7] = _complex_re((u).c[7]);\
(v).c[7]+= I*( _complex_im((u).c[7]));\
(v).c[13] = -_complex_re((u).c[7]);\
(v).c[13]+= I*( _complex_im((u).c[7]));\


#define _suNgfull_unit(u)\
_complex_1((u).c[0]);\
_complex_0((u).c[1]);\
_complex_0((u).c[2]);\
_complex_0((u).c[3]);\
_complex_0((u).c[4]);\
_complex_1((u).c[5]);\
_complex_0((u).c[6]);\
_complex_0((u).c[7]);\
_complex_0((u).c[8]);\
_complex_0((u).c[9]);\
_complex_1((u).c[10]);\
_complex_0((u).c[11]);\
_complex_0((u).c[12]);\
_complex_0((u).c[13]);\
_complex_0((u).c[14]);\
_complex_1((u).c[15])

#define _vector_zero_f(r)\
do { int _i;\
for (_i=0;\
Expand Down
74 changes: 36 additions & 38 deletions Include/spinor_field.h
Expand Up @@ -28,19 +28,20 @@
#define _GPU_FIELD_DATA(_type) _type *gpu_ptr;
#endif //WITH_MPI

typedef struct {
double complex up[NF*(2*NF+1)];
double complex dn[NF*(2*NF+1)];
typedef struct
{
double complex up[NF * (2 * NF + 1)];
double complex dn[NF * (2 * NF + 1)];
} ldl_t;

#define _DECLARE_FIELD_STRUCT(_name,_type) \
typedef struct _##_name { \
_type *ptr; \
geometry_descriptor *type;\
_MPI_FIELD_DATA \
_GPU_FIELD_DATA(_type) \
} _name

#define _DECLARE_FIELD_STRUCT(_name, _type) \
typedef struct _##_name \
{ \
_type *ptr; \
geometry_descriptor *type; \
_MPI_FIELD_DATA \
_GPU_FIELD_DATA(_type) \
} _name

_DECLARE_FIELD_STRUCT(suNg_field, suNg);
_DECLARE_FIELD_STRUCT(suNg_scalar_field, suNg_vector);
Expand All @@ -58,50 +59,47 @@ _DECLARE_FIELD_STRUCT(suNffull_field, suNffull);
#endif



/* LOOPING MACRO */

#ifdef CHECK_SPINOR_MATCHING

#define _TWO_SPINORS_MATCHING(s1,s2) \
error((s1)->type!=(s2)->type,1,__FILE__ ": ", "Spinors don't match!");
#define _TWO_SPINORS_MATCHING(s1, s2) \
error((s1)->type != (s2)->type, 1, __FILE__ ": ", "Spinors don't match!");

#define _ARRAY_SPINOR_MATCHING(s,n) \
for(int i=0; i<n; i++) \
error((s)->type!=((s)+i)->type,1,__FILE__ ": ", "Spinors don't match!");
#define _ARRAY_SPINOR_MATCHING(s, n) \
for (int _i = 0; _i < n; _i++) \
error((s)->type != ((s) + _i)->type, 1, __FILE__ ": ", "Spinors don't match!");

#else /* CHECK_SPINOR_MATCHING */

#define _TWO_SPINORS_MATCHING(s1,s2)
#define _TWO_SPINORS_MATCHING(s1, s2)

#define _ARRAY_SPINOR_MATCHING(s,n)
#define _ARRAY_SPINOR_MATCHING(s, n)

#endif /* CHECK_SPINOR_MATCHING */

#define _ONE_SPINOR_FOR_RED(s, redop1, redop2) _MASTER_FOR_RED((s)->type, _spinor_for_is, redop1, redop2)
#define _ONE_SPINOR_FOR(s) _ONE_SPINOR_FOR_RED(s, , )
#define _ONE_SPINOR_FOR_SUM(s, ...) _ONE_SPINOR_FOR_RED(s, _omp_sum(__VA_ARGS__), )

#define _ONE_SPINOR_FOR_RED(s,redop1,redop2) _MASTER_FOR_RED((s)->type,_spinor_for_is,redop1,redop2)
#define _ONE_SPINOR_FOR(s) _ONE_SPINOR_FOR_RED(s,,)
#define _ONE_SPINOR_FOR_SUM(s,...) _ONE_SPINOR_FOR_RED(s,_omp_sum(__VA_ARGS__),)
#define _TWO_SPINORS_FOR_RED(s1, s2, redop1, redop2) \
_TWO_SPINORS_MATCHING(s1, s2); \
_ONE_SPINOR_FOR_RED(s1, redop1, redop2)
#define _TWO_SPINORS_FOR(s1, s2) _TWO_SPINORS_FOR_RED(s1, s2, , )
#define _TWO_SPINORS_FOR_SUM(s1, s2, ...) _TWO_SPINORS_FOR_RED(s1, s2, _omp_sum(__VA_ARGS__), )

#define _TWO_SPINORS_FOR_RED(s1,s2,redop1,redop2) \
_TWO_SPINORS_MATCHING(s1,s2); \
_ONE_SPINOR_FOR_RED(s1,redop1,redop2)
#define _TWO_SPINORS_FOR(s1,s2) _TWO_SPINORS_FOR_RED(s1,s2,,)
#define _TWO_SPINORS_FOR_SUM(s1,s2,...) _TWO_SPINORS_FOR_RED(s1,s2,_omp_sum(__VA_ARGS__),)

#define _THREE_SPINORS_FOR_RED(s1,s2,s3,redop1,redop2) \
_TWO_SPINORS_MATCHING(s1,s2); \
_TWO_SPINORS_MATCHING(s1,s3); \
_ONE_SPINOR_FOR_RED(s1,redop1,redop2)
#define _THREE_SPINORS_FOR(s1,s2,s3) _THREE_SPINORS_FOR_RED(s1,s2,s3,,)
#define _THREE_SPINORS_FOR_RED(s1, s2, s3, redop1, redop2) \
_TWO_SPINORS_MATCHING(s1, s2); \
_TWO_SPINORS_MATCHING(s1, s3); \
_ONE_SPINOR_FOR_RED(s1, redop1, redop2)
#define _THREE_SPINORS_FOR(s1, s2, s3) _THREE_SPINORS_FOR_RED(s1, s2, s3, , )

#include "field_ordering.h"

#define _FIELD_AT(s,i) (((s)->ptr)+i-(s)->type->master_shift)
#define _4FIELD_AT(s,i,mu) (((s)->ptr)+coord_to_index(i-(s)->type->master_shift,mu))
#define _6FIELD_AT(s,i,mu) (((s)->ptr)+((i-(s)->type->master_shift)*6+mu))

#define _SPINOR_PTR(s) _FIELD_AT(s,_spinor_for_is)
#define _FIELD_AT(s, i) (((s)->ptr) + i - (s)->type->master_shift)
#define _4FIELD_AT(s, i, mu) (((s)->ptr) + coord_to_index(i - (s)->type->master_shift, mu))
#define _6FIELD_AT(s, i, mu) (((s)->ptr) + ((i - (s)->type->master_shift) * 6 + mu))

#define _SPINOR_PTR(s) _FIELD_AT(s, _spinor_for_is)

#endif
2 changes: 2 additions & 0 deletions Include/update.h
Expand Up @@ -14,6 +14,8 @@
void test_staples();


void update(double *beta, int nhb, int nor);
void random_su2(double rho, double s[]);


/* functions and structures for the MRE algorithm */
Expand Down
1 change: 0 additions & 1 deletion Include/utils.h
Expand Up @@ -22,7 +22,6 @@

/*SUN exp matrix*/

void ExpX(double dt, suNg_algebra_vector *h, suNg *u);


typedef struct
Expand Down
2 changes: 1 addition & 1 deletion LibHR/Geometry/process_init.c
Expand Up @@ -57,7 +57,7 @@ static int setup_level = 0;
#endif
#ifdef WITH_SMEARING
#endif
#if defined(WITH_CLOVER)|| defined(WITH_EXPCLOVER)
#if defined(WITH_CLOVER) || defined(WITH_EXPCLOVER)
#endif

#ifdef WITH_MPI
Expand Down
2 changes: 1 addition & 1 deletion LibHR/IO/logger.c
Expand Up @@ -172,7 +172,7 @@ int lprintf(char *name, int level, char *format, ...) {
static record *lastrec=0;
static char lastname[512]={0};
static FILE *lastfd=0;
static char buf[1024];
static char buf[4096];
static char alevel[16];
char *cur=&buf[0];
int ret;
Expand Down

0 comments on commit 8851576

Please sign in to comment.