void init_state(t_state *state, int natoms, int ngtc, int nnhpres, int nhchainlength, int dfhistNumLambda) { int i; state->natoms = natoms; state->flags = 0; state->fep_state = 0; state->lambda = 0; snew(state->lambda, efptNR); for (i = 0; i < efptNR; i++) { state->lambda[i] = 0; } state->veta = 0; clear_mat(state->box); clear_mat(state->box_rel); clear_mat(state->boxv); clear_mat(state->pres_prev); clear_mat(state->svir_prev); clear_mat(state->fvir_prev); init_gtc_state(state, ngtc, nnhpres, nhchainlength); state->nalloc = state->natoms; if (state->nalloc > 0) { /* We need to allocate one element extra, since we might use * (unaligned) 4-wide SIMD loads to access rvec entries. */ snew(state->x, state->nalloc + 1); snew(state->v, state->nalloc + 1); } else { state->x = NULL; state->v = NULL; } state->cg_p = NULL; zero_history(&state->hist); zero_ekinstate(&state->ekinstate); snew(state->enerhist, 1); init_energyhistory(state->enerhist); if (dfhistNumLambda > 0) { snew(state->dfhist, 1); init_df_history(state->dfhist, dfhistNumLambda); } else { state->dfhist = NULL; } state->swapstate = NULL; state->edsamstate = NULL; state->ddp_count = 0; state->ddp_count_cg_gl = 0; state->cg_gl = NULL; state->cg_gl_nalloc = 0; }
void init_state(t_state *state, int natoms, int ngtc, int nnhpres, int nhchainlength, int nlambda) { int i; state->natoms = natoms; state->flags = 0; state->fep_state = 0; state->lambda = 0; snew(state->lambda, efptNR); for (i = 0; i < efptNR; i++) { state->lambda[i] = 0; } state->veta = 0; clear_mat(state->box); clear_mat(state->box_rel); clear_mat(state->boxv); clear_mat(state->pres_prev); clear_mat(state->svir_prev); clear_mat(state->fvir_prev); init_gtc_state(state, ngtc, nnhpres, nhchainlength); state->nalloc = state->natoms; if (state->nalloc > 0) { snew(state->x, state->nalloc); snew(state->v, state->nalloc); } else { state->x = NULL; state->v = NULL; } state->sd_X = NULL; state->cg_p = NULL; zero_history(&state->hist); zero_ekinstate(&state->ekinstate); snew(state->enerhist, 1); init_energyhistory(state->enerhist); init_df_history(&state->dfhist, nlambda); init_swapstate(&state->swapstate); state->ddp_count = 0; state->ddp_count_cg_gl = 0; state->cg_gl = NULL; state->cg_gl_nalloc = 0; }