\(\newcommand{\AA}{\text{Å}}\)

CRYSTALpytools.base.extfmt module

Classes and methods to parse multiple external output formats by ‘crystal’ and ‘properties’ executables, such as ‘BAND.DAT’ and ‘fort.25’ formats.

class CrgraParser

Bases: object

A collection of functions to parse Crgra fort.25 files. Instantiation of this object is not recommaneded.

classmethod band(filename)

Parse fort.25 file for electron / phonon band structure(‘-%-BAND’). Unit: eV / THz. E Fermi is aligned to 0.

Parameters:

filename (str) – File name

Returns:
  • spin (int) – 1, closed shell; 2, open shell

  • tick_pos (array) – n_tick*1 array of 1D tick coordinates. Unit: Angstrom

  • tick_label (list) – n_tick*1 of default tick labels

  • efermi (float) – Fermi energy. Unit: eV. 0 for phonon bands.

  • bands (array) – n_bands*n_kpoints*spin array of energy / frequency. Unit: eV / THz

  • k_path (array) – 1D coordinates of k points. Unit: Angstrom

  • unit (str) – ‘eV’ or ‘THz’

classmethod dos(filename)

Parse fort.25 file for electron / phonon density of states (‘-%-DOSS’ and ‘-%-PDOS’). Unit: eV^-1 / THz^-1. E Fermi is aligned to 0. All projections must have the same energy / frequency range

Parameters:

filename (str) – File name

Returns:
  • spin (array) – 1, closed shell; 2, open shell

  • efermi (float) – Fermi energy. Unit: eV. 0 for phonon bands.

  • doss (array) – n_proj*n_energy*spin array of DOS. Positive values for both spin up and spin down states

  • energy (int) – Number of sampling points (energy or frequency).

  • unit (str) – ‘eV’ or ‘THz’

classmethod mapn(filename, index)

Parse fort.25 file for 2D isovalue maps generated by the ‘MAPNAT’ formatted keyword block (‘-%-MAPN’). Unit: a.u.

Parameters:
  • filename (str) – File name

  • index (int|list|None) – The sequence of ‘-%-MAPN’ headers starting from 0. List inputs are accepted. ‘None’ to read the first 1(2) MAPN entries for spin=1(2).

Returns:
  • spin (array) – 1, closed shell; 2, open shell

  • all_a (array|list) – 3D Cartesian coordinates of MAPNET point A. 1*3 array of index is an integer or 1*1 list. 1*nIndex list otherwise. Same below.

  • all_b (array|list) – 3D Cartesian coordinates of MAPNET point B

  • all_c (array|list) – 3D Cartesian coordinates of MAPNET point C

  • all_cosxy (float|list) – Cosine of vector AB and BC

  • all_struc (CStructure|list) – Extended Pymatgen Structure object.

  • all_map (array|list) – 2D scalar field map commensurate with MAPNET defined above, nY*nX*nSpin.

  • unit (str) – ‘a.u.’

class DLVParser

Bases: object

A collection of functions to parse DLV / Xmgrace files. Instantiation of this object is not recommaneded.

classmethod band(filename)

Parse BAND.DAT / PHONBANDS.DAT file for electron / phonon band structure. Unit: eV / THz. E Fermi is aligned to 0.

Parameters:

filename (str) – BAND.DAT or PHONBANDS.DAT.

Returns:
  • spin (int) – 1, closed shell; 2, open shell

  • tick_pos (array) – n_tick*1 array of 1D tick coordinates. Unit: Angstrom

  • tick_label (list) – n_tick*1 of default tick labels

  • efermi (float) – Fermi energy. Unit: eV. 0 for phonon bands.

  • bands (array) – n_bands*n_kpoints*spin array of energy / frequency. Unit: eV / THz

  • k_path (array) – 1D coordinates of k points. Unit: Angstrom

  • unit (str) – ‘eV’ or ‘THz’

classmethod dos(filename)

Parse DOSS.DAT / PHONDOS.DAT file for electron / phonon density of states. Unit: eV^-1 / THz^-1. E Fermi is aligned to 0. All projections must have the same energy / frequency range

Parameters:

filename (str) – File name

