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

CRYSTALClear.plot#

Functions to visualize physical properties computed with CRYSTAL .

plot_dens_ECHG(obj_echg, levels=150, xticks=5, yticks=5, cmap_max=None, cmap_min=None)#

Plots the 2D ECHG density map from a fort.25 file.

Args:

obj_echg (crystal_io.Properties_output): Properties output object. levels (int or array-like, optional): Determines the number and positions of the contour lines/regions. Default is 150. xticks (int, optional): Number of ticks in the x direction. Default is 5. yticks (int, optional): Number of ticks in the y direction. Default is 5. cmap_max(float, optional): Maximum value used for the colormap. Default is None. cmap_min(float, optional): Minimun value used for the colormap. Default is None.

Returns:
  • matplotlib.figure.Figure

  • matplotlib.axes.Axes

plot_vecfield2D_m(header, dens, quivscale, levels=150)#

Plots the 2D magnetization vector field.

Parameters:
  • header (list) – List containing information about the fort.25 header.

  • dens (numpy.ndarray) – Array containing the vector field data.

  • quivscale (float) – Scale factor for the quiver plot.

  • levels (int or array-like, optional) – Determines the number and positions of the contour lines/regions.

Returns:

matplotlib.figure.Figure

plot_vecfield2D_j(header, dens, quivscale, levels=150)#

Plots the 2D vector field of the spin current.

Parameters:
  • header (list) – List containing information about the fort.25 header.

  • dens (numpy.ndarray) – Array representing the vector field.

  • quivscale (float) – Scale factor for the quiver plot.

  • levels (int or array-like, optional) – Determines the number and positions of the contour lines/regions.

Returns:

matplotlib.figure.Figure

plot_vecfield2D_J(header, dens_JX, dens_JY, dens_JZ, quivscale, levels=150)#

Plots the 2D spin current density vector fields.

Parameters:
  • header (list) – List containing information about the fort.25 header.

  • dens_JX (numpy.ndarray) – Array representing the X-component of the spin current density.

  • dens_JY (numpy.ndarray) – Array representing the Y-component of the spin current density.

  • dens_JZ (numpy.ndarray) – Array representing the Z-component of the spin current density.

  • quivscale – Scale factor for the quiver plot.

  • levels (int or array-like, optional) – Determines the number and positions of the contour lines/regions.

Returns:
  • JX (matplotlib.figure.Figure)

  • JY (matplotlib.figure.Figure)

  • JZ (matplotlib.figure.Figure)

plot_phonon_band(bands, unit='cm-1', k_labels=None, mode='single', not_scaled=False, freq_range=None, k_range=None, color='blue', labels=None, linestl='-', linewidth=1, line_freq0=None, title=None, figsize=None, scheme=None, sharex=True, sharey=True, fontsize=12)#

A wrapper of plot_cry_bands for phonon band structure.

Parameters:
  • bands (BandsBASE|list) – Bands object generated by CRYSTALClear.crystal_io.Crystal_output.read_pband or a list of BandsBASE objects.

  • unit (str) – The unit of frequency. Can be ‘cm-1’ or ‘THz’.

  • k_labels (list) – A list of high-symmetric k point labels. Greek alphabets should be, for example, ‘Gamma’.

  • mode (str) – The plotting mode. Possible values are ‘single’, ‘multi’, and ‘compare’.

  • not_scaled (bool) – Whether to scale the x-axis for different volumes.

  • energy_range (array) – A 2x1 array specifying the energy range.

  • k_range (array) – A 2x1 array specifying the k-range.

  • color (str|list) – Color of plot lines. Should be consistent with bands.

  • labels (str|list) – Plot legend. Should be consistent with bands.

  • linestl (str|list) – Linestyle string. Should be consistent with bands.

  • linewidth (float) – The width of the plot lines.

  • line_freq0 (str) – The color of the frequency=0 line.

  • title (str) – The title of the plot.

  • figsize (list) – The figure size specified as [width, height].

  • scheme (list|tuple) – The layout of subplots.

  • sharex (bool) – Whether to share the x-axis among subplots.

  • sharey (bool) – Whether to share the y-axis among subplots.

  • dpi (int) – Dots per inch resolution of the saved file.

  • fontsize (int) – Fontsize of the axis labels.

  • transparency (bool) – Background transparency of the saved file,

Returns:

Matplotlib object

Raises:

ValueError – If the specified unit is unknown.

plot_electron_band(bands, unit='eV', k_labels=None, mode='single', not_scaled=False, energy_range=None, k_range=None, color='blue', labels=None, linestl='-', linewidth=1, fermi='forestgreen', fermiwidth=1.5, fermialpha=1, title=None, figsize=None, scheme=None, sharex=True, sharey=True, fontsize=12)#

