AbstractPotentials

Functions

FreeBird.AbstractPotentialsModule
AbstractPotentials

Module for defining and implementing potentials.

Currently implemented potentials:

  • Lennard-Jones potential
  • Gupta (SMA-TB) potential
source
FreeBird.AbstractPotentials.AbstractPotentialType
AbstractPotential

An abstract type for potentials. All potentials should be subtypes of AbstractPotential.

Currently, there are two main categories of potentials:

1. `SingleComponentPotential{T}`: Potentials that use the same parameters for all components. 
   Here, `T` is the type of the single component parameter sets, e.g., `LJParameters` or `GuptaParameters`.  

2. `MultiComponentPotential`: Potentials that use different parameters for different components, e.g., `CompositeParameterSets{C,P}`.
   This type is not parameterized by `C` or `P` to allow for more flexibility in defining multi-component potentials, i.e.,
   using different interaction models for different pairs of components.
source
FreeBird.AbstractPotentials.CompositeParameterSetsType
struct CompositeParameterSets{C,P} <: MultiComponentParameterSets

CompositeParameterSets is a struct that represents a set of composite parameter sets, typically used for multi-component systems.

Fields

  • param_sets::Matrix{P}: A matrix of parameter sets representing the composite parameter sets.

Type Parameters

  • C::Int: The number of composite parameter sets.
  • P <: SingleComponentParameterSets: The type of the single component parameter sets.
source
FreeBird.AbstractPotentials.CompositeParameterSetsMethod
CompositeParameterSets(c::Int, ps::Vector{P}) where {P <: SingleComponentParameterSets}

Construct a CompositeParameterSets object from a vector of SingleComponentParameterSets.

Arguments

  • c::Int: The number of components.
  • ps::Vector{P}: A vector of SingleComponentParameterSets objects.

The number of elements in the vector must be equal to c^2 or c*(c+1)/2. The former case is for a full flattened matrix of SingleComponentParameterSets, useful when the interactions are asymmetric, i.e., epsilon_ij != epsilon_ji. The latter case is for symmetric interactions, i.e., epsilon_ij = epsilon_ji, hence only the upper triangular part of the matrix is needed.

Returns

  • A CompositeParameterSets object.

Example

julia> ps = [LJParameters(epsilon=e) for e in [11, 12, 13, 22, 23, 33]]
6-element Vector{LJParameters}:
 LJParameters(11.0 eV, 1.0 Å, Inf, 0.0 eV)
 LJParameters(12.0 eV, 1.0 Å, Inf, 0.0 eV)
 LJParameters(13.0 eV, 1.0 Å, Inf, 0.0 eV)
 LJParameters(22.0 eV, 1.0 Å, Inf, 0.0 eV)
 LJParameters(23.0 eV, 1.0 Å, Inf, 0.0 eV)
 LJParameters(33.0 eV, 1.0 Å, Inf, 0.0 eV)

julia> ljp = CompositeParameterSets(3,ps)
┌ Info: Creating CompositeParameterSets from the upper triangular part of the matrix.
│         By specifying length(ps) sets of parameters, a 3 x 3 matrix is constructed.
└         If this was not your intention, please check the documentation or raise an issue.
CompositeParameterSets{3,LJParameters}(param_sets::3x3 Matrix):
    param_sets[1, 1] : LJParameters(11.0 eV, 1.0 Å, Inf, 0.0 eV)
    param_sets[1, 2] : LJParameters(12.0 eV, 1.0 Å, Inf, 0.0 eV)
    param_sets[1, 3] : LJParameters(13.0 eV, 1.0 Å, Inf, 0.0 eV)
    param_sets[2, 1] : LJParameters(12.0 eV, 1.0 Å, Inf, 0.0 eV)
    param_sets[2, 2] : LJParameters(22.0 eV, 1.0 Å, Inf, 0.0 eV)
    param_sets[2, 3] : LJParameters(23.0 eV, 1.0 Å, Inf, 0.0 eV)
    param_sets[3, 1] : LJParameters(13.0 eV, 1.0 Å, Inf, 0.0 eV)
    param_sets[3, 2] : LJParameters(23.0 eV, 1.0 Å, Inf, 0.0 eV)
    param_sets[3, 3] : LJParameters(33.0 eV, 1.0 Å, Inf, 0.0 eV)
