--- md.c 2009-01-24 10:11:31.000000000 +1100 +++ newmd.c 2009-04-25 16:26:06.000000000 +1000 @@ -926,37 +926,46 @@ update_annealing_target_temp(&(ir->opts),t); if (bRerunMD) { - for(i=0; inr; i++) - copy_rvec(rerun_fr.x[i],state->x[i]); - if (rerun_fr.bV) - for(i=0; inr; i++) - copy_rvec(rerun_fr.v[i],state->v[i]); - else { - for(i=0; inr; i++) - clear_rvec(state->v[i]); - if (bRerunWarnNoV) { - fprintf(stderr,"\nWARNING: Some frames do not contain velocities.\n" - " Ekin, temperature and pressure are incorrect,\n" - " the virial will be incorrect when constraints are present.\n" - "\n"); - bRerunWarnNoV = FALSE; - } - } - copy_mat(rerun_fr.box,state->box); - - if (vsite) { - if (graph) { - /* Following is necessary because the graph may get out of sync - * with the coordinates if we only have every N'th coordinate set - */ - mk_mshift(fplog,graph,fr->ePBC,state->box,state->x); - shift_self(graph,state->box,state->x); - } - construct_vsites(fplog,vsite,state->x,nrnb,ir->delta_t,state->v, - top->idef.iparams,top->idef.il, - fr->ePBC,fr->bMolPBC,graph,cr,state->box); - if (graph) - unshift_self(graph,state->box,state->x); + if (!DOMAINDECOMP(cr) || DDMASTER(cr->dd)) { + t_state *rerun_state; + if (!DOMAINDECOMP(cr)) { + rerun_state = state; + } else { // DDMASTER(cr->dd) == TRUE + rerun_state = state_global; + } + for(i=0; inatoms; i++) { + copy_rvec(rerun_fr.x[i],rerun_state->x[i]); + } + if (rerun_fr.bV) + for(i=0; inatoms; i++) + copy_rvec(rerun_fr.v[i],rerun_state->v[i]); + else { + for(i=0; inatoms; i++) + clear_rvec(rerun_state->v[i]); + if (bRerunWarnNoV) { + fprintf(stderr,"\nWARNING: Some frames do not contain velocities.\n" + " Ekin, temperature and pressure are incorrect,\n" + " the virial will be incorrect when constraints are present.\n" + "\n"); + bRerunWarnNoV = FALSE; + } + } + copy_mat(rerun_fr.box,rerun_state->box); + + if (vsite) { + if (graph) { + /* Following is necessary because the graph may get out of sync + * with the coordinates if we only have every N'th coordinate set + */ + mk_mshift(fplog,graph,fr->ePBC,rerun_state->box,rerun_state->x); + shift_self(graph,rerun_state->box,rerun_state->x); + } + construct_vsites(fplog,vsite,rerun_state->x,nrnb,ir->delta_t,rerun_state->v, + top->idef.iparams,top->idef.il, + fr->ePBC,fr->bMolPBC,graph,cr,rerun_state->box); + if (graph) + unshift_self(graph,rerun_state->box,rerun_state->x); + } } }