From 9806da69f3f9dea9aa8e66b141c3b3f146e9aa56 Mon Sep 17 00:00:00 2001
From: Steve Plimpton <sjplimp@sandia.gov>
Date: Wed, 9 Nov 2016 15:47:50 -0700
Subject: [PATCH] Stan bug fixes for fix reaxc/bonds/kk

---
 doc/src/Manual.txt                            |   4 +-
 doc/src/Section_commands.txt                  |   2 +
 doc/src/pair_born.txt                         |  10 +-
 examples/coreshell/log.8Nov16.coreshell.dsf.2 | 185 ------------------
 ...shell.dsf.1 => log.9Nov16.coreshell.dsf.1} |   0
 src/KOKKOS/fix_reaxc_bonds_kokkos.cpp         |   3 +
 src/KOKKOS/fix_reaxc_bonds_kokkos.h           |   2 +-
 src/math_special.cpp                          |   1 -
 src/pair_born_coul_dsf.cpp                    |   3 +-
 src/version.h                                 |   2 +-
 10 files changed, 15 insertions(+), 197 deletions(-)
 delete mode 100644 examples/coreshell/log.8Nov16.coreshell.dsf.2
 rename examples/coreshell/{log.8Nov16.coreshell.dsf.1 => log.9Nov16.coreshell.dsf.1} (100%)

diff --git a/doc/src/Manual.txt b/doc/src/Manual.txt
index 30e12dea6d..8f5d5ed7d1 100644
--- a/doc/src/Manual.txt
+++ b/doc/src/Manual.txt
@@ -1,7 +1,7 @@
 <!-- HTML_ONLY -->
 <HEAD>
 <TITLE>LAMMPS Users Manual</TITLE>
-<META NAME="docnumber" CONTENT="5 Nov 2016 version">
+<META NAME="docnumber" CONTENT="9 Nov 2016 version">
 <META NAME="author" CONTENT="http://lammps.sandia.gov - Sandia National Laboratories">
 <META NAME="copyright" CONTENT="Copyright (2003) Sandia Corporation.  This software and manual is distributed under the GNU General Public License.">
 </HEAD>
@@ -21,7 +21,7 @@
 <H1></H1>
 
 LAMMPS Documentation :c,h3
-5 Nov 2016 version :c,h4
+9 Nov 2016 version :c,h4
 
 Version info: :h4
 
diff --git a/doc/src/Section_commands.txt b/doc/src/Section_commands.txt
index 4f949648f0..f3ffd5bff2 100644
--- a/doc/src/Section_commands.txt
+++ b/doc/src/Section_commands.txt
@@ -886,6 +886,8 @@ KOKKOS, o = USER-OMP, t = OPT.
 "body"_pair_body.html,
 "bop"_pair_bop.html,
 "born (go)"_pair_born.html,
+"born/coul/dsf"_pair_born.html,
+"born/coul/dsf/cs"_pair_born.html,
 "born/coul/long (go)"_pair_born.html,
 "born/coul/long/cs"_pair_born.html,
 "born/coul/msm (o)"_pair_born.html,
diff --git a/doc/src/pair_born.txt b/doc/src/pair_born.txt
index caf901485d..d38d9e3191 100644
--- a/doc/src/pair_born.txt
+++ b/doc/src/pair_born.txt
@@ -72,7 +72,6 @@ pair_style born/coul/dsf 0.1 10.0 12.0
 pair_coeff * *   0.0 1.00 0.00 0.00 0.00
 pair_coeff 1 1 480.0 0.25 0.00 1.05 0.50 :pre
 
-
 [Description:]
 
 The {born} style computes the Born-Mayer-Huggins or Tosi/Fumi
@@ -101,9 +100,8 @@ term.
 The {born/coul/wolf} style adds a Coulombic term as described for the
 Wolf potential in the "coul/wolf"_pair_coul.html pair style.
 
-The {born/coul/dsf} style computes the Coulomb contribution
-with the damped shifted force model as in the
-"coul/dsf"_pair_coul.html style.
+The {born/coul/dsf} style computes the Coulomb contribution with the
+damped shifted force model as in the "coul/dsf"_pair_coul.html style.
 
 Style {born/coul/long/cs} is identical to {born/coul/long} except that
 a term is added for the "core/shell model"_Section_howto.html#howto_25
