A friction model is a wrapper around a named tuple of matrix models, i.e.
struct FrictionModel{MODEL_IDS} <: AbstractFrictionModel
matrixmodels::NamedTuple{MODEL_IDS}
end
The symbols contained in the tuple MODEL_IDS
are referred to as "IDs" of the corresponding matrix models. When evaluated at an atomic configuration, the resulting friction tensor is the sum of the friction tensors of all matrix models in the friction model, whereas diffusion coefficient matrices are evaluated seperately for each matrix model and returned in the form of a named tuple of the same signature. The following functions act on structures of type FrictionModel
:
ACEfriction.FrictionModels.Gamma
— FunctionGamma(fm::FrictionModel, at::Atoms; filter=(_,_)->true, T=Float64)
Evaluates the friction tensor according to the friction model fm
at the atomic configuration at::Atoms
. The friction tensor is the sum of the friction tensors of all matrix models in fm.matrixmodels
.
Arguments:
fm
– the friction model of which the friction tensor is evaluated.at
– the atomic configuration at which the basis is evaluatedfilter
– (optional, default:(_,_)->true
) a filter function of the generic form(i::Int,at::Atoms) -> Bool
. Only atomsat[i]
for whichfilter(i,at)
returnstrue
are included in the evaluation of the friction tensor.
Output:
A friction tensor in the form of a sparse 3N x 3N matrix, where N is the number of atoms in the atomic configuration at
.
Gamma(fm::FrictionModel{MODEL_IDS}, Σ_vec::NamedTuple{MODEL_IDS}) where {MODEL_IDS}
Computes the friction tensor from a pre-computed collection of diffusion coefficient matrices. The friction tensor is the sum of the squares of all diffusion coefficient matrices in the collection.
Arguments:
fm
– the friction model of which the friction tensor is evaluated. The friction tensor is the sum of the friction tensors of all matrix models infm.matrixmodels
.Σ
– a collection of diffusion coefficient matrices. The friction tensor is the sum of the squares of all matrices inΣ
.
Output:
A friction tensor in the form of a sparse 3N x 3N matrix, where N is the number of atoms in the atomic configuration at
. The friction tensor is the sum of the symmetric squares $\Sigma\Sigma^T$ of all diffusion coefficient matrices $\Sigma$ in Σ_vec
.
ACEfriction.FrictionModels.Sigma
— FunctionSigma(fm::FrictionModel{MODEL_IDS}, at::Atoms; filter=(_,_)->true, T=Float64) where {MODEL_IDS}
Computes the diffusion coefficient matrices for all matrix models in the friction model at a given configuration.
Arguments:
fm
– the friction model of which the diffusion coefficient matrices are evaluatedat
– the atomic configuration at which the diffusion coefficient matrices are evaluatedfilter
– (optional, default:(_,_)->true
) a filter function of the generic form(i::Int,at::Atoms) -> Bool
. Only atomsat[i]
for whichfilter(i,at)
returnstrue
are included in the evaluation of the diffusion coefficient matrices.
Output:
A NamedTuple of diffusion coefficient matrices, where the keys are the IDs of the matrix models in the friction model.
ACEfriction.MatrixModels.randf
— Functionrandf(fm::FrictionModel{MODEL_IDS}, Σ::NamedTuple{MODEL_IDS}) where {MODEL_IDS}
Generates a ${\rm Normal}({\bm 0}, {\bm \Gamma})$-distributed Gaussian pseudo random number from a precomputed diffusion coeffiient matrices.
Arguments:
fm
– the friction model of which the friction tensor is evaluated. The friction tensor is the sum of the friction tensors of all matrix models infm.matrixmodels
.Σ
– a collection of diffusion coefficient matrices. The friction tensor is the sum of the squares of all matrices inΣ
.
Output:
A ${\rm Normal}({\bm 0}, {\bm \Gamma})$-distributed Gaussian vector R::Vector{3,Float64}
of length N, where N is the number of atoms in the configuration for which Σ
was evaluated.
ACEfriction.MatrixModels.basis
— Functionbasis(fm::FrictionModel{MODEL_IDS}, at::Atoms; join_sites=false, filter=(_,_)->true, T=Float64) where {MODEL_IDS}
Evaluates the ACE-basis functions of the friction model fm
at the atomic configuration at::Atoms
.
Arguments:
fm
– the friction model of which the basis is evaluatedat
– the atomic configuration at which the basis is evaluatedjoin_sites
– (optional, default:false
) iftrue
, the basis evaulations of all matrix models are concatenated into a single array. Iffalse
, the basis evaluations are returned as a named tuple of the typeNamedTuple{MODEL_IDS}
.filter
– (optional, default:(_,_)->true
) a filter function of the generic form(i::Int,at::Atoms) -> Bool
. The atomat[i]
will be included in the basis ifffilter(i,at)
returnstrue
.
Setter and getter functions for model parameters
ACE.params
— Functionparams(fm::FrictionModel{MODEL_IDS}) where {MODEL_IDS}
Returns the parameters of all matrix models in the FrictionModel object as a NamedTuple.
params(m::FluxFrictionModel; transformed=true)
Return the parameters of the model m
.
ACE.nparams
— Functionnparams(fm::FrictionModel{MODEL_IDS}) where {MODEL_IDS}
Returns the total number of scalar parameters of all matrix models in the FrictionModel object.
ACE.set_params!
— Functionset_params!(fm::FrictionModel, θ::NamedTuple)
Sets the parameters of all matrix models in the FrictionModel object whose ID is contained in θ::NamedTuple
to the values specified therein.
set_params!(m::FluxFrictionModel; sigma=1E-8, model_ids::Array{Symbol}=Symbol[])
Randomizes the parameters of the model m
.
Arguments
m::FluxFrictionModel
: The model to set the parameters of.sigma::Float64=1E-8
: The standard deviation of the random values.model_ids::Array{Symbol}=[]
: The ids of the models to set the parameters of. If empty, all the parameters are set.
set_params!(m::FluxFrictionModel, c_new::NamedTuple)
Set the parameters of the model to the values in c_new
.
Arguments
m::FluxFrictionModel
: The model to set the parameters of.c_new::NamedTuple
: The new parameters. The keys ofc_new
should be a subset ofm.model_ids
.
ACEfriction.MatrixModels.set_zero!
— Functionset_zero!(fm::FrictionModel, model_ids)
Sets the parameters of all matrix models in the FrictionModel object to zero.