AdiabaticModels

NQCModels.AdiabaticModelsModule
AdiabaticModels

All 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 AdiabaticModel, which all models should subtype.

source
NQCModels.AdiabaticModels.AdiabaticASEModelType
AdiabaticASEModel{A} <: AdiabaticModel

Wrapper for an ase.Atoms object that has a calculator attached. This Model will synchronise the positions with the ase object and handle the unit conversions.

Implements both potential and derivative!.

Notes on calling Python from Julia

Both PyCall.jl and PythonCall.jl can be used to create the ase.Atoms object, but PythonCall.jl is preferred.

source
NQCModels.AdiabaticModels.AdiabaticModelType
AdiabaticModel <: Model

AdiabaticModels represent the potentials from classical molecular dynamics where the potential is a function of the position.

Implementation

AdiabaticModels should implement:

  • potential(model, R)
  • derivative!(model, D, R) (this is the derivative of the potential energy with respect to the positions)
  • ndofs(model) (these are the degrees of freedom)

Example

This example creates a 2 dimensional adiabatic model MyModel. We implement the 3 compulsory functions then evaluate the potential. Here, the argument R is an AbstractMatrix since this is a 2D model that can accept multiple atoms.

struct MyModel{P} <: NQCModels.AdiabaticModels.AdiabaticModel
    param::P
end

NQCModels.ndofs(::MyModel) = 2

NQCModels.potential(model::MyModel, R::AbstractMatrix) = model.param*sum(R.^2)
NQCModels.derivative!(model::MyModel, D, R::AbstractMatrix) = D .= model.param*2R

model = MyModel(10)

NQCModels.potential(model, [1 2; 3 4])

# output

300
source
NQCModels.AdiabaticModels.FreeType
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.0
source
NQCModels.AdiabaticModels.HarmonicType
Harmonic(m=1.0, ω=1.0, r₀=0.0)

Adiabatic harmonic potential. $V(x) = mω^2(x-r₀)^2 / 2$

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)
source