Returns:
  • spin (array) – 1, closed shell; 2, open shell

  • efermi (float) – Fermi energy. Unit: eV. 0 for phonon bands.

  • doss (array) – n_proj*n_energy*spin array of DOS. Positive values

  • energy (int) – Number of sampling points (energy or frequency).

  • unit (str) – ‘eV’ or ‘THz’

classmethod fort35(filename)

Keyword ‘DLV_BAND’. For 3D band structures in reciprocal space. 3D and 2D systems only.

Returns:
  • rlatt (array) – 3*3 reciprocal lattice matrix in Bohr.

  • bandnew (array) – nBand*nZ*nY*nX*nSpin array of 3D band in Hartree.

  • unit (str) – ‘a.u.’

class TOPONDParser

Bases: object

A collection of functions to parse TOPOND output files. Instantiation of this object is not recommaneded.

classmethod contour2D(filename)

Parse TOPOND 2D scalar contour plot files (SURF*.DAT). Unit: a.u.

Parameters:

filename (str)

Returns:
  • spin (array) – Always 1

  • a (array) – 3D Cartesian coordinates of MAPNET point A (xmin, ymax)

  • b (array) – 3D Cartesian coordinates of MAPNET point B (xmin, ymin)

  • c (array) – 3D Cartesian coordinates of MAPNET point C (xmax, ymin)

  • cosxy (float) – Always 0

  • struc (None) – Always None

  • map (array) – 2D scalar field map commensurate with MAPNET defined above. nY*nX*1 (spin dimension kept but no use).

  • unit (str) – ‘a.u.’

classmethod traj(filename)

Parse TOPOND trajectory plot files (TRAJ*.DAT). Unit: a.u.

Parameters:

filename (str)

Returns:
  • wtraj (list[int]) – 1*nPath, weight of the path

  • traj (list[array]) – 1*nPath, list of critical paths. Every array is the nPoint*3 3D ref framework coordinates of points on the path.

  • unit (str) – ‘a.u.’

class BOLTZTRAParaser

Bases: object

A collection of functions to parse BOLTZTRA output files. Instantiation of this object is not recommaneded.

classmethod tensor(filename)

Read properties in tensor forms, include KAPPA, SEEBECK, SIGMA, SIGMAS.

Returns:
  • spin (int) – 1 for closed shell and 2 for open shell.

  • type (str) – Type of tensor output.

  • v (float) – Volume in cm:math:^{3}.

  • t (array) – Temperature in K.

  • mu (array) – Chemical potential in eV.

  • dc (array) – nT*nMu*nspin array of carrier density. Unit: cm:math:^{-3}.

  • tensor (array) – nT*nMu*ndimen*nspin array of tensor elements.

  • unit (str) – Unit of tensor.

classmethod distribution(filename)

Read transport distribution function.

Returns:
  • spin (int) – 1 for closed shell and 2 for open shell.

  • type (str) – Type. Currently only ‘TDF’

  • energy (array) – nEnergy*nspin array, Energy in eV.

  • distr (array) – nEnergy*nDimen*nspin array of distribution. Unit: \(\hbar^{-2}.eV.fs.\AA^{-2}\).

class CUBEParser

Bases: object

A collection of functions to parse CRYSTAL CUBE files. Instantiation of this object is not recommaneded.

Note

Developed especially for CUBE formatted output of CRYSTAL. Lattice parameters must be included in the comment line in Bohr and degree.

classmethod read_cube(filename)

Read CUBE formatted files. For base vectors, they are defined by 4 points, origin, a, b and c.

Parameters:

filename (str)

Returns:
  • origin (array) – 1*3 Cartesian coordinates of origin. Unit: \(\AA\).

  • a (array) – 1*3 Cartesian coordinates of grid x base vector end. Unit: \(\AA\).

  • b (array) – 1*3 Cartesian coordinates of grid y base vector end. Unit: \(\AA\).

  • c (array) – 1*3 Cartesian coordinates of grid z base vector end. Unit: \(\AA\).

  • struc (CStructure) – Extended Pymatgen Structure object.

  • grid (array) – nZ*nY*nX array of 3D data grid.

  • unit (str) – Data grid unit, ‘a.u.’