From c399b75decd44afdf5b426356fbb6f23bf672cca Mon Sep 17 00:00:00 2001
From: "Steven J. Plimpton" <sjplimp@singsing.sandia.gov>
Date: Tue, 20 Feb 2018 12:52:12 -0700
Subject: [PATCH] 2nd try on LATTE error returns, plus a couple minor doc edits

---
 doc/src/Section_commands.txt  |  3 +-
 examples/USER/mgpt/log.lammps | 78 -----------------------------------
 examples/latte/latte.in       |  2 +-
 src/LATTE/fix_latte.cpp       | 15 +++----
 src/fix.cpp                   |  2 -
 5 files changed, 11 insertions(+), 89 deletions(-)
 delete mode 100644 examples/USER/mgpt/log.lammps

diff --git a/doc/src/Section_commands.txt b/doc/src/Section_commands.txt
index 02ce6f2882..faf254f93d 100644
--- a/doc/src/Section_commands.txt
+++ b/doc/src/Section_commands.txt
@@ -978,6 +978,7 @@ KOKKOS, o = USER-OMP, t = OPT.
 "lj/cut/coul/long (gikot)"_pair_lj.html,
 "lj/cut/coul/long/cs"_pair_lj.html,
 "lj/cut/coul/msm (go)"_pair_lj.html,
+"lj/cut/coul/wolf (o)"_pair_lj.html,
 "lj/cut/dipole/cut (go)"_pair_dipole.html,
 "lj/cut/dipole/long"_pair_dipole.html,
 "lj/cut/tip4p/cut (o)"_pair_lj.html,
@@ -1011,7 +1012,7 @@ KOKKOS, o = USER-OMP, t = OPT.
 "reax"_pair_reax.html,
 "rebo (oi)"_pair_airebo.html,
 "resquared (go)"_pair_resquared.html,
-"snap"_pair_snap.html,
+"snap (k)"_pair_snap.html,
 "soft (go)"_pair_soft.html,
 "sw (giko)"_pair_sw.html,
 "table (gko)"_pair_table.html,
diff --git a/examples/USER/mgpt/log.lammps b/examples/USER/mgpt/log.lammps
deleted file mode 100644
index 9485c36e47..0000000000
--- a/examples/USER/mgpt/log.lammps
+++ /dev/null
@@ -1,78 +0,0 @@
-LAMMPS (23 Oct 2015)
-# script for mgpt t=0 eos with relaxed vacancy in bcc structure:
-# input for relaxed vacancy formation energy at constant pressure
-
-echo screen
-Lattice spacing in x,y,z = 6.23812 6.23812 6.23812
-Created orthogonal box = (0 0 0) to (31.1906 31.1906 31.1906)
-  1 by 1 by 1 MPI processor grid
-Created 250 atoms
-Deleted 1 atoms, new total = 249
-Reading potential file Ta6.8x.mgpt.potin with DATE: 2015-07-30
-Neighbor list info ...
-  2 neighbor list requests
-  update every 1 steps, delay 0 steps, check yes
-  max neighbors/atom: 2000, page size: 100000
-  master list distance cutoff = 13.1712
-  ghost atom cutoff = 13.1712
-  binsize = 6.58562 -> bins = 5 5 5
-Memory usage per processor = 4.66978 Mbytes
-Step Volume Temp PotEng TotEng Press 
-       0    30343.887            0   -73.994511   -73.994511 -1.0504398e+09 
-      10    30343.887            0   -74.002332   -74.002332 -1.107516e+09 
-      20    30343.887            0    -74.00485    -74.00485 -1.1316373e+09 
-      30    30343.887            0   -74.005762   -74.005762 -1.143304e+09 
-      40    30343.887            0   -74.006116   -74.006116 -1.149395e+09 
-      50    30343.887            0   -74.006262   -74.006262 -1.1527914e+09 
-      60    30343.887            0   -74.006323   -74.006323 -1.1547677e+09 
-      70    30343.887            0    -74.00635    -74.00635 -1.1559529e+09 
-      80    30343.887            0   -74.006361   -74.006361 -1.1566763e+09 
-      90    30343.887            0   -74.006366   -74.006366 -1.1571256e+09 
-     100    30343.887            0   -74.006369   -74.006369 -1.1574093e+09 
-     110    30343.887            0    -74.00637    -74.00637 -1.1575908e+09 
-     120    30343.887            0    -74.00637    -74.00637 -1.1577083e+09 
-     130    30343.887            0    -74.00637    -74.00637 -1.1577849e+09 
-     139    30343.887            0   -74.006371   -74.006371 -1.1578311e+09 
-Loop time of 4.33109 on 1 procs for 139 steps with 249 atoms
-
-92.4% CPU use with 1 MPI tasks x no OpenMP threads
-
-Minimization stats:
-  Stopping criterion = energy tolerance
-  Energy initial, next-to-last, final = 
-        -73.9945109564     -74.0063705487     -74.0063705557
-  Force two-norm initial, final = 0.0366227 8.09081e-05
-  Force max component initial, final = 0.00730948 8.05242e-06
-  Final line search alpha, max atom move = 1 8.05242e-06
-  Iterations, force evaluations = 139 139
-
-MPI task timing breakdown:
-Section |  min time  |  avg time  |  max time  |%varavg| %total
----------------------------------------------------------------
-Pair    | 4.3064     | 4.3064     | 4.3064     |   0.0 | 99.43
-Neigh   | 0.019113   | 0.019113   | 0.019113   |   0.0 |  0.44
-Comm    | 0.0017624  | 0.0017624  | 0.0017624  |   0.0 |  0.04
-Output  | 0.00084376 | 0.00084376 | 0.00084376 |   0.0 |  0.02
-Modify  | 0          | 0          | 0          |   0.0 |  0.00
-Other   |            | 0.00297    |            |       |  0.07
-
-Nlocal:    249 ave 249 max 249 min
-Histogram: 1 0 0 0 0 0 0 0 0 0
-Nghost:    1479 ave 1479 max 1479 min
-Histogram: 1 0 0 0 0 0 0 0 0 0
-Neighs:    7936 ave 7936 max 7936 min
-Histogram: 1 0 0 0 0 0 0 0 0 0
-FullNghs:  15872 ave 15872 max 15872 min
-Histogram: 1 0 0 0 0 0 0 0 0 0
-
-Total # of neighbors = 15872
-Ave neighs/atom = 63.743
-Neighbor list builds = 4
-Dangerous builds = 0
-number of atoms = 249
-atomic volume (a.u.) = 121.863
-total energy (ry/atom) = -0.594428679162064
-pressure (gpa) = -1.15783109519801
-249   121.863   -148.012741111354   -1.15783109519801
-121.863   -0.594428679162064   -1.15783109519801
-Total wall time: 0:00:04
diff --git a/examples/latte/latte.in b/examples/latte/latte.in
index 7df354a742..b8b214b78b 100644
--- a/examples/latte/latte.in
+++ b/examples/latte/latte.in
@@ -12,7 +12,7 @@ CONTROL{
   xControl= 1
   BASISTYPE= NONORTHO
   COORDSFILE= "./coords.dat"
-  PARAMPATH= "/home/user/LATTE/TBparam"
+  PARAMPATH= "./TBparam"
   KBT= 0.0
   ENTROPYKIND= 1
   PPOTON= 1 
diff --git a/src/LATTE/fix_latte.cpp b/src/LATTE/fix_latte.cpp
index f74b05624f..165dfff597 100644
--- a/src/LATTE/fix_latte.cpp
+++ b/src/LATTE/fix_latte.cpp
@@ -38,7 +38,7 @@ extern "C" {
   void latte(int *, int *, double *, int *, int *,
              double *, double *, double *, double *,
              double *, double *, double *, int*,
-             double *, double *, double *, double * );
+             double *, double *, double *, double *, bool *);
 }
 
 #define INVOKED_PERATOM 8