A wrapper of plot_cry_bands for electron band structure.

Parameters:
  • bands (BandsBASE|list) – Bands object generated by CRYSTALClear.crystal_io.Properties_output.read_bands or a list of BandsBASE objects.

  • unit (str) – The unit of energy. Can be ‘eV’ or ‘Hartree’.

  • k_labels (list) – A list of high-symmetric k point labels. Greek alphabets should be, for example, ‘Gamma’.

  • mode (str) – The plotting mode. Possible values are ‘single’, ‘multi’, and ‘compare’.

  • not_scaled (bool) – Whether to scale the x-axis for different volumes.

  • energy_range (array) – A 2x1 array specifying the energy range.

  • k_range (array) – A 2x1 array specifying the k-range.

  • color (str|list) – Color of plot lines. Should be consistent with bands.

  • labels (str|list) – Plot legend. Should be consistent with bands.

  • linestl (str|list) – Linestyle string. Should be consistent with bands.

  • linewidth (float) – The width of the plot lines.

  • fermi (str) – The color of the Fermi level line.

  • fermiwidth (float) – The width of the fermi line.

  • fermialpha (float) – Opacity of the fermi level 0-1.

  • title (str) – The title of the plot.

  • figsize (list) – The figure size specified as [width, height].

  • scheme (list|tuple) – The layout of subplots.

  • sharex (bool) – Whether to share the x-axis among subplots.

  • sharey (bool) – Whether to share the y-axis among subplots.

  • dpi (int) – Dots per inch resolution of the saved file.

  • fontsize (int) – Fontsize of the axis labels

  • transparency – Background Transparency of the saved file.

Returns:

Matplolib object

Raises:

ValueError – If the specified unit is unknown.

plot_electron_dos(doss, unit='eV', beta='up', overlap=False, prj=None, energy_range=None, dos_range=None, color='blue', labels=None, linestl=None, linewidth=1, fermi='forestgreen', title=None, figsize=None)#

A wrapper of plot_cry_doss for electron density of states.

Parameters:
  • doss (DOSBASE) – DOS obect generated by code:CRYSTALClear.crystal_io.Properties_output.read_doss. Or a list of DOSBASE objects.

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

  • beta (str) – Plot spin-down state ‘up’ or ‘down’

  • overlap (bool) – Plotting multiple lines into the same figure

  • prj (list) – Index of selected projection. Consistent with the index of the 2nd dimension of doss.doss

  • energy_range (list[float]) – 2*1 list of energy range

  • dos_range (list[float]) – 2*1 list of DOS range

  • color (str | list[str]) – Color of plot lines. Should be consistent with number of projections.

  • labels (str | list[str]) – Plot legend. Should be consistent with number of projections.

  • linestl (str | list[str]) – linestyle string. Should be consistent with number of projections.

  • linewidth (float)

  • fermi (str) – Color of Fermi level line.

  • title (str)

  • figsize (list[float])

Returns:

Matplotlib object

plot_phonon_dos(doss, unit='cm-1', overlap=False, prj=None, freq_range=None, dos_range=None, color='blue', labels=None, linestl=None, linewidth=1, line_freq0=None, title=None, figsize=None)#

A wrapper of plot_cry_doss for electron density of states.

Parameters:
  • doss (DOSBASE) – DOS obect generated by code:CRYSTALClear.crystal_io.Crystal_output.read_pdos. Or a list of DOSBASE objects.

  • unit (str) – ‘cm-1’ or ‘THz’

  • overlap (bool) – Plotting multiple lines into the same figure

  • prj (list) – Index of selected projection. Consistent with the index of the 2nd dimension of doss.doss

  • freq_range (list[float]) – 2*1 list of frequency range

  • dos_range (list[float]) – 2*1 list of DOS range

  • color (str | list[str]) – Color of plot lines. Should be consistent with number of projections.

  • labels (str | list[str]) – Plot legend. Should be consistent with number of projections.

  • linestl (str | list[str]) – linestyle string. Should be consistent with number of projections.

  • linewidth (float)

  • line_freq0 (str) – Color of frequency = 0 line.

  • title (str)

  • figsize (list[float])

Returns:

Matplotlib object

plot_electron_banddos(bands, doss, unit='eV', k_labels=None, dos_beta='down', dos_prj=None, energy_range=None, dos_range=None, color_band='blue', color_dos='blue', labels=None, linestl_band='-', linestl_dos=None, linewidth=1, fermi='forestgreen', title=None, figsize=None, legend=False)#

A wrapper of plot_cry_es for electron band structure + dos. For spin-polarized cases, beta state.

