bandstructure

class irrep.bandstructure.BandStructure(fWAV=None, fWFK=None, prefix=None, fPOS=None, Ecut=None, IBstart=None, IBend=None, kplist=None, spinor=None, code='vasp', calculate_traces=False, EF='0.0', onlysym=False, spin_channel=None, refUC=None, shiftUC=None, search_cell=False, trans_thresh=1e-05, degen_thresh=1e-08, save_wf=True, v=0, alat=None, from_sym_file=None)[source]

Parses files and organizes info about the whole band structure in attributes. Contains methods to calculate and write traces (and irreps), for the separation of the band structure in terms of a symmetry operation and for the calculation of the Zak phase and wannier charge centers.

Parameters:
  • fWAV (str, default=None) – Name of file containing wave-functions in VASP (WAVECAR format).

  • fWFK (str, default=None) – Name of file containing wave-functions in ABINIT (WFK format).

  • prefix (str, default=None) – Prefix used for Quantum Espresso calculations or seedname of Wannier90 files.

  • fPOS (str, default=None) – Name of file containing the crystal structure in VASP (POSCAR format).

  • Ecut (float, default=None) – Plane-wave cutoff in eV to consider in the expansion of wave-functions.

  • IBstart (int, default=None) – First band to be considered.

  • IBend (int, default=None) – Last band to be considered.

  • kplist (array, default=None) – List of indices of k-points to be considered.

  • spinor (bool, default=None) – True if wave functions are spinors, False if they are scalars. Mandatory for VASP.

  • code (str, default='vasp') – DFT code used. Set to ‘vasp’, ‘abinit’, ‘espresso’ or ‘wannier90’.

  • EF (float, default=None) – Fermi-energy.

  • onlysym (bool, default=False) – Exit after printing info about space-group.

  • spin_channel (str, default=None) – Selection of the spin-channel. ‘up’ for spin-up, ‘dw’ for spin-down. Only applied in the interface to Quantum Espresso.

  • refUC (array, default=None) – 3x3 array describing the transformation of vectors defining the unit cell to the standard setting.

  • shiftUC (array, default=None) – Translation taking the origin of the unit cell used in the DFT calculation to that of the standard setting.

  • search_cell (bool, default=False) – Whether the transformation to the conventional cell should be computed. It is True if kpnames was specified in CLI.

  • trans_thresh (float, default=1e-5) – Threshold to compare translational parts of symmetries.

  • degen_thresh (float, default=1e-8) – Threshold to determine the degeneracy of energy levels.

  • calculate_traces (bool) – If True, traces of symmetries will be calculated. Useful to icreate instances of BandStructure faster.

  • save_wf (bool) – Whether wave functions should be kept as attribute after calculating traces.

  • v (int, default=0) – Number controlling the verbosity. 0: minimalistic printing. 1: print info about decisions taken internally by the code, recommended when the code runs without errors but the result is not the expected. 2: print detailed info, recommended when the code stops with an error

spacegroup

Instance of SpaceGroup.

Type:

class

spinor

True if wave functions are spinors, False if they are scalars. It will be read from DFT files.

Type:

bool

efermi

Fermi-energy. If user set a number as EF in CLI, it will be used. If EF was set to auto, it will try to parse it and set to 0.0 if it could not.

Type:

float

Ecut0

Plane-wave cutoff (in eV) used in DFT calulations. Always read from DFT files. Insignificant if `code`=’wannier90’.

Type:

float

Ecut

Plane-wave cutoff (in eV) to consider in the expansion of wave-functions. Will be set equal to Ecut0 if input parameter Ecut was not set or the value of this is negative or larger than Ecut0.

Type:

float

Lattice

Each row contains cartesian coordinates of a basis vector forming the unit-cell in real space.

Type:

array, shape=(3,3)

RecLattice

Each row contains the cartesian coordinates of a basis vector forming the unit-cell in reciprocal space.

Type:

array, shape=(3,3)

kpoints

Each element is an instance of class Kpoint corresponding to a k-point specified in input parameter kpoints. If this input was not set, all k-points found in DFT files will be considered. ACCESSED DIRECTLY BY BANDUPPY>=0.3.4. DO NOT CHANGE UNLESS NECESSARY. NOTIFY THE DEVELOPERS IF ANY CHANGES ARE MADE.

Type:

list

num_bandinvs

Property that returns the number of inversion odd states in the given TRIM.

Type:

int

gap_direct

Property that returns the smallest direct gap in the given k points.

Type:

float

gap_indirect

Property that returns the smallest indirect gap in the given k points.

Type:

float

num_k

Property that returns the number of k points in the attribute kpoints

