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();