Tersoff potential getUnits error

Hi,

I am trying to create a simulator wherein i wish to use the tersoff potential. I am doing so by taking hint from the ex_test_Ar_fcc_cluster_cpp example given in the documentation. I am facing the issue right at the start. Here the snippet of my code:

string modelname;
int error;

printf("please enter valid KIM model name: \n");
std::cin >> modelname;

KIM::Model * kim_cluster_model;
   int requestedUnitsAccepted;
   error = KIM::Model::Create(KIM::NUMBERING::zeroBased,
                              KIM::LENGTH_UNIT::A,
                              KIM::ENERGY_UNIT::eV,
                              KIM::CHARGE_UNIT::e,
                              KIM::TEMPERATURE_UNIT::K,
                              KIM::TIME_UNIT::ps,
                              modelname,
                              &requestedUnitsAccepted,
                              &kim_cluster_model);

if (error) { MY_ERROR("KIM::Model::Create()"); }

   // Check for compatibility with the model
if (!requestedUnitsAccepted) { MY_ERROR("Must Adapt to model units"); }
 
      // print model units
   KIM::LengthUnit lengthUnit;
   KIM::EnergyUnit energyUnit;
   KIM::ChargeUnit chargeUnit;
   KIM::TemperatureUnit temperatureUnit;
   KIM::TimeUnit timeUnit;
 
    kim_cluster_model->GetUnits(
       &lengthUnit, &energyUnit, &chargeUnit, &temperatureUnit, &timeUnit);
 
   std::cout << "LengthUnit is \"" << lengthUnit.ToString() << "\"" << std::endl
             << "EnergyUnit is \"" << energyUnit.ToString() << "\"" << std::endl
             << "ChargeUnit is \"" << chargeUnit.ToString() << "\"" << std::endl
             << "TemperatureUnit is \"" << temperatureUnit.ToString() << "\""
             << std::endl
             << "TimeUnit is \"" << timeUnit.ToString() << "\"" << std::endl;
 

It works fine when i enter the KIM model name: LJ_Shifted_Bernardes_1958MedCutoff_Ar__MO_126566794224_004. But I get the error: * Error : “KIM::Model::Create()” when i enter the KIM model name as : Tersoff_LAMMPS_Tersoff_1988_C__MO_579868029681_004.

What is it that i am missing here?

Hello,

The first question is: Do you have Tersoff_LAMMPS_Tersoff_1988_C__MO_579868029681_004 installed? Does the ex_test_Ar_fcc_cluster_cpp simulator give the same error?

Yes, looks like it is installed. I checked by using the command: kim-api-collections-management list. Here’s the relevant snapshot of the terminal output.

Screenshot from 2022-05-12 22-26-17

The ex_test_Ar_fcc_cluster_cpp simulator runs perfectly.

It looks like you have version 003 of the model installed, not version 004 that you’re trying to use.

1 Like

Thanks a lot! I missed that.