Parameters:
  • bands (BandsBASE|list) – Bands object generated by CRYSTALClear.crystal_io.Properties_output.read_bands or a list of BandsBASE objects.

  • doss (DOSBASE) – DOS object generated by CRYSTALClear.crystal_io.Properties_output.read_doss or a list of DOSBASE objects.

  • unit (str) – Unit of energy. Valid options are ‘eV’ or ‘Hartree’.

  • k_labels (list) – A list of high-symmetric k point labels. Greek alphabets should be represented as strings, for example, ‘Gamma’.

  • dos_beta (str) – Spin state to plot. Valid options are ‘Up’ or ‘down’. If ‘down’, the beta state will be plotted on the same side as the alpha state, otherwise on the other side.

  • dos_prj (list) – Index of selected projection. Consistent with the index of the 2nd dimension of doss.doss.

  • energy_range (list) – A list of two values representing the energy range to be plotted.

  • dos_range (list) – DOS range for the y-axis.

  • color_band (str) – Color of the electron bands in the plot.

  • color_dos (str) – Color of the density of states (DOS) in the plot.

  • labels (list) – A list of labels for the plot legend.

  • linestl_band (str) – Linestyle of the electron bands.

  • linestl_dos (str) – Linestyle of the density of states (DOS).

  • linewidth (float) – Width of the lines in the plot.

  • fermi (str) – Color of the Fermi level line.

  • title (str) – Title of the plot.

  • figsize (list[float]) – Size of the figure in inches (width, height).

  • legend (bool) – Enables or disables the legend of the density of states (DOS).

Returns:

Matplotlib object

Raises:

ValueError – If the unit parameter is unknown.

plot_phonon_banddos(bands, doss, unit='cm-1', k_labels=None, dos_prj=None, freq_range=None, dos_max_range=None, color_band='blue', color_dos='blue', labels=None, linestl_band='-', linestl_dos=None, linewidth=1, freq0_line=None, title=None, figsize=None)#

A wrapper of plot_cry_es for phonon band structure + dos. Only one pair is permitted.

Parameters:
  • bands (BandsBASE|list) – Bands object generated by CRYSTALClear.crystal_io.Properties_output.read_bands or a list of BandsBASE objects.

  • doss (DOSBASE) – DOS object generated by CRYSTALClear.crystal_io.Properties_output.read_doss or a list of DOSBASE objects.

  • unit (str) – Unit of frequency. Valid options are ‘cm-1’ or ‘THz’.

  • k_labels (list) – A list of high-symmetric k point labels. Greek alphabets should be represented as strings, for example, ‘Gamma’.

  • dos_prj (list) – Index of selected projection. Consistent with the index of the 2nd dimension of doss.doss.

  • freq_range (list) – A list of two values representing the frequency range to be plotted.

  • dos_max_range (float) – Maximum DOS range for the y-axis.

  • color_band (str) – Color of the phonon bands in the plot.

  • color_dos (str) – Color of the density of states (DOS) in the plot.

  • labels (list) – A list of labels for the plot legend.

  • linestl_band (str) – Linestyle of the phonon bands.

  • linestl_dos (str) – Linestyle of the density of states (DOS).

  • linewidth (float) – Width of the lines in the plot.

  • freq0_line (str) – Color of the frequency=0 line.

  • title (str) – Title of the plot.

  • figsize (list[float]) – Size of the figure in inches (width, height).

Returns:

Matplotlib object

Raises:

ValueError – If the unit parameter is unknown.

plot_cry_contour(contour_obj)#

Plot a contour plot.

Parameters:

contour_obj (object) – Contour object representing the contour plot.

Returns:

None

Notes

  • Plots a contour plot based on the data in the contour object.

  • Retrieves the data from the contour object and converts it to a 2D list.

  • Sets the figure size based on x_graph_param and y_graph_param attributes of the contour object.

  • Sets the x-axis and y-axis labels.

  • Creates a meshgrid using the x_points and y_points attributes of the contour object.

  • Defines contour levels, colors, linestyles, and fmt.

  • Plots the contour plot.

  • Saves the plot to a file named ‘figure_TIPO_YYYY-MM-DD_HHMMSS.jpg’ in the current directory.

plot_cry_contour_differences(contour_obj, contour_obj_ref)#

Plot the differences between two contour plots.

Parameters:
  • contour_obj (object) – Contour object representing the original contour plot.

  • contour_obj_ref (object) – Contour object representing the reference contour plot.

Returns:

None

Notes

  • Plots the differences between two contour plots.

  • Requires the contour objects to have a tipo attribute with values ‘SURFLAPP’, ‘SURFLAPM’, ‘SURFRHOO’, or ‘SURFELFB’.

  • Calculates the difference between the dataframes of the two contour objects.

  • Sets the figure size based on x_graph_param and y_graph_param attributes of the contour object.

  • Sets the x-axis and y-axis labels.

  • Creates a meshgrid using the x_points and y_points attributes of the contour object.

  • Defines contour levels, colors, and linestyles.

  • Plots the contour differences.

  • Saves the plot to a file named ‘figure_diff_TIPO_YYYY-MM-DD_HHMMSS.jpg’ in the current directory.

