NQCModels
NQCModels.NQCModels — Module
NQCModels define the potentials and derivatives that govern the dynamics of the particles. These can exist as analytic models or as interfaces to other codes.
NQCModels.CompositeModel — Type
CompositeModel(Subsystems...)
A CompositeModel is composed of multiple Subsystems, creating an effective model which evaluates each Subsystem for its respective indices.
NQCModels.CompositeModel — Method
CompositeModel(subsystems::Subsystem...)Combine multiple Subsystems into a single model to be handled by NQCDynamics.jl in simulations. Any calls made to potential, derivative and friction will apply each subsystem's model to the respective atoms while ignoring any other atoms.
Some checks are made to ensure each atom is affected by a model and that each model is applied over the same degrees of freedom, but no other sanity checks are made.
NQCModels.Model — Type
Top-level type for models.
Implementation
When adding new models, this should not be directly subtyped. Instead, depending on the intended functionality of the model, one of the child abstract types should be subtyped. If an appropriate type is not already available, a new abstract subtype should be created.
NQCModels.Subsystem — Type
Subsystem(M, indices)
A subsystem is a Model which only applies to a subset of the degrees of freedom of the original model.
When combined in a CompositeModel, potential(), derivative!() and friction!() will be sourced from the respective Subsystems.
Calling potential(), derivative!(), or friction!() on a subsystem directly will output the respective values for the entire system.
The Model specified will be supplied with the positions of the entire system for evaluation.
NQCModels.check_models — Method
Subsystem combination logic - We only want to allow combination of subsystems:
? 1. with the same number of degrees of freedom
- without overlapping indices (Build a different type of CompositeModel) to handle these cases separately.
NQCModels.derivative! — Method
derivative!(model::Model, D, R::AbstractMatrix)Fill D with the derivative of the electronic potential as a function of the positions R.
This must be implemented for all models.
NQCModels.derivative! — Method
derivative!(model::Model, D, R::Number)Convenience method for models where ndofs(model) == 1, allowing the position of a single 1D atom to be passed directly as a number rather than a 1×1 matrix. Wraps R in a 1×1 matrix and redirects to derivative!(model::Model, D, R::AbstractMatrix).
Typed as Number, rather than Real, to stay unambiguous should a model ever dispatch on a Number-typed argument itself.
NQCModels.derivative — Method
derivative(model::Model, R)Allocating version of derivative!, this definition should be suitable for almost all models.
Implement zero_derivative to allocate an appropriate array then implement derivative! to fill the array.
GPU Support
GPU array support is provided via package extensions:
NQCModelsCUDAExt: CUDA.jl support (activated byusing CUDA)NQCModelsMetalExt: Metal.jl support (activated byusing Metal)
When GPU arrays are passed, the return type matches the input array type.
NQCModels.derivative — Method
derivative(model::Model, R::Number)Convenience method for models where ndofs(model) == 1, allowing the position of a single 1D atom to be passed directly as a number rather than a 1×1 matrix. Wraps R in a 1×1 matrix and redirects to derivative(model::Model, R::AbstractMatrix).
Typed as Number, rather than Real, to stay unambiguous should a model ever dispatch on a Number-typed argument itself.
NQCModels.ndofs — Method
ndofs(::Model)Get the number of degrees of freedom for every atom in the model. Usually 1 or 3.
NQCModels.nstates — Method
nstates(::Model)Get the number of electronic states in the model.
NQCModels.potential! — Method
potential!(model::Model, V, R::AbstractMatrix)In-place version of potential, used to implement more efficient dynamics.
NQCModels.potential! — Method
potential!(model::Model, V, R::Number)Convenience method for models where ndofs(model) == 1, allowing the position of a single 1D atom to be passed directly as a number rather than a 1×1 matrix. Wraps R in a 1×1 matrix and redirects to potential!(model::Model, V, R::AbstractMatrix).
Typed as Number, rather than Real, to stay unambiguous should a model ever dispatch on a Number-typed argument itself.
NQCModels.potential — Method
potential(model::Model, R::AbstractMatrix)Evaluate the potential at position R for the given model.
GPU Support
GPU array support is provided via package extensions:
NQCModelsCUDAExt: CUDA.jl support (activated byusing CUDA)NQCModelsMetalExt: Metal.jl support (activated byusing Metal)
When GPU arrays are passed, the return type matches the input array type.
NQCModels.potential — Method
potential(model::Model, R::Number)Convenience method for models where ndofs(model) == 1, allowing the position of a single 1D atom to be passed directly as a number rather than a 1×1 matrix. Wraps R in a 1×1 matrix and redirects to potential(model::Model, R::AbstractMatrix).
Typed as Number, rather than Real, to stay unambiguous should a model ever dispatch on a Number-typed argument itself.
NQCModels.zero_derivative — Method
zero_derivative(model::Model, R)Create an zeroed array of the right size to match the derivative.