euphonic.data.phonon module

class euphonic.data.phonon.PhononData(seedname, model='CASTEP', path='')

Bases: euphonic.data.data.Data

A class to read and store vibrational data from model (e.g. CASTEP) output files

seedname

Seedname specifying file(s) to read from

Type:str
model

Records what model the data came from

Type:str
n_ions

Number of ions in the unit cell

Type:int
n_branches

Number of phonon dispersion branches

Type:int
n_qpts

Number of q-points in the .phonon file

Type:int
cell_vec

The unit cell vectors. Default units Angstroms

Type:(3, 3) float ndarray
recip_vec

The reciprocal lattice vectors. Default units inverse Angstroms

Type:(3, 3) float ndarray
ion_r

The fractional position of each ion within the unit cell

Type:(n_ions, 3) float ndarray
ion_type

The chemical symbols of each ion in the unit cell. Ions are in the same order as in ion_r

Type:(n_ions,) string ndarray
ion_mass

The mass of each ion in the unit cell in atomic units

Type:(n_ions,) float ndarray
qpts

Q-point coordinates

Type:(n_qpts, 3) float ndarray
weights

The weight for each q-point

Type:(n_qpts,) float ndarray
freqs

Phonon frequencies, ordered according to increasing q-point number. Default units meV

Type:(n_qpts, 3*n_ions) float ndarray
eigenvecs

Dynamical matrix eigenvectors. Empty if read_eigenvecs is False

Type:(n_qpts, 3*n_ions, n_ions, 3) complex ndarray
split_i

The q-point indices where there is LO-TO splitting, if applicable. Otherwise empty.

Type:(n_splits,) int ndarray
split_freqs

Holds the additional LO-TO split phonon frequencies for the q-points specified in split_i. Empty if no LO-TO splitting. Default units meV

Type:(n_splits, 3*n_ions) float ndarray
split_eigenvecs

Holds the additional LO-TO split dynamical matrix eigenvectors for the q-points specified in split_i. Empty if no LO-TO splitting

Type:(n_splits, 3*n_ions, n_ions, 3) complex ndarray
__init__(seedname, model='CASTEP', path='')

Calls functions to read the correct file(s) and sets PhononData attributes

Parameters:
  • seedname (str) – Seedname of file(s) to read
  • model ({'CASTEP'}, optional, default 'CASTEP') – Which model has been used. e.g. if seedname = ‘quartz’ and model=’CASTEP’, the ‘quartz.phonon’ file will be read
  • path (str, optional) – Path to dir containing the file(s), if in another directory
calculate_sqw_map(scattering_lengths, ebins, calc_bose=True, **kwargs)

Calculate the structure factor for each q-point contained in data, and bin according to ebins to create a S(Q,w) map

Parameters:
  • scattering_lengths (dictionary) – Dictionary of spin and isotope averaged coherent scattering legnths for each element in the structure in fm e.g. {‘O’: 5.803, ‘Zn’: 5.680}
  • ebins ((n_ebins + 1,) float ndarray) – The energy bin edges in the same units as PhononData.freqs
  • calc_bose (boolean, optional, default True) – Whether to calculate and apply the Bose factor
  • **kwargs – Passes keyword arguments on to PhononData.calculate_structure_factor
Returns:

sqw_map – The intensity for each q-point and energy bin

Return type:

(n_qpts, n_ebins) float ndarray

calculate_structure_factor(scattering_lengths, T=5.0, scale=1.0, calc_bose=True, dw_arg=None, **kwargs)

Calculate the one phonon inelastic scattering at each q-point See M. Dove Structure and Dynamics Pg. 226

Parameters:
  • scattering_lengths (dictionary) – Dictionary of spin and isotope averaged coherent scattering legnths for each element in the structure in fm e.g. {‘O’: 5.803, ‘Zn’: 5.680}
  • T (float, optional, default 5.0) – The temperature in Kelvin to use when calculating the Bose and Debye-Waller factors
  • scale (float, optional, default 1.0) – Apply a multiplicative factor to the final structure factor.
  • calc_bose (boolean, optional, default True) – Whether to calculate and apply the Bose factor
  • dw_arg (string, optional, default None) – If set, will calculate the Debye-Waller factor over the q-points in the .phonon file with this seedname.
  • **kwargs – If dw_arg has been set, passes keyword arguments to initialisation of the PhononData object for the Debye-Waller calculation
Returns:

sf – The structure factor for each q-point and phonon branch

Return type:

(n_qpts, n_branches) float ndarray

cell_vec
freqs
ion_mass
recip_vec
reorder_freqs(reorder_gamma=True)

By doing a dot product of eigenvectors at adjacent q-points, determines which modes are most similar and creates a _mode_map attribute in the Data object, which specifies which order the frequencies should be in at each q-point. The branch ordering can be seen when plotting dispersion

Parameters:reorder_gamma (bool, default True) – Whether to reorder frequencies at gamma-equivalent points. If an analytical correction has been applied at the gamma points (i.e LO-TO splitting) mode assignments can be incorrect at adjacent q-points where the correction hasn’t been applied. So you might not want to reorder at gamma for some materials
split_freqs
sqw_ebins