diff --git a/doc/src/read_data.txt b/doc/src/read_data.txt
index 4ea60163b2214c35c0328975f33c97664c19635d..fd297e36c121e1efb8f631c95c182a51587a60c0 100644
--- a/doc/src/read_data.txt
+++ b/doc/src/read_data.txt
@@ -15,10 +15,11 @@ read_data file keyword args ... :pre
 file = name of data file to read in :ulb,l
 zero or more keyword/arg pairs may be appended :l
 keyword = {add} or {offset} or {shift} or {extra/atom/types} or {extra/bond/types} or {extra/angle/types} or {extra/dihedral/types} or {extra/improper/types} or {extra/bond/per/atom} or {extra/angle/per/atom} or {extra/dihedral/per/atom} or {extra/improper/per/atom} or {group} or {nocoeff} or {fix} :l
-  {add} arg = {append} or {Nstart} or {merge}
-    append = add new atoms with IDs appended to current IDs
-    Nstart = add new atoms with IDs starting with Nstart
-    merge = add new atoms with their IDs unchanged
+  {add} arg = {append} or {IDoffset} or {IDoffset MOLoffset} or {merge}
+    append = add new atoms with atom IDs appended to current IDs
+    IDoffset = add new atoms with atom IDs having IDoffset added
+    MOLoffset = add new atoms with molecule IDs having MOLoffset added (only when molecule IDs are enabled)
+    merge = add new atoms with their atom IDs (and molecule IDs) unchanged
   {offset} args = toff boff aoff doff ioff
     toff = offset to add to atom types
     boff = offset to add to bond types
@@ -120,20 +121,26 @@ boundary, then the atoms may become far apart if the box size grows.
 This will separate the atoms in the bond, which can lead to "lost"
 bond atoms or bad dynamics.
 
-The three choices for the {add} argument affect how the IDs of atoms
-in the data file are treated.  If {append} is specified, atoms in the
-data file are added to the current system, with their atom IDs reset
-so that an atomID = M in the data file becomes atomID = N+M, where N
-is the largest atom ID in the current system.  This rule is applied to
-all occurrences of atom IDs in the data file, e.g. in the Velocity or
-Bonds section.  If {Nstart} is specified, then {Nstart} is a numeric
-value is given, e.g. 1000, so that an atomID = M in the data file
-becomes atomID = 1000+M.  If {merge} is specified, the data file atoms
+The three choices for the {add} argument affect how the atom IDs and
+molecule IDs of atoms in the data file are treated.  If {append} is
+specified, atoms in the data file are added to the current system,
+with their atom IDs reset so that an atomID = M in the data file
+becomes atomID = N+M, where N is the largest atom ID in the current
+system.  This rule is applied to all occurrences of atom IDs in the
+data file, e.g. in the Velocity or Bonds section. This is also done
+for molecule IDs, if the atom style does support molecule IDs or
+they are enabled via fix property/atom. If {IDoffset} is specified,
+then {IDoffset} is a numeric value is given, e.g. 1000, so that an
+atomID = M in the data file becomes atomID = 1000+M. For systems
+with enabled molecule IDs, another numerical argument {MOLoffset}
+is required representing the equivalent offset for molecule IDs.
+If {merge} is specified, the data file atoms
 are added to the current system without changing their IDs.  They are
 assumed to merge (without duplication) with the currently defined
 atoms.  It is up to you to insure there are no multiply defined atom
 IDs, as LAMMPS only performs an incomplete check that this is the case
-by insuring the resulting max atomID >= the number of atoms.
+by insuring the resulting max atomID >= the number of atoms. For
+molecule IDs, there is no check done at all.
 
 The {offset} and {shift} keywords can only be used if the {add}
 keyword is also specified.
diff --git a/src/CLASS2/pair_lj_class2_coul_long.cpp b/src/CLASS2/pair_lj_class2_coul_long.cpp
index 5d2ae891d052f3d49851cd649991dc80b2bfbe29..9278703e2a4685898b97a4d0e1ebf3bca6a6b2ff 100644
--- a/src/CLASS2/pair_lj_class2_coul_long.cpp
+++ b/src/CLASS2/pair_lj_class2_coul_long.cpp
@@ -66,6 +66,7 @@ PairLJClass2CoulLong::~PairLJClass2CoulLong()
       memory->destroy(offset);
     }
   }
