Model Management

Low-level wrappers for constructing, configuring, and executing KIM-API models.

KIM_API.ComputeArgumentsType
ComputeArguments

Wrapper for KIM-API compute arguments pointer.

This mutable struct holds a pointer to a KIM-API compute arguments instance, which contains all the data needed for model calculations including particle positions, species, and output arrays.

Fields

  • p::Ptr{Cvoid}: C pointer to the KIM-API compute arguments
source
KIM_API.ModelType
Model

Wrapper for KIM-API model pointer.

This mutable struct holds a pointer to a KIM-API model instance. The pointer should be initialized using create_model() and destroyed using destroy_model!() to prevent memory leaks.

Fields

  • p::Ptr{Cvoid}: C pointer to the KIM-API model
source
KIM_API.create_modelMethod
create_model(numbering, length_unit, energy_unit, charge_unit, temperature_unit, time_unit, model_name) -> (Model, Bool)

Create a new KIM-API model instance with specified units.

Arguments

  • numbering::Numbering: Indexing scheme (zeroBased or oneBased)
  • length_unit::LengthUnit: Length unit (A, Bohr, cm, m, nm)
  • energy_unit::EnergyUnit: Energy unit (eV, J, kcal_mol, etc.)
  • charge_unit::ChargeUnit: Charge unit (C, e, statC)
  • temperature_unit::TemperatureUnit: Temperature unit (K)
  • time_unit::TimeUnit: Time unit (fs, ps, ns, s)
  • model_name::String: Name of the KIM model to load

Returns

  • Model: The created model instance
  • Bool: Whether the specified units were accepted by the model

Throws

  • ErrorException: If model creation fails

Example

model, accepted = create_model(
    zeroBased, A, eV, e, K, ps,
    "SW_StillingerWeber_1985_Si__MO_405512056662_006"
)
if !accepted
    error("Model rejected the specified units")
end
source
KIM_API.destroy_model!Method
destroy_model!(model::Model)

Destroy a Model and free memory. TODO: Is this needed? The model should automatically be destroyed when the Julia process exits.

source
KIM_API.set_callback_pointer!Method
set_callback_pointer!(args::ComputeArguments, callback::ComputeCallbackName,
                     language::LanguageName, func_ptr, data_ptr)

Set a callback function pointer.

source