Type:

int

num_bands

Property that returns the number of bands. Used to write trace.txt.

Type:

int

KPOINTSline(kpred=None, supercell=None, breakTHRESH=0.1)[source]

Calculate cumulative length along a k-path in cartesian coordinates. ACCESSED DIRECTLY BY BANDUPPY>=0.3.4. DO NOT CHANGE UNLESS NECESSARY. NOTIFY THE DEVELOPERS IF ANY CHANGE IS MADE.

Parameters:
  • kpred (list, default=None) – Each element contains the direct coordinates of a k-point in the attribute kpoints.

  • supercell (array, shape=(3,3), default=None) – Describes how the lattice vectors of the (super)cell used in the calculation are expressed in the basis vectors of the primitive cell. USED IN BANDUPPY. DO NOT CHANGE UNLESS NECESSARY.

  • breakTHRESH (float, default=0.1) – If the distance between two neighboring k-points in the path is larger than breakTHRESH, it is taken to be 0. Set breakTHRESH to a large value if the unforlded kpoints line is continuous.

Returns:

K – Each element is the cumulative distance along the path up to a k-point. The first element is 0, so that the number of elements matches the number of k-points in the path.

Return type:

array

Separate(isymop, degen_thresh=1e-05, groupKramers=True, v=0)[source]

Separate band structure according to the eigenvalues of a symmetry operation.

Parameters:
  • isymop (int) – Index of symmetry used for the separation.

  • degen_thresh (float, default=1e-5) – Energy threshold used to determine degeneracy of energy-levels.

  • groupKramers (bool, default=True) – If True, states will be coupled by Kramers’ pairs.

  • v (int, default=0) – Verbosity level. Default is set to minimalistic printing

Returns:

subspaces – Each key is an eigenvalue of the symmetry operation and the corresponding value is an instance of class BandStructure for the subspace of that eigenvalue.

Return type:

dict

property gap_direct

Getter for the direct gap

Returns:

gap – Smallest direct gap

Return type:

float

property gap_indirect

Getter for the indirect gap

Returns:

gap – Smallest indirect gap

Return type:

float

identify_irreps(kpnames, v=0)[source]

Identifies the irreducible representations of wave functions based on the traces of symmetries of the little co-group. Each element of kpoints will be assigned the attribute irreps with the labels of irreps.

Parameters:
  • kpnames (list) – List of labels of the maximal k points.

  • v (int, default=0) – Verbosity level. Default set to minimalistic printing

json(kpnames=None)[source]

Prepare a dictionary to save the data in JSON format.

Parameters:

kpnames (list) – List of labels of the maximal k points.

Returns:

json_data – Dictionary with the data.

Return type:

dict

property num_bandinvs

Getter for the total number of inversion odd states

Returns:

num_bandinvs – Total number of inversion odd states. 0 if the crystal is not inversion symmetric.

Return type:

int

property num_bands

Return number of bands. Raise RuntimeError if the number of bands varies from on k-point to the other.

Returns:

Number of bands in every k-point.

Return type:

int

property num_k

Getter for the number of k points

wcc()[source]

Calculate Wilson loops.

Returns:

Eigenvalues of the Wilson loop operator, divided by \(2\pi\).

Return type:

array

write_characters()[source]

For each k point, write the energy levels, their degeneracies, traces of the little cogroup’s symmetries, and the direct and indirect gaps. Also the irreps, if they have been identified. If the crystal is inversion symmetries, the number of total inversion odd states, the Z2 and Z4 numbers will be written.

write_irrepsfile()[source]

Write the file irreps.dat with the identified irreps.

write_plotfile(filename='bands-tognuplot.dat')[source]

Generate lines for a band structure plot, with cummulative length of the k-path as values for the x-axis and energy-levels for the y-axis.

Returns:

Lines to write into a file that will be parsed to plot the band structure.

Return type:

str

write_trace()[source]

Generate trace.txt file to upload to the program CheckTopologicalMat in BCS .

zakphase()[source]

Calculate Zak phases along a path for a set of states.

Returns:

  • z (array) – z[i] contains the total (trace) zak phase (divided by \(2\pi\)) for the subspace of the first i-bands.

  • array – The \(i^{th}\) element is the gap between \(i^{th}\) and \((i+1)^{th}\) bands in the considered set of bands.

  • array – The \(i^{th}\) element is the mean energy between \(i^{th}\) and \((i+1)^{th}\) bands in the considered set of bands.

  • array – Each line contains the local gaps between pairs of bands in a k-point of the path. The \(i^{th}\) column is the local gap between \(i^{th}\) and \((i+1)^{th}\) bands.