kim-api-v2-2.0.0-beta.3 released

The KIM development team is pleased to announce the release of version 2.0.0-beta.3 of the KIM API package. This release includes:

* New KIM::Model::IsRoutinePresent() interface to facilitate backward compatibility
* Updated SpeciesName entries for recently renamed periodic table elements
* New WriteParameterizedModel() interface
* New Extensions() interface
* Updated and new examples to work with and demonstrate api changes/additions
* Various improvements and fixes throughout

For more information on the features of KIM API v2 see the documentation (https://openkim.org/kim-api/docs-beta.3). To see a summary of the differences between KIM API v1 and KIM API v2, see https://openkim.org/kim-api/docs-beta.3/version2_differences.html

Also see the `NEWS`, `README`, and `INSTALL` files in the KIM API package root directory after downloading and extracting the package.

Here is a download link to the new package https://s3.openkim.org/kim-api/kim-api-v2-2.0.0-beta.3.txz

Or, you can find this release of the KIM API package listed at https://openkim.org/kim-api

Cheers,

Ryan

Hi Ryan,

Great news! I will look at it.

The KIM development team is pleased to announce the release of version 2.0.0-beta.3 of the KIM API package. This release includes:

* New KIM::Model::IsRoutinePresent() interface to facilitate backward compatibility
* Updated SpeciesName entries for recently renamed periodic table elements

Just in case somebody has experimental data for Livermorium or Oganesson and wants to fit a model :slight_smile:

* New WriteParameterizedModel() interface

It takes two arguments, the first is a path and the second is a model name. Is path supposed to be a folder, and then you save a files called e.g. “path/model_name.params” ?

Also, is providing a WriteParameterizedModel() method compulsory for all models, or only for models that allows you to set parameters. Or is it optional?

Have a nice weekend!

Best regards

Jakob

* New WriteParameterizedModel() interface

It takes two arguments, the first is a path and the second is a model name. Is path supposed to be a folder, and then you save a files called e.g. “path/model_name.params” ?

Yes, path is supposed to be a folder. You should save fiels as "path/<filename>"

The model driver may write whatever files it likes into this folder. The names are completely up to the driver. The model_name *may* be used by the driver as part of the parameter file(s) name, but this is not required or necessarily recommended. The driver must make an api call to tell the api what the names of the parameter files are that have been written to the path. One call for each file, in the order in which they should be listed in the Model's CMakeLists.txt file. Then the api will write the required CMakeLists.txt file into path as well.

Also, is providing a WriteParameterizedModel() method compulsory for all models, or only for models that allows you to set parameters. Or is it optional?

It must NOT be provided by a stand-alone model (there is nothing that would read the resulting files), but may be provided by a model driver.

It must NOT be provided if the driver registers no adjustable parameters.

It may optionally be provided if the driver registers some adjustable parameters.

Ryan

Hi Ryan,

I have now updated to BETA 3, that was pretty painless.

The KIM development team is pleased to announce the release of version 2.0.0-beta.3 of the KIM API package. This release includes:

* New KIM::Model::IsRoutinePresent() interface to facilitate backward compatibility

Is the code below how we are intended to use this?

Also, does KIM::MODEL_ROUTINE_NAME::Refresh refer to the method called as Model->ClearThenRefresh() ?
And should there not be a test for Model->SetParameter() ?

Best regards

Jakob

// Check that the model does not require a KIM Routine that we do not
// know about. This could happen if the KIM API has been extended
// without updating Asap.
// Also verify that the model does provide the routines that we do require.
void OpenKIMcalculator::VerifyKimCompatibility()
{
  int nnames;
  KIM::MODEL_ROUTINE_NAME::GetNumberOfModelRoutineNames(&nnames);
  for (int i = 0; i < nnames; ++i)
  {
    KIM::ModelRoutineName routinename;
    int error = KIM::MODEL_ROUTINE_NAME::GetModelRoutineName(i, &routinename);
    if (error)
      throw AsapError("Call to KIM::MODEL_ROUTINE_NAME::GetModelRoutineName failed.");
    // Is the Routine defined and required by the model?
    int present;
    int required;
    error = model->IsRoutinePresent(routinename, &present, &required);
    if (present && required)
    {
      // First check for known, unsupported routines. Then check for unknown routines.
      if ((routinename == KIM::MODEL_ROUTINE_NAME::Extension)
    >> (routinename == KIM::MODEL_ROUTINE_NAME::WriteParameterizedModel))
  throw AsapError("Kim model ") << kimname
              << " requires known but unsupported routine "
              << routinename.String();
      else if ((routinename != KIM::MODEL_ROUTINE_NAME::Create)
         && (routinename != KIM::MODEL_ROUTINE_NAME::ComputeArgumentsCreate)
         && (routinename != KIM::MODEL_ROUTINE_NAME::Compute)
         && (routinename != KIM::MODEL_ROUTINE_NAME::Refresh)
         && (routinename != KIM::MODEL_ROUTINE_NAME::ComputeArgumentsDestroy)
         && (routinename != KIM::MODEL_ROUTINE_NAME::Destroy))
  throw AsapError("Kim model ") << kimname
              << " requires unknown routine "
              << routinename.String()
              << ": Asap should be updated!";
    }
    else if (!present)
    {
      // Check for absent routines required by this end. Create is
      // not tested, as it has already been called. Refresh is not
      // tested here, instead it is tested if we attempt to use it.
      if ((routinename == KIM::MODEL_ROUTINE_NAME::ComputeArgumentsCreate)
    >> (routinename == KIM::MODEL_ROUTINE_NAME::Compute)
    >> (routinename == KIM::MODEL_ROUTINE_NAME::ComputeArgumentsDestroy)
    >> (routinename == KIM::MODEL_ROUTINE_NAME::Destroy))
  throw AsapError("Kim model ") << kimname
              << " does not provide required routine "
              << routinename.String();
    }
  }
}

Hi Ryan,

I have now updated to BETA 3, that was pretty painless.

Great!

The KIM development team is pleased to announce the release of version 2.0.0-beta.3 of the KIM API package. This release includes:

* New KIM::Model::IsRoutinePresent() interface to facilitate backward compatibility

Is the code below how we are intended to use this?

Yes, this looks like it should work!

Also, does KIM::MODEL_ROUTINE_NAME::Refresh refer to the method called as Model->ClearThenRefresh() ?
And should there not be a test for Model->SetParameter() ?

Thanks,

Ryan