@@ -134,8 +132,8 @@ cutoff specified in the pair_style command is used.
 
 For {born/coul/long}, {born/coul/wolf} and {born/coul/dsf} no
 Coulombic cutoff can be specified for an individual I,J type pair.
-All type pairs use the same global Coulombic cutoff specified in
-the pair_style command.
+All type pairs use the same global Coulombic cutoff specified in the
+pair_style command.
 
 :line
 
diff --git a/examples/coreshell/log.8Nov16.coreshell.dsf.2 b/examples/coreshell/log.8Nov16.coreshell.dsf.2
deleted file mode 100644
index 94da2f5832..0000000000
--- a/examples/coreshell/log.8Nov16.coreshell.dsf.2
+++ /dev/null
@@ -1,185 +0,0 @@
-LAMMPS (27 Oct 2016)
-# Testsystem for core-shell model compared to Mitchel and Finchham
-# Hendrik Heenen, June 2014
-
-# ------------------------ INITIALIZATION ----------------------------
-
-units 		metal
-dimension	3
-boundary	p	p	p
-atom_style	full
-
-# ----------------------- ATOM DEFINITION ----------------------------
-
-fix csinfo all property/atom i_CSID
-read_data data.coreshell fix csinfo NULL CS-Info
-  orthogonal box = (0 0 0) to (24.096 24.096 24.096)
-  1 by 1 by 2 MPI processor grid
-  reading atoms ...
-  432 atoms
-  scanning bonds ...
-  1 = max bonds/atom
-  reading bonds ...
-  216 bonds
-  1 = max # of 1-2 neighbors
-  0 = max # of 1-3 neighbors
-  0 = max # of 1-4 neighbors
-  1 = max # of special neighbors
-
-group cores type 1 2
-216 atoms in group cores
-group shells type 3 4
-216 atoms in group shells
-
-neighbor 2.0 bin
-comm_modify vel yes
-
-# ------------------------ FORCE FIELDS ------------------------------
-
-pair_style   born/coul/dsf/cs 0.1 20.0 20.0    # A, rho, sigma=0, C, D
-pair_coeff   * *      0.0 1.000   0.00  0.00   0.00
-pair_coeff   3 3    487.0 0.23768 0.00  1.05   0.50 #Na-Na
-pair_coeff   3 4 145134.0 0.23768 0.00  6.99   8.70 #Na-Cl
-pair_coeff   4 4 405774.0 0.23768 0.00 72.40 145.40 #Cl-Cl
-
-bond_style harmonic
-bond_coeff 1 63.014 0.0
-bond_coeff 2 25.724 0.0
-
-# ------------------------ Equilibration Run -------------------------------
-
-reset_timestep 0
-
-thermo 50
-thermo_style custom step etotal pe ke temp press              epair evdwl ecoul elong ebond fnorm fmax vol
-
-compute CSequ all temp/cs cores shells
-
-# output via chunk method
-
-#compute prop all property/atom i_CSID
-#compute cs_chunk all chunk/atom c_prop
-#compute cstherm all temp/chunk cs_chunk temp internal com yes cdof 3.0
-#fix ave_chunk all ave/time 100 1 100 c_cstherm file chunk.dump mode vector
-
-thermo_modify temp CSequ
-
-# velocity bias option
-
-velocity all create 1427 134 dist gaussian mom yes rot no bias yes temp CSequ
-Neighbor list info ...
-  1 neighbor list requests
-  update every 1 steps, delay 10 steps, check yes
-  max neighbors/atom: 2000, page size: 100000
-  master list distance cutoff = 22
-  ghost atom cutoff = 22
-  binsize = 11 -> bins = 3 3 3
-velocity all scale 1427 temp CSequ
-
-fix thermoberendsen all temp/berendsen 1427 1427 0.4
-fix nve all nve
-fix_modify thermoberendsen temp CSequ
-
-# 2 fmsec timestep
-
-timestep 0.002
-run 500
-Memory usage per processor = 6.59457 Mbytes
-Step TotEng PotEng KinEng Temp Press E_pair E_vdwl E_coul E_long E_bond Fnorm Fmax Volume 
-       0   -635.80596   -675.46362    39.657659         1427   -21302.622   -675.46362    1.6320365   -677.09565            0            0 1.4528722e-14 2.747802e-15      13990.5 
-      50   -634.54091   -666.58532    32.044415    1153.0529   -4531.3775   -668.37478    37.774715   -706.14949            0    1.7894556    9.6796061    2.2085323      13990.5 
-     100   -632.30603   -662.37331    30.067272    1081.9095   -3494.2387   -664.52701    39.193627   -703.72064            0    2.1537086    11.074727    2.1546198      13990.5 
-     150   -630.53361   -663.40981    32.876196    1182.9829   -73.383109   -665.83886    46.267578   -712.10644            0    2.4290532    11.741311    2.7510336      13990.5 
-     200   -628.96388   -664.35527    35.391398    1273.4873   -1706.4631   -666.68771    41.799509   -708.48722            0    2.3324396    10.596222    3.0017211      13990.5 
-     250   -627.71591   -662.45411    34.738199    1249.9833   -1256.9123   -665.05391    43.020328   -708.07424            0    2.5998001    10.583081    1.8375441      13990.5 
-     300   -627.00338   -664.01808    37.014699    1331.8985   -1884.1512   -666.29225     40.78768   -707.07994            0    2.2741714    9.4246938    1.2451114      13990.5 
-     350   -626.21003   -664.96799    38.757968    1394.6265   -1431.9753   -667.39487    41.866515   -709.26138            0     2.426873     10.31352    1.9959989      13990.5 
-     400   -625.51909   -661.88115    36.362062    1308.4147    -366.8119   -664.48329    44.342045   -708.82533            0      2.60214    11.071369    2.1790546      13990.5 
-     450    -624.9333   -661.08821    36.154909    1300.9607   -2315.3532   -663.62656    39.690513   -703.31708            0    2.5383564    10.013961    1.4015893      13990.5 
-     500   -624.02542   -660.36457    36.339145      1307.59    374.84327   -663.00031    45.787267   -708.78758            0    2.6357437     10.67964    2.2503424      13990.5 
-Loop time of 5.89773 on 2 procs for 500 steps with 432 atoms
-
-Performance: 14.650 ns/day, 1.638 hours/ns, 84.778 timesteps/s
-99.9% CPU use with 2 MPI tasks x no OpenMP threads
-
-MPI task timing breakdown:
-Section |  min time  |  avg time  |  max time  |%varavg| %total
----------------------------------------------------------------
-Pair    | 5.2578     | 5.4112     | 5.5647     |   6.6 | 91.75
-Bond    | 0.0015583  | 0.0015992  | 0.0016401  |   0.1 |  0.03
-Neigh   | 0.076808   | 0.076815   | 0.076823   |   0.0 |  1.30
-Comm    | 0.23842    | 0.39185    | 0.54528    |  24.5 |  6.64
-Output  | 0.00029778 | 0.00038707 | 0.00047636 |   0.5 |  0.01
-Modify  | 0.0082664  | 0.0083008  | 0.0083351  |   0.0 |  0.14
-Other   |            | 0.007544   |            |       |  0.13
-
-Nlocal:    216 ave 220 max 212 min
-Histogram: 1 0 0 0 0 0 0 0 0 1
-Nghost:    7852 ave 7890 max 7814 min
-Histogram: 1 0 0 0 0 0 0 0 0 1
-Neighs:    148601 ave 149750 max 147452 min
-Histogram: 1 0 0 0 0 0 0 0 0 1
-
-Total # of neighbors = 297202
-Ave neighs/atom = 687.968
-Ave special neighs/atom = 1
-Neighbor list builds = 21
-Dangerous builds = 0
-
-unfix thermoberendsen
-
-# ------------------------ Dynamic Run -------------------------------
-
-run 1000
-Memory usage per processor = 6.59743 Mbytes
-Step TotEng PotEng KinEng Temp Press E_pair E_vdwl E_coul E_long E_bond Fnorm Fmax Volume 
-     500   -624.02542   -660.36457    36.339145      1307.59    374.84327   -663.00031    45.787267   -708.78758            0    2.6357437     10.67964    2.2503424      13990.5 
-     550   -624.01275    -659.6763    35.663547      1283.28   -408.77541   -662.43528    44.140494   -706.57577            0    2.7589824    11.231423    1.8578347      13990.5 
-     600   -624.01608   -661.00741    36.991333    1331.0577    97.833921   -663.55203    45.177756   -708.72979            0    2.5446206    11.407616    1.9340498      13990.5 
-     650   -624.01489   -661.39357    37.378678    1344.9955   -1635.0963   -663.98652     41.03269   -705.01921            0    2.5929525    9.7182838    1.8437992      13990.5 
-     700   -624.01641   -660.60919    36.592785    1316.7168    274.84427   -663.34199    45.758937   -709.10093            0    2.7327992     11.40835    2.6926812      13990.5 
-     750   -624.01423   -660.30947    36.295243    1306.0103   -424.48119   -662.95011    43.863553   -706.81366            0    2.6406337    11.369608    1.7919396      13990.5 
-     800   -624.01561   -662.42457    38.408956     1382.068   -1601.0688    -664.8166    41.228621   -706.04522            0    2.3920376    10.379512    1.4876332      13990.5 
-     850   -624.01051    -660.5341    36.523587    1314.2268   -1834.5447   -662.93225    40.927147    -703.8594            0    2.3981558    10.724301    2.0240776      13990.5 
-     900   -624.01424    -662.4875    38.473259    1384.3818   -285.09099   -665.18917     44.16937   -709.35854            0    2.7016741    11.202878    2.9137876      13990.5 
-     950   -624.01787   -661.88077    37.862897    1362.4192    294.61522   -664.50863     45.54898   -710.05761            0    2.6278644    12.347191    2.5194653      13990.5 
-    1000   -624.01006   -658.82908    34.819022    1252.8915    1297.8621   -661.39405    48.235238   -709.62929            0    2.5649692    13.763173    2.6809836      13990.5 
-    1050   -624.01237   -657.96252    33.950153     1221.627   -565.05956     -661.022    43.831206   -704.85321            0     3.059482    10.980185    1.5069363      13990.5 
-    1100   -624.01221   -662.32641    38.314199    1378.6583   -1053.4531   -664.68928     42.37808   -707.06736            0    2.3628693    11.058878     2.310501      13990.5 
-    1150   -624.01355   -663.31571     39.30216    1414.2081   -682.32516   -665.67212    42.824978    -708.4971            0    2.3564095    9.9617506    1.4794302      13990.5 
-    1200   -624.01228   -660.54648    36.534208     1314.609   -1922.8104   -663.09623     40.35503   -703.45126            0    2.5497509    10.105408    1.5577027      13990.5 
-    1250   -624.01453   -660.19988     36.18535     1302.056    1030.8826   -662.54352    47.329262   -709.87278            0    2.3436398    11.480691    2.3100697      13990.5 
-    1300    -624.0174   -660.44812    36.430711    1310.8848   -592.37472   -663.42007    43.498393   -706.91846            0    2.9719516    10.517346    1.4566735      13990.5 
-    1350   -624.02147    -662.7255    38.704027    1392.6855    328.82353   -665.26912      45.2889   -710.55802            0    2.5436194    11.071493     2.299515      13990.5 
-    1400   -624.01155   -660.32249    36.310942    1306.5752    664.45071   -663.12835    46.391793   -709.52014            0    2.8058565      12.0411    2.0813357      13990.5 
-    1450   -624.01128   -660.37598    36.364706    1308.5098   -954.57186    -662.9841    42.653305   -705.63741            0    2.6081222    10.498899    1.7930019      13990.5 
-    1500   -624.01495   -658.96253    34.947585    1257.5176    14.253508    -661.8179    45.019135   -706.83704            0    2.8553699    10.911364    1.8897264      13990.5 
-Loop time of 11.7651 on 2 procs for 1000 steps with 432 atoms
-
-Performance: 14.687 ns/day, 1.634 hours/ns, 84.997 timesteps/s
-99.9% CPU use with 2 MPI tasks x no OpenMP threads
-
-MPI task timing breakdown:
-Section |  min time  |  avg time  |  max time  |%varavg| %total
----------------------------------------------------------------
-Pair    | 10.824     | 10.886     | 10.948     |   1.9 | 92.53
-Bond    | 0.0032091  | 0.0032401  | 0.0032711  |   0.1 |  0.03
-Neigh   | 0.16206    | 0.16206    | 0.16206    |   0.0 |  1.38
-Comm    | 0.62978    | 0.6916     | 0.75341    |   7.4 |  5.88
-Output  | 0.00071597 | 0.00087166 | 0.0010273  |   0.5 |  0.01
-Modify  | 0.0043559  | 0.0043788  | 0.0044017  |   0.0 |  0.04
-Other   |            | 0.01691    |            |       |  0.14
-
-Nlocal:    216 ave 224 max 208 min
-Histogram: 1 0 0 0 0 0 0 0 0 1
-Nghost:    7910 ave 7994 max 7826 min
-Histogram: 1 0 0 0 0 0 0 0 0 1
-Neighs:    148484 ave 151739 max 145228 min
-Histogram: 1 0 0 0 0 0 0 0 0 1
-
-Total # of neighbors = 296967
-Ave neighs/atom = 687.424
-Ave special neighs/atom = 1
-Neighbor list builds = 46
-Dangerous builds = 0
-Total wall time: 0:00:17
diff --git a/examples/coreshell/log.8Nov16.coreshell.dsf.1 b/examples/coreshell/log.9Nov16.coreshell.dsf.1
similarity index 100%
rename from examples/coreshell/log.8Nov16.coreshell.dsf.1
rename to examples/coreshell/log.9Nov16.coreshell.dsf.1
diff --git a/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp b/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp
index 6e96c49196..6fefb6b667 100644
--- a/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp
+++ b/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp
@@ -103,6 +103,7 @@ void FixReaxCBondsKokkos::Output_ReaxC_Bonds(bigint ntimestep, FILE *fp)
     ((PairReaxCKokkos<LMPDeviceType>*) reaxc)->PackBondBuffer(k_buf,nbuf_local);
   else
     ((PairReaxCKokkos<LMPHostType>*) reaxc)->PackBondBuffer(k_buf,nbuf_local);