source
FreeBird.AbstractPotentials.GuptaParametersType
struct GuptaParameters

The GuptaParameters struct represents the parameters for the Gupta potential (a many-body potential, also known as the second-moment approximation tight-binding potential or SMA-TB).

Formula

The Gupta potential is given by:

\[E_i = \sum_j A \exp\left(-p \left(\frac{r_{ij}}{r_0} - 1\right)\right) - \sqrt{\sum_j \xi^2 \exp\left(-2q \left(\frac{r_{ij}}{r_0} - 1\right)\right)}\]

where:

  • $E_i$ is the combined attraction and repulsion energy for atom $i$.
  • $r_{ij}$ is the distance between atoms $i$ and $j$.
  • $A$ is the repulsive energy scale.
  • $\xi$ is the attractive energy scale.
  • $p$ is the exponent for the repulsive term.
  • $q$ is the exponent for the attractive term.
  • $r_0$ is the nearest-neighbor distance in the bulk material.
  • The potential is typically truncated at a cutoff distance, defined as a multiple of $r_0$.

See Cleri and Rosato 1993 Phys. Rev. B 48, 22 for more details.

Fields

  • A::typeof(1.0u"eV"): The repulsive energy scale of the potential.
  • ξ::typeof(1.0u"eV"): The attractive energy scale of the potential.
  • p::Float64: The exponent for the repulsive term.
  • q::Float64: The exponent for the attractive term.
  • r0::typeof(1.0u"Å"): The equilibrium distance for the potential.
  • cutoff::Float64: The cutoff distance for the potential, in units of r0.
source
FreeBird.AbstractPotentials.LJParametersType
struct LJParameters

The LJParameters struct represents the parameters for the Lennard-Jones potential.

Fields

  • epsilon::typeof(1.0u"eV"): The energy scale of the potential.
  • sigma::typeof(1.0u"Å"): The length scale of the potential.
  • cutoff::Float64: The cutoff distance for the potential, in units of sigma.
  • shift::typeof(0.0u"eV"): The energy shift applied to the potential, calculated at the cutoff distance.
source
FreeBird.AbstractPotentials.LJParametersMethod
LJParameters(;epsilon=1.0, sigma=1.0, cutoff=Inf, shift=true)

A constructor for the LJParameters struct with default values for the Lennard-Jones potential with no cutoff or shift. The shift parameter can be specified as a boolean, if true, the shift energy is calculated automatically at the cutoff distance; or as a typeof(0.0u"eV"), in which case the value is used directly.

Example

julia> lj = LJParameters(epsilon=0.1,sigma=2.5,cutoff=3.5,shift=false)
LJParameters(0.1 eV, 2.5 Å, 3.5, 0.0 eV)

julia> lj = LJParameters(sigma=2.5)
LJParameters(1.0 eV, 2.5 Å, Inf, 0.0 eV)

julia> lj = LJParameters(cutoff=3.5,shift=5.0)
LJParameters(1.0 eV, 1.0 Å, 3.5, 5.0 eV)

julia> lj = LJParameters(cutoff=3.5,shift=true)
LJParameters(1.0 eV, 1.0 Å, 3.5, -0.0021747803916549904 eV)

julia> lj = LJParameters(cutoff=3.5,shift=false)
LJParameters(1.0 eV, 1.0 Å, 3.5, 0.0 eV)
source
FreeBird.AbstractPotentials.PotentialStyleType
PotentialStyle

An abstract type for potential styles, used to parameterize potentials and dispatch methods for energy evaluation based on the interaction model.

Subtypes

  • Pairwise: Potentials that depend only on pairwise interactions between particles, e.g., Lennard-Jones potential.
  • ManyBody: Potentials that depend on many-body interactions, e.g., Gupta potential.

Examples

  • Pairwise: LJParameters <: LennardJonesParameterSets{Pairwise}.
  • ManyBody: GuptaParameters <: GuptaParameters{ManyBody}.
source
FreeBird.AbstractPotentials.SingleComponentPotentialType
SingleComponentPotential{T}

An abstract type for single-component potentials, where all components interact using the same parameters. Here, T is the type of the single component parameter sets, e.g., LJParameters or GuptaParameters.