plot_cry_xrd(xrd_obj)#

Plot the X-ray diffraction pattern.

Parameters:

xrd_obj (object) – XRD object containing the data for the X-ray diffraction pattern.

Returns:

None

Notes

  • Plots the X-ray diffraction pattern.

  • Sets the figure size to [16, 9].

  • Sets the x-axis limit to (0, 30).

  • Saves the plot to a file named ‘figure_XRD_YYYY-MM-DD_HHMMSS.jpg’ in the current directory.

plot_cry_rholine(rholine_obj)#

Plot the resistivity as a function of distance.

Args:

rholine_obj (object): Rholine object containing the data for the resistivity.

Returns:

None

Notes:
  • Plots the resistivity as a function of distance.

  • Sets the x-axis label as ‘d [$AA$]’ and the y-axis label as r’$

ho$ [$ rac{e}{AA^3}$]’.

  • Saves the plot to a file named ‘figure_rholine_YYYY-MM-DD_HHMMSS.jpg’ in the current directory.

plot_cry_lapl_profile(lapl_obj)#

Plot the Laplacian profile of a crystal.

Parameters:

lapl_obj (object) – Laplacian object containing the data for the Laplacian profile.

Returns:

None

Notes

  • Plots the Laplacian profile using the data from the Laplacian object.

  • The x-axis represents the distance in angstroms.

  • The y-axis represents the Laplacian in electrons per cubic angstrom to the fifth power (e/A^5).

  • The area under the curve where the Laplacian is negative is filled with a light blue color.

  • The area under the curve where the Laplacian is positive is filled with a light coral color.

plot_cry_density_profile(lapl_obj)#

Plot the density profile of a crystal.

Parameters:

lapl_obj (object) – Laplacian object containing the data for the density profile.

Returns:

None

Notes

  • Plots the density profile using the data from the Laplacian object.

  • The x-axis represents the distance in angstroms.

  • The y-axis represents the density in electrons per cubic angstrom (e/A^3).

plot_cry_seebeck_potential(seebeck_obj, direction, temperature)#

Plot the Seebeck coefficient as a function of chemical potential.

Parameters:
  • seebeck_obj (object) – Seebeck object containing the data for the Seebeck coefficient.

  • direction (str) – choose the direction to plot among ‘S_xx’, ‘S_xy’, ‘S_xz’, ‘S_yx’, ‘S_yy’, ‘S_yz’, ‘S_yz’, ‘S_zx’, ‘S_zy’, ‘S_zz’.

  • temperature (value/str) – choose the temperature to be considered or ‘all’ to consider them all together

Returns:

Figure object

Notes

  • Plots the Seebeck coefficient as a function of chemical potential for each temperature.

  • Distinguishes between n-type and p-type conduction with dashed and solid lines, respectively.

plot_cry_seebeck_carrier(seebeck_obj, direction, temperature)#

Plot the Seebeck coefficient as a function of charge carrier concentration.

Parameters:
  • seebeck_obj – Seebeck object containing the data for the Seebeck coefficient.

  • direction (str) – choose the direction to plot among ‘S_xx’, ‘S_xy’, ‘S_xz’, ‘S_yx’, ‘S_yy’, ‘S_yz’, ‘S_yz’, ‘S_zx’, ‘S_zy’, ‘S_zz’.

  • temperature (value/str) – choose the temperature to be considered or ‘all’ to consider them all together

Returns:

Figure object

Notes

  • Plots the Seebeck coefficient as a function of charge carrier concentration for each temperature, distinguishing between n-type and p-type conduction.

plot_cry_multiseebeck(direction, temperature, minpot, maxpot, *seebeck)#

Plot the seebeck coefficient from different files.

Parameters:
  • direction (str) – choose the direction to plot among ‘S_xx’, ‘S_xy’, ‘S_xz’, ‘S_yx’, ‘S_yy’, ‘S_yz’, ‘S_yz’, ‘S_zx’, ‘S_zy’, ‘S_zz’.

  • temperature (value) – choose the temperature to be considered

  • minpot (value) – lower value of chemical potential you want to plot in eV

  • maxpot (value) – higher value of chemical potential you want to plot in eV

  • *seebeck (obj) – Variable number of seebeck objects containing the data for the Seebeck coefficient.

Returns:

Figure object

Notes

  • Plots the seebeck coefficient for each seebeck object.

  • Differentiates transport coefficients due to n-type or p-type conduction using dashed and solid lines.

