diff --git a/global/examples/lennard-jones/lennard.c b/global/examples/lennard-jones/lennard.c index 08e21d4de..6d4cb6f14 100644 --- a/global/examples/lennard-jones/lennard.c +++ b/global/examples/lennard-jones/lennard.c @@ -122,10 +122,7 @@ void LJ_Setup(int natoms, double **x_i, double **x_j, double **grad) { i = gBlockSize * NDIM * 2; /* for gX_i and gX_j used in computeFG() */ j = natoms * NDIM; /* for gGrad in computeFG() */ n = i + j + SAFELIMIT; /* total memory required */ - if(MA_push_get(C_DBL, n, "GA LJ bufs", (void *)&gMemHandle, &maindex)) - MA_get_pointer(gMemHandle, x_i); - else GA_Error("ma_alloc_get failed",n); - + *x_i = (double *) malloc(sizeof(double) * n); *x_j = *x_i + i/2 + 1; *grad = *x_j + i/2 + 1; } @@ -395,8 +392,8 @@ void LJ_Initialize(int natoms) { printf(" System Volume = %f\n\n\n", pow(L, 3.0)); } #endif - - if(gMe == 0) { + GA_Sync(); + // if(gMe == 0) { int c, i, j, k, m, n, p; double b, xSum[3] = {0.0, 0.0, 0.0}; @@ -408,9 +405,7 @@ void LJ_Initialize(int natoms) { MA_AccessIndex maindex; n = NDIM * natoms + 1; - if(MA_push_get(C_DBL, n, "GA LJ_Init bufs", (void *)&handle, &maindex)) - MA_get_pointer(handle, &x); - else GA_Error("ma_alloc_get failed",n); + x = (double *) malloc(sizeof(double) * n); /* Use face centered cubic (FCC) lattice for initial positions. Find number of unit cells (c) needed to place all atoms */ @@ -438,7 +433,7 @@ void LJ_Initialize(int natoms) { lo = 0; hi = natoms*NDIM-1; - NGA_Put (g_X, &lo, &hi, x, &hi); + if(gMe == 0) NGA_Put (g_X, &lo, &hi, x, &hi); /* Random Gaussian distribution of initial velocities */ for(i=0; i +#endif /* $Id: DP.c,v 1.14 2003-02-18 00:24:32 manoj Exp $ */ #include "global.h" diff --git a/global/src/base.c b/global/src/base.c index 31dcdf21d..066653f00 100644 --- a/global/src/base.c +++ b/global/src/base.c @@ -725,14 +725,14 @@ C_Integer *map= (map_ij);\ \ candidate = (int)(scale*(elem));\ found = 0;\ - if(map[candidate] <= (elem)){ /* search downward */\ + if(map[candidate] <= (elem)){ /* search upward */\ b= candidate;\ while(b<(n)-1){ \ found = (map[b+1]>(elem));\ if(found)break;\ b++;\ } \ - }else{ /* search upward */\ + }else{ /* search downward */\ b= candidate-1;\ while(b>=0){\ found = (map[b]<=(elem));\ diff --git a/global/src/ga_symmetr.c b/global/src/ga_symmetr.c index bb5e6746b..9b29a886a 100644 --- a/global/src/ga_symmetr.c +++ b/global/src/ga_symmetr.c @@ -2,7 +2,9 @@ # include "config.h" #endif +#if HAVE_STDLIB_H #include +#endif /** * Symmetrizes matrix A: A := .5 * (A+A`) diff --git a/global/src/matmul.c b/global/src/matmul.c index b8a04a8ac..0c8dc5f41 100644 --- a/global/src/matmul.c +++ b/global/src/matmul.c @@ -1495,7 +1495,7 @@ void pnga_matmul(transa, transb, alpha, beta, if(tmp == NULL) { /*if armci malloc fails again, then get from MA */ tmp = a_ar[0] = a =(DoubleComplex*) pnga_malloc(elems,atype, - "GA mulmat bufs"); + "GA mulmat bufs"); } if(use_NB_matmul) tmp = a_ar[1] = a_ar[0] + (Ichunk*Kchunk)/factor+1;