source
FreeBird.AbstractPotentials.gupta_attraction_squaredMethod
gupta_attraction_squared(r::typeof(1.0u"Å"), gp::GuptaParameters)

Calculate the squared attractive energy term of the Gupta potential for a given interatomic distance r and a set of GuptaParameters. It is used to define the many-body interaction in the Gupta potential. See many_body_energy for more details. The square root is taken when calculating the total energy. See total_energy.

Arguments

  • r::typeof(1.0u"Å"): The interatomic distance.
  • gp::GuptaParameters: The parameters of the Gupta potential.

Returns

  • The squared attractive energy term of the Gupta potential.
source
FreeBird.AbstractPotentials.gupta_repulsionMethod
gupta_repulsion(r::typeof(1.0u"Å"), gp::GuptaParameters)

Calculate the repulsive energy term of the Gupta potential for a given interatomic distance r and a set of GuptaParameters. It is used to define the two-body interaction in the Gupta potential. See two_body_energy for more details.

Arguments

  • r::typeof(1.0u"Å"): The interatomic distance.
  • gp::GuptaParameters: The parameters of the Gupta potential.

Returns

  • The repulsive energy term of the Gupta potential.
source
FreeBird.AbstractPotentials.lj_energyMethod
lj_energy(r::typeof(1.0u"Å"), lj::LJParameters)

Compute the Lennard-Jones energy between two particles at a given distance.

Arguments

  • r::typeof(1.0u"Å"): The distance between the particles.
  • lj::LJParameters: The Lennard-Jones parameters.

Returns

  • 0.0u"eV" if the distance is greater than the cutoff distance.
  • The Lennard-Jones energy minus the shift otherwise.
source
FreeBird.AbstractPotentials.lj_energyMethod
lj_energy(epsilon::typeof(1.0u"eV"), sigma::typeof(1.0u"Å"), r::typeof(1.0u"Å"))

Compute the Lennard-Jones potential energy between two particles.

The Lennard-Jones potential energy is given by the equation:

\[V(r_{ij}) = 4\varepsilon_{ij} \left[\left(\frac{\sigma_{ij}}{r_{ij}}\right)^{12} - \left(\frac{\sigma_{ij}}{r_{ij}}\right)^{6}\right]\]

where epsilon is the energy scale, sigma is the distance scale, and r is the distance between the particles.

Arguments

  • epsilon::typeof(1.0u"eV"): The energy scale of the potential.
  • sigma::typeof(1.0u"Å"): The distance scale of the potential.
  • r::typeof(1.0u"Å"): The distance between the particles.

Returns

  • The Lennard-Jones potential energy between the particles.
source
FreeBird.AbstractPotentials.many_body_energyMethod
many_body_energy(r::typeof(1.0u"Å"), gp::GuptaParameters)

Calculate the squared many-body attractive energy contribution from a single atom at a distance r using the Gupta potential defined by the parameters in gp. See gupta_attraction_squared for more details.

source
FreeBird.AbstractPotentials.pair_energyMethod
pair_energy(r::typeof(1.0u"Å"), lj::LJParameters)

Compute the energy of a pair of particles separated by distance r using the Lennard-Jones potential.

Arguments

  • r::typeof(1.0u"Å"): The distance between the two particles.
  • lj::LJParameters: The Lennard-Jones parameters.

Returns

  • energy::typeof(0.0u"eV"): The energy of the pair of particles.
source
FreeBird.AbstractPotentials.total_energyMethod
total_energy(energies_two_body::Vector{<:Real}, 
                energies_many_body::Vector{<:Real}, 
                pot::Union{GuptaParameters,CompositeParameterSets{C, GuptaParameters}}) where C

Calculate the total energy of a system using the Gupta potential. The total energy is computed by summing the two-body repulsive energies and subtracting the square root of the many-body attractive energies. See two_body_energy and many_body_energy for more details.

source
FreeBird.AbstractPotentials.two_body_energyMethod
two_body_energy(r::typeof(1.0u"Å"), gp::GuptaParameters)

Calculate the two-body repulsive energy between two atoms separated by a distance r using the Gupta potential defined by the parameters in gp. See gupta_repulsion for more details.

source