Mark Abraham wrote:
Berk Hess wrote:
Hi,
I think you can replace all state-> by state_global-> within { } after
the if statement
on line 929 of md.c.
Then I think it should work for serial, PD and DD.
Mark, could you test if this works and report back?
Thanks for the prompt response.
I had tried something equivalent to this earlier, and kept getting the
same segfault. I now see why... state_global is only allocated on
DDMASTER(cr) (or some such), so we need a slightly more cunning
solution. I'll figure it out tomorrow.
OK I have a complete fix. Under DD, non-DDMASTER processes should skip
this step copying data structures from rerun_fr to state_global. The
sizes of the various loop copies should be state_global->natoms, not
mdatoms->nr (which is smaller than state_global->natoms under DD, but
equal under other conditions). So attached is a patchfile to be applied
from src/kernel with
patch md.c < dd_mdrun.patch
I tested single-processor with and without mpi, four processors with DD
and no separate PME nodes, four processors with PD, and 16 processors
with DD and 5 PME nodes and got agreement between the leading
significant figures reported in the .log file for all cases compared
with single-processor plain 4.0.4.
I had a quick look at CVS releases-4.0-patches and since this bit of
do_md() looks the same, this patch can probably be applied there and/or
to the head 4.1 branch painlessly.
I will attach this patchfile to the bugzilla.
Before a release of 4.0.5 or 4.1, normal users should do "mdrun -rerun
-pd", unless they're confident with applying this patch!
Mark
--- 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; i<mdatoms->nr; i++)
- copy_rvec(rerun_fr.x[i],state->x[i]);
- if (rerun_fr.bV)
- for(i=0; i<mdatoms->nr; i++)
- copy_rvec(rerun_fr.v[i],state->v[i]);
- else {
- for(i=0; i<mdatoms->nr; 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; i<rerun_state->natoms; i++) {
+ copy_rvec(rerun_fr.x[i],rerun_state->x[i]);
+ }
+ if (rerun_fr.bV)
+ for(i=0; i<rerun_state->natoms; i++)
+ copy_rvec(rerun_fr.v[i],rerun_state->v[i]);
+ else {
+ for(i=0; i<rerun_state->natoms; 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);
+ }
}
}
_______________________________________________
gmx-users mailing list [email protected]
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the
www interface or send it to [email protected].
Can't post? Read http://www.gromacs.org/mailing_lists/users.php