euphonic.data.interpolation module

class euphonic.data.interpolation.InterpolationData(seedname, model='CASTEP', path='', qpts=array([], dtype=float64), **kwargs)

Bases: euphonic.data.phonon.PhononData

Extends PhononData. A class to read and store the data required for a phonon interpolation calculation from model (e.g. CASTEP) output, and calculate phonon frequencies/eigenvectors at arbitrary q-points via Fourier interpolation

seedname

Seedname specifying castep_bin file 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
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
n_cells_in_sc

Number of cells in the supercell

Type:int
sc_matrix

The supercell matrix

Type:(3, 3) int ndarray
cell_origins

The locations of the unit cells within the supercell

Type:(n_cells_in_sc, 3) int ndarray
force_constants

Force constants matrix. Default units atomic units

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

Number of q-points used in the most recent interpolation calculation. Default value 0

Type:int
qpts

Coordinates of the q-points used for the most recent interpolation calculation. Is empty by default

Type:(n_qpts, 3) float ndarray
weights

The weight for each q-point

Type:(n_qpts,) float ndarray
freqs

Phonon frequencies from the most recent interpolation calculation. Default units meV. Is empty by default

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

Dynamical matrix eigenvectors from the most recent interpolation calculation. Is empty by default

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

Stores which the acoustic sum rule, if any, was used in the last phonon calculation. Ensures consistency of other calculations e.g. when calculating on a grid of phonons for the Debye-Waller factor

Type:str
dipole

Stores whether the Ewald dipole tail correction was used in the last phonon calculation. Ensures consistency of other calculations e.g. when calculating on a grid of phonons for the Debye-Waller factor

Type:boolean
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='', qpts=array([], dtype=float64), **kwargs)

Calls functions to read the correct file(s) and sets InterpolationData attributes, additionally can calculate frequencies/eigenvectors at specified q-points

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.castep_bin’ file will be read
  • path (str, optional) – Path to dir containing the file(s), if in another directory
  • qpts ((n_qpts, 3) float ndarray, optional) – Q-point coordinates to use for an initial interpolation calculation
  • **kwargs – If qpts has been specified, kwargs may be used to pass keyword arguments to calculate_fine_phonons
born
calculate_fine_phonons(qpts, asr=None, precondition=False, dipole=True, eta_scale=1.0, splitting=True, reduce_qpts=True, nprocs=1, _qchunk=None)

Calculate phonon frequencies and eigenvectors at specified q-points from a supercell force constant matrix via interpolation. For more information on the method see section 2.5: http://www.tcm.phy.cam.ac.uk/castep/Phonons_Guide/Castep_Phonons.html

Parameters:
  • qpts ((n_qpts, 3) float ndarray) – The q-points to interpolate onto
  • asr ({'realspace', 'reciprocal'}, optional, default None) – Which acoustic sum rule correction to apply. ‘realspace’ applies the correction to the force constant matrix in real space. ‘reciprocal’ applies the correction to the dynamical matrix at every q-point
  • dipole (boolean, optional, default True) – Calculates the dipole tail correction to the dynamical matrix at each q-point using the Ewald sum, if the Born charges and dielectric permitivitty tensor are present.
  • eta_scale (float, optional, default 1.0) – Changes the cutoff in real/reciprocal space for the dipole Ewald sum. A higher value uses more reciprocal terms
  • splitting (boolean, optional, default True) – Whether to calculate the LO-TO splitting at the gamma points. Only applied if dipole is True and the Born charges and dielectric permitivitty tensor are present.
  • nprocs (integer, optional, default 1) – If more than 1, uses Python’s multiprocessing module to distribute q-point calculations across processors
  • reduce_qpts (boolean, optional, default False) – Whether to use periodicity to reduce all q-points and only calculate for unique q-points within the 1st BZ. This won’t change the output but could increase performance.
Returns:

  • freqs ((n_qpts, 3*n_ions) float ndarray) – The phonon frequencies (same as set to InterpolationData.freqs)
  • eigenvecs ((n_qpts, 3*n_ions, n_ions, 3) complex ndarray) – The phonon eigenvectors (same as set to InterpolationData.eigenvecs)

calculate_sqw_map(scattering_lengths, ebins, **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 freqs
  • **kwargs – Passes keyword arguments on to PhononData.calculate_sqw_map
Returns:

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

Return type:

ndarray

calculate_structure_factor(scattering_lengths, 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}
  • dw_arg ((3,) float ndarray, optional, default None) – If set, will calculate the Debye-Waller factor on a Monkhorst-Pack grid
  • **kwargs – Passes keyword arguments to PhononData.calculate_structure_factor, if dw_arg is an ndarray, it can also pass arguments to calculate_fine_phonons when calculating phonons on the grid
Returns:

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

Return type:

(n_qpts, n_branches) float ndarray

eigenvecs
force_constants
reorder_freqs(**kwargs)

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