plot_cry_sigma_potential(sigma_obj, direction, temperature)#

Plot the electrical conductivity as a function of chemical potential.

Parameters:
  • sigma_obj (object) – Sigma object containing the data for electrical conductivity.

  • direction (str) – choose the direction to plot among ‘S_xx’, ‘S_xy’, ‘S_xz’, ‘S_yx’, ‘S_yy’, ‘S_yz’, ‘S_yz’, ‘S_zx’, ‘S_zy’, ‘S_zz’.

  • temperature (value/str) – choose the temperature to be considered or ‘all’ to consider them all together

Returns:

Returns figure object

Notes

  • Plots the electrical conductivity as a function of chemical potential the selected temperature.

  • Distinguishes between n-type and p-type conduction with dashed and solid lines, respectively.

plot_cry_sigma_carrier(sigma_obj, direction, temperature)#

Plot the electrical conductivity as a function of charge carrier concentration.

Parameters:
  • sigma_obj (object) – Sigma object containing the data for electrical conductivity.

  • direction (str) – choose the direction to plot among ‘S_xx’, ‘S_xy’, ‘S_xz’, ‘S_yx’, ‘S_yy’, ‘S_yz’, ‘S_yz’, ‘S_zx’, ‘S_zy’, ‘S_zz’.

  • temperature – choose the temperature to be considered or ‘all’ to consider them all together

plot_cry_multisigma(direction, temperature, minpot, maxpot, *sigma)#

Plot the electron cinductivity from different files.

Parameters:
  • direction (str) – choose the direction to plot among ‘S_xx’, ‘S_xy’, ‘S_xz’, ‘S_yx’, ‘S_yy’, ‘S_yz’, ‘S_yz’, ‘S_zx’, ‘S_zy’, ‘S_zz’.

  • temperature (value) – choose the temperature to be considered

  • minpot (value) – lower value of chemical potential you want to plot in eV

  • maxpot (value) – higher value of chemical potential you want to plot in eV

  • *seebeck (obj) – Variable number of seebeck objects containing the data for the electron conductivity (sigma).

Returns:

Figure object

Notes

  • Plots the electron conductivity for each sigma object.

  • Differentiates transport coefficients due to n-type or p-type conduction using dashed and solid lines.

plot_cry_powerfactor_potential(seebeck_obj, sigma_obj, direction, temperature)#

Plot the power factor for different potentials.

Parameters:
  • seebeck_obj (obj) – Seebeck object containing the data for the Seebeck coefficient.

  • sigma_obj (obj) – Sigma object containing the data for the electrical conductivity.

  • direction (str) – choose the direction to plot among ‘PF_xx’, ‘PF_xy’, ‘PF_xz’, ‘PF_yx’, ‘PF_yy’, ‘PF_yz’, ‘PF_yz’, ‘PF_zx’, ‘PF_zy’, ‘PF_zz’.

  • temperature (value/str) – choose the temperature to be considered or ‘all’ to consider them all together

Returns:

Figure object

Notes

  • Calculates the power factor using the Seebeck coefficient and electrical conductivity data for each temperature.

  • Plots the power factor for each temperature as a function of the chemical potential, distinguishing between n-type and p-type conduction.

plot_cry_powerfactor_carrier(seebeck_obj, sigma_obj, direction, temperature)#

Plot the power factor for different charge carrier concentrations.

Parameters:
  • seebeck_obj (obj) – Seebeck object containing the data for the Seebeck coefficient.

  • sigma_obj (obj) – Sigma object containing the data for the electrical conductivity.

  • direction (str) – choose the direction to plot among ‘PF_xx’, ‘PF_xy’, ‘PF_xz’, ‘PF_yx’, ‘PF_yy’, ‘PF_yz’, ‘PF_yz’, ‘PF_zx’, ‘PF_zy’, ‘PF_zz’.

  • temperature (value/str) – choose the temperature to be considered or ‘all’ to consider them all together

Returns:

Figure object

Notes

  • Calculates the power factor using the Seebeck coefficient and electrical conductivity data for each temperature.

  • Plots the power factor for each temperature as a function of the charge carrier concentration, distinguishing between n-type and p-type conduction.

plot_cry_zt(seebeck_obj, sigma_obj, direction, temperature, ktot)#

Plot the ZT value for different temperatures.

Parameters:
  • seebeck_obj (obj) – Seebeck object containing the data for the Seebeck coefficient.

  • sigma_obj (obj) – Sigma object containing the data for the electrical conductivity.

  • direction (str) – choose the direction to plot among ‘ZT_xx’, ‘ZT_xy’, ‘ZT_xz’, ‘ZT_yx’, ‘ZT_yy’, ‘ZT_yz’, ‘ZT_yz’, ‘ZT_zx’, ‘ZT_zy’, ‘ZT_zz’.

  • temperature (value/str) – choose the temperature to be considered or ‘all’ to consider them all together

  • ktot (value) – alue of the total thermal conductivity (ktot) in W-1K-1m-1

