diff --git a/Tersoff_LAMMPS.kim.tpl b/Tersoff_LAMMPS.kim.tpl
index 0c9993e..36007da 100644
--- a/Tersoff_LAMMPS.kim.tpl
+++ b/Tersoff_LAMMPS.kim.tpl
@@ -104,17 +104,17 @@ particleVirial       double    energy    [numberOfParticles,6] optional
 MODEL_PARAMETERS:
 
 # variable           type      unit      dimensions
-PARAM_FREE_A         double    energy    [numberParticleTypes,numberParticleTypes,numberParticleTypes]
-PARAM_FREE_B         double    energy    [numberParticleTypes,numberParticleTypes,numberParticleTypes]
-PARAM_FREE_lambda1   double    length^-1 [numberParticleTypes,numberParticleTypes,numberParticleTypes]
-PARAM_FREE_lambda2   double    length^-1 [numberParticleTypes,numberParticleTypes,numberParticleTypes]
-PARAM_FREE_lambda3   double    length^-1 [numberParticleTypes,numberParticleTypes,numberParticleTypes]
-PARAM_FREE_beta      double    none      [numberParticleTypes,numberParticleTypes,numberParticleTypes]
-PARAM_FREE_n         double    none      [numberParticleTypes,numberParticleTypes,numberParticleTypes]
-PARAM_FREE_m         integer   none      [numberParticleTypes,numberParticleTypes,numberParticleTypes]
-PARAM_FREE_gamma     double    none      [numberParticleTypes,numberParticleTypes,numberParticleTypes]
-PARAM_FREE_c         double    none      [numberParticleTypes,numberParticleTypes,numberParticleTypes]
-PARAM_FREE_d         double    none      [numberParticleTypes,numberParticleTypes,numberParticleTypes]
-PARAM_FREE_h         double    none      [numberParticleTypes,numberParticleTypes,numberParticleTypes]
-PARAM_FREE_Rc        double    length    [numberParticleTypes,numberParticleTypes,numberParticleTypes]
-PARAM_FREE_Dc        double    length    [numberParticleTypes,numberParticleTypes,numberParticleTypes]
+PARAM_FREE_A         double    energy    [numberOfSpecies,numberOfSpecies,numberOfSpecies]
+PARAM_FREE_B         double    energy    [numberOfSpecies,numberOfSpecies,numberOfSpecies]
+PARAM_FREE_lambda1   double    length^-1 [numberOfSpecies,numberOfSpecies,numberOfSpecies]
+PARAM_FREE_lambda2   double    length^-1 [numberOfSpecies,numberOfSpecies,numberOfSpecies]
+PARAM_FREE_lambda3   double    length^-1 [numberOfSpecies,numberOfSpecies,numberOfSpecies]
+PARAM_FREE_beta      double    none      [numberOfSpecies,numberOfSpecies,numberOfSpecies]
+PARAM_FREE_n         double    none      [numberOfSpecies,numberOfSpecies,numberOfSpecies]
+PARAM_FREE_m         integer   none      [numberOfSpecies,numberOfSpecies,numberOfSpecies]
+PARAM_FREE_gamma     double    none      [numberOfSpecies,numberOfSpecies,numberOfSpecies]
+PARAM_FREE_c         double    none      [numberOfSpecies,numberOfSpecies,numberOfSpecies]
+PARAM_FREE_d         double    none      [numberOfSpecies,numberOfSpecies,numberOfSpecies]
+PARAM_FREE_h         double    none      [numberOfSpecies,numberOfSpecies,numberOfSpecies]
+PARAM_FREE_Rc        double    length    [numberOfSpecies,numberOfSpecies,numberOfSpecies]
+PARAM_FREE_Dc        double    length    [numberOfSpecies,numberOfSpecies,numberOfSpecies]
diff --git a/model_driver_Tersoff.cpp b/model_driver_Tersoff.cpp
index 5d2807b..f5e6170 100644
--- a/model_driver_Tersoff.cpp
+++ b/model_driver_Tersoff.cpp
@@ -403,10 +403,13 @@ int model_driver_init(void* km, // The KIM model object
   }
 
   // Pass functions and parameters to KIM.
-  kim_model.setm_data(&error, 17*4,
+  int *n_spec_permanent = new int;
+  *n_spec_permanent = n_spec;
+  kim_model.setm_data(&error, 18*4,
                       "compute", 1, &compute, 1,
                       "reinit",  1, &reinit,  1,
                       "destroy", 1, &destroy, 1,
+		      "numberOfSpecies", 1, n_spec_permanent, 1,
                       "PARAM_FREE_A", 1, &tersoff->kim_params.A(0,0,0), 1,
                       "PARAM_FREE_B", 1, &tersoff->kim_params.B(0,0,0), 1,
                       "PARAM_FREE_lambda1", 1, &tersoff->kim_params.lam1(0,0,0), 1,
@@ -428,6 +431,27 @@ int model_driver_init(void* km, // The KIM model object
     return error;
   }
 
+  // Set shapes of all parameters
+  static char *paramnames[] = {"PARAM_FREE_A", "PARAM_FREE_B",
+			      "PARAM_FREE_lambda1", "PARAM_FREE_lambda2",
+			      "PARAM_FREE_lambda3", "PARAM_FREE_beta",
+			      "PARAM_FREE_n", "PARAM_FREE_m",
+			      "PARAM_FREE_gamma", "PARAM_FREE_c",
+			      "PARAM_FREE_d", "PARAM_FREE_h",
+			      "PARAM_FREE_Rc", "PARAM_FREE_Dc", NULL};
+  int paramshape[3];
+  for (int i = 0; i < 3; i++)
+    paramshape[i] = n_spec;
+  for (int i = 0; paramnames[i] != NULL; i++)
+    {
+      kim_model.set_shape(paramnames[i], paramshape, 3, &error);
+      if (error < KIM_STATUS_OK) {
+	kim_model.report_error(__LINE__, __FILE__, "KIM_API_setm_data", error);
+	delete tersoff;
+	return error;
+      }
+    } 
+  
   // Set up cutoff for KIM.
   double& cutoff =
     *static_cast<double*>(kim_model.get_data("cutoff", &error));
