/* initialize the delta_h list */ static void mde_delta_h_init(t_mde_delta_h *dh, int nbins, double dx, unsigned int ndhmax) { int i; dh->ndhmax=ndhmax+2; for(i=0;i<2;i++) { dh->bin[i]=NULL; } snew(dh->dh, dh->ndhmax); snew(dh->dhf,dh->ndhmax); if ( nbins <= 0 || dx<GMX_REAL_EPS*10 ) { dh->nhist=0; } else { int i; /* pre-allocate the histogram */ dh->nhist=2; /* energies and derivatives histogram */ dh->dx=dx; dh->nbins=nbins; for(i=0;i<dh->nhist;i++) { snew(dh->bin[i], dh->nbins); } } mde_delta_h_reset(dh); }
/* reset the data for a new round */ void mde_delta_h_coll_reset(t_mde_delta_h_coll *dhc) { int i; for (i = 0; i < dhc->ndh; i++) { if (dhc->dh[i].written) { /* we can now throw away the data */ mde_delta_h_reset(dhc->dh + i); } } dhc->start_time_set = FALSE; }
/* initialize the delta_h list */ static void mde_delta_h_init(t_mde_delta_h *dh, int nbins, double dx, unsigned int ndhmax, int type, int derivative, int nlambda, double *lambda) { int i; dh->type = type; dh->derivative = derivative; dh->lambda = lambda; dh->nlambda = nlambda; snew(dh->lambda, nlambda); for (i = 0; i < nlambda; i++) { dh->lambda[i] = lambda[i]; } snew(dh->subblock_meta_d, dh->nlambda+1); dh->ndhmax = ndhmax+2; for (i = 0; i < 2; i++) { dh->bin[i] = NULL; } snew(dh->dh, dh->ndhmax); snew(dh->dhf, dh->ndhmax); if (nbins <= 0 || dx < GMX_REAL_EPS*10) { dh->nhist = 0; } else { int i; /* pre-allocate the histogram */ dh->nhist = 2; /* energies and derivatives histogram */ dh->dx = dx; dh->nbins = nbins; for (i = 0; i < dh->nhist; i++) { snew(dh->bin[i], dh->nbins); } } mde_delta_h_reset(dh); }