+  buf[0] = nlocal;
 
   // Receive information from buffer for output
   RecvBuffer(buf, nbuf, nbuf_local, nlocal_tot, numbonds_max);
@@ -110,6 +111,8 @@ void FixReaxCBondsKokkos::Output_ReaxC_Bonds(bigint ntimestep, FILE *fp)
   memory->destroy_kokkos(k_buf,buf);
 }
 
+/* ---------------------------------------------------------------------- */
+
 double FixReaxCBondsKokkos::memory_usage()
 {
   double bytes;
diff --git a/src/KOKKOS/fix_reaxc_bonds_kokkos.h b/src/KOKKOS/fix_reaxc_bonds_kokkos.h
index f27e558fdd..e85a7988f3 100644
--- a/src/KOKKOS/fix_reaxc_bonds_kokkos.h
+++ b/src/KOKKOS/fix_reaxc_bonds_kokkos.h
@@ -32,7 +32,7 @@ class FixReaxCBondsKokkos : public FixReaxCBonds {
   void init();
 
  private:
-  double nbuf;
+  int nbuf;
   void Output_ReaxC_Bonds(bigint, FILE *);
   double memory_usage();
 };
diff --git a/src/math_special.cpp b/src/math_special.cpp
index 5da6e7985c..39487dd386 100644
--- a/src/math_special.cpp
+++ b/src/math_special.cpp
@@ -1,4 +1,3 @@
-
 #include <math.h>
 #include <stdint.h>
 #include "math_special.h"
diff --git a/src/pair_born_coul_dsf.cpp b/src/pair_born_coul_dsf.cpp
index a79790dc48..87c2a14baa 100644
--- a/src/pair_born_coul_dsf.cpp
+++ b/src/pair_born_coul_dsf.cpp
@@ -107,7 +107,8 @@ void PairBornCoulDSF::compute(int eflag, int vflag)
     jlist = firstneigh[i];
     jnum = numneigh[i];
 
-  // self coulombic energy
+    // self coulombic energy
+
     if (eflag) {
       double e_self = -(e_shift/2.0 + alpha/MY_PIS) * qtmp*qtmp*qqrd2e;
       ev_tally(i,i,nlocal,0,0.0,e_self,0.0,0.0,0.0,0.0);
diff --git a/src/version.h b/src/version.h
index 5715946c31..7424d7792a 100644
--- a/src/version.h
+++ b/src/version.h
@@ -1 +1 @@
-#define LAMMPS_VERSION "5 Nov 2016"
+#define LAMMPS_VERSION "9 Nov 2016"
-- 
GitLab