Miscellaneous functions: cij.misc

cij.misc.evec_disp2eig(a, mass)

Convert phonon displacement vector to eigenvector.

The displacement vectors (\(\left|C_i\right>\)) are not orthogonal, whereas eigenvectors (\(\left|C_i^m\right>\)) are orthogonal. The difference is the mass matrix (\(\hat M\)).

\(\left|C_i\right>\) and \(\left|C_i^m\right>\) are related by

\[\left|C_i^m\right> = \hat M^{1/2} \left |C_i \right>.\]

This function returns normalized \(\left|C_i^m\right>\).

Parameters
  • a (ndarray) – M x 3N displacement vector matrix

  • mass (list) – N x 1 atom mass vector, of any unit

Return type

ndarray

Returns

Eigenvector matrix, shape is same as a (M x 3N):

cij.misc.evec_load(fname, nq, np)

Load eig file from matdyn.x output.

Parameters
  • fname (str) – The name of the eig file

  • nq (int) – The number of q points

  • np (int) – The number of modes

Return type

list

cij.misc.evec_sort(target_arr, target_evecs, base_evecs, filter=None, threshold=None)

Sort elements of an array based on the eigenvector similarities with respect to another set of eigenvectors.

Parameters
  • target_arr (list) – The array of element to be sorted

  • target_evecs – The array of eigenvectors with one-on-one corresponds to target_arr

  • base_evecs – The array of eigenvectors as alignment.

  • filter (Optional[callable]) – the filter to apply on the dot product before the sorting actually happens.

  • threshold (Optional[float]) – below which threshold the error should be raised.

Return type

list

Returns

The sorted array of elements

Raises

RuntimeError