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

Adjust some internal pair_kim things

parent 8a8b968d
Loading
Loading
Loading
Loading
+8 −16
Original line number Diff line number Diff line
@@ -52,11 +52,11 @@ PairKIM::PairKIM(LAMMPS *lmp) :
   lmps_units(METAL),
   pkim(0),
   pargs(0),
   kim_particle_codes(0),
   lmps_local_tot_num_atoms(0),
   kim_global_influence_distance(0.0),
   kim_number_of_cutoffs(0),
   kim_cutoff_values(0),
   kim_particle_codes(0),
   lmps_maxalloc(0),
   kim_particleSpecies(0),
   kim_particleContributing(0),
@@ -119,6 +119,8 @@ void PairKIM::compute(int eflag , int vflag)
   else
      ev_unset();

   // @@@@ can we strip the neighbor list here (like pair_meamc does)?

   // grow kim_particleSpecies and kim_particleContributing array if necessary
   // needs to be atom->nmax in length
   if (atom->nmax > lmps_maxalloc) {
@@ -158,7 +160,7 @@ void PairKIM::compute(int eflag , int vflag)
   }

   // pass current atom pointers to KIM
   set_volatiles();
   set_argument_pointers();

   // compute via KIM model
   kimerror = pkim->Compute(pargs);
@@ -656,16 +658,6 @@ void PairKIM::kim_init()
        error->all(FLERR,"create_kim_particle_codes: symbol not found ");
   }

   // set pointer values in KIM API object that will not change during run
   set_statics();

   return;
}

/* ---------------------------------------------------------------------- */

void PairKIM::set_statics()
{
   // set total number of atoms
   lmps_local_tot_num_atoms = (int) (atom->nghost + atom->nlocal);

@@ -673,7 +665,7 @@ void PairKIM::set_statics()
   pkim->GetNeighborListCutoffsPointer(&kim_number_of_cutoffs,
                                       &kim_cutoff_values);

   int kimerror = pargs->SetArgumentPointer(
   kimerror = pargs->SetArgumentPointer(
       KIM::COMPUTE_ARGUMENT_NAME::numberOfParticles,
       &lmps_local_tot_num_atoms);
   if (kim_model_has_energy)
@@ -688,14 +680,14 @@ void PairKIM::set_statics()
       reinterpret_cast<void *>(this));

   if (kimerror)
     error->all(FLERR,"Unable to register KIM static pointers");
     error->all(FLERR,"Unable to register KIM pointers");

   return;
}

/* ---------------------------------------------------------------------- */

void PairKIM::set_volatiles()
void PairKIM::set_argument_pointers()
{
   int kimerror;
   lmps_local_tot_num_atoms = (int) (atom->nghost + atom->nlocal);
@@ -752,7 +744,7 @@ void PairKIM::set_volatiles()

   if (kimerror)
   {
     error->all(FLERR,"Unable to set KIM volatile pointers");
     error->all(FLERR,"Unable to set KIM argument pointers");
   }

   return;
+11 −12
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ namespace LAMMPS_NS {
      virtual void settings(int, char**);
      virtual void coeff(int, char**);
      virtual void init_style();
     //virtual void init_list(int id, NeighList *ptr);
      virtual double init_one(int, int);
      virtual int pack_reverse_comm(int, int, double*);
      virtual void unpack_reverse_comm(int, int*, double*);
@@ -85,30 +86,29 @@ namespace LAMMPS_NS {
      KIM::TemperatureUnit temperatureUnit;
      KIM::TimeUnit timeUnit;

      // values set in set_kim_model_has_flags(), called by kim_init()

      KIM::Model * pkim;
      KIM::ComputeArguments * pargs;

      // values set in set_kim_model_has_flags(), called by kim_init()
      bool kim_model_has_energy;
      bool kim_model_has_forces;
      bool kim_model_has_virial;
      bool kim_model_has_particleEnergy;
      bool kim_model_has_particleVirial;

      // values set in kim_init(), after call to string_init(_)
      // values set in kim_init()
      bool kim_init_ok;

      // values set in init_style(), after calling pkim->model_init()
      bool kim_model_init_ok;
      bool kim_particle_codes_ok;
      int *kim_particle_codes;

      // values set in set_statics(), called at end of kim_init(),
      //   then again in set_volatiles(), called in compute()
      int lmps_local_tot_num_atoms;
      double kim_global_influence_distance;  // KIM Model cutoff value
      int kim_number_of_cutoffs;
      double const * kim_cutoff_values;

      // values set in init_style()
      bool kim_model_init_ok;
      bool kim_particle_codes_ok;
      int *kim_particle_codes;

      // values set in compute()
      int lmps_maxalloc;              // max allocated memory value
      int* kim_particleSpecies;       // array of KIM particle species
@@ -119,8 +119,7 @@ namespace LAMMPS_NS {
      // KIM specific helper functions
      void kim_init();
      void kim_free();
      void set_statics();
      void set_volatiles();
      void set_argument_pointers();
      void set_lmps_flags();
      void set_kim_model_has_flags();
      // static methods used as callbacks from KIM