From 72d747f07e3737080451bb121eb0f1a462abe850 Mon Sep 17 00:00:00 2001 From: Erik Lindahl Date: Thu, 22 May 2014 23:44:53 +0200 Subject: [PATCH] Added grompp checks for zero atom masses in state B Grompp already issued fatal errors if atoms had zero mass, or if vsites had non-zero mass, in state A. This patch adds state B to the same check. Refs #1433. Change-Id: Iec3d764ff7db6e7bdc3901d51b475cf2c35fe137 --- src/gromacs/gmxpreprocess/topio.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gromacs/gmxpreprocess/topio.c b/src/gromacs/gmxpreprocess/topio.c index 52dcdd51cc..e5b97a4d43 100644 --- a/src/gromacs/gmxpreprocess/topio.c +++ b/src/gromacs/gmxpreprocess/topio.c @@ -173,7 +173,7 @@ double check_mol(gmx_mtop_t *mtop, warninp_t wi) char buf[256]; int i, mb, nmol, ri, pt; double q; - real m; + real m, mB; t_atoms *atoms; /* Check mass and charge */ @@ -187,30 +187,31 @@ double check_mol(gmx_mtop_t *mtop, warninp_t wi) { q += nmol*atoms->atom[i].q; m = atoms->atom[i].m; + mB = atoms->atom[i].mB; pt = atoms->atom[i].ptype; /* If the particle is an atom or a nucleus it must have a mass, * else, if it is a shell, a vsite or a bondshell it can have mass zero */ - if ((m <= 0.0) && ((pt == eptAtom) || (pt == eptNucleus))) + if (((m <= 0.0) || (mB <= 0.0)) && ((pt == eptAtom) || (pt == eptNucleus))) { ri = atoms->atom[i].resind; - sprintf(buf, "atom %s (Res %s-%d) has mass %g\n", + sprintf(buf, "atom %s (Res %s-%d) has mass %g (state A) / %g (state B)\n", *(atoms->atomname[i]), *(atoms->resinfo[ri].name), atoms->resinfo[ri].nr, - m); + m, mB); warning_error(wi, buf); } else - if ((m != 0) && (pt == eptVSite)) + if (((m != 0) || (mB != 0)) && (pt == eptVSite)) { ri = atoms->atom[i].resind; - sprintf(buf, "virtual site %s (Res %s-%d) has non-zero mass %g\n" + sprintf(buf, "virtual site %s (Res %s-%d) has non-zero mass %g (state A) / %g (state B)\n" " Check your topology.\n", *(atoms->atomname[i]), *(atoms->resinfo[ri].name), atoms->resinfo[ri].nr, - m); + m, mB); warning_error(wi, buf); /* The following statements make LINCS break! */ /* atoms->atom[i].m=0; */ -- 2.22.0