ClassicalModels
NQCModels.ClassicalModels — Module
ClassicalModelsAll models defined within this module have only a single electronic state and return potentials as scalars and derivatives as simple arrays.
The central abstract type is the ClassicalModel, which all models should subtype.
NQCModels.ClassicalModels.AtomsCalculatorsModel — Method
AtomsCalculatorsModel(calc_object, structure::AtomsBase.AbstractSystem)Model interface to AtomsCalculators. Supply this function with the calculator object you would use with AtomsCalculators and the correct unit conversions will be automatically applied.
NQCModels.ClassicalModels.AveragedPotential — Type
AveragedPotential(models::Vector{<:ClassicalModel}, r::AbstractMatrix)
A classical model that averages the potential and derivative of a set of classical models.NQCModels.ClassicalModels.ClassicalModel — Type
ClassicalModel <: ModelClassicalModels represent the potentials from classical molecular dynamics where the potential is a function of the position.
R is always a dimensions * atoms shaped AbstractMatrix, potential(model, R) always returns a scalar, and derivative(model, R)/derivative!(model, D, R) always return/fill a dimensions * atoms shaped array of scalars.
Implementation
Every model must implement:
potential(model, R::AbstractMatrix): the total potential for every atom (column) inR.derivative!(model, D::AbstractMatrix, R::AbstractMatrix): fillDin place with the derivative for every atom (column) inR.ndofs(model)(the degrees of freedom per atom)
There is no automatic per-atom fallback: if every atom experiences the model independently, the implementation should say so explicitly, typically by summing/broadcasting over eachcol(R)/axes(R, 2) internally. Models that explicitly implement an interaction between different atoms (like DiatomicHarmonic), or that support heterogeneous per-atom parameters (like Harmonic), are written the same way — there is only one method to implement, not a separate "independent atoms" special case.
The only automatic convenience is at the Model level: for models where ndofs(model) == 1, the position of a single 1D atom may be passed directly as a plain number rather than a 1×1 matrix.
Example
This example creates a 2 dimensional Classical model MyModel where every atom is independent, then evaluates the potential for a 2 atom system.
struct MyModel{P} <: NQCModels.ClassicalModels.ClassicalModel
param::P
end
NQCModels.ndofs(::MyModel) = 2
NQCModels.potential(model::MyModel, R::AbstractMatrix) = model.param*sum(R.^2)
function NQCModels.derivative!(model::MyModel, D::AbstractMatrix, R::AbstractMatrix)
D .= model.param*2R
end
model = MyModel(10)
NQCModels.potential(model, [1 2; 3 4])
# output
300
NQCModels.ClassicalModels.DarlingHollowayElbow — Type
DarlingHollowayElbow()Adiabatic elbow potential from Darling and Holloway: Faraday Discuss., 1993, 96, 43-54
NQCModels.ClassicalModels.DiatomicHarmonic — Type
DiatomicHarmonic(r₀=1.0)Harmonic interaction between two particles.
Only the first two atoms (the first two columns of R) interact. Any additional atoms are treated as independent and do not contribute to the potential or derivative. Requires at least 2 atoms.
NQCModels.ClassicalModels.Free — Type
Free()Zero external potential everywhere. Useful for modelling free particles.
julia> model, R = Free(3), rand(3, 10);
julia> potential(model, R)
0.0
julia> derivative(model, R)
3×10 Matrix{Float64}:
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0NQCModels.ClassicalModels.Harmonic — Type
Harmonic(m=1.0, ω=1.0, r₀=0.0)Classical harmonic potential. $V(x) = mω^2(x-r₀)^2 / 2$
m, ω, r₀ are the mass, frequency, and equilibrium position respectively and can be supplied as numbers or Matrices to create a compound model for multiple particles.
julia> using Symbolics;
julia> @variables x, m, ω, r₀;
julia> model = Harmonic(m=m, ω=ω, r₀=r₀);
julia> potential(model, hcat(x))
0.5m*(ω^2)*((x - r₀)^2)
julia> derivative(model, hcat(x))
1×1 Matrix{Num}:
m*(x - r₀)*(ω^2)NQCModels.ClassicalModels.JuLIPModel — Type
struct JuLIPModel{T} <: ClassicalModelModel for interfacing with JuLIP potentials.
NQCModels.ClassicalModels.Logistic — Type
Parameters.@with_kw struct Logistic{T} <: ClassicalModel
The sigmoid function is given by:
L / (1 + exp(-k * (a * x - x0))) + c
where:
L is the supremum of the values of the function
k is the steepness of the function
x0 is the x value of the sigmoid midpoint
c is the y value of the sigmoid midpoint
a is a scaling factorNQCModels.ClassicalModels.eigenenergy — Method
Eq. 43
NQCModels.ClassicalModels.getλ — Method
Eq. 36
NQCModels.ClassicalModels.getω₀ — Method
Eq. 44
NQCModels.potential! — Method
NQCModels.potential!(model::ClassicalModel, V::AbstractMatrix, R::AbstractMatrix)Default in-place potential!, suitable for every ClassicalModel since potential always returns a scalar.