From 087f2560ac3448b2a268a1e3c4d9c2f7829ff752 Mon Sep 17 00:00:00 2001 From: Giovanni Bussi <giovanni.bussi@gmail.com> Date: Thu, 7 Apr 2016 15:58:05 +0200 Subject: [PATCH] Fixed hrex with gmx 5.1.2 with NPT Volume data were not exchanged properly in hrex. Bug was appearing only when not using domain decomposition. --- .../src/programs/mdrun/md.cpp | 20 +++++++++++-------- .../src/programs/mdrun/repl_ex.cpp | 2 +- .../src/programs/mdrun/repl_ex.h | 1 + 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/patches/gromacs-5.1.2.diff/src/programs/mdrun/md.cpp b/patches/gromacs-5.1.2.diff/src/programs/mdrun/md.cpp index dade566c5..7af01c2a5 100644 --- a/patches/gromacs-5.1.2.diff/src/programs/mdrun/md.cpp +++ b/patches/gromacs-5.1.2.diff/src/programs/mdrun/md.cpp @@ -1063,10 +1063,10 @@ double do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[], repl=replica_exchange_get_repl(repl_ex); nrepl=replica_exchange_get_nrepl(repl_ex); } - if (PAR(cr)) { - if (DOMAINDECOMP(cr)) - dd_collect_state(cr->dd,state,state_global); - } + if (DOMAINDECOMP(cr)) + dd_collect_state(cr->dd,state,state_global); + else + copy_state_nonatomdata(state, state_global); if(MASTER(cr)){ if(repl%2==step/repl_ex_nst%2){ if(repl-1>=0) exchange_state(cr->ms,repl-1,state_global); @@ -1074,6 +1074,8 @@ double do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[], if(repl+1<nrepl) exchange_state(cr->ms,repl+1,state_global); } } + if (!DOMAINDECOMP(cr)) + copy_state_nonatomdata(state_global, state); if(PAR(cr)){ if (DOMAINDECOMP(cr)) { dd_partition_system(fplog,step,cr,TRUE,1, @@ -1099,10 +1101,10 @@ double do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[], sfree(hrex_enerd); /* exchange back */ - if (PAR(cr)) { - if (DOMAINDECOMP(cr)) - dd_collect_state(cr->dd,state,state_global); - } + if (DOMAINDECOMP(cr)) + dd_collect_state(cr->dd,state,state_global); + else + copy_state_nonatomdata(state, state_global); if(MASTER(cr)){ if(repl%2==step/repl_ex_nst%2){ if(repl-1>=0) exchange_state(cr->ms,repl-1,state_global); @@ -1110,6 +1112,8 @@ double do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[], if(repl+1<nrepl) exchange_state(cr->ms,repl+1,state_global); } } + if (!DOMAINDECOMP(cr)) + copy_state_nonatomdata(state_global, state); if(PAR(cr)){ if (DOMAINDECOMP(cr)) { dd_partition_system(fplog,step,cr,TRUE,1, diff --git a/patches/gromacs-5.1.2.diff/src/programs/mdrun/repl_ex.cpp b/patches/gromacs-5.1.2.diff/src/programs/mdrun/repl_ex.cpp index b42f55137..63eac8236 100644 --- a/patches/gromacs-5.1.2.diff/src/programs/mdrun/repl_ex.cpp +++ b/patches/gromacs-5.1.2.diff/src/programs/mdrun/repl_ex.cpp @@ -651,7 +651,7 @@ static void copy_ints(const int *s, int *d, int n) #define scopy_reals(v, n) copy_reals(state->v, state_local->v, n); #define scopy_ints(v, n) copy_ints(state->v, state_local->v, n); -static void copy_state_nonatomdata(t_state *state, t_state *state_local) +void copy_state_nonatomdata(t_state *state, t_state *state_local) { /* When t_state changes, this code should be updated. */ int ngtc, nnhpres; diff --git a/patches/gromacs-5.1.2.diff/src/programs/mdrun/repl_ex.h b/patches/gromacs-5.1.2.diff/src/programs/mdrun/repl_ex.h index aa51f07b4..29d7bfa49 100644 --- a/patches/gromacs-5.1.2.diff/src/programs/mdrun/repl_ex.h +++ b/patches/gromacs-5.1.2.diff/src/programs/mdrun/repl_ex.h @@ -76,6 +76,7 @@ extern int replica_exchange_get_repl(const gmx_repl_ex_t re); extern int replica_exchange_get_nrepl(const gmx_repl_ex_t re); extern void pd_collect_state(const t_commrec *cr, t_state *state); extern void exchange_state(const gmx_multisim_t *ms, int b, t_state *state); +extern void copy_state_nonatomdata(t_state *state, t_state *state_local); #ifdef __cplusplus } -- GitLab