void preserve_box_shape(t_inputrec *ir, matrix box_rel, matrix b) { if (inputrecPreserveShape(ir)) { do_box_rel(ir, box_rel, b, FALSE); } }
void set_box_rel(t_inputrec *ir, t_state *state) { /* Make sure the box obeys the restrictions before we fix the ratios */ correct_box(NULL, 0, state->box, NULL); clear_mat(state->box_rel); if (inputrecPreserveShape(ir)) { do_box_rel(ir, state->box_rel, state->box, TRUE); } }
void set_state_entries(t_state *state, const t_inputrec *ir) { /* The entries in the state in the tpx file might not correspond * with what is needed, so we correct this here. */ state->flags = 0; if (ir->efep != efepNO || ir->bExpanded) { state->flags |= (1<<estLAMBDA); state->flags |= (1<<estFEPSTATE); } state->flags |= (1<<estX); if (state->lambda == NULL) { snew(state->lambda, efptNR); } if (state->x == NULL) { /* 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); } if (EI_DYNAMICS(ir->eI)) { state->flags |= (1<<estV); if (state->v == NULL) { snew(state->v, state->nalloc + 1); } } if (ir->eI == eiCG) { state->flags |= (1<<estCGP); if (state->cg_p == NULL) { /* cg_p is not stored in the tpx file, so we need to allocate it */ snew(state->cg_p, state->nalloc + 1); } } state->nnhpres = 0; if (ir->ePBC != epbcNONE) { state->flags |= (1<<estBOX); if (inputrecPreserveShape(ir)) { state->flags |= (1<<estBOX_REL); } if ((ir->epc == epcPARRINELLORAHMAN) || (ir->epc == epcMTTK)) { state->flags |= (1<<estBOXV); } if (ir->epc != epcNO) { if (inputrecNptTrotter(ir) || (inputrecNphTrotter(ir))) { state->nnhpres = 1; state->flags |= (1<<estNHPRES_XI); state->flags |= (1<<estNHPRES_VXI); state->flags |= (1<<estSVIR_PREV); state->flags |= (1<<estFVIR_PREV); state->flags |= (1<<estVETA); state->flags |= (1<<estVOL0); } else { state->flags |= (1<<estPRES_PREV); } } } if (ir->etc == etcNOSEHOOVER) { state->flags |= (1<<estNH_XI); state->flags |= (1<<estNH_VXI); } if (ir->etc == etcVRESCALE) { state->flags |= (1<<estTC_INT); } init_gtc_state(state, state->ngtc, state->nnhpres, ir->opts.nhchainlength); /* allocate the space for nose-hoover chains */ init_ekinstate(&state->ekinstate, ir); snew(state->enerhist, 1); init_energyhistory(state->enerhist); init_df_history(&state->dfhist, ir->fepvals->n_lambda); state->swapstate.eSwapCoords = ir->eSwapCoords; }
void set_state_entries(t_state *state, const t_inputrec *ir) { /* The entries in the state in the tpx file might not correspond * with what is needed, so we correct this here. */ state->flags = 0; if (ir->efep != efepNO || ir->bExpanded) { state->flags |= (1<<estLAMBDA); state->flags |= (1<<estFEPSTATE); } state->flags |= (1<<estX); state->lambda.resize(efptNR); GMX_RELEASE_ASSERT(state->x.size() >= static_cast<unsigned int>(state->natoms), "We should start a run with an initialized state->x"); if (EI_DYNAMICS(ir->eI)) { state->flags |= (1<<estV); state->v.resize(state->natoms + 1); } if (ir->eI == eiCG) { state->flags |= (1<<estCGP); /* cg_p is not stored in the tpx file, so we need to allocate it */ state->cg_p.resize(state->natoms + 1); } state->nnhpres = 0; if (ir->ePBC != epbcNONE) { state->flags |= (1<<estBOX); if (inputrecPreserveShape(ir)) { state->flags |= (1<<estBOX_REL); } if ((ir->epc == epcPARRINELLORAHMAN) || (ir->epc == epcMTTK)) { state->flags |= (1<<estBOXV); state->flags |= (1<<estPRES_PREV); } if (inputrecNptTrotter(ir) || (inputrecNphTrotter(ir))) { state->nnhpres = 1; state->flags |= (1<<estNHPRES_XI); state->flags |= (1<<estNHPRES_VXI); state->flags |= (1<<estSVIR_PREV); state->flags |= (1<<estFVIR_PREV); state->flags |= (1<<estVETA); state->flags |= (1<<estVOL0); } } if (ir->etc == etcNOSEHOOVER) { state->flags |= (1<<estNH_XI); state->flags |= (1<<estNH_VXI); } if (ir->etc == etcVRESCALE) { state->flags |= (1<<estTC_INT); } init_gtc_state(state, state->ngtc, state->nnhpres, ir->opts.nhchainlength); /* allocate the space for nose-hoover chains */ init_ekinstate(&state->ekinstate, ir); if (ir->bExpanded) { snew(state->dfhist, 1); init_df_history(state->dfhist, ir->fepvals->n_lambda); } if (ir->eSwapCoords != eswapNO) { if (state->swapstate == NULL) { snew(state->swapstate, 1); } state->swapstate->eSwapCoords = ir->eSwapCoords; } }