void init_ekindata(FILE gmx_unused *log, gmx_mtop_t *mtop, t_grpopts *opts, gmx_ekindata_t *ekind) { int i; int nthread, thread; #ifdef DEBUG fprintf(log, "ngtc: %d, ngacc: %d, ngener: %d\n", opts->ngtc, opts->ngacc, opts->ngener); #endif /* bNEMD tells if we should remove remove the COM velocity * from the velocities during velocity scaling in T-coupling. * Turn this on when we have multiple acceleration groups * or one accelerated group. */ ekind->bNEMD = (opts->ngacc > 1 || norm(opts->acc[0]) > 0); ekind->ngtc = opts->ngtc; snew(ekind->tcstat, opts->ngtc); init_grptcstat(opts->ngtc, ekind->tcstat); /* Set Berendsen tcoupl lambda's to 1, * so runs without Berendsen coupling are not affected. */ for (i = 0; i < opts->ngtc; i++) { ekind->tcstat[i].lambda = 1.0; ekind->tcstat[i].vscale_nhc = 1.0; ekind->tcstat[i].ekinscaleh_nhc = 1.0; ekind->tcstat[i].ekinscalef_nhc = 1.0; } nthread = gmx_omp_nthreads_get(emntUpdate); snew(ekind->ekin_work_alloc, nthread); snew(ekind->ekin_work, nthread); snew(ekind->dekindl_work, nthread); #pragma omp parallel for num_threads(nthread) schedule(static) for (thread = 0; thread < nthread; thread++) { #define EKIN_WORK_BUFFER_SIZE 2 /* Allocate 2 extra elements on both sides, so in single * precision we have * EKIN_WORK_BUFFER_SIZE*DIM*DIM*sizeof(real) = 72/144 bytes * buffer on both sides to avoid cache pollution. */ snew(ekind->ekin_work_alloc[thread], ekind->ngtc+2*EKIN_WORK_BUFFER_SIZE); ekind->ekin_work[thread] = ekind->ekin_work_alloc[thread] + EKIN_WORK_BUFFER_SIZE; /* Nasty hack so we can have the per-thread accumulation * variable for dekindl in the same thread-local cache lines * as the per-thread accumulation tensors for ekin[fh], * because they are accumulated in the same loop. */ ekind->dekindl_work[thread] = &(ekind->ekin_work[thread][ekind->ngtc][0][0]); #undef EKIN_WORK_BUFFER_SIZE } ekind->ngacc = opts->ngacc; snew(ekind->grpstat, opts->ngacc); init_grpstat(mtop, opts->ngacc, ekind->grpstat); }
void init_ekindata(FILE *log, gmx_mtop_t *mtop, t_grpopts *opts, gmx_ekindata_t *ekind) { int i; int nthread, thread; #ifdef DEBUG fprintf(log, "ngtc: %d, ngacc: %d, ngener: %d\n", opts->ngtc, opts->ngacc, opts->ngener); #endif /* bNEMD tells if we should remove remove the COM velocity * from the velocities during velocity scaling in T-coupling. * Turn this on when we have multiple acceleration groups * or one accelerated group. */ ekind->bNEMD = (opts->ngacc > 1 || norm(opts->acc[0]) > 0); ekind->ngtc = opts->ngtc; snew(ekind->tcstat, opts->ngtc); init_grptcstat(opts->ngtc, ekind->tcstat); /* Set Berendsen tcoupl lambda's to 1, * so runs without Berendsen coupling are not affected. */ for (i = 0; i < opts->ngtc; i++) { ekind->tcstat[i].lambda = 1.0; ekind->tcstat[i].vscale_nhc = 1.0; ekind->tcstat[i].ekinscaleh_nhc = 1.0; ekind->tcstat[i].ekinscalef_nhc = 1.0; } nthread = gmx_omp_nthreads_get(emntUpdate); snew(ekind->ekin_work_alloc, nthread); snew(ekind->ekin_work, nthread); #pragma omp parallel for num_threads(nthread) schedule(static) for (thread = 0; thread < nthread; thread++) { /* Allocate 2 elements extra on both sides, * so in single precision we have 2*3*3*4=72 bytes buffer * on both sides to avoid cache pollution. */ snew(ekind->ekin_work_alloc[thread], ekind->ngtc+4); ekind->ekin_work[thread] = ekind->ekin_work_alloc[thread] + 2; } ekind->ngacc = opts->ngacc; snew(ekind->grpstat, opts->ngacc); init_grpstat(log, mtop, opts->ngacc, ekind->grpstat); }
void init_ekindata(FILE *log,gmx_mtop_t *mtop,t_grpopts *opts, gmx_ekindata_t *ekind) { int i; #ifdef DEBUG fprintf(log,"ngtc: %d, ngacc: %d, ngener: %d\n",opts->ngtc,opts->ngacc, opts->ngener); #endif snew(ekind->tcstat,opts->ngtc); init_grptcstat(opts->ngtc,ekind->tcstat); /* Set Berendsen tcoupl lambda's to 1, * so runs without Berendsen coupling are not affected. */ for(i=0; i<opts->ngtc; i++) { ekind->tcstat[i].lambda = 1.0; } snew(ekind->grpstat,opts->ngacc); init_grpstat(log,mtop,opts->ngacc,ekind->grpstat); }