Returns:

Figure object

Notes

  • Calculates the ZT value using the Seebeck coefficient and electrical conductivity data.

  • Plots the ZT value for each temperature as a function of the chemical potential.

plot_cry_young(theta, phi, S)#

Compute Young’s modulus for each direction of the space (i.e., each pair of theta and phi angles).

Parameters:
  • theta (float) – Theta value.

  • phi (float) – Phi value.

  • S (numpy.ndarray) – Compliance matrix.

Returns:

float – Young’s modulus values.

Notes

  • This function is intended to be called by cry_ela_plot

plot_cry_comp(theta, phi, S)#

Compute linear compressibility for each direction of the space (i.e., each pair of theta and phi angles).

Parameters:
  • theta (float) – Theta value.

  • phi (float) – Phi value.

  • S (numpy.ndarray) – Compliance matrix.

Returns:

float – Linear compressibility values.

Notes

  • This function is intended to be called by cry_ela_plot

plot_cry_shear(theta_1D, phi_1D, S, ndeg, shear_choice)#

For each direction of the space (i.e., for each pair of theta and phi angles) the shear modulus is computed for the third angle chi and the average, maximum and minimum values are stored.

Parameters:
  • theta_1D (numpy.ndarray) – One-dimensional array of theta values.

  • phi_1D (numpy.ndarray) – One-dimensional array of phi values.

  • S (numpy.ndarray) – Compliance matrix.

  • ndeg (int) – Number of degrees for discretization.

  • shear_choice (str) – Type of shear property to plot. Options: “avg”, “min”, “max”.

Returns:

numpy.ndarray – Shear property array.

Notes

  • This function is intended to be called by cry_ela_plot

plot_cry_poisson(theta_1D, phi_1D, S, ndeg, poisson_choice)#

For each direction of the space (i.e., for each pair of theta and phi angles) the Poisson ratio is computed for the third angle chi and the average, maximum and minimum values are stored.

Parameters:
  • theta_1D (numpy.ndarray) – One-dimensional array of theta values.

  • phi_1D (numpy.ndarray) – One-dimensional array of phi values.

  • S (numpy.ndarray) – Compliance matrix.

  • ndeg (int) – Number of degrees for discretization.

  • poisson_choice (str) – Type of Poisson’s ratio to plot. Options: “avg”, “min”, “max”.

Returns:

numpy.ndarray – Poisson’s ratio array.

Notes

  • This function is intended to be called by cry_ela_plot

plot_cry_ela(co, choose, ndeg=200)#

Plot crystal elastic properties on the basis of the elastic tensor. A variable number of elastic tensors can be provided in order to get multiple plots in one shot, establishing a fixed color scale among them.

Parameters:
  • co (list) – A CRYSTALClear object or a list thereof, with the elatensor attribute set by CRYSTALClear.crystal_io.Crystal_output.get_elatensor.

  • choose (str) – Property to plot. Options: “young”, “comp”, “shear avg”, “shear min”, “shear max”, “poisson avg”, “poisson min”, “poisson max”.

  • ndeg (int) – Angular resolution (default is 200).

Returns:
  • fig_list – list of matplotlib.figure.Figure A list containing matplotlib Figure objects for each plot.

  • ax_list – list of matplotlib.axes._axes.Axes A list containing the Axes objects associated with each plot.

  • plt_list – list of matplotlib.pyplot A list of the pyplot objects for each plot, representing the actual plot.

plot_cry_irspec(irspec, x_unit='cm-1', y_mode='LG', figsize=None, linestyle='-', linewidth=1.5, color='tab:blue', freq_range=None, int_range=None, label=None, dpi=100, offset=0)#

Generates the IR spectra for the IRSPEC.DAT file produced by an IRSPEC calculation

