APIs
Types
SymOrb.ActionType
— TypeThe type of the action can by Cyclic, Dihedral or Brake
SymOrb.CompoundMethod
— TypeCompoundMethod{M <: AbstrAtomicOrNothing, N <: AbstrAtomicOrNothing, O <: AbstrAtomicOrNothing}
A minimization method that combines up to three atomic minimization methods
SymOrb.GroupElement
— TypeA group element of the symmetry group
Fields
σ::Permutation
: The permutation of the particlesM::Rotation
: The rotation of the particles
SymOrb.GroupElement
— MethodGroupElement(el)::GroupElement
Create a GroupElement from the GAP result.
SymOrb.MinimizationResult
— TypeMinimizationResult{T <: AbstractMethod}
The result of a minimization
Fields
initial::Vector
: The initial pathfourier_coeff::Vector
: The Fourier coefficients of the minimization resultgradient_norm::Float64
: The norm of the gradient at the minimumaction_value::Float64
: The value of the action at the minimumconverged::Bool
: Whether the minimization convergedmethod::T
: The minimization method used
SymOrb.Problem
— TypeThe minimization problem to be solved
Fields
N::Int
: The number of particlesdim::Int
: The dimension of the spaceF::Int
: The number of Fourier series termssteps::Int
: The number of steps in the discretization of time [0,π]G::SymmetryGroup
: The symmetry group of the minimization problemm::Vector{Float64}
: The masses of the particlesf::M
: The denominator of the potentialf_raw::String
: The string representation of fK::Matrix{Float64}
: The kinetic energy matrixdx_dA::Matrix{Float64}
: The derivative of the path w.r.t. the Fourier coefficientsdA_dx::Matrix{Float64}
: The derivative of the Fourier coefficients w.r.t. the pathA_to_x::Matrix{Float64}
: The transformation matrix from Fourier coefficients to pathx_to_A::Matrix{Float64}
: The transformation matrix from path to Fourier coefficientsΠ::Matrix{Float64}
: The projection matrixR::Matrix{Float64}
: The matrix that reconstructs the nth bodyRi::Matrix{Float64}
: The matrix that removes the nth bodyI_factors::Vector{Float64}
: The integration factors
SymOrb.SymmetryGroup
— TypeThe symmetry group of the minimization problem
Fields
action_type::ActionType
: The type of the actionkerT::Vector{GroupElement}
: The kernel ofτ
, the action onO(2)
g::Vector{GroupElement}
: The elements of the cyclic part of the symmetry groupH0::GroupElement
: If the action is dihedral or brake, it's the generator of the first isotropy subspacesH1::GroupElement
: If the action is dihedral or brake, it's the generator of the second isotropy subspaces
Base.show
— MethodBase.show(io::IO, method::AbstractAtomicMethod)
Pretty-print the minimization method
in a more detailed way
Base.show
— Method Base.show(io::IO, result::MinimizationResult)
Pretty-print the minimization result
Base.show
— MethodBase.show(io::IO, method::AbstractCompoundMethod)
Base.show(io::IO, ::MIME"text/plain", method::AbstractCompoundMethod)
Pretty-print the compound minimization method
Base.show
— MethodBase.show(io::IO, method::AbstractMethod)
Pretty-print the minimization method
in a concise way
Base.show
— MethodBase.show(io::IO, P::Problem)
Pretty-print the minimization problem
SymOrb.@atomic_method
— Macroatomic_method(type, struct_name, f_name)
Define a new atomic minimization method with the given type
, struct_name
and f_name
.
Problem definition and minimization
SymOrb.initialize
— Methodinitialize(data::Dict)::Problem
initialize(filename::String)::Problem
Initialize the problem with the data given in the dictionary data
or in the file filename
.
SymOrb.find_orbits
— Functionfind_orbits(P::Problem, method::AbstractMethod=OneMethod(BFGS());; starting_path_type::Symbol=:random, starting_path::Union{Path,Nothing}=nothing, show_steps=true, print_path=true, print_path_folder::String="/.", options...)
Find number_of_orbits
orbits using the given method
and starting path.
Arguments
method::AbstractMethod=OneMethod(BFGS())
: the minimization method to use. Defaults to BFGS for 200 steps.number_of_orbits=Inf
: the number of orbits to find. Defaults to infinity.
Keyword Arguments
starting_path_type::Symbol=:random
: the type of starting path to usestarting_path::Union{Path,Nothing}=nothing
: the starting path to use. If provided,starting_path_type
is ignoredshow_steps::Bool=true
: whether to show the steps of the minimization.print_path::Bool=true
: whether to print the path to a file.print_path_folder::String="./"
: the folder where to print the path.options...
: additional options to pass to the optimization method.
SymOrb.new_orbit
— Methodnew_orbit(p::Problem, starting_path::Vector, method::CompoundMethod; max_repetitions::Int=10, perturb::Bool=false, perturbation::Float64=1e-3, action_threshold::Float64=2.0, show_steps=true)::MinimizationResult
Find a new orbit using the given CompoundMethod
and starting path.
It first executes the init
method. Then it alternates the first
method and the second
method until the minimization converges, the action is below action_threshold
or the maximum number of repetitions is reached.
To implement new optimization algorithms, define new methods for this function. New methods must accept 2 arguments, the starting path and the method to use, and a keyword argument show_steps
. They must return a MinimizationResult
.
Keyword Arguments
max_repetitions::Int=10
: how many times to minimize using first and second methodperturb::Bool=false
: whether to perturb the path if minimization failsperturbation::Float64=1e-3
: the strength of the perturbation to apply to the pathaction_threshold::Float64=2.0
: the threshold for the action value above which to continue minimizationshow_steps::Bool=true
: whether to show the steps of the minimization
SymOrb.perform_optimization
— Methodperform_optimization(P::Problem, Γ0::Vector, method::NLSolveMethod)::Tuple{Vector, Int, Bool}
perform_optimization(P::Problem, Γ0::Vector, method::OptimMethod)::Tuple{Vector, Int, Bool}
Wrappers around the minimization libraries
Action computation
SymOrb.HU
— MethodHU(Γ::Coefficients, [n::Int = steps+1])::AbstractMatrix
Compute the hessian of the potential at every time step along the path $x$
SymOrb.HU_t!
— MethodHU_t!(hessian::AbstractArray{T, 4}, x::AbstractArray{T, 2}, m::Vector, f::Function, df::Function, d2f::Function) where T
Compute the hessian of the potential for the configuration $x$. The hessian is stored in the array $hessian$.
SymOrb.Haction
— MethodHaction(p::Problem, Γ::Vector{T})::Matrix{T}
Compute the Hessian of the constrained action for a given configuration $Γ$.
SymOrb.Hkinetic
— MethodHkinetic(Γ::Coefficients)::AbstractMatrix
Compute the Hessian of the kinetic part of the action for a given configuration $Γ$.
SymOrb.Hpotential
— MethodHpotential(p::Problem, Γ::Vector{T})
Compute the Hessian of the potential part of the action for a given configuration $Γ$.
SymOrb.K_energy
— MethodK_energy(P::Problem, Γ::Vector{T}, n::Int)::Vector{T}
Compute the kinetic energy for a given configuration $Γ$ over $n$ points along the path.
SymOrb.U
— MethodU(P, x::Array{T, 3})::Vector{T}
Compute the potential at every time step along the path $x$.
SymOrb.U_t
— MethodU(P, x::Array{T, 3})::Vector{T}
Compute the potential for the configuration $x$ (fixed-time potential).
SymOrb.kinetic
— Methodkinetic(p::Problem, Γ::Vector{T})::T
Compute the kinetic part of the action for a given configuration $Γ$.
SymOrb.potential
— Methodpotential(p::Problem, Γ::Vector{T})::T
Compute the potential part of the action for a given configuration $Γ$.
SymOrb.∇U
— Method∇U(Γ::Coefficients, [n::Int = steps+1])::AbstractVector
Compute the gradient of the potential at every time step along the path $x$.
SymOrb.∇U_t!
— Method∇U_t!(grad::AbstractArray{T, 2}, x::AbstractArray{T, 2}, m::Vector, f::Function, df::Function) where T
Compute the gradient of the potential for the configuration$x$. The gradient is stored in the array $grad$.
SymOrb.∇action
— Method∇action(p::Problem, Γ::Vector{T})::Vector{T}
Compute the gradient of the constrained action for a given configuration $Γ$.
SymOrb.∇kinetic
— Method∇kinetic(p::Problem, Γ::Vector{T})::Vector{T}
Compute the gradient of the kinetic part of the action for a given configuration $Γ$.
SymOrb.∇potential
— Method∇potential(p::Problem, Γ::Vector{T})::Vector{T}
Compute the gradient of the potential part of the action for a given configuration $Γ$.
Projectors and operators
Paths
SymOrb.build_path
— Methodbuild_path(P::Problem, Γ::Vector{T})::Array{T, 3}
build_path(P::Problem, Γ::Vector{T}, steps::Int64)::Array{T, 3}
Build the path from the Fourier coefficients Γ
. If steps
is provided, the path is built with steps
steps. NOTE: If steps
is provided, the function will compute the Jacobian of the path in terms of the Fourier coefficients. Otherwise, it will use the precomputed Jacobian.
SymOrb.circular_starting_path
— Methodcircular_starting_path(dimensions)::Vector
Generate a circular starting path for the minimization problem.
SymOrb.extend_to_period
— Methodextend_to_period(P::Problem, x::Array{T, 3})::Array{T, 3}
Extend the path $x$ form the fundamental domain I = [0, π] to a full period.
SymOrb.extend_to_period
— Methodextend_to_period(P::Problem, f::T)::Array{T, 3}
Extend the function $f$ form the fundamental domain I = [0, π] to a full period.
SymOrb.fourier_coefficients
— Methodfourier_coefficients(P::Problem, x::Array{T, 3})::Vector{T}
Compute the Fourier coefficients of the path $x$.
SymOrb.get_starting_path
— Methodget_starting_path(path_type::Symbol, dimensions)::Vector
Generate the starting path for the minimization problem according to the given $path_type$.
SymOrb.perturbe_path
— Methodperturbe_path(Γ::Vector{T}, dims::NTuple{3, Int64}, λ=0.001)::Vector{T}
Perturb the given path Γ
by a factor
λ
`.
SymOrb.perturbed_circular_starting_path
— Functionperturbed_circular_starting_path(dimensions, λ::Float64=0.001)::Vector
Generate a perturbed circular starting path for the minimization problem.
SymOrb.print_path_to_file
— Functionprintpathto_file(P::Problem, Γ::Vector, filename::String)::Nothing
Print the information about P
and the Fourier coefficients of the path $Γ$ to the file named filename
.
SymOrb.random_starting_path
— Methodrandom_starting_path(dimensions::NTuple{3, Int64})::Vector
Generate a random starting path for the minimization problem.
SymOrb.read_path_from_file
— Methodread_path_from_file(filename::String)::Tuple{Problem, Vector}
Read the Fourier coefficients of a path and the problem configuration from the file named filename
.