CastepReader.CastepBin.read_cell!Method
read_cell!(output, f::FortranFile, tags::Dict{String,Int})

Read in the unit cell information. Note that the data is taken from the second set which stores the current cell, e.g. consistent with the wavefunction data stored.

CastepReader.CastepBin.read_parameters_electronic!Method
read_parameters_electronic(output, f::FortranFile, tags::Dict{String, Int})

Read the data store after BEGIN_ELECTRONIC header. These are internal parameters used by CASTEP. There are duplicated entries in the same section as some of the field are written as different types for backward compatibility.

CastepReader.CastepBin.update_wavefunction!Method
update_wavefunction(fname, coeffs::AbstractArray{T, 5}) where {T}

Update the wavefunction (coefficients) stored in the check file. The coefficients array passed should be modified based on that was originally read from the file.

  • NOTE this function will overwrite target file.
CastepReader.CastepBin.update_wavefunctionMethod
update_wavefunction(src, dst, coeffs::AbstractArray{T, 5}) where {T}

Update the wavefunction (coefficients) stored in the check file. The coefficients array passed should be modified based on that was originally read from the file.

CastepReader.CastepBin.@readtagMacro

Macro for compact representation of how data should read from the binary file

For example, the following definition:

@readtag f outdict tags begin

    CELL_VERSION_NUMBER
    VERSION_NUMBER::Float64
    skip
    X::(Float64, :B)

end

expands into to:

if "CELL_VERSION_NUMBER" in keys(tags)
    gototag("CELL_VERSION_NUMBER", f, tags)
    output[:VERSION_NUMBER] = read(f, Float64)
    skiptag(f)
    output[:X] = read(f, outdict[:B])
end

Note that tags that are not present will simply be skipped.
CastepReader.WaveFunctionMethod
WaveFunction(data_dict::Dict)

Construct the WaveFunction from a Dict of read data from castep_bin/check file

AbstractFFTs.fft!Method
FFTW.fft!(wavef::WaveFunction)

In place FFT to transfer the wavefunction to the frequency space

The in-place transformation is apply slice by slice

AbstractFFTs.fftMethod
fft(wavef::WaveFunction)

FFT to transfer the wavefunction to the frequency space

AbstractFFTs.ifft!Method

In place FFT to transfer the wavefunction to the real space

The in-place transformation is apply slice by slice

AbstractFFTs.ifftMethod
fft(wavef::WaveFunction)

FFT to transfer the wavefunction to the frequency space

CastepReader.chargedensityMethod
chargedensity(wavef::WaveFunction, kidx, bidx, sidx)

Construct charge density for given kpoints, band, and spin indices

CastepReader.chargedensityMethod
chargedensity(wavef::WaveFunction, ib, ik, is)

Get the charge density for a single slice of band, kpoint, spin channel

CastepReader.chargedensityMethod
chargedensity(wavef::WaveFunction)

Compute charge density from the wavefunction

Note that the density does not include the augmentation charges involved in ultrasoft pseudopotentials

CastepReader.coeff_to_recipMethod
coeff_to_recip(coeff_array, nwaves_at_kp, grid_coords, ngx, ngy, ngz)

Convert planewave coefficients in the reduced representation to grids

CastepReader.coeff_to_recipMethod
coeff_to_recip(coeff_array, data_dict::Dict)

Convert plane wave coefficients to a reciprocal space grid.

CastepReader.m_channel_maskMethod

Get an masking for the m channels inferred from the repeated appearance of l channels

CASTEP does not write the m channel labels explicity, but they can be inferred from repeated l channels. This assumes that l channels of the same atom is written consecutively, which seem to be the case.

CastepReader.pdos_index_by_siteMethod

Reorder the PDOS information

Return a dictionary which can be used as

output = pdos_index_by_site(pdos_data)
idx = output[1][Orbitals.s]   # Index of the s orbital in the pdos_data.weights
weights = pdos_data.pdos_weights[idx, :, :, :]  # Slice the weight array to obtain the weigths for this site/am combination
CastepReader.read_bands_castep_rawMethod

Read the bands file

The bands file contains the eigenvalues of the

Arguments

  • reorder: If true, recover the orignial kpoint orders as defined in the cell file. Note that the

order of kpoint in other quantities, such as the optical matrix, are the same as they appear in the bands file rather than following the internal "counter".

CastepReader.read_cst_omeMethod
read_cst_ome(seed;)

Read the <seed>.cst_ome file, requires <seed>.bands file to be present.

CastepReader.read_om_castepMethod
read_om_castep(ome_file, nb, nk, ns;endian="big-endian", legacy_format=false)

Read optical matrix element for CASTEP

CastepReader.read_om_castepMethod
read_om_castep(seed; endian="big-endian", legacy_format=false)

Read optical matrix element given a CASTEP seed name.

CastepReader.read_ome_binMethod
read_ome_bin(seed; legacy_format=false)

Read the <seed>.ome_bin file, requires <seed>.bands file to be present.

CastepReader.read_pdos_binMethod
read_pdos_bin(f::FortranFile)

Read the pdos_bin file.

Args:

  • legacy_format: Read from file with legacy format, e.g. without the version number and header.
CastepReader.recip_to_coeffMethod

Convert full grid representation back to reciprocal coefficients The original specifications of the wave function needs to be reused

CastepReader.wavefunctionMethod

Load wavefunction using data read from the checkpoint file.

Returns the reciprocal representation on the grids. Needs to be FFTed to get to the real space representation.