tb_zyx Subroutine

public subroutine tb_zyx(alpha, beta, gamma, basis, inv_basis)

Creates active rotation matrix for z-y'-x" rotation given Tait-Bryan angles

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in) :: alpha

Angle of rotation about z

real(kind=Float64), intent(in) :: beta

Angle of rotation about y'

real(kind=Float64), intent(in) :: gamma

Angle of rotation about x"

real(kind=Float64), intent(out), dimension(3,3):: basis

Rotation matrix/basis for transforming from rotated to non-rotated coordinates

real(kind=Float64), intent(out), optional dimension(3,3):: inv_basis

Inverse basis for reverse transformation


Called by

proc~~tb_zyx~~CalledByGraph proc~tb_zyx tb_zyx proc~make_beam_grid make_beam_grid proc~make_beam_grid->proc~tb_zyx proc~line_basis line_basis proc~line_basis->proc~tb_zyx proc~read_beam read_beam proc~read_beam->proc~tb_zyx program~fidasim fidasim program~fidasim->proc~make_beam_grid program~fidasim->proc~read_beam proc~bremsstrahlung bremsstrahlung program~fidasim->proc~bremsstrahlung proc~make_diagnostic_grids make_diagnostic_grids program~fidasim->proc~make_diagnostic_grids proc~bremsstrahlung->proc~line_basis proc~make_diagnostic_grids->proc~line_basis

Contents

Source Code


Source Code

subroutine tb_zyx(alpha, beta, gamma, basis, inv_basis)
    !+ Creates active rotation matrix for z-y'-x" rotation given Tait-Bryan angles
    real(Float64), intent(in)                            :: alpha
        !+ Angle of rotation about z
    real(Float64), intent(in)                            :: beta
        !+ Angle of rotation about y'
    real(Float64), intent(in)                            :: gamma
        !+ Angle of rotation about x"
    real(Float64), dimension(3,3), intent(out)           :: basis
        !+ Rotation matrix/basis for transforming from rotated to non-rotated coordinates
    real(Float64), dimension(3,3), intent(out), optional :: inv_basis
        !+ Inverse basis for reverse transformation

    real(Float64) :: sa, sb, sg, ca, cb, cg

    sa = sin(alpha) ; sb = sin(beta) ; sg = sin(gamma)
    ca = cos(alpha) ; cb = cos(beta) ; cg = cos(gamma)

    basis(1,1) = ca*cb ; basis(1,2) = ca*sb*sg - cg*sa ; basis(1,3) = sa*sg + ca*cg*sb
    basis(2,1) = cb*sa ; basis(2,2) = ca*cg + sa*sb*sg ; basis(2,3) = cg*sa*sb - ca*sg
    basis(3,1) = -sb   ; basis(3,2) = cb*sg            ; basis(3,3) = cb*cg

    if(present(inv_basis)) inv_basis = transpose(basis)

end subroutine tb_zyx