def_nofc ("DIHVIOL", "Dih. Rest. viol." ),
def_shkcb ("CONSTR", "Constraint", 2, 1, 1 ),
def_shk ("CONSTRNC", "Constr. No Conn.",2, 1, 1 ),
- def_shkcb ("SETTLE", "Settle", 1, 2, 0 ),
+ def_shkcb ("SETTLE", "Settle", 3, 2, 0 ),
def_vsite ("VSITE2", "Virtual site 2", 3, 1 ),
def_vsite ("VSITE3", "Virtual site 3", 4, 2 ),
def_vsite ("VSITE3FD", "Virtual site 3fd",4, 2 ),
np = interaction_function[ftype].nratoms;
if (ia[1] >= at_start && ia[1] < at_end) {
- if (ia[np] >= at_end || (ftype == F_SETTLE && ia[1]+2 >= at_end))
+ if (ia[np] >= at_end)
gmx_fatal(FARGS,
"Molecule in topology has atom numbers below and "
"above natoms (%d).\n"
at_end,at_end);
if (ftype == F_SETTLE) {
/* Bond all the atoms in the settle */
- add_gbond(g,ia[1],ia[1]+1);
- add_gbond(g,ia[1],ia[1]+2);
+ add_gbond(g,ia[1],ia[2]);
+ add_gbond(g,ia[1],ia[3]);
} else if (part == NULL) {
/* Simply add this bond */
for(j=1; j<np; j++) {
iaa = ia[1];
if (iaa >= at_start && iaa < at_end) {
nbond[iaa] += 2;
- nbond[iaa+1] += 1;
- nbond[iaa+2] += 1;
+ nbond[ia[2]] += 1;
+ nbond[ia[3]] += 1;
g->at_start = min(g->at_start,iaa);
g->at_end = max(g->at_end,iaa+2+1);
}
/* Only the first particle is stored for settles ... */
ai=ilist->iatoms[i+1];
nodeid=hid[ai];
- if ((nodeid != hid[ai+1]) ||
- (nodeid != hid[ai+2]))
+ if (nodeid != hid[ilist->iatoms[i+2]] ||
+ nodeid != hid[ilist->iatoms[i+3]])
gmx_fatal(FARGS,"Settle block crossing node boundaries\n"
- "constraint between atoms (%d-%d)",ai+1,ai+2+1);
+ "constraint between atoms %d, %d, %d)",
+ ai,ilist->iatoms[i+2],ilist->iatoms[i+3]);
}
else if(interaction_function[ftype].flags & IF_VSITE)
{
static const char *tpx_tag = TPX_TAG_RELEASE;
/* This number should be increased whenever the file format changes! */
-static const int tpx_version = 77;
+static const int tpx_version = 78;
/* This number should only be increased when you edit the TOPOLOGY section
* of the tpx format. This way we can maintain forward compatibility too
* to the end of the tpx file, so we can just skip it if we only
* want the topology.
*/
-static const int tpx_generation = 23;
+static const int tpx_generation = 24;
/* This number should be the most recent backwards incompatible version
* I.e., if this number is 9, we cannot read tpx version 9 with this code.
}
}
+static void add_settle_atoms(t_ilist *ilist)
+{
+ int i;
+
+ /* Settle used to only store the first atom: add the other two */
+ srenew(ilist->iatoms,2*ilist->nr);
+ for(i=ilist->nr/2-1; i>=0; i--)
+ {
+ ilist->iatoms[4*i+0] = ilist->iatoms[2*i+0];
+ ilist->iatoms[4*i+1] = ilist->iatoms[2*i+1];
+ ilist->iatoms[4*i+2] = ilist->iatoms[2*i+1] + 1;
+ ilist->iatoms[4*i+3] = ilist->iatoms[2*i+1] + 2;
+ }
+ ilist->nr = 2*ilist->nr;
+}
+
static void do_ilists(t_fileio *fio, t_ilist *ilist,gmx_bool bRead,
int file_version)
{
ilist[j].iatoms = NULL;
} else {
do_ilist(fio, &ilist[j],bRead,file_version,j);
+ if (file_version < 78 && j == F_SETTLE && ilist[j].nr > 0)
+ {
+ add_settle_atoms(&ilist[j]);
+ }
}
/*
if (bRead && gmx_debug_at)
bFound = TRUE;
}
}
- for(j=0; j<ils->nr; j+=2)
+ for(j=0; j<ils->nr; j+=4)
{
- if ((a1 >= ils->iatoms[j+1] && a1 < ils->iatoms[j+1]+3) &&
- (a2 >= ils->iatoms[j+1] && a2 < ils->iatoms[j+1]+3))
+ if ((a1 == ils->iatoms[j+1] || a1 == ils->iatoms[j+2] || a1 == ils->iatoms[j+3]) &&
+ (a2 == ils->iatoms[j+1] || a2 == ils->iatoms[j+2] || a2 == ils->iatoms[j+3]))
{
bFound = TRUE;
}
ia = molt->ilist[F_SETTLE].iatoms;
for(i=0; i<molt->ilist[F_SETTLE].nr; ) {
/* Subtract 1 dof from every atom in the SETTLE */
- for(ai=as+ia[1]; ai<as+ia[1]+3; ai++) {
+ for(j=0; j<3; j++) {
+ ai = as + ia[1+j];
imin = min(2,nrdf2[ai]);
nrdf2[ai] -= imin;
nrdf_tc [ggrpnr(groups,egcTC ,ai)] -= 0.5*imin;
nrdf_vcm[ggrpnr(groups,egcVCM,ai)] -= 0.5*imin;
}
- ia += 2;
- i += 2;
+ ia += 4;
+ i += 4;
}
as += molt->atoms.nr;
}
"%*s%*s%*s%*s%*s%*s%*s"
};
const char *ccformat="%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf";
- int nr,i,j,nral,nread,ftype;
+ int nr,i,j,nral,nral_fmt,nread,ftype;
char format[STRLEN];
/* One force parameter more, so we can check if we read too many */
double cc[MAXFORCEPARAM+1];
nparam_defA=nparam_defB=0;
- ftype = ifunc_index(d,1);
- nral = NRAL(ftype);
- for(j=0; j<MAXATOMLIST; j++)
- aa[j]=NOTSET;
- bDef = (NRFP(ftype) > 0);
-
- nread = sscanf(line,aaformat[nral-1],
- &aa[0],&aa[1],&aa[2],&aa[3],&aa[4],&aa[5]);
- if (nread < nral) {
- too_few(wi);
- return;
- } else if (nread == nral)
ftype = ifunc_index(d,1);
- else {
- /* this is a hack to allow for virtual sites with swapped parity */
- bSwapParity = (aa[nral]<0);
- if (bSwapParity)
- aa[nral] = -aa[nral];
- ftype = ifunc_index(d,aa[nral]);
- if (bSwapParity)
- switch(ftype) {
- case F_VSITE3FAD:
- case F_VSITE3OUT:
- break;
- default:
- gmx_fatal(FARGS,"Negative function types only allowed for %s and %s",
- interaction_function[F_VSITE3FAD].longname,
- interaction_function[F_VSITE3OUT].longname);
- }
- }
+ nral = NRAL(ftype);
+ for(j=0; j<MAXATOMLIST; j++)
+ {
+ aa[j] = NOTSET;
+ }
+ bDef = (NRFP(ftype) > 0);
+
+ if (ftype == F_SETTLE)
+ {
+ /* SETTLE acts on 3 atoms, but the topology format only specifies
+ * the first atom (for historical reasons).
+ */
+ nral_fmt = 1;
+ }
+ else
+ {
+ nral_fmt = nral;
+ }
+
+ nread = sscanf(line,aaformat[nral_fmt-1],
+ &aa[0],&aa[1],&aa[2],&aa[3],&aa[4],&aa[5]);
+
+ if (ftype == F_SETTLE)
+ {
+ aa[3] = aa[1];
+ aa[1] = aa[0] + 1;
+ aa[2] = aa[0] + 2;
+ }
+
+ if (nread < nral_fmt)
+ {
+ too_few(wi);
+ return;
+ }
+ else if (nread > nral_fmt)
+ {
+ /* this is a hack to allow for virtual sites with swapped parity */
+ bSwapParity = (aa[nral]<0);
+ if (bSwapParity)
+ {
+ aa[nral] = -aa[nral];
+ }
+ ftype = ifunc_index(d,aa[nral]);
+ if (bSwapParity)
+ {
+ switch(ftype)
+ {
+ case F_VSITE3FAD:
+ case F_VSITE3OUT:
+ break;
+ default:
+ gmx_fatal(FARGS,"Negative function types only allowed for %s and %s",
+ interaction_function[F_VSITE3FAD].longname,
+ interaction_function[F_VSITE3OUT].longname);
+ }
+ }
+ }
+
/* Check for double atoms and atoms out of bounds */
for(i=0; (i<nral); i++) {
warning(wi,errbuf);
}
}
- if (ftype == F_SETTLE)
- if (aa[0]+2 > at->nr)
- gmx_fatal(FARGS,"[ file %s, line %d ]:\n"
- " Atom index (%d) in %s out of bounds (1-%d)\n"
- " Settle works on atoms %d, %d and %d",
- get_warning_file(wi),get_warning_line(wi),
- aa[0],dir2str(d),at->nr,
- aa[0],aa[0]+1,aa[0]+2);
/* default force parameters */
for(j=0; (j<MAXATOMLIST); j++)
gmx_incons("Unknown function type in push_bond");
}
- if (nread > nral) {
+ if (nread > nral_fmt) {
/* Manually specified parameters - in this case we discard multiple torsion info! */
-
- strcpy(format,asformat[nral-1]);
+
+ strcpy(format,asformat[nral_fmt-1]);
strcat(format,ccformat);
nread = sscanf(line,format,&cc[0],&cc[1],&cc[2],&cc[3],&cc[4],&cc[5],
settle = &idef->il[F_SETTLE];
if (settle->nr > 0)
{
- nsettle = settle->nr/2;
+ nsettle = settle->nr/4;
switch (econq)
{
sprintf(buf,
"\nstep " gmx_large_int_pfmt ": Water molecule starting at atom %d can not be "
"settled.\nCheck for bad contacts and/or reduce the timestep if appropriate.\n",
- step,ddglatnr(cr->dd,settle->iatoms[error*2+1]));
+ step,ddglatnr(cr->dd,settle->iatoms[error*4+1]));
if (fplog)
{
fprintf(fplog,"%s",buf);
{
settle = &idef->il[F_SETTLE];
iO = settle->iatoms[1];
- iH = settle->iatoms[1]+1;
+ iH = settle->iatoms[2];
constr->settled =
settle_init(md->massT[iO],md->massT[iH],
md->invmass[iO],md->invmass[iH],
iloop = gmx_mtop_ilistloop_init(mtop);
while (gmx_mtop_ilistloop_next(iloop,&ilist,&nmol))
{
- for (i=0; i<ilist[F_SETTLE].nr; i+=2)
+ for (i=0; i<ilist[F_SETTLE].nr; i+=4)
{
if (settle_type == -1)
{
for (i=0; i<nsettle; i++)
{
- ow1 = iatoms[i*2+1];
- hw2 = ow1 + 1;
- hw3 = ow1 + 2;
+ ow1 = iatoms[i*4+1];
+ hw2 = iatoms[i*4+2];
+ hw3 = iatoms[i*4+3];
for(m=0; m<DIM; m++)
for (i = 0; i < nsettle; ++i) {
doshake = 0;
/* --- Step1 A1' --- */
- ow1 = iatoms[i*2+1] * 3;
- hw2 = ow1 + 3;
- hw3 = ow1 + 6;
+ ow1 = iatoms[i*4+1] * 3;
+ hw2 = iatoms[i*4+2] * 3;
+ hw3 = iatoms[i*4+3] * 3;
xb0 = b4[hw2 ] - b4[ow1];
yb0 = b4[hw2 + 1] - b4[ow1 + 1];
zb0 = b4[hw2 + 2] - b4[ow1 + 2];
delta = interaction_function[ftype].nratoms;
if (ftype == F_SETTLE) {
- aj=ai+1;
- ak=ai+2;
+ aj = ia[2];
+ ak = ia[3];
bB[ai]=bB[aj]=bB[ak]=TRUE;
add_object(man,eOHBond,ai,aj);
add_object(man,eOHBond,ai,ak);
int i,j,nra,n;
t_functype func_type;
t_ilist *interaction;
- atom_id nr1,nr2;
+ atom_id nr1,nr2,nr3;
gmx_bool stop;
if (!ddd->dptr) {
/* check out this functype */
if (func_type == F_SETTLE) {
- nr1=interaction->iatoms[i+1];
+ nr1 = interaction->iatoms[i+1];
+ nr2 = interaction->iatoms[i+2];
+ nr3 = interaction->iatoms[i+3];
if (ISINGRP(datable[nr1])) {
- if (ISINGRP(datable[nr1+1])) {
+ if (ISINGRP(datable[nr2])) {
datable[nr1] |= DON;
add_dh(ddd,nr1,nr1+1,grp,datable);
}
- if (ISINGRP(datable[nr1+2])) {
+ if (ISINGRP(datable[nr3])) {
datable[nr1] |= DON;
add_dh(ddd,nr1,nr1+2,grp,datable);
}