+  if (ftable) free_tables();
 }
 
 /* ---------------------------------------------------------------------- */
diff --git a/src/USER-MISC/pair_edip_multi.cpp b/src/USER-MISC/pair_edip_multi.cpp
index d52b2e4a47b1d4e3c28cfd1f4e5f0964ffc39841..3345549ae3d111a3ec42967b2f2d4f1bf664c179 100644
--- a/src/USER-MISC/pair_edip_multi.cpp
+++ b/src/USER-MISC/pair_edip_multi.cpp
@@ -364,7 +364,7 @@ void PairEDIPMulti::edip_fc(double r, Param *param, double &f, double &fdr)
   double c = param->cutoffC;
   double alpha = param->alpha;
   double x;
-  double v1, v2, v3;
+  double v1, v2;
 
   if(r < c + 1E-6)
   {
diff --git a/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp b/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp
index c6490b08243254def01c983c0c223dd2fbfb347d..60445d2d865a32eff8c5e5a3a6f6a7c25e480477 100644
--- a/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp
+++ b/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp
@@ -1700,6 +1700,7 @@ void PairLJLongTIP4PLongOMP::eval_outer(int iifrom, int iito, ThrData * const th
     jnum = numneigh[i];
     offseti = offset[itype];
     lj1i = lj1[itype]; lj2i = lj2[itype]; lj3i = lj3[itype]; lj4i = lj4[itype];
+    fxtmp = fytmp = fztmp = 0.0;
 
     for (jj = 0; jj < jnum; jj++) {
       j = jlist[jj];
diff --git a/src/atom.cpp b/src/atom.cpp
index 3fa470efd5167450111f932618debfa596753321..fa86046d239be4dc9d52d4717b86130df3e12fb0 100644
--- a/src/atom.cpp
+++ b/src/atom.cpp
@@ -822,8 +822,8 @@ void Atom::deallocate_topology()
    call style-specific routine to parse line
 ------------------------------------------------------------------------- */
 
-void Atom::data_atoms(int n, char *buf, tagint id_offset, int type_offset,
-                      int shiftflag, double *shift)
+void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset,
+                      int type_offset, int shiftflag, double *shift)
 {
   int m,xptr,iptr;
   imageint imagedata;
@@ -948,6 +948,7 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, int type_offset,
         coord[2] >= sublo[2] && coord[2] < subhi[2]) {
       avec->data_atom(xdata,imagedata,values);
       if (id_offset) tag[nlocal-1] += id_offset;
+      if (mol_offset) molecule[nlocal-1] += mol_offset;
       if (type_offset) {
         type[nlocal-1] += type_offset;
         if (type[nlocal-1] > ntypes)
diff --git a/src/atom.h b/src/atom.h
index 007142a1c045f90f24981b1facbf92e3c10cc20b..62c2d64ca7dfdd574172c3440b5b6109023574a6 100644
--- a/src/atom.h
+++ b/src/atom.h
@@ -229,7 +229,7 @@ class Atom : protected Pointers {
 
   void deallocate_topology();
 
-  void data_atoms(int, char *, tagint, int, int, double *);
+  void data_atoms(int, char *, tagint, tagint, int, int, double *);
   void data_vels(int, char *, tagint);
   void data_bonds(int, char *, int *, tagint, int);
   void data_angles(int, char *, int *, tagint, int);
diff --git a/src/comm.cpp b/src/comm.cpp
index 88edf98ca60dffa3a646f2107ab144164aa2e228..d997c2914fddb1ca3c9f8bc65001c028400c9710 100644
--- a/src/comm.cpp
+++ b/src/comm.cpp
@@ -696,10 +696,15 @@ void Comm::ring(int n, int nper, void *inbuf, int messtag,
 
   if (maxbytes == 0) return;
 
+  // sanity check
+
+  if ((nbytes > 0) && inbuf == NULL)
+    error->one(FLERR,"Cannot put data on ring from NULL pointer");
+
   char *buf,*bufcopy;
   memory->create(buf,maxbytes,"comm:buf");
   memory->create(bufcopy,maxbytes,"comm:bufcopy");
-  memcpy(buf,inbuf,nbytes);
+  if (nbytes && inbuf) memcpy(buf,inbuf,nbytes);
 
   int next = me + 1;
   int prev = me - 1;
@@ -712,12 +717,12 @@ void Comm::ring(int n, int nper, void *inbuf, int messtag,
       MPI_Send(buf,nbytes,MPI_CHAR,next,messtag,world);
       MPI_Wait(&request,&status);
       MPI_Get_count(&status,MPI_CHAR,&nbytes);
-      memcpy(buf,bufcopy,nbytes);
+      if (nbytes) memcpy(buf,bufcopy,nbytes);
     }
     if (self || loop < nprocs-1) callback(nbytes/nper,buf,ptr);
   }
 
-  if (outbuf) memcpy(outbuf,buf,nbytes);
+  if (nbytes && outbuf) memcpy(outbuf,buf,nbytes);
 
   memory->destroy(buf);
   memory->destroy(bufcopy);
diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp
index aa1210caadf1f7247006daecdc7763a095a8b25f..d08f462907143ec18d63fe9d439bbb22baca2f56 100644
--- a/src/compute_chunk_atom.cpp
+++ b/src/compute_chunk_atom.cpp
@@ -1809,13 +1809,13 @@ void ComputeChunkAtom::atom2binsphere()
     }
     yremap = x[i][1];
     if (periodicity[1]) {
-      if (xremap < boxlo[1]) yremap += prd[1];
-      if (xremap >= boxhi[1]) yremap -= prd[1];
+      if (yremap < boxlo[1]) yremap += prd[1];
+      if (yremap >= boxhi[1]) yremap -= prd[1];
     }
     zremap = x[i][2];
     if (periodicity[2]) {
-      if (xremap < boxlo[2]) zremap += prd[2];
-      if (xremap >= boxhi[2]) zremap -= prd[2];
+      if (zremap < boxlo[2]) zremap += prd[2];
+      if (zremap >= boxhi[2]) zremap -= prd[2];
     }
 
     dx = xremap - sorigin[0];
diff --git a/src/fix_wall_harmonic.cpp b/src/fix_wall_harmonic.cpp
index f91295d4693c2b1394712b062e232b150d43cd1e..20d5dbebd4fef90efff97feb14114cde107efea4 100644
--- a/src/fix_wall_harmonic.cpp
+++ b/src/fix_wall_harmonic.cpp
@@ -22,7 +22,10 @@ using namespace FixConst;
 /* ---------------------------------------------------------------------- */
 
 FixWallHarmonic::FixWallHarmonic(LAMMPS *lmp, int narg, char **arg) :
-  FixWall(lmp, narg, arg) {}
+  FixWall(lmp, narg, arg)
+{
+  dynamic_group_allow = 1;
+}
 
 /* ----------------------------------------------------------------------
    interaction of all particles in group with a wall
diff --git a/src/fix_wall_lj1043.cpp b/src/fix_wall_lj1043.cpp
index e8e706ed5ef0078682b48a44f2770ade938da1c7..064a5a8d6064b3445efee5b41c5074244afd7a5c 100644
--- a/src/fix_wall_lj1043.cpp
+++ b/src/fix_wall_lj1043.cpp
@@ -26,7 +26,10 @@ using namespace MathConst;
 /* ---------------------------------------------------------------------- */
 
 FixWallLJ1043::FixWallLJ1043(LAMMPS *lmp, int narg, char **arg) :
-  FixWall(lmp, narg, arg) {}
+  FixWall(lmp, narg, arg)
+{
+  dynamic_group_allow = 1;
+}
 
 /* ---------------------------------------------------------------------- */
 
diff --git a/src/fix_wall_lj126.cpp b/src/fix_wall_lj126.cpp
index 22199fed5b0d709b35cfb2e50e01e424770bf1a8..f556952ab3de5ec9bd7dff1118b3848f09c0016a 100644
--- a/src/fix_wall_lj126.cpp
+++ b/src/fix_wall_lj126.cpp
@@ -22,7 +22,10 @@ using namespace FixConst;
 /* ---------------------------------------------------------------------- */
 
 FixWallLJ126::FixWallLJ126(LAMMPS *lmp, int narg, char **arg) :
-  FixWall(lmp, narg, arg) {}
+  FixWall(lmp, narg, arg)
+{
+  dynamic_group_allow = 1;
+}
 
 /* ---------------------------------------------------------------------- */
 
diff --git a/src/fix_wall_lj93.cpp b/src/fix_wall_lj93.cpp
index 281a1fafc44679a690576a2eeab1a75eeafb8649..f5d6a7e147d19ae5c062fc6157fe57c43738cf0e 100644
--- a/src/fix_wall_lj93.cpp
+++ b/src/fix_wall_lj93.cpp
@@ -22,7 +22,10 @@ using namespace FixConst;
 /* ---------------------------------------------------------------------- */
 
 FixWallLJ93::FixWallLJ93(LAMMPS *lmp, int narg, char **arg) :
-  FixWall(lmp, narg, arg) {}
+  FixWall(lmp, narg, arg)
+{
+  dynamic_group_allow = 1;
+}
 
 /* ---------------------------------------------------------------------- */
 
diff --git a/src/fix_wall_reflect.cpp b/src/fix_wall_reflect.cpp
index dba7cf70360b9312c539da3ba3cd661a38340cf7..86607dbe8e611078ba7f59de9c5c8b0984b4dded 100644
--- a/src/fix_wall_reflect.cpp
+++ b/src/fix_wall_reflect.cpp
@@ -39,6 +39,8 @@ FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) :
 {
   if (narg < 4) error->all(FLERR,"Illegal fix wall/reflect command");
 
+  dynamic_group_allow = 1;
+
   // parse args
 
   nwall = 0;
diff --git a/src/fix_wall_region.cpp b/src/fix_wall_region.cpp
index 1d22e6141bc60324e758748069dededdd5a0e38a..67b0bcd713750403bcc007d741e90aeae26387ef 100644
--- a/src/fix_wall_region.cpp
+++ b/src/fix_wall_region.cpp
@@ -67,6 +67,8 @@ FixWallRegion::FixWallRegion(LAMMPS *lmp, int narg, char **arg) :
   else if (strcmp(arg[4],"harmonic") == 0) style = HARMONIC;
   else error->all(FLERR,"Illegal fix wall/region command");
 
+  if (style != COLLOID) dynamic_group_allow = 1;
+
   epsilon = force->numeric(FLERR,arg[5]);
   sigma = force->numeric(FLERR,arg[6]);
   cutoff = force->numeric(FLERR,arg[7]);
diff --git a/src/library.cpp b/src/library.cpp
index 0544aa5a4a3538143cc7b7a8ec436b25f66d3964..233bb3122cb57de5cfa84c71b65be12ca67168e8 100644
--- a/src/library.cpp
+++ b/src/library.cpp
@@ -276,13 +276,6 @@ void lammps_commands_string(void *ptr, char *str)
 {
   LAMMPS *lmp = (LAMMPS *) ptr;
 
-  BEGIN_CAPTURE
-  {
-    if (lmp->update->whichflag != 0)
-      lmp->error->all(FLERR,"Library error: issuing LAMMPS command during run");
-  }
-  END_CAPTURE
-
   // make copy of str so can strtok() it
 
   int n = strlen(str) + 1;
@@ -291,6 +284,10 @@ void lammps_commands_string(void *ptr, char *str)
 
   BEGIN_CAPTURE
   {
+    if (lmp->update->whichflag != 0) {
+      lmp->error->all(FLERR,"Library error: issuing LAMMPS command during run");
+    }
+
     char *ptr = copy;
     for (int i=0; i < n-1; ++i) {
 
diff --git a/src/read_data.cpp b/src/read_data.cpp
index b1a42608c050a1214fb3eed63df2f19554159e1c..3b93098a6e7bdedfcb874c7926be5ef4cba3b62d 100644
--- a/src/read_data.cpp
+++ b/src/read_data.cpp
@@ -124,7 +124,7 @@ void ReadData::command(int narg, char **arg)
 
   addflag = NONE;
   coeffflag = 1;
-  id_offset = 0;
+  id_offset = mol_offset = 0;
   offsetflag = shiftflag = 0;
   toffset = boffset = aoffset = doffset = ioffset = 0;
   shift[0] = shift[1] = shift[2] = 0.0;
@@ -145,11 +145,21 @@ void ReadData::command(int narg, char **arg)
       if (strcmp(arg[iarg+1],"append") == 0) addflag = APPEND;
       else if (strcmp(arg[iarg+1],"merge") == 0) addflag = MERGE;
       else {
+        if (atom->molecule_flag && (iarg+3 > narg))
+          error->all(FLERR,"Illegal read_data command");
         addflag = VALUE;
         bigint offset = force->bnumeric(FLERR,arg[iarg+1]);
         if (offset > MAXTAGINT)
-          error->all(FLERR,"Read data add offset is too big");
+          error->all(FLERR,"Read data add atomID offset is too big");
         id_offset = offset;
+
+        if (atom->molecule_flag) {
+          offset = force->bnumeric(FLERR,arg[iarg+2]);
+          if (offset > MAXTAGINT)
+            error->all(FLERR,"Read data add molID offset is too big");
+          mol_offset = offset;
+          iarg++;
+        }
       }
       iarg += 2;
     } else if (strcmp(arg[iarg],"offset") == 0) {
@@ -310,14 +320,18 @@ void ReadData::command(int narg, char **arg)
     update->ntimestep = 0;
   }
 
-  // compute atomID offset for addflag = MERGE
+  // compute atomID and optionally moleculeID offset for addflag = APPEND
 
   if (addflag == APPEND) {
     tagint *tag = atom->tag;
+    tagint *molecule = atom->molecule;
     int nlocal = atom->nlocal;
-    tagint max = 0;
-    for (int i = 0; i < nlocal; i++) max = MAX(max,tag[i]);
-    MPI_Allreduce(&max,&id_offset,1,MPI_LMP_TAGINT,MPI_MAX,world);
+    tagint maxid = 0, maxmol = 0;
+    for (int i = 0; i < nlocal; i++) maxid = MAX(maxid,tag[i]);
+    if (atom->molecule_flag)
+      for (int i = 0; i < nlocal; i++) maxmol = MAX(maxmol,molecule[i]);
+    MPI_Allreduce(&maxid,&id_offset,1,MPI_LMP_TAGINT,MPI_MAX,world);
+    MPI_Allreduce(&maxmol,&mol_offset,1,MPI_LMP_TAGINT,MPI_MAX,world);
   }
 
   // set up pointer to hold original styles while we replace them with "zero"
@@ -1137,7 +1151,7 @@ void ReadData::atoms()
     nchunk = MIN(natoms-nread,CHUNK);
     eof = comm->read_lines_from_file(fp,nchunk,MAXLINE,buffer);
     if (eof) error->all(FLERR,"Unexpected end of data file");
-    atom->data_atoms(nchunk,buffer,id_offset,toffset,shiftflag,shift);
+    atom->data_atoms(nchunk,buffer,id_offset,mol_offset,toffset,shiftflag,shift);
     nread += nchunk;
   }
 
diff --git a/src/read_data.h b/src/read_data.h
index 730229c72296fccdfc86ec401051801f6bd6ae27..b85ed67dcdc1d96eb308cfa8710941fcfb7456d4 100644
--- a/src/read_data.h
+++ b/src/read_data.h
@@ -39,7 +39,7 @@ class ReadData : protected Pointers {
   int narg,maxarg;
   char argoffset1[8],argoffset2[8];
 
-  bigint id_offset;
+  bigint id_offset, mol_offset;
 
   int nlocal_previous;
   bigint natoms;