From 1b6af8196fc1e058bdbf4e5256d8031cce029d8d Mon Sep 17 00:00:00 2001
From: sjplimp <sjplimp@f3b2605a-c512-4ea7-a41b-209d697bcdaa>
Date: Fri, 11 Apr 2014 14:41:25 +0000
Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11775
 f3b2605a-c512-4ea7-a41b-209d697bcdaa

---
 src/MISC/compute_ti.cpp               |  4 ++--
 src/Make.py                           |  2 +-
 src/Makefile                          | 14 +++++++-------
 src/USER-OMP/fix_qeq_comb_omp.cpp     |  6 +-----
 src/USER-OMP/neigh_full_omp.cpp       |  6 +++---
 src/USER-OMP/neigh_gran_omp.cpp       |  8 ++++----
 src/USER-OMP/neigh_half_bin_omp.cpp   |  8 ++++----
 src/USER-OMP/neigh_half_multi_omp.cpp |  6 +++---
 src/USER-OMP/neigh_respa_omp.cpp      | 18 +++++++++---------
 src/compute_property_atom.cpp         | 20 ++++++++++++++++++++
 src/compute_property_atom.h           |  2 ++
 11 files changed, 56 insertions(+), 38 deletions(-)

diff --git a/src/MISC/compute_ti.cpp b/src/MISC/compute_ti.cpp
index e47bbda556..90083b0666 100644
--- a/src/MISC/compute_ti.cpp
+++ b/src/MISC/compute_ti.cpp
@@ -127,7 +127,7 @@ void ComputeTI::init()
   for (int m = 0; m < nterms; m++) {
     ivar1[m] = input->variable->find(var1[m]);
     ivar2[m] = input->variable->find(var2[m]);
-    if (ivar1[m] < 0 || ivar2 < 0)
+    if (ivar1[m] < 0 || ivar2[m] < 0)
       error->all(FLERR,"Variable name for compute ti does not exist");
     if (!input->variable->equalstyle(ivar1[m]) ||
         !input->variable->equalstyle(ivar2[m]))
@@ -185,7 +185,7 @@ double ComputeTI::compute_scalar()
         
         double *eatom = pptr[m]->eatom;
         
-        if (force->newton) npair += atom->nghost;
+        if (force->newton_pair) npair += atom->nghost;
         for (int i = 0; i < npair; i++)    
           if ((ilo[m]<=type[i])&(ihi[m]>=type[i])) eng += eatom[i];  
         MPI_Allreduce(&eng,&engall,1,MPI_DOUBLE,MPI_SUM,world);
diff --git a/src/Make.py b/src/Make.py
index d02620aa35..c704cb7037 100755
--- a/src/Make.py
+++ b/src/Make.py
@@ -73,7 +73,7 @@ support = ["Makefile","Make.sh","Makefile.package.empty",
 
 extlibs = {"USER-ATC": "atc", "USER-AWPMD": "awpmd", "USER-COLVARS": "colvars",
            "USER-CUDA": "cuda","GPU": "gpu","MEAM": "meam", "POEMS": "poems",
-           "REAX": "reax"}
+           "USER-QMMM": "qmmm", "REAX": "reax"}
 
 # help messages
 
diff --git a/src/Makefile b/src/Makefile
index 555b87e8bc..019bb4bed9 100755
--- a/src/Makefile
+++ b/src/Makefile
@@ -22,7 +22,7 @@ PACKUSER = user-atc user-awpmd user-cg-cmm user-colvars \
 	   user-omp user-phonon user-qmmm user-reaxc user-sph
 
 PACKLIB = gpu kim meam poems reax voronoi \
-	  user-atc user-awpmd user-colvars user-cuda user-molfile
+	  user-atc user-awpmd user-colvars user-qmmm user-cuda user-molfile
 
 PACKALL = $(PACKAGE) $(PACKUSER)
 
@@ -50,7 +50,7 @@ help:
 	@echo 'make install-python      install LAMMPS wrapper in Python'
 	@echo ''
 	@echo 'make package             list available packages'
-	@echo 'make package-status      status of all packages'
+	@echo 'make package-status (ps) status of all packages'
 	@echo 'make yes-package         install a single package in src dir'
 	@echo 'make no-package          remove a single package from src dir'
 	@echo 'make yes-all             install all packages in src dir'
@@ -61,9 +61,9 @@ help:
 	@echo 'make no-user             remove all user packages'
 	@echo 'make no-lib              remove all packages with external libs'
 	@echo ''
-	@echo 'make package-update      replace src files with package files'
+	@echo 'make package-update (pu) replace src files with updated package files'
 	@echo 'make package-overwrite   replace package files with src files'
-	@echo 'make package-diff        diff src files against package files'
+	@echo 'make package-diff (pd)   diff src files against package files'
 	@echo ''
 	@echo 'make machine             build LAMMPS where machine is one of:'
 	@echo ''
@@ -108,18 +108,18 @@ purge: Purge.list
 # Create a tarball of src dir and packages
 
 tar:
-	@cd STUBS; make clean
+	@cd STUBS; $(MAKE) clean
 	@cd ..; tar cvzf src/$(ROOT)_src.tar.gz \
 	  src/Make* src/Package.sh src/MAKE src/*.cpp src/*.h src/STUBS \
 	  $(patsubst %,src/%,$(PACKAGEUC)) $(patsubst %,src/%,$(PACKUSERUC)) \
           --exclude=*/.svn
-	@cd STUBS; make
+	@cd STUBS; $(MAKE)
 	@echo "Created $(ROOT)_src.tar.gz"
 
 # Make MPI STUBS library
 
 stubs:
-	@cd STUBS; make clean; make
+	@cd STUBS; $(MAKE) clean; $(MAKE)
 
 # Create Makefile.lib, Makefile.shlib, and Makefile.list
 
diff --git a/src/USER-OMP/fix_qeq_comb_omp.cpp b/src/USER-OMP/fix_qeq_comb_omp.cpp
index f29ba5fb3d..e5de887cd3 100644
--- a/src/USER-OMP/fix_qeq_comb_omp.cpp
+++ b/src/USER-OMP/fix_qeq_comb_omp.cpp
@@ -54,7 +54,7 @@ void FixQEQCombOMP::init()
   if (!atom->q_flag)
     error->all(FLERR,"Fix qeq/comb/omp requires atom attribute q");
 
-  if (NULL == force->pair_match("comb3",0))
+  if (NULL != force->pair_match("comb3",0))
     error->all(FLERR,"No support for comb3 currently available in USER-OMP");
 
   comb = (PairComb *) force->pair_match("comb/omp",1);
@@ -79,10 +79,6 @@ void FixQEQCombOMP::init()
   }
 
   int irequest = neighbor->request(this);
