euphonic.util module

euphonic.util.bose_factor(x, T)

Calculate the Bose factor

Parameters:
  • x ((n_qpts, 3*n_ions) float ndarray) – Phonon frequencies in Hartree
  • T (float) – Temperature in K
Returns:

bose – Bose factor

Return type:

(n_qpts, 3*n_ions) float ndarray

euphonic.util.direction_changed(qpts, tolerance=5e-06)

Takes a N length list of q-points and returns an N - 2 length list of booleans indicating whether the direction has changed between each pair of q-points

euphonic.util.gaussian(x, sigma)
euphonic.util.gaussian_2d(xbins, ybins, xwidth, ywidth, extent=6.0)

Calculate a 2D Gaussian probability density, with independent standard deviations in x and y

Parameters:
  • xbins ((xbins,) float ndarray) – Bin edges in x
  • ybins ((ybins,) float ndarray) – Bin edges in y
  • xwidth (float) – The FWHM in x of the Gaussian function
  • ywidth (float) – The FWHM in y of the Gaussian function
  • extent (float) – How far out to calculate the Gaussian, in standard deviations
Returns:

gauss – Gaussian probability density

Return type:

(nxbins, nybins) float ndarray

euphonic.util.is_gamma(qpt)

Determines whether the given point(s) are gamma points

Parameters:qpts ((3,) or (N, 3) float ndarray) – The q-point or q-points
Returns:isgamma – Whether the input q-points(s) are gamma points. Returns a scalar if only 1 q-point is provided
Return type:bool or (N,) bool ndarray
euphonic.util.lorentzian(x, gamma)
euphonic.util.mp_grid(grid)

Returns the q-points on a MxNxL Monkhorst-Pack grid specified by grid

Parameters:grid ((3,) int ndarray) – Length 3 array specifying the number of points in each direction
Returns:qgrid – Q-points on an MP grid
Return type:(M*N*L, 3) float ndarray
euphonic.util.reciprocal_lattice(unit_cell)

Calculates the reciprocal lattice from a unit cell