Commit b93d9e6f authored by Ryan S. Elliott's avatar Ryan S. Elliott
Browse files

reaxc: Fixes to allow multiple object instances

Move LR into system structure
Make fix_reaxc have unique id for each instance

closes #1432
parent 89886032
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -143,7 +143,7 @@ template<class DeviceType>
void PairReaxCKokkos<DeviceType>::init_style()
{
  PairReaxC::init_style();
  if (fix_reax) modify->delete_fix("REAXC"); // not needed in the Kokkos version
  if (fix_reax) modify->delete_fix(fix_id.c_str()); // not needed in the Kokkos version
  fix_reax = NULL;

  // irequest = neigh request made by parent class
@@ -340,6 +340,7 @@ void PairReaxCKokkos<DeviceType>::init_md()
{
  // init_taper()
  F_FLOAT d1, d7, swa, swa2, swa3, swb, swb2, swb3;
  LR_lookup_table ** & LR = system->LR;

  swa = control->nonb_low;
  swb = control->nonb_cut;
@@ -437,6 +438,7 @@ int PairReaxCKokkos<DeviceType>::Init_Lookup_Tables()
  double dr;
  double *h, *fh, *fvdw, *fele, *fCEvd, *fCEclmb;
  double v0_vdw, v0_ele, vlast_vdw, vlast_ele;
  LR_lookup_table ** & LR = system->LR;

  /* initializations */
  v0_vdw = 0;
@@ -541,6 +543,7 @@ void PairReaxCKokkos<DeviceType>::Deallocate_Lookup_Tables()
{
  int i, j;
  int ntypes;
  LR_lookup_table ** & LR = system->LR;

  ntypes = atom->ntypes;

+7 −2
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@
   High Performance Computing Applications, to appear.
 ------------------------------------------------------------------------- */

#include <sstream>

#include "pair_reaxc_omp.h"
#include "atom.h"
#include "update.h"
@@ -97,6 +99,10 @@ PairReaxCOMP::PairReaxCOMP(LAMMPS *lmp) : PairReaxC(lmp), ThrOMP(lmp, THR_PAIR)

  num_nbrs_offset = NULL;

  std::stringstream ss;
  ss << "REAXC_COMP_" << std::dec << Pair::instance_me;
  fix_id = ss.str();

#ifdef OMP_TIMING
  for (int i=0;i<LASTTIMINGINDEX;i++) {
    ompTimingData[i] = 0;
@@ -373,7 +379,7 @@ void PairReaxCOMP::init_style( )

  if (fix_reax == NULL) {
    char **fixarg = new char*[3];
    fixarg[0] = (char *) "REAXC";
    fixarg[0] = (char *) fix_id.c_str();
    fixarg[1] = (char *) "all";
    fixarg[2] = (char *) "REAXC";
    modify->add_fix(3,fixarg);
@@ -643,4 +649,3 @@ void PairReaxCOMP::FindBond()
    }
  }
}
+1 −0
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ class PairReaxCOMP : public PairReaxC, public ThrOMP {
  }

 protected:
  std::string fix_id;
  virtual void setup();
  virtual void write_reax_atoms();
  virtual int estimate_reax_lists();
+1 −0
Original line number Diff line number Diff line
@@ -281,6 +281,7 @@ void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *system,control_params *contro
  int tid = 0;
#endif
  long froffset = (system->N * tid);
  LR_lookup_table ** & LR = system->LR;

  class PairReaxCOMP *pair_reax_ptr;
  pair_reax_ptr = static_cast<class PairReaxCOMP*>(system->pair_ptr);
+8 −2
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@
   Hybrid and hybrid/overlay compatibility added by Ray Shan (Sandia)
------------------------------------------------------------------------- */

#include <sstream>

#include "pair_reaxc.h"
#include "atom.h"
#include "update.h"
@@ -74,6 +76,10 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp)
  manybody_flag = 1;
  ghostneigh = 1;

  std::stringstream ss;
  ss << "REAXC_" << std::dec << Pair::instance_me;
  fix_id = ss.str();

  system = (reax_system *)
    memory->smalloc(sizeof(reax_system),"reax:system");
  memset(system,0,sizeof(reax_system));
@@ -135,7 +141,7 @@ PairReaxC::~PairReaxC()
{
  if (copymode) return;

  if (fix_reax) modify->delete_fix("REAXC");
  if (fix_reax) modify->delete_fix(fix_id.c_str());

  if (setup_flag) {
    Close_Output_Files( system, control, out_control, mpi_data );
@@ -412,7 +418,7 @@ void PairReaxC::init_style( )

  if (fix_reax == NULL) {
    char **fixarg = new char*[3];
    fixarg[0] = (char *) "REAXC";
    fixarg[0] = (char *) fix_id.c_str();
    fixarg[1] = (char *) "all";
    fixarg[2] = (char *) "REAXC";
    modify->add_fix(3,fixarg);
Loading