From f7e17e97e8f34686e523ab55773f2120767b5864 Mon Sep 17 00:00:00 2001
From: sjplimp <sjplimp@f3b2605a-c512-4ea7-a41b-209d697bcdaa>
Date: Thu, 17 Dec 2015 15:46:12 +0000
Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14379
 f3b2605a-c512-4ea7-a41b-209d697bcdaa

---
 src/KOKKOS/pair_kokkos.h       |  6 +++---
 src/KOKKOS/verlet_kokkos.cpp   |  4 ++--
 src/MANYBODY/pair_comb3.cpp    |  2 +-
 src/USER-MISC/fix_srp.cpp      | 10 ++++++++++
 src/USER-PHONON/fix_phonon.cpp |  3 +++
 src/USER-PHONON/fix_phonon.h   |  4 ----
 src/modify.h                   |  1 +
 7 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/src/KOKKOS/pair_kokkos.h b/src/KOKKOS/pair_kokkos.h
index 5f9b347ddf..eb188f9c14 100644
--- a/src/KOKKOS/pair_kokkos.h
+++ b/src/KOKKOS/pair_kokkos.h
@@ -355,12 +355,12 @@ struct PairComputeFunctor<PairStyle,FULLCLUSTER,STACKPARAMS,Specialisation>  {
   EV_FLOAT compute_item(const typename Kokkos::TeamPolicy<device_type>::member_type& dev,
                         const NeighListKokkos<device_type> &list, const NoCoulTag& ) const {
     EV_FLOAT ev;
-    const int i = dev.league_rank()*dev.team_size() + dev.team_rank();
+    int i = dev.league_rank()*dev.team_size() + dev.team_rank();
 
     const X_FLOAT xtmp = c.c_x(i,0);
     const X_FLOAT ytmp = c.c_x(i,1);
     const X_FLOAT ztmp = c.c_x(i,2);
-    const int itype = c.type(i);
+    int itype = c.type(i);
 
     const AtomNeighborsConst neighbors_i = list.get_neighbors_const(i);
     const int jnum = list.d_numneigh[i];
@@ -368,7 +368,7 @@ struct PairComputeFunctor<PairStyle,FULLCLUSTER,STACKPARAMS,Specialisation>  {
     F_FLOAT3 ftmp;
 
     for (int jj = 0; jj < jnum; jj++) {
-      const int jjj = neighbors_i(jj);
+      int jjj = neighbors_i(jj);
 
       Kokkos::parallel_reduce(Kokkos::ThreadVectorRange(dev,NeighClusterSize),[&] (const int& k, F_FLOAT3& fftmp) {
         const F_FLOAT factor_lj = c.special_lj[sbmask(jjj+k)];
diff --git a/src/KOKKOS/verlet_kokkos.cpp b/src/KOKKOS/verlet_kokkos.cpp
index 67e852a7d9..527e10add3 100644
--- a/src/KOKKOS/verlet_kokkos.cpp
+++ b/src/KOKKOS/verlet_kokkos.cpp
@@ -458,7 +458,7 @@ void VerletKokkos::force_clear()
     size_t nbytes = sizeof(double) * nall;
 
     if (nbytes) {
-      if (atomKK->k_f.modified_host > atomKK->k_f.modified_device) {
+      if (atomKK->k_f.modified_host() > atomKK->k_f.modified_device()) {
     	memset_kokkos(atomKK->k_f.view<LMPHostType>());
     	atomKK->modified(Host,F_MASK);
       } else {
@@ -475,7 +475,7 @@ void VerletKokkos::force_clear()
 
   } else {
     int nall = atomKK->nfirst;
-    if (atomKK->k_f.modified_host > atomKK->k_f.modified_device) {
+    if (atomKK->k_f.modified_host() > atomKK->k_f.modified_device()) {
       memset_kokkos(atomKK->k_f.view<LMPHostType>());
       atomKK->modified(Host,F_MASK);
     } else {
diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp
index 255e8a54c4..fc2a805d15 100644
--- a/src/MANYBODY/pair_comb3.cpp
+++ b/src/MANYBODY/pair_comb3.cpp
@@ -604,7 +604,7 @@ void PairComb3::read_file(char *file)
 
   FILE *fp;
   if (comm->me == 0) {
-    fp = fopen(file,"r");
+    fp = force->open_potential(file);
     if (fp == NULL) {
       char str[128];
       sprintf(str,"Cannot open COMB3 potential file %s",file);
diff --git a/src/USER-MISC/fix_srp.cpp b/src/USER-MISC/fix_srp.cpp
index e5d592d301..88f18e9a7c 100644
--- a/src/USER-MISC/fix_srp.cpp
+++ b/src/USER-MISC/fix_srp.cpp
@@ -104,6 +104,16 @@ void FixSRP::init()
   if ((bptype < 1) || (bptype > atom->ntypes))
     error->all(FLERR,"Illegal bond particle type");
 
+  // fix SRP should be the first fix running at the PRE_EXCHANGE step.
+  // Otherwise it might conflict with, e.g. fix deform
+
+  if (modify->n_pre_exchange > 1) {
+    char *first = modify->fix[modify->list_pre_exchange[0]]->id;
+    if ((comm->me == 0) && (strcmp(id,first) != 0))
+      error->warning(FLERR,"Internal fix for pair srp defined too late."
+                     " May lead to incorrect behavior.");
+  }
+
   // setup neigh exclusions for diff atom types
   // bond particles do not interact with other types
   // type bptype only interacts with itself
diff --git a/src/USER-PHONON/fix_phonon.cpp b/src/USER-PHONON/fix_phonon.cpp
index f2748994f5..d675736179 100644
--- a/src/USER-PHONON/fix_phonon.cpp
+++ b/src/USER-PHONON/fix_phonon.cpp
@@ -23,8 +23,11 @@
      konglt@sjtu.edu.cn; konglt@gmail.com
 ------------------------------------------------------------------------- */
 
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include "fix_phonon.h"
+#include "fft3d_wrap.h"
 #include "atom.h"
 #include "compute.h"
 #include "domain.h"
diff --git a/src/USER-PHONON/fix_phonon.h b/src/USER-PHONON/fix_phonon.h
index 95a9d200e1..ecd3a8ebc9 100644
--- a/src/USER-PHONON/fix_phonon.h
+++ b/src/USER-PHONON/fix_phonon.h
@@ -43,10 +43,6 @@ typedef double FFT_SCALAR;
 #include <complex>
 #include "fix.h"
 #include <map>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "fft3d_wrap.h"
 
 namespace LAMMPS_NS {
 
diff --git a/src/modify.h b/src/modify.h
index 0367761037..17d409a46e 100644
--- a/src/modify.h
+++ b/src/modify.h
@@ -23,6 +23,7 @@ namespace LAMMPS_NS {
 
 class Modify : protected Pointers {
   friend class Info;
+  friend class FixSRP;
  public:
   int nfix,maxfix;
   int n_initial_integrate,n_post_integrate,n_pre_exchange,n_pre_neighbor;
-- 
GitLab