Merge branch release-2016
authorMark Abraham <mark.j.abraham@gmail.com>
Thu, 2 Nov 2017 09:43:11 +0000 (10:43 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Thu, 2 Nov 2017 09:56:11 +0000 (10:56 +0100)
Ensured fix for gmx compare cmp_atoms went to the right code.

Change-Id: Iabc8ec03e7ebc45517f63697c3e7dea12b3f5398

1  2 
docs/manual/algorithms.tex
src/gromacs/mdlib/wall.cpp
src/gromacs/tables/forcetable.cpp
src/gromacs/taskassignment/resourcedivision.cpp
src/gromacs/topology/atoms.cpp

Simple merge
Simple merge
index 4742c58ea4a0e5c70164a3a507fc9b200f952864,55dbfc4b83aa4aa3f22f5c602719677119caec47..cfd20340b9e391bdabf9fdc4e7d3d32a19a4a94c
@@@ -1394,16 -1425,15 +1394,17 @@@ t_forcetable *make_tables(FILE *out
  
      for (int k = 0; (k < etiNR); k++)
      {
-         /* Now fill data for tables that should not be read (perhaps
-            overwriting data that was read but should not be used) */
-         if (!ETAB_USER(tabsel[k]))
+         /* Now fill data for tables that have not been read
+          * or add the Ewald long-range correction for Ewald user tables.
+          */
+         if (tabsel[k] != etabUSER)
          {
              real scale = table->scale;
 -            if (fr->bBHAM && (fr->bham_b_max != 0) && tabsel[k] == etabEXPMIN)
 +            if (ic->useBuckingham &&
 +                (ic->buckinghamBMax != 0) &&
 +                tabsel[k] == etabEXPMIN)
              {
 -                scale /= fr->bham_b_max;
 +                scale /= ic->buckinghamBMax;
              }
              init_table(table->n, nx0, scale, &(td[k]), !useUserTable);
  
index 541cd79d03dc74957afe032fe08020326f3477e9,20efcca11c512564ecda5344e0076041504257a9..fecba7db1f3a23f016287c401e1c8113f9a1367e
  #include "gromacs/mdtypes/commrec.h"
  #include "gromacs/mdtypes/inputrec.h"
  #include "gromacs/mdtypes/md_enums.h"
 +#include "gromacs/taskassignment/hardwareassign.h"
+ #include "gromacs/topology/mtop_util.h"
  #include "gromacs/topology/topology.h"
 +#include "gromacs/utility/baseversion.h"
  #include "gromacs/utility/fatalerror.h"
  #include "gromacs/utility/gmxassert.h"
 +#include "gromacs/utility/logger.h"
  #include "gromacs/utility/stringutil.h"
  
  
index 72b504596a6d25bfc85b6d14213ddc14817d03c2,cc04615c90aa68ed1d6a7207be706889c496aaba..0fa17bcd36d388dbabe4b2cd0d5c4d032f88f70f
@@@ -339,92 -326,3 +339,92 @@@ void pr_atomtypes(FILE *fp, int indent
          }
      }
  }
-         for (i = 0; (i < a1->nr); i++)
 +
 +static void cmp_atom(FILE *fp, int index, const t_atom *a1, const t_atom *a2, real ftol, real abstol)
 +{
 +    if (a2)
 +    {
 +        cmp_us(fp, "atom.type", index, a1->type, a2->type);
 +        cmp_us(fp, "atom.ptype", index, a1->ptype, a2->ptype);
 +        cmp_int(fp, "atom.resind", index, a1->resind, a2->resind);
 +        cmp_int(fp, "atom.atomnumber", index, a1->atomnumber, a2->atomnumber);
 +        cmp_real(fp, "atom.m", index, a1->m, a2->m, ftol, abstol);
 +        cmp_real(fp, "atom.q", index, a1->q, a2->q, ftol, abstol);
 +        cmp_us(fp, "atom.typeB", index, a1->typeB, a2->typeB);
 +        cmp_real(fp, "atom.mB", index, a1->mB, a2->mB, ftol, abstol);
 +        cmp_real(fp, "atom.qB", index, a1->qB, a2->qB, ftol, abstol);
 +    }
 +    else
 +    {
 +        cmp_us(fp, "atom.type", index, a1->type, a1->typeB);
 +        cmp_real(fp, "atom.m", index, a1->m, a1->mB, ftol, abstol);
 +        cmp_real(fp, "atom.q", index, a1->q, a1->qB, ftol, abstol);
 +    }
 +}
 +
 +void cmp_atoms(FILE *fp, const t_atoms *a1, const t_atoms *a2, real ftol, real abstol)
 +{
 +    int i;
 +
 +    fprintf(fp, "comparing atoms\n");
 +
 +    if (a2)
 +    {
 +        cmp_int(fp, "atoms->nr", -1, a1->nr, a2->nr);
++        for (i = 0; i < std::min(a1->nr, a2->nr); i++)
 +        {
 +            cmp_atom(fp, i, &(a1->atom[i]), &(a2->atom[i]), ftol, abstol);
 +        }
 +    }
 +    else
 +    {
 +        for (i = 0; (i < a1->nr); i++)
 +        {
 +            cmp_atom(fp, i, &(a1->atom[i]), nullptr, ftol, abstol);
 +        }
 +    }
 +}
 +
 +void atomsSetMassesBasedOnNames(t_atoms *atoms, gmx_bool printMissingMasses)
 +{
 +    if (atoms->haveMass)
 +    {
 +        /* We could decide to anyhow assign then or generate a fatal error,
 +         * but it's probably most useful to keep the masses we have.
 +         */
 +        return;
 +    }
 +
 +    int            maxWarn  = (printMissingMasses ? 10 : 0);
 +    int            numWarn  = 0;
 +
 +    gmx_atomprop_t aps      = gmx_atomprop_init();
 +
 +    gmx_bool       haveMass = TRUE;
 +    for (int i = 0; i < atoms->nr; i++)
 +    {
 +        if (!gmx_atomprop_query(aps, epropMass,
 +                                *atoms->resinfo[atoms->atom[i].resind].name,
 +                                *atoms->atomname[i],
 +                                &atoms->atom[i].m))
 +        {
 +            haveMass = FALSE;
 +
 +            if (numWarn < maxWarn)
 +            {
 +                fprintf(stderr, "Can not find mass in database for atom %s in residue %d %s\n",
 +                        *atoms->atomname[i],
 +                        atoms->resinfo[atoms->atom[i].resind].nr,
 +                        *atoms->resinfo[atoms->atom[i].resind].name);
 +                numWarn++;
 +            }
 +            else
 +            {
 +                break;
 +            }
 +        }
 +    }
 +    atoms->haveMass = haveMass;
 +
 +    gmx_atomprop_destroy(aps);
 +}