CRYSTALClear.crystal_io

Contents

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

CRYSTALClear.crystal_io#

Objects of input / output files of CRYSTAL. Methods to edit or substract data from corresponding files are provided.

class Crystal_input#

Bases: Crystal_inputBASE

Crystal input object inherited from the Crystal_inputBASE object. For the basic set-ups of keywords, please refer to manuals there.

geom_from_cif(file, zconv=None, keyword='EXTERNAL', pbc=[True, True, True], gui_name='fort.34', **kwargs)#

Read geometry from cif file and put infomation to geom block, either as “EXTERNAL” or “CRYSTAL”. CIF files with a single geometry only.

CIF with Symmetry is required.

Note

CIF files should have the “.cif” extension.

Parameters:
  • file (str) – CIF file.

  • keyword (str) – “EXTERNAL” or “CRYSTAL”.

  • zconv (list[list[int, int]]) – 1st element: The index of atom; 2nd element: The new conventional atomic number. Atoms of the irreducible unit is required.

  • pbc (list[bool]) – Valid only if keyword = EXTERNAL. Force to remove periodic boundary conditions along x, y, z axis.

  • gui_name (str) – Valid only if keyword = EXTERNAL. Gui file’s name.

  • object. (#pymatgen.symmetry.analyzer.SpacegroupAnalyzer>`_)

  • **kwargs – Passed to Pymatgen `SpacegroupAnalyzer <https://pymatgen.org/pymatgen.symmetry.html

geom_from_pmg(struc, zconv=None, keyword='EXTERNAL', gui_name='fort.34', **kwargs)#

Read geometry defined by PyMatGen structure object and put infomation into geom block, either as “EXTERNAL” or “CRYSTAL”.

See Crystal_input.geom_from_cif for definition of arguments.

Note

Coordinates of corresponding atoms may not consistent with the original CIF file if “CRYSTAL” is used, in which case coordinates of another symmetry equivalent atom is used.

bs_from_bse(name, element, zconv=None)#

Download basis set definitions from BSE. A wrapper of BasisSetBASE.from_bse.

Parameters:
  • name (str) – Basis set’s name.

  • element (list[str] | list[int]) – List of elements.

  • zconv (list[int]) – If not none, use the conventional atomic number. Its length must be the same as element. Its sequence must be consistent with basis set’s.

bs_from_string(fmt='crystal')#

Define basis set from a string. A wrapper of BasisSetBASE.from_string.

Parameters:
  • bs_str (str)

  • fmt (str) – Format string. Consistent with BSE python API.

bs_from_file(fmt='crystal')#

Define a basis set from a file. A wrapper of BasisSetBASE.from_file.

class Crystal_output(output=None)#

Bases: object

This class reads a CRYSTAL output and generates an object.

read_cry_output(output_name)#

Deprecated

get_dielectric_tensor()#

Extracts the dielectric tensor from the output.

Returns:

self.dielectric_tensor (list[float]) – Dielectric tensor values.

get_eigenvectors()#

Extracts eigenvectors from the output.

Returns:
  • self.num_ao (int) – Number of atomic orbitals.

  • self.num_k (int) – Number of k points.

get_code_version()#

Get the CRYSTAL executable and version that produced the output.

Only the banner is scanned — it always precedes the STARTING DATE line, though how far down it sits depends on how much of the input deck the run echoed first.

Returns:

self.code_version (dict) – New attribute. Keys:

  • ‘code’ (str|None): e.g. ‘CRYSTAL23’.

  • ‘version’ (str|None): the release line under the banner, e.g. ‘public : 1.0.1 - Feb 1st, 2017’.

get_hamiltonian()#

Get the Hamiltonian the calculation was run with.

Reads the TYPE OF CALCULATION / ... HAMILTONIAN block printed before the SCF, so it works for any run type. Entries the output does not report are left as None rather than guessed.

Returns:

self.hamiltonian (dict) – New attribute. Keys:

  • ‘method’ (str|None): ‘DFT’ or ‘Hartree-Fock’.

  • ‘exchange’ (str|None): exchange functional, e.g. ‘PERDEW-BURKE-ERNZERHOF’. None for Hartree-Fock.

  • ‘correlation’ (str|None): correlation functional.

  • ‘hybrid_exchange’ (float|None): percentage of Fock exchange, for hybrid functionals only.

  • ‘shell_type’ (str|None): e.g. ‘RESTRICTED CLOSED SHELL’.

  • ‘spin_polarized’ (bool): whether the run is unrestricted.

  • ‘dispersion’ (str|None): dispersion correction, e.g. ‘DFT-D3(BJ)’.

get_kpoint_info()#

Get the reciprocal-space sampling of the SCF.

Returns:

self.kpoint_info (dict) – New attribute. Keys:

  • ‘shrink’ (list[int]|None): Monkhorst-Pack shrinking factors.

  • ‘n_kpoints_ibz’ (int|None): k points in the irreducible Brillouin zone.

  • ‘gilat_shrink’ (int|None): shrinking factor of the Gilat net.

  • ‘n_kpoints_gilat’ (int|None): k points of the Gilat net.

All None for a molecule, which has no k point sampling.

get_basis_info()#

Get the size of the basis set and of the system, as CRYSTAL counts it.

Returns:
  • self.basis_info (dict) – New attribute, with None for anything the

  • output does not report. Keys – ‘n_atoms’, ‘n_shells’, ‘n_ao’,

  • ‘n_electrons’, ‘n_core_electrons’, ‘n_symmops’ (all int|None)

get_scf_settings()#

Get the SCF thresholds and the DFT integration grid size.

Returns:

self.scf_settings (dict) – New attribute. Keys:

  • ‘max_cycles’ (int|None): SCF cycle limit.

  • ‘toldee’ (int|None): n in the 10**-n energy convergence threshold.

  • ‘tolinteg’ (list[int]|None): the five truncation tolerances T1-T5, as positive exponents (CRYSTAL prints them 10**-n but signs the columns inconsistently).

  • ‘grid_points’ (int|None): points in the DFT integration grid. None for Hartree-Fock.

get_run_type()#

Get the task(s) the run performed, as CRYSTAL keywords.

Two sources are used, and a task found by either is reported once:

  • the section banners CRYSTAL prints when it starts a task;

  • the input keywords themselves, when the deck was echoed into the output (many job scripts do, and it is the only way to see tasks that print no banner of their own, such as QHA and SCANMODE).

Nothing is inferred beyond those, so a run whose task cannot be identified returns an empty list rather than a guess.

Returns:
  • self.run_type (list[str]) – New attribute, in the order the tasks

  • run rather than the order they appear in the file. Any of

  • ‘OPTGEOM’, ‘EOS’, ‘ELASTCON’, ‘FREQCALC’, ‘DISPERSI’, ‘QHA’,

  • ‘SCANMODE’, ‘ANHARM’, ‘ANHAPES’, ‘VSCF’, ‘VCI’, ‘VPT2’, ‘CPHF’.

get_calculation_info()#

Summarise how the calculation was set up, in one call.

Convenience wrapper over get_code_version(), get_hamiltonian(), get_kpoint_info(), get_basis_info(), get_scf_settings() and get_run_type() — useful for reporting a run at a glance. Each part is collected independently, so one unparsable section leaves its keys None instead of failing the whole summary.

Returns:
  • self.calculation_info (dict) – New attribute. The union of the keys

  • documented by those methods, plus ‘code’, ‘version’, ‘run_type’

  • and ‘terminated’ (bool, whether the run ended normally)

get_dimensionality()#

Gets the dimensionality of the system.

Returns:

self.dimensionality (int) – Dimensionality of the system.

get_symmops()#

Return the symmetry operators

Returns:

self.symmops (numpy.ndarray) – Symmetry operators.

get_geometry(initial=True, write_gui=False, gui_name=None, symmetry='pymatgen', **kwargs)#

Get the geometry.

Parameters:
  • initial (bool) – Read the initial or last gemetry. Useful in case of geometry optimization.

  • write_gui (bool) – If True, write .gui file

  • gui_name (str) – Valid only if write_gui = True. Gui file is named as gui_name. If None, use basename.gui. The basename is the same as output file.

  • symmetry (str) – Valid only if write_gui = True. “pymatgen” to use symmetry info from a pymatgen SpacegroupAnalyzer; “initial” to use symmetry information on output file. If “None”, no symmetry. Otherwise it is taken from the existing gui file.

  • **kwargs – Valid only if write_gui = True and symmetry = "pymatgen". Passed to Pymatgen SpacegroupAnalyzer object.

Returns:

self.geometry (Structure | Molecule) – A pymatgen Structure or molecule object.

get_last_geom(write_gui_file=False, symm_info='initial')#

Return the last optimised geometry.

Returns:

self.last_geom (list) – To be documented.

get_lattice(initial=True)#

Returns the lattice of the system. Unit: Angstrom.

Parameters:

initial (bool) – Read the initial or last lattice. Useful in case of geometry optimization.

Returns:

self.lattice (np.ndarray) – Lattice of the system.

get_reciprocal_lattice(initial=True)#

Returns the reciprocal lattice of the system. Unit: Angstrom^-1. Reciprocal lattice is consistent with CRYSTAL: 2pi is added.

Parameters:

initial (bool) – Read the initial or last lattice. Useful in case of geometry optimization.

Returns:

self.reciprocal_lattice (np.ndarray) – Lattice of the system.

property sg_number#

CRYSTAL 0~3D space group number. Before geometry editing.

property sg_symbol#

CRYSTAL 0~3D 0~3D space group symbol. Before geometry editing.

property n_atoms#

Number of atoms. After geometry editing.

property atom_symbols#

Atom symbols. After geometry editing.

property atom_numbers#

Conventional atom numbers. After geometry editing.

property atom_positions#

Composite fractional / Cartesian atomic coordinates. Consistent with CRYSTAL definitions. 3D: Fractional; 2D: Frac, Frac, Cart; 1D Frac, Cart, Cart; 0D: Cart, Cart, Cart. After geometry editing (before optimization).

property atom_positions_cart#

Cartesian atomic coordinates. After geometry editing (before optimization).

property atom_positions_frac#

Fractional atomic coordinates. After geometry editing (before optimization).

get_trans_matrix()#

Get cell transformation matrix

Returns:

self.trans_matrix (np.ndarray) – 3*3 array of supercell expansion matrix

get_primitive_geometry(initial=True, write_gui=False, gui_name=None, symmetry='pymatgen', **kwargs)#

Get the primitive geometry, reduced by cell transformation matrix inversed.

Note

This is not the standard primitive cell. This method returns geometry before supercell expansion keywords such as “SUPERCEL” or “SCELPHONO”.

Conventional atomic numbers are not available.

Parameters:
  • initial (bool) – Read the initial or last geometry. Useful in case of geometry optimization.

  • write_gui (bool) – If True, write .gui file

  • gui_name (str) – Valid only if write_gui = True. Gui file is named as “gui_name”. If None, use “basename.gui”. The basename is the same as output file.

  • symmetry (str) – Valid only if write_gui = True. “pymatgen” to use symmetry info from a pymatgen SpacegroupAnalyzer; “initial” to use symmstry information on output file. If None, no symmetry. Otherwise it is taken from the existing gui file.

  • **kwargs – Valid only if write_gui = True and symmetry = 'pymatgen'. Passed to Pymatgen SpacegroupAnalyzer object.

Returns:

self.primitive_geometry (Structure | Molecule) – A pymatgen Structure or molecule object.

get_primitive_lattice(initial=True)#

Returns the primitive lattice of the system reduced by cell transformation matrix inverse. Unit: Angstrom.

Parameters:

initial (bool) – Read the initial or last lattice. Useful in case of geometry optimization.

Returns:

self.primitive_lattice (np.ndarray) – Lattice of the system.

get_primitive_reciprocal_lattice(initial=False)#

Returns the primitive reciprocal lattice of the system before expansion by cell transformation matrix inverse. Unit: Angstrom^-1.

Parameters:

initial (bool) – Read the initial or last lattice. Useful in case of geometry optimization.

Returns:

self.primitive_reciprocal_lattice (np.ndarray) – Lattice of the system.

get_config_analysis(return_multiplicity=False)#

Return the configuration analysis for solid solutions (CONFCON keyword in input)

Parameters:
  • return_multiplicity (bool, optional) – Return multiplicity

  • information (default is False)

Returns:

list or str – Configuration analysis if available, or a warning message

get_convergence(history=False)#

The upper level of get_scf_convergence and get_opt_convergence. For analysing the geometry and energy convergence.

Note

It might not work well with SCF / OPT cycles of multiple systems such as PREOPTGEOM + EOS calculations

Parameters:

history (bool) – If true, the convergence history of optimisation (energy,gradient, displacement) / SCF is returned.

Returns:
  • self (Crystal_output) – New attributes listed below

  • self.final_energy (float) – eV

For other attributes, see get_scf_convergence and get_opt_convergence methods on the same page.

get_scf_convergence(all_cycles=False)#

Returns the scf convergence energy and energy difference. A wrapper of CRYSTALClear.base.SCFBASE.read_convergence.

Parameters:

all_cycles (bool, optional) – Return all SCF steps for a geometry opt. The “ONELOG’” CRYSTAL keyword is needed.

Returns:
  • self (Crystal_output) – New attributes listed below

  • self.scf_cycles (int | array) – Number of cycles. Array if all_cycles=True.

  • self.scf_status (str | list) – “terminated”, “converged”, “too many cycles” and “unknown”. List if all_cycles=True.

  • self.scf_energy (array) – SCF energy convergence. Unit: eV

  • self.scf_deltae (array) – Energy difference. Unit: eV

get_fermi_energy(history=False)#

Returns the system Fermi energy.

Parameters:

history (bool) – Whether to read the convergence history of Fermi energy.

Returns:

self.fermi_energy (float | array) – Fermi energy of the system. For spin-polarized insulating systems, self.fermi_energy would be either a 2*1 array (history=False) or a nCYC*2 array (history=True).

get_band_gap(history=False)#

Returns the system band gap.

Parameters:

history (bool) – Whether to read the convergence history of band gap.

Returns:

self.band_gap (float | array) – Band gap of the system. For spin-polarized systems, self.band_gap would be either a 2*1 array (history=False) or a nCYC*2 array (history=True).

get_mulliken_charges()#

Return the atomic Mulliken charges (PPAN keyword in input).

Returns:

self.mulliken_charges (array) – natom*1 for non spin-polarised systems. natom*3 for spin-polarised systems. [total, \(alpha\), \(beta\)].

get_final_energy()#

Get the final energy of the system. A wrapper of self.get_convergence.

Returns:

self.final_energy (float) – The final energy of the system.

get_num_cycles()#

Deprecated

Returns:

self.scf_cycles (int) – Number of SCF cycles.

get_opt_convergence_energy()#

Deprecated. Returns the energy for each opt step.

Returns:

self.opt_energy (array) – Energy for each optimization step.

get_opt_convergence(primitive=False, scf_history=False, write_gui=False, gui_name=None, symmetry='pymatgen', **kwargs)#

Returns optimisation convergence. A wrapper of CRYSTALClear.base.OptBASE.read_convergence.

Parameters:
  • primitive (bool) – Restore the primitive cell (multiply by the cell transform matrix inversed)

  • scf_history (bool) – Read SCF history of each optimisation step. Keyword “ONELOG” is needed. Please refer to self.get_scf_convergence(all_cycles=True) method.

  • write_gui (bool) – If True, write .gui file of each step

  • gui_name (str) – Valid only if write_gui = True. Gui file is named as “gui_name-optxxx.gui”. If “None”, use “basename-optxxx.gui”. The basename is the same as output.

  • symmetry (str) – Valid only if write_gui = True. “pymatgen” to use symmetry info from a pymatgen SpacegroupAnalyzer; “initial” to use symmetry information on output file. If “None”, no symmetry. Otherwise it is taken from the existing gui file.

  • **kwargs – Valid only if write_gui = True and symmetry = 'pymatgen'. Passed to Pymatgen SpacegroupAnalyzer object.

Returns:
  • self (Crystal_output) – New attributes listed below

  • self.opt_cycles (int) – Number of cycles.

  • self.opt_status (str) – “terminated”, “converged”, “failed” and

  • “unknown”

  • self.opt_energy (array) – Total energy convergence. Unit: eV

  • self.opt_deltae (array) – Total energy difference. Unit: eV

  • self.opt_geometry (list) – Pymatgen structure at each step.

  • self.opt_maxgrad (array) – Maximum gradient convergence. Unit: Hartree/Bohr

  • self.opt_rmsgrad (array) – RMS gradient convergence. Unit: Hartree/Bohr

  • self.opt_maxdisp (array) – Maximum displacement convergence. Unit: Bohr

  • self.opt_rmsdisp (array) – RMS displacement convergence. Unit: Bohr

get_forces(initial=True, grad=False)#

Read forces.

Parameters:
  • initial (bool) – Return forces from the initial calculation. If initial=False, return to the last forces, which is valid only for geometry optimizations and the keyword “ONELOG” is needed in .d12 file.

  • grad (bool) – Return gradient convergence history. For optimizations only.

Returns:
  • self (Crystal_output) – New attributes listed below

  • self.forces_atoms (array) – natom*3 array. Atomic forces. Unit: Hartree/Bohr

  • self.forces_cell (array) – 3*3 array. Cell forces, 3D only. Unit: Hartree/Bohr

  • self.opt_maxgrad (array) – Maximum gradient convergence. Unit: Hartree/Bohr

  • self.opt_rmsgrad (array) – RMS gradient convergence. Unit: Hartree/Bohr

get_phonon(read_eigvt=True, rm_imaginary=True, imaginary_tol=-0.0001, eigvt_amplitude=1.0)#

Read phonon-related properties from output file.

Parameters:
  • read_eigvt (bool) – Whether to read phonon eigenvectors and normalize it to 1.

  • rm_imaginary (bool) – Remove the modes with negative frequencies and set all the related properties to NaN.

  • imaginary_tol (float) – Valid only if rm_imaginary = True. The threshold of negative frequencies.

  • eigvt_amplitude (float | str) – Valid if read_eigvt = True. Amplitude of normalization, or “classical”, “classical-rev”, classical amplitude and revmove classical amplitude.

Note

In QHA calculations, the “Q point” dimension refer to harmonic phonons computed. In other cases it refers to points in reciprocal space.

Returns:
  • self (Crystal_output) – New attributes listed below

  • self.edft (np.array) – \(E_{0}\) Energy with empirical correction. Unit: kJ/mol.

  • self.nqpoint (int) – Number of Q points.

  • self.qpoint (list[list[array[float], float]]) – A nqpoint*1 list of 2*1 list whose first element is a 3*1 array of fractional coordinates and the second is its weight.

  • self.nmodes (int) – Number of vibrational modes.

  • self.frequency (np.array) – nqpoint*nmode array of harmonic vibrational frequency. Unit: THz.

  • self.intens (np.array) – Harmonic intensity. Unit: km/mol.

  • self.IR (np.array) – Boolean values specifying whether the mode is IR active.

  • self.Raman (np.array) – Boolean values specifying whether the mode is Raman active.

  • self.eigenvector (np.array) – Valid if read_eigvt = True. 3D array containing normal modes for each Q point (Q point; normal mode; components). Normalized to 1.

get_q_info()#

Deprecated.

get_mode()#

Deprecated.

get_phonon_eigenvector()#

Deprecated.

get_IR()#

Extract harmonic IR spectrum from CRYSTAL output.

Returns:

self.IR_HO_0K (np.array) – 2D array containing harmonic IR frequency and intensities computed at 0 K.

get_Raman()#

Extract harmonic Raman spectrum from CRYSTAL output.

Returns:
  • self (Crystal_output) – New attributes listed below.

  • self.Ram_HO_0K_tot (np.array) – 2D array containing harmonic Raman frequency and intensities (total) computed at 0 K.

  • self.Ram_HO_0K_par (np.array) – 2D array containing harmonic Raman frequency and intensities (parallel) computed at 0 K.

  • self.Ram_HO_0K_per (np.array) – 2D array containing harmonic Raman frequency and intensities (perpendicular) computed at 0 K.

  • self.Ram_HO_0K_comp_xx (np.array) – 2D array containing harmonic Raman frequency and intensities (xx component) computed at 0 K.

Note

Please, note that for the sake of brevity, only the xx component attributes have been listed here, but the yy, zz, xy, xz, yz components are available as well.

get_ADP()#

Extract the atomic displacement parameters (ADP) from a FREQCALC run.

Reads every block CRYSTAL prints under the ADP keyword: one per temperature requested by TEMPERAT, each holding the ADP tensor, the principal values of the displacement ellipsoid and the rotation tensor carrying the cartesian axes onto the principal ones, for every atom in the cell.

The tensors are in the cartesian frame. Converting them to the crystallographic basis a CIF wants is a separate step, and needs the cell.

Returns:
  • self (Crystal_output) – New attributes listed below. All empty

  • arrays when the output has no ADP section.

  • self.adp_temperature (np.array) – ntemp temperatures. Unit: K.

  • self.adp_active_modes (np.array) – ntemp counts of the modes included at each temperature.

  • self.adp (np.array) – ntemp*natom*3*3 ADP tensors, cartesian. Unit: Angstrom^2.

  • self.adp_principal (np.array) – ntemp*natom*3 principal values of each displacement ellipsoid. Unit: Angstrom^2.

  • self.adp_axes (np.array) – ntemp*natom*3*3 rotation tensors, whose rows are the ellipsoid’s principal axes in cartesian coordinates.

get_anh_const()#

Extract anharmonic terms of the PES (ANHAPES).

Returns:
  • self (Crystal_output) – New attributes listed below.

  • self.PES_single (np.array) – 2D array containing single-mode anharmonic force constants (col 1: mode; cols 2-3: cubic and quartic single-mode terms of the PES, respectively).

  • self.PES_couple (np.array) – 2D array contaning anharmonic force constants coupling two phonon modes (col 1: mode I; col 2: mode J; cols 3-7: two-mode anharmonic force constants of type IIJ, IJJ, IIIJ, IJJJ and IIJJ, respectively.)

  • self.PES_triplet (np.array) – 2D array contaning anharmonic force constant coupling three phonon modes (col 1: mode I; col 2: mode J; col 3: mode K; cols 4-7: three-mode anharmonic force constants of type IJK, IIJK, IJJK and IJKK, respectively)

get_vci()#

Extract VCI states (in development).

Returns:
  • self (Crystal_output) – New attributes listed below.

  • self.VCI_label (np.array) – Label of each state, as printed by CRYSTAL. It restarts from 1 in every symmetry block, so it identifies a state only together with self.VCI_irrep.

  • self.VCI_state (np.array) – 3D array of the printed contributions to each state (axis 0), holding their configuration index (axis 1 index 0) and the corresponding VCI coefficient (axis 1 index 1). States printing fewer contributions than the longest one are padded with a null configuration index.

  • self.VCI_energy (np.array) – Energy of each state relative to the zero point energy, in cm^-1.

  • self.VCI_nconfs (int) – Total number of configurations.

  • self.VCI_list_conf (np.array) – 2D array of the occupation number vector of every configuration.

  • self.VCI_basis (str) – Zeroth-order basis the VCI expansion is built on, either ‘HO’ (VCI@HO) or ‘VSCF’ (VCI@VSCF).

  • self.VCI_zpe (float) – Vibrational zero point energy in cm^-1.

  • self.VCI_irrep (np.array) – Irrep the VCI matrix block each state comes from, 0 when symmetry is not exploited.

  • self.VCI_sym_conf (dict) – Configuration list of each irrep, keyed by irrep. The configuration indices held by self.VCI_state are local to these lists, not to self.VCI_list_conf, whenever the VCI matrix is block-diagonalised. Empty dictionary when symmetry is not exploited.

get_anh_spectra()#

Extract anharmonic (VSCF and VCI) IR and Raman spectra (in development).

Returns:
  • self (Crystal_output) – New attributes listed below.

  • self.IR_HO_0K (np.array) – 2D array containing harmonic IR frequency and intensities computed at 0 K.

  • self.IR_HO_T (np.array) – 2D array containing harmonic IR frequency and intensities computed at temperature T.

  • self.IR_VSCF_0K (np.array) – 2D array containing VSCF IR frequency and intensities computed at 0 K.

  • self.IR_VSCF_T (np.array) – 2D array containing VSCF IR frequency and intensities computed at temperature T.

  • self.IR_VCI_0K (np.array) – 2D array containing VCI IR frequency and intensities computed at 0 K.

  • self.IR_VCI_T (np.array) – 2D array containing VCI IR frequency and intensities computed at temperature T.

  • self.Ram_HO_0K_tot (np.array) – 2D array containing harmonic Raman frequency and intensities (total) computed at 0 K.

  • self.Ram_HO_0K_per (np.array) – 2D array containing harmonic Raman frequency and intensities (perpendicular component ) computed at temperature 0 K.

  • self.Ram_HO_0K_par (np.array) – 2D array containing harmonic Raman frequency and intensities (parallel component ) computed at temperature 0 K.

  • self.Ram_HO_T_tot (np.array) – 2D array containing harmonic Raman frequency and intensities (total) computed at temperature T.

  • self.Ram_HO_T_per (np.array) – 2D array containing harmonic Raman frequency and intensities (perpendicular component ) computed at temperature T.

  • self.Ram_HO_T_par (np.array) – 2D array containing harmonic Raman frequency and intensities (parallel component ) computed at temperature T.

  • self.Ram_VSCF_0K_tot (np.array) – 2D array containing VSCF Raman frequency and intensities (total) computed at 0 K. self.Ram_VSCF_0K_per (array[float]): 2D numpy array containing VSCF Raman frequency and intensities (perpendicular component) computed at 0 K.

  • self.Ram_VSCF_0K_par (np.array) – 2D array containing VSCF Raman frequency and intensities (parallel component) computed at 0 K.

  • self.Ram_VSCF_T_tot (np.array) – 2D array containing VSCF Raman frequency and intensities (total) computed at temperature T. self.Ram_VSCF_T_per (array[float]): 2D numpy array containing VSCF Raman frequency and intensities (perpendicular component) computed at temperature T.

  • self.Ram_VSCF_T_par (np.array) – 2D array containing VSCF Raman frequency and intensities (parallel component) computed at temperature T.

  • self.Ram_VPT2_0K_tot (np.array) – 2D array containing VPT2 Raman frequency and intensities (total) computed at 0 K. self.Ram_VPT2_0K_per (array[float]): 2D numpy array containing VSCF Raman frequency and intensities (perpendicular component) computed at 0 K.

  • self.Ram_VPT2_0K_par (np.array) – 2D array containing VPT2 Raman frequency and intensities (parallel component) computed at 0 K.

  • self.Ram_VPT2_T_tot (np.array) – 2D array containing VPT2 Raman frequency and intensities (total) computed at temperature T. self.Ram_VPT2_T_per (array[float]): 2D numpy array containing VSCF Raman frequency and intensities (perpendicular component) computed at temperature T.

  • self.Ram_VPT2_T_par (np.array) – 2D array containing VPT2 Raman frequency and intensities (parallel component) computed at temperature T.

  • self.Ram_VCI_0K_tot (np.array) – 2D array containing VCI Raman frequency and intensities (total) computed at 0 K.

  • self.Ram_VCI_0K_per (np.array) – 2D array containing VCI Raman frequency and intensities (perpendicular component) computed at 0 K.

  • self.Ram_VCI_0K_par (np.array) – 2D array containing VCI Raman frequency and intensities (parallel component) computed at 0 K.

  • self.Ram_VCI_T_tot (np.array) – 2D array containing VCI Raman frequency and intensities (total) computed at temperature T.

  • self.Ram_VCI_T_per (np.array) – 2D array containing VCI Raman frequency and intensities (perpendicular component) computed at temperature T.

  • self.Ram_VCI_T_par (np.array) – 2D array containing VCI Raman frequency and intensities (parallel component) computed at temperature T.

  • self.Ram_HO_0K_comp_xx (np.array) – 2D array containing harmonic Raman frequency and intensities (xx component) computed at 0 K.

  • self.Ram_HO_T_comp_xx (np.array) – 2D array containing harmonic Raman frequency and intensities (xx component) computed at temperature T.

  • self.Ram_VSCF_0K_comp_xx (np.array) – 2D array containing VSCF Raman frequency and intensities (xx component) computed at 0 K.

  • self.Ram_VSCF_T_comp_xx (np.array) – 2D array containing VSCF Raman frequency and intensities (xx component) computed at temperature T.

  • self.Ram_VCI_0K_comp_xx (np.array) – 2D array containing VCI Raman frequency and intensities (xx component) computed at 0 K.

  • self.Ram_VCI_T_comp_xx (np.array) – 2D array containing VCI Raman frequency and intensities (xx component) computed at temperature T.

Note

Please, note that for the sake of brevity, only the xx Raman component attributes have been listed here, but the yy, zz, xy, xz, yz components are available as well.

get_anscan(anscanwf)#

Extracts the results of an ANSCAN run: the potential scanned along one normal mode, its Taylor expansion, the anharmonic vibrational states and their wavefunctions.

Everything is stored in the dimensionless normal coordinate xi that ANSCAN itself uses, i.e. the [DISPLAC] column of the output, which measures the displacement in units of the classical amplitude at the quantum ground state energy.

Parameters:

anscanwf (str) – Path to the ANSCANWF.DAT file of the run.

Returns:
  • self.rangescan (list[float]) – [first, last] displacement of the scan.

  • self.displac (np.array) – Displacements the scan was run on.

  • self.anhpot (np.array) – Scanned potential, cm^-1.

  • self.harmpot (np.array) – Harmonic potential, cm^-1.

  • self.energy (list[float]) – Anharmonic vibrational states, cm^-1. The first entry is the ground state (the ZPE printed by CRYSTAL).

  • self.force_const (list[float]) – Derivatives of the potential with respect to xi, cm^-1, ordered by (and indexed by) their order.

  • self.harm_freq (float) – Harmonic frequency of the scanned mode, cm^-1, negative if the mode is imaginary.

  • self.wf (np.array) – Expansion coefficients of the anharmonic wavefunctions over the harmonic basis, (n_basis, n_states).

  • self.alpha (float) – ALPHA constant printed in ANSCANWF.DAT.

get_elatensor()#

Extracts the elastic tensor from CRYSTAL output.

Returns:

self.elatensor (np.array) – Symmetrized 6x6 elastic tensor.

get_EOS()#

Extracts the Equation of state output data and corresponding fittings

Returns:
  • self (Crystal_output) – New attributes listed below.

  • self.VvsE (np.array) – numpy array containing the computed volumes and the corresponding energies in the first and second column respectively

  • self.murnaghan (np.array) – numpy array containing the fitted thermodynamics functions with the Murnaghan Equation

  • self.bmurnaghan (np.array) – numpy array containing the fitted thermodynamics functions with the Birch-Murnaghan Equation

  • self.pt (np.array) – numpy array containing the fitted thermodynamics functions with the Poirier-Tarantola Equation

  • self.vinet (np.array) – numpy array containing the fitted thermodynamics functions with the Vinet Equation

get_masses()#

Docs will be provided shortly

get_locmodes()#

Docs will be provided shortly

class Properties_input(input_name=None)#

Bases: object

Create a properties_input object

from_file(input_name)#

Read the prope fo forrrties input from a file.

Parameters:

input_name (str) – Name of the input file.

Returns:

self (Properties_input) – Properties_input object.

make_newk_block(shrink1, shrink2, Fermi=1, print_option=0)#

Returns the newk block.

Parameters:
  • shrink1 (int) – First newk shrinking factor.

  • shrink2 (int) – Second newk shrinking factor.

  • Fermi (int) – Fermi recalculation option (default is 1).

  • print_option (int) – Properties printing option (default is 0).

make_bands_block(k_path, n_kpoints, first_band, last_band, print_eig=0, print_option=1, precision=5, title='BAND STRUCTURE CALCULATION')#

Returns the bands block for a bands calculation.

Parameters:
  • k_path (list or HighSymmKpath) – k-path for bands calculation.

  • n_kpoints (int) – Number of k-points along the path.

  • first_band (int) – Index of the first band.

  • last_band (int) – Index of the last band.

  • print_eig (int) – Printing options for eigenvalues (default is 0).

  • print_option (int) – Properties printing options (default is 1).

  • precision (int) – Number of zeros in the calculation of the gcd

  • title (str) – Title of the calculation (default is “BAND STRUCTURE CALCULATION”).

make_doss_block(n_points=200, band_range=None, e_range=None, plotting_option=2, poly=12, print_option=1)#

Returns the doss block for a doss calculation.

Parameters:
  • n_points (int) – Number of points in the DOS plot (default is 200).

  • band_range (list or tuple) – Range of bands to include in the DOS calculation (default is None).

  • e_range (list or tuple) – Energy range for the DOS calculation (default is None).

  • plotting_option (int) – DOS plotting options (default is 2).

  • poly (int) – Degree of the polynomial for smearing (default is 12).

  • print_option (int) – Properties printing options (default is 1).

make_pdoss_block(projections, proj_type='atom', output_file=None, n_points=200, band_range=None, e_range=None, plotting_option=2, poly=12, print_option=1)#

Returns the pdoss block for a pdoss calculation.

Parameters:
  • projections (dict) – Dictionary specifying the projections for the pdoss calculation.

  • proj_type (str) – Type of projection (“atom” or “site”, default is “atom”).

  • output_file (str) – Output file name (default is None).

  • n_points (int) – Number of points in the DOS plot (default is 200).

  • band_range (list or tuple) – Range of bands to include in the DOS calculation (default is None).

  • e_range (list or tuple) – Energy range for the DOS calculation (default is None).

  • plotting_option (int) – DOS plotting options (default is 2).

  • poly (int) – Degree of the polynomial for smearing (default is 12).

  • print_option (int) – Properties printing options (default is 1).

write_properties_input(input_name)#

Writes the properties input to a file.

Parameters:

input_name (str) – Name of the output file.

class Properties_output#

Bases: object

Creates a Properties_output object.

read_file(properties_output)#

Parse the properties output file.

Parameters:

properties_output (str) – Properties output file.

Returns:

Properties_output – Updated Properties_output object.

read_electron_band(band_file, output=None)#

Generate bands object from CRYSTAL BAND.DAT or fort.25 file. Energy unit: eV. E Fermi is aligned to 0.

Parameters:
  • band_file (str) – Name of BAND.DAT or fort.25 file

  • output (str) – Properties output file (.outp or .out). For 3D, k coordinates and geometry information.

Returns:

self.bands (BandsBASE) – A Bands base object

read_electron_dos(properties_output)#

Generate doss object from CRYSTAL DOSS.DAT or fort.25 file. Energy unit: eV. E Fermi is aligned to 0.

Parameters:

properties_output (str) – File name

Returns:

self.doss (DOSBASE) – A DOS base object

read_cry_bands(properties_output)#

Deprecated.

read_cry_doss(properties_output)#

Deprecated.

read_cry_contour(properties_output)#
Read the CRYSTAL contour files (SURFRHOO, SURFLAPP, SURFLAPM, SURFGRHO,

SURFELFB, SURFVIRI, SURFGKIN, SURFKKIN) to create the contour objects.

Parameters:

properties_output (str) – Properties output file.

Returns:

Properties_output – Updated Properties_output object.

read_cry_xrd_spec(properties_output)#

Read XRD spectrum data from a file.

Parameters:

properties_output (str) – Path to the properties output file.

Returns:

self – The modified object with extracted XRD spectrum data.

read_cry_rholine(properties_output)#

Read density line data from a file.

Parameters:

properties_output (str) – Path to the properties output file.

Returns:

self – Modified object with extracted density line data.

read_cry_seebeck(properties_output)#

Read Seebeck coefficient data from a file.

Parameters:

properties_output (str) – Path to the properties output file.

Returns:

self – Modified object with extracted Seebeck coefficient data.

read_cry_sigma(properties_output)#

Read electrical conductivity data from a file.

Parameters:

properties_output (str) – Path to the properties output file.

Returns:

self – Modified object with extracted electrical conductivity data.

read_cry_lapl_profile(properties_output)#

Read Laplacian profile data from a file.

Parameters:

properties_output (str) – Path to the properties output file.

Returns:

self – Modified object with extracted Laplacian profile data.

read_cry_density_profile(properties_output)#

Read density profile data from a file.

Parameters:

properties_output (str) – Path to the properties output file.

Returns:

self – Modified object with extracted density profile data.

read_vecfield(properties_output, which_prop)#

Reads the fort.25 file to return data arrays containing one or more vectiorial density properties.

Parameters:
  • properties_output (str) – Properties output file.

  • which_prop (str) – Density property selected by the user: “m” (magnetization), “j” (spin current), “J” (spin current density)

Returns:

Properties_output (str) – fort.25 output file.

read_cry_ECHG(properties_output)#

Read density profile data from a file.

Parameters:

properties_output (str) – Path to the fort.25 file.

Returns:

self – Modified object with extracted ECHG data.

read_cry_ECHG_delta(properties_output1, properties_output2)#

Read density profile data from two files and plots the difference. It is important that the header stays the same for the two output files.

Parameters:
  • properties_output1 (str) – Path to first fort.25 file.

  • properties_output2 (str) – Path to second fort.25 file.

Returns:

self – Modified object with extracted ECHG data.

read_topond_trho(properties_output)#
Read the TOPOND TRHO run output file to create associated DataFrames:
  • Coordinates for the nuclei at the unitcell (nuclei_df)

  • Data of the critical points (CP) discoverd (topo_df)

Parameters:

properties_output (str) – Properties output file.

Returns:

Properties_output – Updated Properties_output object.

topond_viz_file(cp_type='ALL', add_atoms=False, file_type='xyz')#

Given the existence of TOPOND TRHO DataFrames, write files with the critical points (CP) coordinates for further visualization.

Parameters:
  • cp_type (str) –

    Generate file for a given type CP. Options: “ALL” to include all CP in the system,

    ”BCP” for Bond CPs, “RCP” for Ring CPs, “CCP” for Cage CPs, “NNA” for Nuclear/Non-Nuclear Atractors.

  • add_atoms (bool) – Include the Nuclei atoms read from the TOPOND output in the same file.

  • file_type (str) – Type of output file to be generated.

Returns:

ase_obj – ASE object.

read_topond_tlap(properties_output)#
Read the TOPOND TLAP run output file to create associated DataFrames:
  • Coordinates for the nuclei at the unitcell (nuclei_df)

  • Data of the laplacian critical points (CP) discoverd (tlap_df)

Parameters:

properties_output (str) – Properties output file.

Returns:

Properties_output – Updated Properties_output object.

topond_viz_tlap_file(cp_type='+3', add_atoms=False, file_type='xyz')#

Given the existence of TOPOND TLAP DataFrames, write files with the critical points (CP) coordinates for further visualization.

Parameters:
  • cp_type (str) –

    Generate file for a given type CP. Options: ‘ALL’ to include all CP in the system,

    ’+3’ for CPs with +3 signature, ‘+1’ for CPs with +1 signature, ‘-1’ for CPs with -1 signature, ‘+1’ for CPs with -3 signature.

  • add_atoms (bool) – Include the Nuclei atoms read from the TOPOND output in the same file.

  • file_type (str) – Type of output file to be generated.

Returns:

ase_obj – The generated ASE object.

class Crystal_gui#

Bases: object

This class can read a CRYSTAL gui file into an object or substrate information of the object to generate a gui file.

read_gui(gui_file)#

This is used mainly to convert the object into an ASE or pymatgen object.

Parameters:

gui_file (str) – CRYSTAL structure (gui) file

write_gui(gui_file, symm=True, pseudo_atoms=[])#

Write a CRYSTAL gui file (to file)

Parameters:
  • gui_file (str) – Name of the gui that is going to be written (including .gui).

  • symm (bool) – Whether to include symmetry operations (default is True).

  • pseudo_atoms (list[int]) – A list of atoms whose core is described by a pseudopotential

class Crystal_density#

Bases: object

Read density data from a .f98 file.

read_cry_irr_density(fort98_unit)#

Read density profile data from a CRYSTAL .f98 file. :param fort98_unit: File containing the formatted density matrix. :type fort98_unit: str

Returns:

None

Note: This is a work in progress. If you are interested in this functionality, please open an Issue on GitHub.

cry_combine_density(density1, density2, density3, new_density='new_density.f98', spin_pol=False)#

Combine density matrix files.

Parameters:
  • density1 (str) – First density matrix file.

  • density2 (str) – Second density matrix file.

  • density3 (str) – Density matrix file for the whole system.

  • new_density (str, optional) – Name of the new density matrix (default is “new_density.f98”).

  • spin_pol (bool, optional) – Specifies if the system is spin polarized (default is False).

Returns:

None

Note

This is a work in progress. If you are interested in this functionality, please open an Issue on GitHub.

write_cry_density(fort98_name, new_p, new_fort98)#

Write the formatted density matrix.

Parameters:
  • fort98_name (str) – Name of the previous density matrix file.

  • new_p (list) – New density matrix.

  • new_fort98 (str) – Name of the new density matrix file.

  • Returns

  • None

Note

This is a work in progress. If you are interested in this functionality, please open an Issue on GitHub.

class External_unit#

Bases: object

read_external_unit(external_unit)#
read_cry_irspec(external_unit)#

Reads the IRSPEC.DAT unit produced by CRYSTAL (IRSPEC keyword).

Parameters:

external_unit (str) – Path of the IRSPEC.DAT file.

Returns:

self – Modified object to be read by plot_cry_irspec().

read_cry_ramspec(external_unit)#

Reads the RAMSPEC.DAT unit produced by CRYSTAL (RAMSPEC keyword).

Parameters:

external_unit (str) – Path of the RAMSPEC.DAT file.

Returns:

self – Modified object to be read by plot_cry_ramspec().

read_phonon_band(band_file, output=None)#

Generate bands object from CRYSTAL PHONBAND.DAT or fort.25 file. Energy unit: eV. E Fermi is aligned to 0.

Parameters:
  • band_file (str) – Name of PHONBAND.DAT or fort.25 file

  • output (str) – Properties output file (.outp or .out). For 3D, k coordinates and geometry information.

Returns:

self.bands (BandsBASE) – A Bands base object.

read_phonon_dos(external_unit)#

Generate doss object from CRYSTAL PHONONDOSS.DAT or fort.25 file. Energy unit: eV. E Fermi is aligned to 0.

Parameters:

properties_output (str) – File name.

Returns:

self.doss (DOSBASE) – A DOS base object.