Miscellaneous functions: cij.misc

cij.misc.evec_disp2eig(a, mass)

Convert phonon displacement vector to eigenvector.

The displacement vectors (|Ci) are not orthogonal, whereas eigenvectors (|Cim) are orthogonal. The difference is the mass matrix (M^).

|Ci and |Cim are related by

|Cim=M^1/2|Ci.

This function returns normalized |Cim.

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