SciBmad.jl API Reference

This documentation is a work in progress. Please see the examples and slides until this is complete.

For full documentation, see Documentation or User Guide.

Index

SciBmad.jl

SciBmad.newton!Method
newton!(f!, y, x; reltol=1e-13, abstol=1e-13,  max_iter=100, backend=DI.AutoForwardDiff(), check_stable=Val{false}())

Finds roots of f!(y, x) using Newton's method. y and x will be mutated during solution. x will contain the result.

Arguments

  • f!: Function that mutates y in place with the residual vector
  • y: Residual vector
  • x: Initial guess

Keyword arguments

  • abstol: Convergence absolute tolerance (default: 1e-13)
  • reltol: Convergence relative tolerance (default: 1e-13)
  • max_iter: Maximum number of iterations (default: 100)

Returns NamedTuple containing newton search results.

source
SciBmad.rotate_spins!Method
Given an N x 4 matrix quaternions `q` (e.g., from the `Bunch` struct),
and an N x 3 matrix of initial spin 3-vectors `si`, rotates the spin 
3-vectors by its corresponding row in the quaternion matrix and fills 
the N x 3 matrix `sf` with the result.
source
SciBmad.rotate_spinsMethod
Given an N x 4 matrix quaternions `q` (e.g., from the `Bunch` struct),
and an N x 3 matrix of initial spin 3-vectors `si`, rotates the spin 
3-vectors by its corresponding row in the quaternion matrix and returns 
a new spin matrix containing the final spin 3-vectors.
source

Beamlines.jl

Beamlines.BMultipoleParamsType
struct BMultipoleParams{T,N} <: AbstractParams

Structure holding the magnetic multipole components of a lattice element.

Fields

n::SizedVector{N,T,Vector{T}} # Vector of normal multipole components.
s::SizedVector{N,T,Vector{T}} # Vector of skew multipole components.
tilt::SizedVector{N,T,Vector{T}} # Vector of tilt components.
order::SVector{N,Int} # Vector of the order of the components.
normalized::SVector{N,Bool} # Vector of whether a multipole is normalized or not.
integrated::SVector{N,Bool} # Vector of whether a multipole is integrated or not.

source
Base.empty!Method
empty!(::Beamline)

Removes BeamlineParams from all elements in the Beamline and empties the array of LineElements.

WARNING: this is irreversible.

source
Beamlines.scalarize!Method
scalarize!(bl::Beamline)

Modifies the Beamline so all LineElement parameters are scalars and all Beamline-level parameters are scalars.

source
Beamlines.scalarize!Method
scalarize!(lat::Lattice)

Modifies the Lattice so all LineElement and Beamline parameters are scalars.

source
Beamlines.scalarize!Method
scalarize!(ele::LineElement)

Modifies the LineElement so all element-level parameters are scalars

source