-  neighbor->requests[irequest]->pair = 0;
-  neighbor->requests[irequest]->fix = 1;
-  neighbor->requests[irequest]->half = 0;
-  neighbor->requests[irequest]->full = 1;
   neighbor->requests[irequest]->omp = use_omp;
 }
 
diff --git a/src/USER-OMP/neigh_full_omp.cpp b/src/USER-OMP/neigh_full_omp.cpp
index f8036727dd..ee36e5610e 100644
--- a/src/USER-OMP/neigh_full_omp.cpp
+++ b/src/USER-OMP/neigh_full_omp.cpp
@@ -255,7 +255,7 @@ void Neighbor::full_bin_omp(NeighList *list)
 {
   // bin owned & ghost atoms
 
-  bin_atoms();
+  if (binatomflag) bin_atoms();
 
   const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
   const int molecular = atom->molecular;
@@ -367,7 +367,7 @@ void Neighbor::full_bin_ghost_omp(NeighList *list)
 {
   // bin owned & ghost atoms
 
-  bin_atoms();
+  if (binatomflag) bin_atoms();
 
   const int nlocal = atom->nlocal;
   const int nall = nlocal + atom->nghost;
@@ -510,7 +510,7 @@ void Neighbor::full_multi_omp(NeighList *list)
 {
   // bin local & ghost atoms
 
-  bin_atoms();
+  if (binatomflag) bin_atoms();
 
   const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
   const int molecular = atom->molecular;
diff --git a/src/USER-OMP/neigh_gran_omp.cpp b/src/USER-OMP/neigh_gran_omp.cpp
index 36f07fa095..55ab604b02 100644
--- a/src/USER-OMP/neigh_gran_omp.cpp
+++ b/src/USER-OMP/neigh_gran_omp.cpp
@@ -96,7 +96,7 @@ void Neighbor::granular_nsq_no_newton_omp(NeighList *list)
       touchptr = ipage_touch->vget();
       shearptr = dpage_shear->vget();
     }
-    
+
     xtmp = x[i][0];
     ytmp = x[i][1];
     ztmp = x[i][2];
@@ -271,7 +271,7 @@ void Neighbor::granular_bin_no_newton_omp(NeighList *list)
 {
   // bin local & ghost atoms
 
-  bin_atoms();
+  if (binatomflag) bin_atoms();
 
   const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
 
@@ -424,7 +424,7 @@ void Neighbor::granular_bin_newton_omp(NeighList *list)
 {
   // bin local & ghost atoms
 
-  bin_atoms();
+  if (binatomflag) bin_atoms();
 
   const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
 
@@ -533,7 +533,7 @@ void Neighbor::granular_bin_newton_tri_omp(NeighList *list)
 {
   // bin local & ghost atoms
 
-  bin_atoms();
+  if (binatomflag) bin_atoms();
 
   const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
 
diff --git a/src/USER-OMP/neigh_half_bin_omp.cpp b/src/USER-OMP/neigh_half_bin_omp.cpp
index 3974d9f6ab..65fa07a48a 100644
--- a/src/USER-OMP/neigh_half_bin_omp.cpp
+++ b/src/USER-OMP/neigh_half_bin_omp.cpp
@@ -35,7 +35,7 @@ void Neighbor::half_bin_no_newton_omp(NeighList *list)
 {
   // bin local & ghost atoms
 
-  bin_atoms();
+  if (binatomflag) bin_atoms();
 
   const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
   const int molecular = atom->molecular;
@@ -152,7 +152,7 @@ void Neighbor::half_bin_no_newton_ghost_omp(NeighList *list)
 {
   // bin local & ghost atoms
 
-  bin_atoms();
+  if (binatomflag) bin_atoms();
 
   const int nlocal = atom->nlocal;
   const int nall = nlocal + atom->nghost;
@@ -299,7 +299,7 @@ void Neighbor::half_bin_newton_omp(NeighList *list)
 {
   // bin local & ghost atoms
 
-  bin_atoms();
+  if (binatomflag) bin_atoms();
 
   const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
   const int molecular = atom->molecular;
@@ -447,7 +447,7 @@ void Neighbor::half_bin_newton_tri_omp(NeighList *list)
 {
   // bin local & ghost atoms
 
-  bin_atoms();
+  if (binatomflag) bin_atoms();
 
   const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
   const int molecular = atom->molecular;
diff --git a/src/USER-OMP/neigh_half_multi_omp.cpp b/src/USER-OMP/neigh_half_multi_omp.cpp
index ee5c3cf6f4..cc93bf6367 100644
--- a/src/USER-OMP/neigh_half_multi_omp.cpp
+++ b/src/USER-OMP/neigh_half_multi_omp.cpp
@@ -36,7 +36,7 @@ void Neighbor::half_multi_no_newton_omp(NeighList *list)
 {
   // bin local & ghost atoms
 
-  bin_atoms();
+  if (binatomflag) bin_atoms();
 
   const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
   const int molecular = atom->molecular;
@@ -158,7 +158,7 @@ void Neighbor::half_multi_newton_omp(NeighList *list)
 {
   // bin local & ghost atoms
 
-  bin_atoms();
+  if (binatomflag) bin_atoms();
 
   const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
   const int molecular = atom->molecular;
@@ -314,7 +314,7 @@ void Neighbor::half_multi_newton_tri_omp(NeighList *list)
 {
   // bin local & ghost atoms
 
-  bin_atoms();
+  if (binatomflag) bin_atoms();
 
   const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
   const int molecular = atom->molecular;
diff --git a/src/USER-OMP/neigh_respa_omp.cpp b/src/USER-OMP/neigh_respa_omp.cpp
index 6ac70cf9d7..409090c9ea 100644
--- a/src/USER-OMP/neigh_respa_omp.cpp
+++ b/src/USER-OMP/neigh_respa_omp.cpp
@@ -143,7 +143,7 @@ void Neighbor::respa_nsq_no_newton_omp(NeighList *list)
                                  tag[j]-tagprev);
           else which = 0;
           if (which == 0) neighptr[n++] = j;
-          else if (minchange = domain->minimum_image_check(delx,dely,delz))
+          else if ((minchange = domain->minimum_image_check(delx,dely,delz)))
             neighptr[n++] = j;
           else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
         } else neighptr[n++] = j;
@@ -328,7 +328,7 @@ void Neighbor::respa_nsq_newton_omp(NeighList *list)
                                  tag[j]-tagprev);
           else which = 0;
           if (which == 0) neighptr[n++] = j;
-          else if (minchange = domain->minimum_image_check(delx,dely,delz))
+          else if ((minchange = domain->minimum_image_check(delx,dely,delz)))
             neighptr[n++] = j;
           else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
         } else neighptr[n++] = j;
@@ -390,7 +390,7 @@ void Neighbor::respa_bin_no_newton_omp(NeighList *list)
 {
   // bin local & ghost atoms
 
-  bin_atoms();
+  if (binatomflag) bin_atoms();
 
   const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
   const int molecular = atom->molecular;
@@ -506,7 +506,7 @@ void Neighbor::respa_bin_no_newton_omp(NeighList *list)
                                    tag[j]-tagprev);
             else which = 0;
             if (which == 0) neighptr[n++] = j;
-            else if (minchange = domain->minimum_image_check(delx,dely,delz))
+            else if ((minchange = domain->minimum_image_check(delx,dely,delz)))
               neighptr[n++] = j;
             else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
           } else neighptr[n++] = j;
@@ -569,7 +569,7 @@ void Neighbor::respa_bin_newton_omp(NeighList *list)
 {
   // bin local & ghost atoms
 
-  bin_atoms();
+  if (binatomflag) bin_atoms();
 
   const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
   const int molecular = atom->molecular;
@@ -688,7 +688,7 @@ void Neighbor::respa_bin_newton_omp(NeighList *list)
                                  tag[j]-tagprev);
             else which = 0;
           if (which == 0) neighptr[n++] = j;
-          else if (minchange = domain->minimum_image_check(delx,dely,delz))
+          else if ((minchange = domain->minimum_image_check(delx,dely,delz)))
             neighptr[n++] = j;
           else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
         } else neighptr[n++] = j;
@@ -732,7 +732,7 @@ void Neighbor::respa_bin_newton_omp(NeighList *list)
                                    tag[j]-tagprev);
             else which = 0;
             if (which == 0) neighptr[n++] = j;
-            else if (minchange = domain->minimum_image_check(delx,dely,delz))
+            else if ((minchange = domain->minimum_image_check(delx,dely,delz)))
               neighptr[n++] = j;
             else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
           } else neighptr[n++] = j;
@@ -795,7 +795,7 @@ void Neighbor::respa_bin_newton_tri_omp(NeighList *list)
 {
   // bin local & ghost atoms
 
-  bin_atoms();
+  if (binatomflag) bin_atoms();
 
   const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
   const int molecular = atom->molecular;
@@ -919,7 +919,7 @@ void Neighbor::respa_bin_newton_tri_omp(NeighList *list)
                                    tag[j]-tagprev);
             else which = 0;
             if (which == 0) neighptr[n++] = j;
-            else if (minchange = domain->minimum_image_check(delx,dely,delz))
+            else if ((minchange = domain->minimum_image_check(delx,dely,delz)))
               neighptr[n++] = j;
             else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
           } else neighptr[n++] = j;
diff --git a/src/compute_property_atom.cpp b/src/compute_property_atom.cpp
index c9e6b126e2..23d8fb8226 100644
--- a/src/compute_property_atom.cpp
+++ b/src/compute_property_atom.cpp
@@ -337,6 +337,11 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
                                  "atom property that isn't allocated");
       pack_choice[i] = &ComputePropertyAtom::pack_corner3z;
 
+    } else if (strcmp(arg[iarg],"nbonds") == 0) {
+      if (!atom->molecule_flag)
+        error->all(FLERR,"Compute property/atom for "
+                   "atom property that isn't allocated");
+      pack_choice[i] = &ComputePropertyAtom::pack_nbonds;
     } else if (strstr(arg[iarg],"i_") == arg[iarg]) {
       int flag;
       index[i] = atom->find_custom(&arg[iarg][2],flag);
@@ -1687,6 +1692,21 @@ void ComputePropertyAtom::pack_corner3z(int n)
 
 /* ---------------------------------------------------------------------- */
 
+void ComputePropertyAtom::pack_nbonds(int n)
+{
+  int *num_bond = atom->num_bond;
+  int *mask = atom->mask;
+  int nlocal = atom->nlocal;
+
+  for (int i = 0; i < nlocal; i++) {
+    if (mask[i] & groupbit) buf[n] = num_bond[i];
+    else buf[n] = 0.0;
+    n += nvalues;
+  }
+}
+
+/* ---------------------------------------------------------------------- */
+
 void ComputePropertyAtom::pack_iname(int n)
 {
   int *ivector = atom->ivector[index[n]];
diff --git a/src/compute_property_atom.h b/src/compute_property_atom.h
index a5d2c5832d..01e623011d 100644
--- a/src/compute_property_atom.h
+++ b/src/compute_property_atom.h
@@ -121,6 +121,8 @@ class ComputePropertyAtom : public Compute {
   void pack_corner3y(int);
   void pack_corner3z(int);
 
+  void pack_nbonds(int);
+
   void pack_iname(int);
   void pack_dname(int);
 };
-- 
GitLab