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.GammaFunction
Gamma(fm::FrictionModel, at::AbstractSystem; filter=(_,_)->true, T=Float64)

Evaluates the friction tensor according to the friction model fm at the atomic configuration at::AbstractSystem. 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 evaluated
  • filter – (optional, default: (_,_)->true) a filter function of the generic form (i::Int,at::AbstractSystem) -> Bool. Only atoms at[i] for which filter(i,at) returns true 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.

source
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 in fm.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.

source
ACEfriction.FrictionModels.SigmaFunction
Sigma(fm::FrictionModel{MODEL_IDS}, at::AbstractSystem; 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 evaluated
  • at – the atomic configuration at which the diffusion coefficient matrices are evaluated
  • filter – (optional, default: (_,_)->true) a filter function of the generic form (i::Int,at::AbstractSystem) -> Bool. Only atoms at[i] for which filter(i,at) returns true 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.

source
ACEfriction.MatrixModels.randfFunction
randf(M::MatrixModel, Σ_vec::AbstractVector)

Random force of a single matrix model from its per-replica diffusion matrices Σ_vec = Sigma(M, at) (one sparse / Diagonal matrix per replica). Each replica draws an independent random force via the coupling-scheme-specific randf(M, Σ) method (defined in the model files), and the model's force is their sum. Its covariance equals the model's friction tensor Gamma(M, Σ_vec). Usually called through randf(fm, Σ) rather than directly.

source
randf(fm::FrictionModel{MODEL_IDS}, Σ::NamedTuple{MODEL_IDS}) where {MODEL_IDS}

Draws a ${\rm Normal}({\bm 0}, {\bm \Gamma})$-distributed Gaussian random force from a precomputed collection of diffusion coefficient matrices Σ = Sigma(fm, at). The sample covariance of the returned force equals the friction tensor ${\bm \Gamma} =$ Gamma(fm, Σ) (the fluctuation–dissipation relation); this holds for every coupling scheme, even where ${\bm \Gamma} \neq {\bm \Sigma}{\bm \Sigma}^{T}$ (e.g. the pair-wise coupling).

This is the cheap, per-step entry point for Langevin/GLE-type dynamics: assemble Σ once with Sigma, then call randf each timestep to obtain the stochastic force.

Arguments:

  • fm – the friction model; the total force is the sum over its matrix models.
  • Σ – a NamedTuple of per-model diffusion coefficient matrices (each a vector of per-replica matrices), as returned by Sigma(fm, at).

Output:

A Vector{SVector{3,Float64}} of length N (one 3-vector per atom), where N is the number of atoms in the configuration for which Σ was evaluated. Each matrix model draws its own independent noise (summed over replicas), and the model forces are summed.

source
ACEfriction.MatrixModels.basisFunction
basis(fm::FrictionModel{MODEL_IDS}, at::AbstractSystem; 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::AbstractSystem.

Arguments:

  • fm – the friction model of which the basis is evaluated
  • at – the atomic configuration at which the basis is evaluated
  • join_sites – (optional, default: false) if true, the basis evaulations of all matrix models are concatenated into a single array. If false, the basis evaluations are returned as a named tuple of the type NamedTuple{MODEL_IDS}.
  • filter – (optional, default: (_,_)->true) a filter function of the generic form (i::Int,at::AbstractSystem) -> Bool. The atom at[i] will be included in the basis iff filter(i,at) returns true.
source

Setter and getter functions for model parameters

ACEfriction.MatrixModels.paramsFunction
params(fm::FrictionModel{MODEL_IDS}) where {MODEL_IDS}

Returns the parameters of all matrix models in the FrictionModel object as a NamedTuple.

source
params(m::FluxFrictionModel; transformed=true)

Return the parameters of the model m.

source
ACEfriction.MatrixModels.nparamsFunction
nparams(fm::FrictionModel{MODEL_IDS}) where {MODEL_IDS}

Returns the total number of scalar parameters of all matrix models in the FrictionModel object.

source
ACEfriction.MatrixModels.set_params!Function
set_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.

source
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.
source
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 of c_new should be a subset of m.model_ids.
source