From 8499e72cdc91684549d77f4e154103a2df33af61 Mon Sep 17 00:00:00 2001
From: Axel Kohlmeyer <akohlmey@gmail.com>
Date: Thu, 20 Jul 2017 12:11:46 -0400
Subject: [PATCH] updates to USER-REAXC code in USER-OMP from Chris Knight.
 addresses issues with multiple threads in use

---
 src/USER-OMP/reaxc_bonds_omp.cpp          | 2 +-
 src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp | 8 --------
 src/USER-OMP/reaxc_multi_body_omp.cpp     | 9 ---------
 src/USER-OMP/reaxc_nonbonded_omp.cpp      | 9 ---------
 src/USER-OMP/reaxc_torsion_angles_omp.cpp | 5 -----
 src/USER-OMP/reaxc_valence_angles_omp.cpp | 9 ---------
 6 files changed, 1 insertion(+), 41 deletions(-)

diff --git a/src/USER-OMP/reaxc_bonds_omp.cpp b/src/USER-OMP/reaxc_bonds_omp.cpp
index d079db6674..2b7ab7e5e8 100644
--- a/src/USER-OMP/reaxc_bonds_omp.cpp
+++ b/src/USER-OMP/reaxc_bonds_omp.cpp
@@ -86,7 +86,7 @@ void BondsOMP( reax_system *system, control_params *control,
   class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid);
 
   pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either,
-				    system->pair_ptr->vflag_either, natoms,
+				    system->pair_ptr->vflag_either, system->N,
 				    system->pair_ptr->eatom, system->pair_ptr->vatom, thr);
 
 #if defined(_OPENMP)
diff --git a/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp b/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp
index be1444824b..c6486ae8e6 100644
--- a/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp
+++ b/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp
@@ -102,11 +102,6 @@ void Hydrogen_BondsOMP( reax_system *system, control_params *control,
 
   class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid);
 
-  pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either,
-				    system->pair_ptr->vflag_either,
-				    natoms, system->pair_ptr->eatom,
-				    system->pair_ptr->vatom, thr);
-
   /* loops below discover the Hydrogen bonds between i-j-k triplets.
      here j is H atom and there has to be some bond between i and j.
      Hydrogen bond is between j and k.
@@ -242,9 +237,6 @@ void Hydrogen_BondsOMP( reax_system *system, control_params *control,
   {
     data->my_en.e_hb += e_hb_thr;
   }
-
-  pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, system->pair_ptr->eflag_either,
-				  system->pair_ptr->vflag_either, thr);
 }
 
 #ifdef OMP_TIMING
diff --git a/src/USER-OMP/reaxc_multi_body_omp.cpp b/src/USER-OMP/reaxc_multi_body_omp.cpp
index 13d250750b..27779f8e85 100644
--- a/src/USER-OMP/reaxc_multi_body_omp.cpp
+++ b/src/USER-OMP/reaxc_multi_body_omp.cpp
@@ -59,7 +59,6 @@ void Atom_EnergyOMP( reax_system *system, control_params *control,
   const double p_ovun7 = system->reax_param.gp.l[8];
   const double p_ovun8 = system->reax_param.gp.l[9];
 
-  const int natoms = system->n;
   reax_list *bonds = (*lists) + BONDS;
 
   double total_Elp = 0.0;
@@ -99,10 +98,6 @@ void Atom_EnergyOMP( reax_system *system, control_params *control,
   pair_reax_ptr = static_cast<class PairReaxCOMP*>(system->pair_ptr);
   class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid);
 
-  pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either,
-				    system->pair_ptr->vflag_either, natoms,
-				    system->pair_ptr->eatom, system->pair_ptr->vatom, thr);
-
 #if defined(_OPENMP)
 #pragma omp for schedule(guided)
 #endif
@@ -280,10 +275,6 @@ void Atom_EnergyOMP( reax_system *system, control_params *control,
         (workspace->Delta[j] - dfvl*workspace->Delta_lp_temp[j]);  // UnCoor-2b
     }
   }
-
-  pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, system->pair_ptr->eflag_either,
-				  system->pair_ptr->vflag_either, thr);
-
  }
 
  data->my_en.e_lp += total_Elp;
diff --git a/src/USER-OMP/reaxc_nonbonded_omp.cpp b/src/USER-OMP/reaxc_nonbonded_omp.cpp
index 0c595e07df..d131195ca0 100644
--- a/src/USER-OMP/reaxc_nonbonded_omp.cpp
+++ b/src/USER-OMP/reaxc_nonbonded_omp.cpp
@@ -87,10 +87,6 @@ void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control,
   pair_reax_ptr = static_cast<class PairReaxCOMP*>(system->pair_ptr);
   class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid);
 
-  pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either,
-				    system->pair_ptr->vflag_either,
-				    natoms, system->pair_ptr->eatom,
-				    system->pair_ptr->vatom, thr);
   e_core = 0;
   e_vdW = 0;
   e_lg = 0;
@@ -291,11 +287,6 @@ void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *system,control_params *contro
   pair_reax_ptr = static_cast<class PairReaxCOMP*>(system->pair_ptr);
   class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid);
 
-  pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either,
-				    system->pair_ptr->vflag_either,
-				    natoms, system->pair_ptr->eatom,
-				    system->pair_ptr->vatom, thr);
-
 #if defined(_OPENMP)
 #pragma omp for schedule(guided)
 #endif
diff --git a/src/USER-OMP/reaxc_torsion_angles_omp.cpp b/src/USER-OMP/reaxc_torsion_angles_omp.cpp
index b6920c6709..4227f62763 100644
--- a/src/USER-OMP/reaxc_torsion_angles_omp.cpp
+++ b/src/USER-OMP/reaxc_torsion_angles_omp.cpp
@@ -124,11 +124,6 @@ void Torsion_AnglesOMP( reax_system *system, control_params *control,
   pair_reax_ptr = static_cast<class PairReaxCOMP*>(system->pair_ptr);
   class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid);
 
-  pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either,
-                                    system->pair_ptr->vflag_either,
-                                    system->N, system->pair_ptr->eatom,
-                                    system->pair_ptr->vatom, thr);
-
 #if defined(_OPENMP)
 #pragma omp for schedule(static)
 #endif
diff --git a/src/USER-OMP/reaxc_valence_angles_omp.cpp b/src/USER-OMP/reaxc_valence_angles_omp.cpp
index 888eeab4a1..6c15a529d3 100644
--- a/src/USER-OMP/reaxc_valence_angles_omp.cpp
+++ b/src/USER-OMP/reaxc_valence_angles_omp.cpp
@@ -173,12 +173,6 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
     pair_reax_ptr = static_cast<class PairReaxCOMP*>(system->pair_ptr);
     class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid);
 
-    pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either,
-                                      system->pair_ptr->vflag_either,
-                                      system->N, system->pair_ptr->eatom,
-                                      system->pair_ptr->vatom, thr);
-
-
     // Run through a minimal for(j<N) loop once to precompute offsets with safe number of threads
 
     const int per_thread = thb_intrs->num_intrs / nthreads;
@@ -600,9 +594,6 @@ void Valence_AnglesOMP( reax_system *system, control_params *control,
         Set_End_Index(pi, my_offset, thb_intrs );
       } // for(pi)
     } // for(j)
-
-    pair_reax_ptr->reduce_thr_proxy(system->pair_ptr, system->pair_ptr->eflag_either,
-                                    system->pair_ptr->vflag_either, thr);
   } // end omp parallel
 
   data->my_en.e_ang = total_Eang;
-- 
GitLab