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

CRYSTALpytools.base.output module

Classes and methods to parse the output files (screen output, or .out and .outp files) of ‘crystal’ and ‘properties’ executables.

class GeomBASE

Bases: object

A container of basic methods for SCF geometry.

classmethod read_geom(data)

Read lattice from ‘A B C ALPHA BETA GAMMA’ block, periodic boundary condition and atom positions from ‘ATOMS IN THE ASYMMETRIC UNIT’ block. It terminates at the first empty line after that block.

Parameters:

data (DataFrame) – Pandas DataFrame of the output

Returns:

struc (CStructure) – Extended Pymatgen Structure

class SCFBASE

Bases: object

A container of basic methods for SCF loop.

classmethod get_SCF_blocks(data)

Get SCF convergence block from output file.

Parameters:

data (DataFrame) – Pandas DataFrame of the output.

Returns:
  • nSCF (int) – Number of SCF blocks

  • SCFrange (array[int, int]) – The beginning and ending points of every SCF block.

classmethod read_convergence(data)

Read a SCF convergence block.

Parameters:

data (DataFrame) – Pandas DataFrame of the SCF convergence block.

Returns:
  • ncyc (int) – Number of cycles

  • endflag (str) – ‘terminated’, ‘converged’, ‘too many cycles’ and ‘unknown’

  • e (array) – nCYC*1 array of SCF energy. Unit: eV

  • de (array) – nCYC*1 array of SCF energy difference. Unit: eV

  • spin (bool) – Whether the system is spin-polarised.

  • efermi (array) – Fermi energy. Unit: eV

  • gap (array) – Band gap. Unit: eV

class OptBASE

Bases: object

A container of basic methods for Opt loop.

classmethod get_opt_block(data)

Get optimization convergence block (every OPT step) from output file.

Parameters:

data (DataFrame) – Pandas DataFrame of the output.

Returns:
  • nOPT (int) – Number of OPT steps

  • OPTrange (array[int, int]) – The beginning and ending points of every OPT step.

  • endflag (str) – ‘terminated’, ‘converged’, ‘failed’ and ‘unknown’

classmethod read_opt_block(data)

Read information of every OPT step from output file.

Parameters:

data (DataFrame) – Pandas DataFrame of the output.

Returns:
  • e (float) – Final SCF energy with corrections. Unit: eV

  • de (float) – Final SCF energy difference with last OPT step. Unit: eV

  • struc (CStructure) – Modified pymatgen structure.

  • maxg (float) – Max energy gradient convergence. Unit: Hartree / Bohr.

  • rmsg (float) – RMS energy gradient convergence. Unit: Hartree / Bohr,

  • maxd (float) – Max displacement convergence. Unit: Bohr.

  • rmsd (float) – RMS displacement convergence. Unit: Bohr.

class PhononBASE

Bases: object

A container of basic methods for phonon information.

classmethod readmode_basic(data, IRREP)

Read basic frequency information.

Parameters:
  • data (Series) – Pandas series. The block containing frequency info.

  • IRREP (list[str]) – Irreducible representations in Mulliken symbols. Used for phonon dispersion only.

Returns:
  • frequency (array[float]) – nmode * 1

  • mode_symm (array) – nmode * 1

  • intens (array[float]) – nmode * 1

  • IR (array[bool]) – nmode * 1

  • Raman (array[bool]) – nmode * 1

classmethod readmode_eigenvector(data, nmode)

Get mode eigenvectors.

Returns:

eigvt (array[float]) – nmode*natom*3 array.

classmethod classical_amplitude(struc, freq)

Get classical amplitude of phonon modes Under Testing

\[x = \sqrt{\frac{\hbar}{\mu\omega}}\]
Parameters:
  • struc (Structure) – Pymatgen structure

  • freq (float|array) – Frequency. Unit: THz

Returns:

classic_a (array) – nfreq*3natom*3natom array, or 3natom*3natom if freq is float. The diagonal matrix of classical amplitude.

classmethod normalize_eigenvector(eigvt, amplitude=1.0)

Normalize the mode of eigenvectors.

Parameters:
  • eigvt (array[complex]) – nmode*natom*3 array.

  • amplitude (float) – Amplitude of normalization

Returns:

eigvt (array[complex]) – Normalized eigenvector.

classmethod clean_q_overlap(crysout, threshold)

Remove the repeated q points at both ends of line segment when dispersion is read. The weight of q points will be updated here.

Parameters:
  • crysout (Crystal_output) – CRYSTALpytools.crystal_io.Crystal_output object

  • threshold (float) – The q point overlap threshold.

classmethod clean_imaginary(crysout, threshold)

Set negative frequenceies and related properteis to 0 and print warning message. Eigenvectors are kept.

Parameters:
  • crysout (Crystal_output) – CRYSTALpytools.crystal_io.Crystal_output object

  • threshold (float) – The threshold to identify a phonon mode as negative.

class POutBASE(filename)

Bases: object

Base object for Properties output file. Auxiliary information is substracted. Other data is read from formatted files respectively.

Parameters:

filename (str) – Properties output file name.

get_geometry()

Get geometry from properties output calculation.

Returns:

struc (CStructure) – Modified Pymatgen structure

get_lattice()

Get lattice matrix from properties output calculation. A 3D lattice is generated since no dimensionality information is provided.

Returns:

matrix (array) – 3*3 lattice matrix

get_topond_geometry()

Get the cluster geometry and plot plane base (2D only) from TOPOND calculation output.

Returns:
  • atomsplt (array) – Atomic numbers and coordinates in plotting frame.

  • base (array) – Valid for 2D plots only 3*3 range of orthogonal plotting base x and y. A: (xmin, ymax), B: (xmin, ymin), C: (xmax, ymin). Unit: Bohr.

get_reciprocal_lattice()

Get reciprocal lattice matrix from properties output calculation. A 3D lattice is generated since no dimensionality information is provided.

Returns:

matrix (array) – 3*3 reciprocal lattice matrix

get_3dkcoord()

BANDS calculation only. Get 3D fractional coordinates of high-symmetry and sampled k points from output file.

Returns:
  • tick_pos3d (array) – ntick*3 array of fractional coordinates of high symmetry k points

  • k_pos3d (array) – nkpoint*3 fractional coordinates of k points

get_XRDSPEC()

The keyword ‘XRDSPEC’ only. Get calculated XRD spectra.

get_Fermi()

Get Fermi energy in eV from the common block.