Parameters:
  • irspec (External_unit object) – Object (or a list of) generated by the read_cry_irspec function necessary for the plot

  • x_unit (str, optional) – Unit measure of the x axes. Avalilable: ‘cm-1’ and ‘nm’. Defaults to ‘cm-1’.

  • y_mode (str, optional) – Peak broadening modality in absorbance and reflectance. Available: ‘LG’(Lorentzian-Gaussian broadening), ‘V’ (Voight broadening), ‘RS’ (Rayleigh spherical particles), ‘RE’ (Rayleigh with elipsoid particles), ‘REFL’ (Reflectance) Defaults to ‘LG’.

  • figsize (tuple, optional) – Image dimensions correspondig to matplotlib figsize. Defaults to None.

  • linestyle (str/list[str], optional) – linestyle corresponding to the matplotlib one it can be a list for a multiplot. Defaults to ‘-‘.

  • linewidth (float/list[float], optional) – linewidth corresponding to the matplotlib one it can be a list for a multiplot. Defaults to 1.5.

  • color (str/list[str], optional) – Color of the spectra it can accept all matplotlib colors it can be a list for multiplots. Defaults to ‘tab:blue’.

  • freq_range (list, optional) – Two element list [min, max], that allows to visualize the spectra in a given frequency window. Defaults to None.

  • int_range (list, optional) – Two element list [min, max], that allows to visualize the spectra in a given intensity window. Defaults to None.

  • label (list[str], optional) – List of labels for the legend of a multiplot. Defaults to None.

  • dpi (int, optional) – Resolution of the saved file. Defaults to 100

  • offset (float, optional) – Allows the user to define an offset between different spectra in a multi plot

Returns:

Matplotlib object

Raises:

ValueError – The function raises an error when the object to be plotted does not have the required y_mode

plot_cry_ramspec(ramspec, y_mode='total', figsize=None, linestyle='-', linewidth=1.5, color='tab:blue', freq_range=None, int_range=None, label=None, dpi=100, offset=0)#

Generates the RAMAN spectra for the RAMSPEC.DAT file produced by an RAMSPEC calculation

Parameters:
  • ramspec (External_unit object) – Object (or a list of) generated by the read_cry_ramspec function necessary for the plot

  • y_mode (str, optional) – Polarization of the spectra for the simulated compound Available: ‘total’, ‘parallel’, ‘perpendicular’ (for powders), ‘xx’, ‘xy’, ‘xz’, ‘yy’, ‘yz’, ‘zz’ (for single crystals) Defaults to ‘LG’.

  • figsize (tuple, optional) – Image dimensions correspondig to matplotlib figsize. Defaults to None.

  • linestyle (str/list[str], optional) – linestyle corresponding to the matplotlib one it can be a list for a multiplot. Defaults to ‘-‘.

  • linewidth (float/list[float], optional) – linewidth corresponding to the matplotlib one it can be a list for a multiplot. Defaults to 1.5.

  • color (str/list[str], optional) – Color of the spectra it can accept all matplotlib colors it can be a list for multiplots. Defaults to ‘tab:blue’.

  • freq_range (list, optional) – Two element list [min, max], that allows to visualize the spectra in a given frequency window. Defaults to None.

  • int_range (list, optional) – Two element list [min, max], that allows to visualize the spectra in a given intensity window. Defaults to None.

  • label (list[str], optional) – List of labels for the legend of a multiplot. Defaults to None.

  • dpi (int, optional) – Resolution of the saved file. Defaults to 300.

  • offset (float) – Allows the user to define an offset between different spectra in a multi plot

Returns:

Matplotlib object

plot_cry_spec(transitions, typeS='lorentz', components=False, bwidth=5, stdev=3, eta=0.5, fmin=None, fmax=None, ylim=None, exp_spec=None, sep=';', export_csv=False, label=None, xlabel='Wavenumber [cm$^{-1}$]', ylabel='Intensity [arb. u.]', linewidth=2.0, padd=100, style=None, compstyle=None, figsize=(16, 6), fig=None, ax=None, offset=0)#

This function enables the simulation of vibrational spectra based on a 2D NumPy array containing a list of transition frequencies and the corresponding intensities. The code allows users to model spectral broadening according to various profiles (Gaussian, Lorentzian, pseudo-Voigt), or zero broadening (Dirac deltas-like lines). Please, note that by turning the optional argument ‘component’ to True you can additionally plot contributions arising from each transition.

Parameters:
  • transitions (numpy.ndarray) – 2D array containing transition frequencies (axis=0) and corresponding intensities (axis=1).

  • typeS (str) – String specifying the spectral profile: “bars”, “lorentz”, “gauss”, “pvoigt” (default is “lorentz”).

  • components (bool, optional) – Whether to plot contributions arising from each transition (default is False).

  • bwidth (float, optional) – Half-width at half-maximum of the Lorentzian profile (default is 5).

  • stdev (float, optional) – Standard deviation of the Gaussian profile (default is 5).

  • eta (float, optional) – Fraction of Lorentzian character in pseudo-Voigt profile (default is 0.5).

  • fmin (float, optional) – Minimum frequency.

  • fmax (float, optional) – Maximum frequency.

  • ylim (float, optional) – Maximum intensity.

  • export_csv (bool, optional) – Whether to save plot in csv format (default is False).

  • xlabel (str, optional) – x-axis label (default is “Wavenumber [cm$^{-1}$]”).

  • ylabel (str, optional) – y-axis label (default is “Intensity [arb. u.]”).

  • linewidth (float, optional) – Linewidth (default is 2.0).

  • padd (float, optional) – left- and right- hand side padding expressed in the same unit of the quantity reported in x-axis (default is 100).

  • style (str, optional) – String specifying Matplotlib style.

  • compstyle (list[string], optional) – List containing Matplotlib styles to plot each component.

  • figsize (list[real], optional) – List of two numbers specifying the aspect ratio of the figure (default is [16, 6]).

