nitrogen.angmom

Angular momentum and spherical tensor routines.

nitrogen.angmom.Jbf_cs(J)

Calculate Condon-Shortley body-fixed J operators

Parameters

J (int) – Angular momentum: 0, 1, 2, …

Returns

Jx,Jy,Jz – Body-fixed angular momentum components

Return type

ndarray

Notes

The basis function order is \(k = -J, \ldots, +J\).

nitrogen.angmom.L_matrix(L)

Calculate the Cartesian components of a general angular momentum operator with normal commutation relations

\[\langle L m' \vert L_i \vert L m \rangle\]
Parameters

L (integer) – The total angular momentum quantum number, \(L\).

Returns

LX, LY, LZ – The matrix representations.

Return type

ndarray

Notes

The basis function order is \(m = 0, 1, \ldots, L, -L, -L+1, \ldots, -1\).

nitrogen.angmom.Nbf_matrix(N)

Calculate the body-fixed operators of \(\mathbf{N}\) for a given \(N\) quantum number,

\[\langle N k' \vert N_i \vert N k \rangle\]
Parameters

N (integer) – The \(N\) quantum number

Returns

Nx,Ny,Nz – The matrix representations.

Return type

ndarray

Notes

The basis function order is \(k = 0, 1, \ldots, N, -N, -N+1, \ldots, -1\). This is different than Jbf_cs().

nitrogen.angmom.Rpi_cs(J)

Calculate the matrix elements of R(pi) about the body-fixed axes in the Condon-Shortley basis.

Parameters

J (integer) – The angular momentum.

Returns

Rx,Ry,Rz – The rotation matrices

Return type

ndarray

nitrogen.angmom.Rpi_wr(J)

Calculate the R(pi) rotation matrices in the Wang-Real representation.

Parameters

J (TYPE) – DESCRIPTION.

Returns

Rx,Ry,Rz – The rotation matrices.

Return type

ndarray

nitrogen.angmom.U_wr2cs(J)

Wang transformation matrix, with additional phase factors for real functions.

cs = U @ wr

Parameters

J (int) – Angular momentum quantum number, 0, 1, 2, …

Returns

W – The unitary transformation matrix

Return type

ndarray

nitrogen.angmom.X2ABC(X, mass)

Calculate rotational constants from Cartesian positions.

Parameters
  • X (ndarray) – A (3*N,…) array containing the x, y, and z Cartesian positions of N particles.

  • mass (array_like) – The masses of the N particles.

Returns

ABC – A (3,…) array containing the A, B, and C rotational constants (in energy units).

Return type

ndarray

nitrogen.angmom.X2COM(X, mass)

Return X translated to the center-of-mass frame

Parameters
  • X (ndarray) – A (3*N,…) array containing the x, y, and z Cartesian positions of N particles.

  • mass (array_like) – The masses of the N particles.

Returns

XCOM

Return type

ndarray

nitrogen.angmom.X2I(X, mass)

Calculate the inertia tensor from Cartesian coordinates.

Parameters
  • X (ndarray) – A (3*N,…) array containing the x, y, and z Cartesian positions of N particles.

  • mass (array_like) – The masses of the N particles.

Returns

I – A (3,3,…) array containing the symmetric inertia tensor

Return type

ndarray

nitrogen.angmom.X2PAS(X, mass)

Rotate coordinates to the principal axis system.

Parameters
  • X (ndarray) – A (3*N,…) array containing the x, y, and z Cartesian positions of N particles.

  • mass (array_like) – The masses of the N particles.

Returns

  • XPAS (ndarray) – A (3*N,…) array of the positions in the PAS frame with axes ordered \(a\), \(b\), \(c\).

  • R (ndarray) – A (3,3,…) orthogonal array containing the transformation matrix from the original axes to the principal axis system.

  • COM (ndarray) – A (3,…) array of the center-of-mass position in the original frame.

Notes

The PAS coordinates are defined as

\[\vec{x}_\text{PAS} = \mathbf{R}(\vec{x} - \vec{x}_\text{COM}).\]

The rows of \(\mathbf{R}\) equal the unit vectors of the principal axes with respect to the input coordinate frame.

nitrogen.angmom.caseb_multistate_L(Li_e, LiLj_ac_e, alpha, N, k, SS1, JJ1)

Calculate the body-fixed \(L_i\) operators for a multi-state case (b) basis set.

Parameters
  • Li_e ((3,NE,NE) array_like) – The pure electronic matrix elements of \(L_i\).

  • LiLj_ac_e ((3,3,NE,NE) array_like) – The pure electronic matrix elements of the anti-commutators \([L_i, L_j]_+ = L_i L_j + L_j L_i\).

  • alpha (array_like) – The electronic state index, i.e. the values for indexing into Li_e and LiLj_ac_e.

  • N (array_like) – The \(N\) quantum number.

  • k (array_like) – The signed \(k\) quantum number.

  • SS1 (array_like) – The value of \(2S+1\).

  • JJ1 (array_like) – The value of \(2J+1\).

Returns

  • Li ((3,n,n) ndarray) – Li[i] is the \(L_i\) operator in the case (b) representation.

  • LiLj_ac ((3,3,n,n) ndarray) – LiLj_ac[i,j] is the \([L_i, L_j]_+\) anti-commutator in the case (b) representation.

nitrogen.angmom.caseb_multistate_N(alpha, N, k, SS1, JJ1)

Calculate the body-fixed \(N_i\) operators for a multi-state case (b) basis set.

Parameters
  • alpha (array_like) – The electronic (or other) state index.

  • N (array_like) – The \(N\) quantum number.

  • k (array_like) – The signed \(k\) quantum number.

  • SS1 (array_like) – The value of \(2S+1\).

  • JJ1 (array_like) – The value of \(2J+1\).

Returns

Nx, Ny, Nz – The matrix elements of the body-fixed components of \(\mathbf{N}\).

Return type

ndarray

Notes

The case (b) basis function is

\[\vert J m_J N k S; \alpha \rangle = \sum_{m_N, m_S} \vert N k m_N \rangle \vert S m_S \rangle \vert \alpha \rangle \langle N m_N, S m_S \vert J m_J \rangle\]

The matrix elements of the body-fixed components \(N_i\), \(i = x,y,z\), are

\[\langle J' m_J' N' k' S' ;\alpha' \vert N_i \vert J m_J N k S ; \alpha\rangle = \delta_{\alpha\alpha'} \delta_{JJ'} \delta_{m_J m_J'} \delta_{SS'} \delta_{NN'} \langle N' k' \vert N_i \vert N k \rangle\]
nitrogen.angmom.caseb_multistate_S(alpha, N, k, SS1, JJ1)

Calculate the body-fixed \(S_i\) operators for a multi-state case (b) basis set.

Parameters
  • alpha (array_like) – The electronic (or other) state index.

  • N (array_like) – The \(N\) quantum number.

  • k (array_like) – The signed \(k\) quantum number.

  • SS1 (array_like) – The value of \(2S+1\).

  • JJ1 (array_like) – The value of \(2J+1\).

Returns

Sx, Sy, Sz – The matrix elements of the body-fixed components of \(\mathbf{S}\).

Return type

ndarray

Notes

The case (b) basis function is

\[\vert J m_J N k S; \alpha \rangle = \sum_{m_N, m_S} \vert N k m_N \rangle \vert S m_S \rangle \vert \alpha \rangle \langle N m_N, S m_S \vert J m_J \rangle\]

The matrix elements of the body-fixed components \(S_i\), \(i = x,y,z\), are calculated by first calculating the body-fixed spherical tensor components

\[\begin{split}&\langle J' m_J' N' k' S' ;\alpha' \vert S_q \vert J m_J N k S ; \alpha\rangle = \delta_{\alpha\alpha'} \delta_{JJ'} \delta_{m_J m_J'} \delta_{SS'} \\ &\qquad\qquad \times (-1)^{k + J + S + 1} \sqrt{(2N+1)(2N'+1)(2S+1)S(S+1)} \left(\begin{array}{ccc} N & 1 & N' \\ k & -q & -k' \end{array} \right) \left\{\begin{array}{ccc} N & S & J \\ S & N' & 1 \end{array} \right\}\end{split}\]

and then relating

\[\begin{split}S_x &= \frac{1}{\sqrt{2}} ( -S_{q = +1} + S_{q = -1}) \\ S_y &= \frac{+i}{\sqrt{2}} ( S_{q = +1} + S_{q = -1}) \\ S_z &= S_{q = 0}\end{split}\]
nitrogen.angmom.caseb_multistate_dircos(Np, kp, SS1p, JJ1p, N, k, SS1, JJ1)

Calculate the (lab-)reduced matrix elements of the direction cosine tensor in a multi-state case (b) basis set.

Parameters
  • Np (array_like) – The bra \(N\) quantum number.

  • kp (array_like) – The bra signed \(k\) quantum number.

  • SS1p (array_like) – The bra value of \(2S+1\).

  • JJ1p (array_like) – The bra value of \(2J+1\).

  • N (array_like) – The ket \(N\) quantum number.

  • k (array_like) – The ket signed \(k\) quantum number.

  • SS1 (array_like) – The ket value of \(2S+1\).

  • JJ1 (array_like) – The ket value of \(2J+1\).

Returns

lamq – The body-frame spherical tensor components. lamq[q] = \(\lambda_q\) where \(q = 0,+1,-1\).

Return type

ndarray

Notes

The reduced matrix element is

\[\begin{split}\langle J' N' k' S' || \lambda_q || J N k S \rangle = \delta_{SS'} (-1)^{k + S + J + 1} [(2J+1)(2N'+1)(2N+1)]^{1/2} \left(\begin{array}{ccc} N & 1 & N' \\ -k & q & k' \end{array} \right) \left\{\begin{array}{ccc} N' & J' & S' \\ J & N & 1 \end{array} \right\}\end{split}\]

The \(\alpha\) index is not used here, as this is usually absorbed into the factor that the direction cosine tensor multiplies.

nitrogen.angmom.clebsch_gordan(jj1, jj2, jj3, mm1, mm2, mm3)

Calculate the Clebsch-Gordan coefficient,

\[\langle j_1\,m_1, j_2 \, m_2 \vert j_3 \, m_3 \rangle\]
Parameters
  • jj1 (integer) – Twice the value of \(j_1\).

  • jj2 (integer) – Twice the value of \(j_2\).

  • jj3 (integer) – Twice the value of \(j_3\).

  • mm1 (integer) – Twice the value of \(m_1\).

  • mm2 (integer) – Twice the value of \(m_2\).

  • mm3 (integer) – Twice the value of \(m_3\).

Returns

The result.

Return type

float

Notes

This currently wraps the py3nj implementation. The back-end may change in the future.

Examples

>>> n2.angmom.clebsch_gordan(2 * 6, 2 * 9, 2 * 13, 2 * -3, 2 * 4, 2 * 1)
0.4277601867185667
nitrogen.angmom.dircos_tensor(N1, k1, m1, N2, k2, m2)

Calculate a matrix element of the direction cosine spherical tensor,

\[\langle N_1, k_1, m_1 \vert \lambda_{Qq} \vert N_2, k_2, m_2 \rangle\]
Parameters
  • N1 (integer) – Angular momentum quantum numbers

  • k1 (integer) – Angular momentum quantum numbers

  • m2 (integer) – Angular momentum quantum numbers

  • N2 (integer) – Angular momentum quantum numbers

  • k2 (integer) – Angular momentum quantum numbers

  • m2 – Angular momentum quantum numbers

Returns

The direction cosine tensor matrix element in terms of spherical tensor components. The components are ordered [0, +1, -1] so that normal array indexing is unchanged.

Return type

(3,3) ndarray

Notes

The basis functions are standard symmetric top rotational basis functions with the usual phase conventions. \(k\) is the body-frame \(z\) component with respect to “anomalous” body-frame operators, \(J_x,J_y,J_z\).

The direction cosine tensor \(\lambda_{Q,q}^{(1,1)}\) is a double tensor with respect to the lab-frame angular momentum (\(J_{X},J_Y,J_Z\)) and the body-frame angular momentum (\(-J_x,-J_y,-J_z\)). Its components are

\[\lambda_{Q,q} = (-1)^q \left[D_{Q,-q}^{(1)}(\phi,\theta,\chi)\right]^*\]

The matrix elements are

\[ \begin{align}\begin{aligned}\langle N_1, k_1, m_1 \vert \lambda_{Qq} \vert N_2, k_2, m_2 \rangle = (-1)^{k_1 + k_2 + N_1 + N_2 - 1} \sqrt{\frac{2N_2+1}{2N_1+1}}\\ \times \langle N_2 m_2, 1 Q | N_1 m_1 \rangle \langle N_2, -k_2, 1 q | N_1, -k_1 \rangle\end{aligned}\end{align} \]
nitrogen.angmom.dircos_tensor_cart(N1, k1, m1, N2, k2, m2)

Calculate a matrix element of the direction cosine Cartesian tensor

\[\langle N_1, k_1, m_1 \vert \lambda_{Ij} \vert N_2, k_2, m_2 \rangle\]
Parameters
  • N1 (integer) – Angular momentum quantum numbers

  • k1 (integer) – Angular momentum quantum numbers

  • m2 (integer) – Angular momentum quantum numbers

  • N2 (integer) – Angular momentum quantum numbers

  • k2 (integer) – Angular momentum quantum numbers

  • m2 – Angular momentum quantum numbers

Returns

The direction cosine tensor matrix element in terms of Cartesian components.

Return type

(3,3) ndarray

See also

dircos_tensor

Direction cosine spherical tensor matrix elements

Notes

The indices are with respect to lab frame (\(I = X,Y,Z\)) and body-fixed frame (\(j = x,y,z\)) axes.

nitrogen.angmom.iJbf_wr(J)

Calculate body-fixed J operators in real, symmetrized JK basis (“Wang-Real”)

Parameters

J (int) – Angular momentum quantum number, 0, 1, 2, …

Returns

iJx, iJy, iJz – The body-frame angular momentum operators multiplied by i. These are purely real, anti-symmetric matrices

Return type

ndarray

nitrogen.angmom.iJiJbf_wr(J)

Calculate the anti-commutators [iJ_a,iJ_b]_+ for body-fixed angular momentum components in the Wang-real representation.

Parameters

J (int) – Total angular momentum, 0, 1, 2, …

Returns

iJiJ – iJiJ[a][b] is the [iJa, iJb]_+ anti-commutator ndarray

Return type

nested tuple of ndarrays

nitrogen.angmom.sigtau2Btau(sigma, tau)

Transform a general quartic rotational operator to the quadratic-diagonalized form.

Parameters
  • sigma ((3,3) ndarray) – The quadratic coefficients.

  • tau ((3,3,3,3) ndarray) – The quartic coefficients.

Returns

  • B ((3,) ndarray) – The diagonal quadratic coefficients in descending order (i.e., A, B, C)

  • taup ((3,3,3,3) ndarray) – The modified quartic coefficients

nitrogen.angmom.vectorRME_cs(Vbf, U1, U2)

Calculate the scaled reduced matrix element of a vector operator.

Parameters
  • Vbf ((3,N1,N2) array_like) – The vibronic matrix elements of the body-fixed components, \(V_{x,y,z}\) between N1 and N2 vibronic basis functions

  • U1 ((N1, 2*J1+1, n1) ndarray) – The rovibronic wavefunctions of n1 eigenvectors.

  • U2 ((N2, 2*J2+1, n2) ndarray) – The rovibronic wavefunctions of n2 eigenvectors.

Returns

VRME – The scaled reduced matrix elements.

Return type

(n1,n2) ndarray

Notes

The rotational basis functions are standard body-fixed symmetric top wavefunctions in \(k = -J,\ldots,+J\) order using Condon-Shortley phase conventions.

Integer \(J\) only supported currently.

nitrogen.angmom.wigner3j(jj1, jj2, jj3, mm1, mm2, mm3)

Calculate the Wigner 3-j symbol,

\[\begin{split}\left(\begin{array}{ccc} j_1 & j_2 & j_3 \\ m_1 & m_2 & m_3 \end{array} \right)\end{split}\]
Parameters
  • jj1 (integer) – Twice the value of \(j_1\).

  • jj2 (integer) – Twice the value of \(j_2\).

  • jj3 (integer) – Twice the value of \(j_3\).

  • mm1 (integer) – Twice the value of \(m_1\).

  • mm2 (integer) – Twice the value of \(m_2\).

  • mm3 (integer) – Twice the value of \(m_3\).

Returns

The result.

Return type

float

Notes

This currently wraps the py3nj implementation. The back-end may change in the future.

Examples

>>> n2.angmom.wigner3j(2 * 20, 2 * 21, 2 * 22, 2 * 5, 2 * -15, 2 * 10)
0.032597617477982975
nitrogen.angmom.wigner6j(jj1, jj2, jj3, jj4, jj5, jj6)

Calculate the Wigner 6-j symbol,

\[\begin{split}\left\{\begin{array}{ccc} j_1 & j_2 & j_3 \\ j_4 & j_5 & j_6 \end{array} \right\}\end{split}\]
Parameters
  • jj1 (integer) – Twice the value of \(j_1\).

  • jj2 (integer) – Twice the value of \(j_2\).

  • jj3 (integer) – Twice the value of \(j_3\).

  • jj4 (integer) – Twice the value of \(j_4\).

  • jj5 (integer) – Twice the value of \(j_5\).

  • jj6 (integer) – Twice the value of \(j_6\).

Returns

The result.

Return type

float

Notes

This currently wraps the py3nj implementation. The back-end may change in the future.

Examples

>>> n2.angmom.wigner6j(2 * 3, 2 * 6, 2 * 5, 2 * 4, 2 * 6, 2 * 9)
-0.020558557070186504