#endif
void init_disres(FILE *fplog,const gmx_mtop_t *mtop,
- t_inputrec *ir,const t_commrec *cr,gmx_bool bPartDecomp,
- t_fcdata *fcd,t_state *state);
+ t_inputrec *ir,const t_commrec *cr,gmx_bool bPartDecomp,
+ t_fcdata *fcd,t_state *state, gmx_bool bIsREMD);
/* Initiate *fcd data, must be called once, nbonds is the number
* of iatoms in the ilist of the idef struct.
* When time averaging is used, the history is initialized in state,
* unless it was read before from a checkpoint file.
+ * The implementation of distance restraints with -multi
+ * must differ according to whether REMD is active.
*/
void calc_disres_R_6(const gmx_multisim_t *ms,
void init_disres(FILE *fplog,const gmx_mtop_t *mtop,
t_inputrec *ir,const t_commrec *cr,gmx_bool bPartDecomp,
- t_fcdata *fcd,t_state *state)
+ t_fcdata *fcd,t_state *state, gmx_bool bIsREMD)
{
int fa,nmol,i,npair,np;
t_iparams *ip;
dd->Rtav_6 = &(dd->Rt_6[dd->nres]);
ptr = getenv("GMX_DISRE_ENSEMBLE_SIZE");
- if (cr && cr->ms != NULL && ptr != NULL)
+ if (cr && cr->ms != NULL && ptr != NULL && !bIsREMD)
{
#ifdef GMX_MPI
dd->nsystems = 0;
{
fprintf(fplog,"Found GMX_DISRE_ENSEMBLE_SIZE set to %d systems per ensemble\n",dd->nsystems);
}
- check_multi_int(fplog,cr->ms,dd->nsystems,
- "the number of systems per ensemble");
+ /* This check is only valid on MASTER(cr), so probably
+ * ensemble-averaged distance restraints are broken on more
+ * than one processor per simulation system. */
+ if (MASTER(cr))
+ {
+ check_multi_int(fplog,cr->ms,dd->nsystems,
+ "the number of systems per ensemble");
+ }
+ gmx_bcast_sim(sizeof(int), &dd->nsystems, cr);
+
if (dd->nsystems <= 0 || cr->ms->nsim % dd->nsystems != 0)
{
gmx_fatal(FARGS,"The number of systems %d is not divisible by the number of systems per ensemble %d\n",cr->ms->nsim,dd->nsystems);
if (fplog) {
fprintf(fplog,"There are %d distance restraints involving %d atom pairs\n",dd->nres,dd->npair);
}
- if (cr && cr->ms)
+ /* Have to avoid g_disre de-referencing cr blindly, mdrun not
+ * doing consistency checks for ensemble-averaged distance
+ * restraints when that's not happening, and only doing those
+ * checks from appropriate processes (since check_multi_int is
+ * too broken to check whether the communication will
+ * succeed...) */
+ if (cr && cr->ms && dd->nsystems > 1 && MASTER(cr))
{
check_multi_int(fplog,cr->ms,fcd->disres.nres,
"the number of distance restraints");
}
if (idef->il[F_POSRES].nr > nposre_old)
{
+ /* Executing this line line stops gmxdump -sys working
+ * correctly. I'm not aware there's an elegant fix. */
set_posres_params(idef,molb,nposre_old/2,natoms);
}
t_complex ***t;
int i,j;
- snew(t,x);
t = (t_complex ***)calloc(x,sizeof(t_complex**));
if(!t) exit(fprintf(stderr,"\nallocation error"));
t[0] = (t_complex **)calloc(x*y,sizeof(t_complex*));
"Note that currently setting [TT]GMXLIB[tt] is the only way to customize",
"directories used for searching include files.",
};
+ const char *bugs[] = {
+ "Position restraint output from -sys -s is broken"
+ };
t_filenm fnm[] = {
{ efTPX, "-s", NULL, ffOPTRD },
{ efTRX, "-f", NULL, ffOPTRD },
CopyRight(stderr,argv[0]);
parse_common_args(&argc,argv,0,NFILE,fnm,asize(pa),pa,
- asize(desc),desc,0,NULL,&oenv);
+ asize(desc),desc,asize(bugs),bugs,&oenv);
if (ftp2bSet(efTPX,NFILE,fnm))
snew(fcd,1);
/* This needs to be called before read_checkpoint to extend the state */
- init_disres(fplog,mtop,inputrec,cr,Flags & MD_PARTDEC,fcd,state);
+ init_disres(fplog,mtop,inputrec,cr,Flags & MD_PARTDEC,fcd,state, repl_ex_nst > 0);
if (gmx_mtop_ftype_count(mtop,F_ORIRES) > 0)
{
isize=0;
ir.dr_tau=0.0;
- init_disres(fplog,&mtop,&ir,NULL,FALSE,&fcd,NULL);
+ init_disres(fplog,&mtop,&ir,NULL,FALSE,&fcd,NULL,FALSE);
natoms=read_first_x(oenv,&status,ftp2fn(efTRX,NFILE,fnm),&t,&x,box);
snew(f,5*natoms);
snew(fcd,1);
/* This needs to be called before read_checkpoint to extend the state */
- init_disres(fplog,mtop,inputrec,cr,Flags & MD_PARTDEC,fcd,state);
+ init_disres(fplog,mtop,inputrec,cr,Flags & MD_PARTDEC,fcd,state,FALSE);
if (gmx_mtop_ftype_count(mtop,F_ORIRES) > 0)
{
*(top.atoms.atomname[index[i]]));
fprintf(fp,"%5d %10.5f %10.5f\n",
- bRes ? top.atoms.resinfo[top.atoms.atom[index[i]].resind].nr : i+1,rmsf[i]*bfac,
+ bRes ? top.atoms.resinfo[top.atoms.atom[index[i]].resind].nr : index[i]+1,rmsf[i]*bfac,
pdb_bfac);
}
}
if (!bRes || i+1==isize ||
top.atoms.atom[index[i]].resind!=top.atoms.atom[index[i+1]].resind)
fprintf(fp,"%5d %8.4f\n",
- bRes ? top.atoms.resinfo[top.atoms.atom[index[i]].resind].nr : i+1,sqrt(rmsf[i]));
+ bRes ? top.atoms.resinfo[top.atoms.atom[index[i]].resind].nr : index[i]+1,sqrt(rmsf[i]));
ffclose(fp);
}
if (!bRes || i+1==isize ||
top.atoms.atom[index[i]].resind!=top.atoms.atom[index[i+1]].resind)
fprintf(fp,"%5d %8.4f\n",
- bRes ? top.atoms.resinfo[top.atoms.atom[index[i]].resind].nr : i+1,sqrt(rmsf[i]));
+ bRes ? top.atoms.resinfo[top.atoms.atom[index[i]].resind].nr : index[i]+1,sqrt(rmsf[i]));
ffclose(fp);
}