Returns:
  • matplotlib.figure.Figure

  • matplotlib.axes.Axes

plot_cry_spec_multi(files, typeS='lorentz', components=False, bwidth=5, stdev=3, eta=0.5, fmin=None, fmax=None, ylim=None, label=None, xlabel='Wavenumber [cm$^{-1}$]', ylabel='Intensity [arb. u.]', linewidth=2.0, padd=100, style=None, figsize=(16, 6), exp_spec=None, norm_fac=1, sep=';', offset=0)#

This function is a wrapper for plot_spec function, enablng the simulation of many vibrational spectra coming from a list of NumPy array.

Parameters:
  • transitions (list[numpy.ndarray]) – List of 2D arrays containing transition frequencies (axis=0) and corresponding intensities (axis=1).

  • typeS (str) – String specifying the spectral profile: “bars”, “lorentz”, “gauss”, “pvoigt”.

  • components (bool, optional) – Whether to plot contributions arising from each transition (default is False).

  • bwidth (float, optional) – Half-width at half-maximum of the Lorentzian profile (default is 5).

  • stdev (float, optional) – Standard deviation of the Gaussian profile (default is 5).

  • eta (float, optional) – Fraction of Lorentzian character in pseudo-Voigt profile (default is 0.5).

  • fmin (float, optional) – Minimum frequency.

  • fmax (float, optional) – Maximum frequency

  • ylim (float, optional) – Maximum intensity.

  • xlabel (str, optional) – x-axis label (default is “Wavenumber [cm$^{-1}$]”).

  • ylabel (str, optional) – y-axis label (default is “Intensity [arb. u.]”).

  • linewidth (float, optional) – Linewidth (default is 2.0).

  • padd (float, optional) – left- and right- hand side padding expressed in the same unit of the quantity reported in x-axis (default is 100).

  • style (str, optional) – String specifying Matplotlib style.

  • figsize (list[float], optional) – List of two numbers specifying the aspect ratio of the figure (default is [16, 6]).

  • offset (float, optional) – Offset along the y axis (default is 0).

Returns:
  • matplotlib.figure.Figure

  • matplotlib.axes.Axes

plot_cry_anscan(co, scale_wf=None, scale_prob=None, harmpot=False, scanpot=True, figsize=[10, 10])#

This function provides a plotting tool for the ANSCAN keyword.

Parameters:
  • co (crystal_io.Crystal_output) – Crystal output object.

  • scale_wf (float, optional) – Scaling factor for wavefunctions plot. By

  • default (plot. By)

  • this (wavefunctions are not plotted. Providing a value for)

  • accordingly. (scales it)

  • scale_prob (float, optional) – Scaling factor for probability density

  • default

  • a (probability densities are not plotted. Providing)

  • and (value for this argument enables the probability density plot)

  • accordingly.

  • harmpot (bool, optional) – A logical flag to activate the plotting of

  • potential (the harmonic)

  • scanpot (bool, optional) – A logical flag to activate the plotting of

  • ANSCAN (the scan potential provided by)

  • figsize (list[float])

Notes

  • This is a work in progress.

plot_cry_EOS(eos, formula_unit=None, plot='VvsE', color='tab:blue', figsize=(5, 5), dpi=72, marker='o', fontsize=12, legend=None)#

This function provides a tool to plot quantities extracted from the EOS module

Parameters:
  • eos[obj/list] – CRYSTAL object or list of two CRYSTAL objects containing quantities extracted from the EOS module generated by the get_EOS() function

  • formula_unit[list] – List containing the formula unit associated with each CRYSTAL object, the order should be the same as in the eos list (default:None)

  • plot[str] – String identifing the Equation of State/Computed data the user wants to plot (default:VvsE)

  • color[str/list] – String or list of defining the colors of the plotted series of data requested (default:’tab:blue’)

  • figsize[tuple] – Tuple of floats defining the size of the figure (default:(5,5))

  • dpi[int] – Integer defining the resolution of the figure (default:72)

  • fontsize[int] – Integer defining the fontsize of the text (default:12)

  • legend[list] – List of strings that will be used as legend in the plot (default:None)

Returns:

Matplotlib object