@@ -267,7 +267,7 @@ void FixLatte::post_force(int vflag)
   flags[1] = coulombflag;     // 1 for LAMMPS computes Coulombics, 0 for LATTE
   flags[2] = eflag_atom;      // 1 to return per-atom energies, 0 for no
   flags[3] = vflag_global && thermo_virial;    // 1 to return global/per-atom
-  flags[4] = vflag_atom && thermo_virial;      //   virial, 0 for no       
+  flags[4] = vflag_atom && thermo_virial;      //   virial, 0 for no
   flags[5] = neighflag;       // 1 to pass neighbor list to LATTE, 0 for no
 
   // setup LATTE arguments
@@ -279,16 +279,17 @@ void FixLatte::post_force(int vflag)
   double *mass = &atom->mass[1];
   double *boxlo = domain->boxlo;
   double *boxhi = domain->boxhi;
-
   double *forces;
+  bool latteerror = 0;
   if (coulomb) forces = &flatte[0][0];
   else forces = &atom->f[0][0];
-
   int maxiter = -1;
-  
+
   latte(flags,&natoms,coords,type,&ntypes,mass,boxlo,boxhi,&domain->xy,
-        &domain->xz,&domain->yz,
-        forces,&maxiter,&latte_energy,&atom->v[0][0],&update->dt,virial);
+        &domain->xz,&domain->yz,forces,&maxiter,&latte_energy,
+        &atom->v[0][0],&update->dt,virial,&latteerror);
+
+  if (latteerror) error->all(FLERR,"Internal LATTE problem");
 
   // sum LATTE forces to LAMMPS forces
   // e.g. LAMMPS may compute Coulombics at some point
diff --git a/src/fix.cpp b/src/fix.cpp
index 80fa00f4b3..297d184967 100644
--- a/src/fix.cpp
+++ b/src/fix.cpp
@@ -350,7 +350,6 @@ void Fix::v_tally(int n, int *list, double total, double *v)
 
 void Fix::v_tally(int i, double *v)
 {
-
   if (vflag_global) {
     virial[0] += v[0];
     virial[1] += v[1];
@@ -384,7 +383,6 @@ void Fix::v_tally(int i, double *v)
 
 void Fix::v_tally(int n, int i, double vn)
 {
-
   if (vflag_global)
     virial[n] += vn;
 
-- 
GitLab