\(\newcommand{\AA}{\text{Å}}\)
CRYSTALClear.plot#
Functions to visualize physical properties computed with CRYSTAL .
- set_font(family=None, size=None)#
Set the font every subsequent plot is drawn with.
Acts on matplotlib’s rcParams, so it applies to figures created afterwards and leaves existing ones alone.
- Parameters:
family (str, optional) – One of the keys of FONT_FAMILIES – ‘default’, ‘cm’ (Computer Modern), ‘cmss’, ‘serif’, ‘sans-serif’, ‘monospace’ – or the name of any installed font, e.g. ‘Times New Roman’. Default is None, i.e. leave the family alone.
size (float, optional) – Base font size in points. Everything else (tick labels, titles) is sized relative to it, except where a plot takes an explicit fontsize argument. Default is None, i.e. leave the size alone.
- Returns:
dict – The rcParams that were applied, which is what to keep in order to restore them later.
- 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.dossenergy_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.dossfreq_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_shear_2D(theta_1D, phi_1D, S, ndeg, shear_choice)#
2D counterpart of plot_cry_shear: for each in-plane direction (theta, phi) the shear modulus is evaluated over the perpendicular angle chi, and the avg/min/max value is returned. Returns a 1D array (one value per in-plane direction) instead of the 2D grid used by the 3D routine.
- Parameters:
theta_1D (numpy.ndarray) – In-plane theta values (1D).
phi_1D (numpy.ndarray) – In-plane phi values (1D).
S (numpy.ndarray) – Compliance matrix (6x6, Voigt).
ndeg (int) – Number of chi samples for the perpendicular sweep.
shear_choice (str) – “avg”, “min” or “max”.
- Returns:
numpy.ndarray – Shear property, one value per in-plane direction.
- plot_cry_poisson_2D(theta_1D, phi_1D, S, ndeg, poisson_choice)#
2D counterpart of plot_cry_poisson. See plot_cry_shear_2D for the convention. Returns a 1D array (one value per in-plane direction).
- Parameters:
theta_1D (numpy.ndarray) – In-plane theta values (1D).
phi_1D (numpy.ndarray) – In-plane phi values (1D).
S (numpy.ndarray) – Compliance matrix (6x6, Voigt).
ndeg (int) – Number of chi samples for the perpendicular sweep.
poisson_choice (str) – “avg”, “min” or “max”.
- Returns:
numpy.ndarray – Poisson’s ratio, one value per in-plane direction.
- plot_cry_ela_2D(co, choose, ndeg=200, planes=('xy', 'xz', 'yz'))#
Plot crystal elastic properties in 2D as polar sections through the three principal planes, i.e. the 2D analogue of plot_cry_ela. One figure is produced per elastic tensor, overlaying the requested planes on a single polar axes with a fixed radial scale shared across all figures.
- Parameters:
co – A CRYSTALClear object (or list thereof) with the
elatensorattribute set byCrystal_output.get_elatensor.choose (str) – Property to plot. One of “young”, “comp”, “shear avg”, “shear min”, “shear max”, “poisson avg”, “poisson min”, “poisson max”.
ndeg (int) – Angular resolution (default 200).
planes (tuple[str]) – Subset of (“xy”, “xz”, “yz”) to draw.
- Returns:
tuple (list, list) – (fig_list, ax_list) of matplotlib Figure / polar Axes.
- 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_vci(co, states=None, frange=None, irrep=None, list_mode=None, threshold=0.01, signed=False, basis=None, cmap=None, vmin=None, vmax=None, annotate=False, colorbar=True, max_states=60, figsize=[9, 7], fontsize=9, ax=None)#
Heatmap of the VCI coefficients $A_{n,s}$: every row is a zeroth-order configuration $Phi^mathbf{n}$, every column a VCI state $Psi_s$ labelled by its energy relative to the ZPE.
The zeroth-order basis is taken from co.VCI_basis, set by crystal_io.Crystal_output.get_vci(): configurations are Hartree products of harmonic eigenfunctions for a VCI@HO run (quanta labelled $nu_i$) and of VSCF modals for a VCI@VSCF run (quanta labelled $tilde{nu}_i$).
Only the contributions CRYSTAL prints under ‘MOST IMPORTANT CONFIGURATIONS’ are available, so a column sums up to slightly less than one and configurations left out of every selected state are not shown.
- Parameters:
co (crystal_io.Crystal_output) – Crystal output object, on which get_vci() has already been called.
states (list[int], optional) – VCI states to be displayed, given as positional indices into co.VCI_energy. Note that the label CRYSTAL prints restarts from 1 in every symmetry block and is therefore not used here. Takes precedence over frange. Default is None.
frange (list[float], optional) – Wavenumber window [min, max] the states are taken from, in cm^-1 and relative to the ZPE. Default is None, i.e. every state of the run, which max_states then caps.
irrep (int, optional) – Restrict the map to the states of one irrep of the block-diagonalised VCI matrix. Default is None, i.e. all of them.
list_mode (list[int], optional) – CRYSTAL mode index of each VCI-active mode, used to label the configurations. Default is None, in which case the VCI-active modes are numbered from 1.
threshold (float, optional) – Minimum absolute value of a coefficient for its configuration to be shown. Default is 0.01.
signed (bool, optional) – Whether to map the coefficients with their sign, on a diverging colormap centred on zero, rather than their absolute value. Default is False.
basis (str, optional) – ‘HO’ or ‘VSCF’, overriding the flavour detected by get_vci(). Default is None.
cmap (str, optional) – Matplotlib colormap name. Default is None, i.e. ‘bone_r’ when signed is False and ‘RdBu_r’ when it is True.
vmin (float, optional) – Lower bound of the colour scale. Default is None, i.e. 0 when signed is False and minus the largest coefficient when it is True.
vmax (float, optional) – Upper bound of the colour scale. Default is None, i.e. the largest coefficient found.
annotate (bool, optional) – Whether to print the value of every non-zero coefficient in its cell. Default is False.
colorbar (bool, optional) – Whether to draw the colorbar. Default is True.
max_states (int, optional) – Refuse to draw more states than this, so that an unbounded window fails with a clear message instead of building an unreadable figure. Default is 60.
figsize (tuple, optional) – Image dimensions corresponding to matplotlib figsize. Default is [9, 7].
fontsize (int, optional) – Font size of the tick labels. Default is 9.
ax (matplotlib.axes.Axes, optional) – Axes the map is drawn on. Default is None, in which case a new figure is created.
- Returns:
matplotlib.figure.Figure
matplotlib.axes.Axes
- plot_cry_vci_sankey(co, states=None, frange=None, irrep=None, list_mode=None, threshold=0.01, weight='square', color_by='config', cmap='tab20', basis=None, show_weights=False, max_states=60, figsize=[9, 7], node_width=0.03, gap=0.02, label_pitch=0.04, alpha=0.6, fontsize=9, ax=None)#
Sankey representation of the VCI wavefunctions: the zeroth-order configurations $Phi^mathbf{n}$ (left) are connected to the VCI states $Psi_s$ they contribute to (right), each ribbon having a width proportional to the weight of that configuration in that state.
The zeroth-order basis is taken from co.VCI_basis, set by crystal_io.Crystal_output.get_vci(): configurations are Hartree products of harmonic eigenfunctions for a VCI@HO run (quanta labelled $nu_i$) and of VSCF modals for a VCI@VSCF run (quanta labelled $tilde{nu}_i$).
Only the contributions CRYSTAL prints under ‘MOST IMPORTANT CONFIGURATIONS’ are available, so the ribbons entering a state sum up to slightly less than one.
- Parameters:
co (crystal_io.Crystal_output) – Crystal output object, on which get_vci() has already been called.
states (list[int], optional) – VCI states to be displayed, given as positional indices into co.VCI_energy. Note that the label CRYSTAL prints restarts from 1 in every symmetry block and is therefore not used here. Takes precedence over frange. Default is None.
frange (list[float], optional) – Wavenumber window [min, max] the states are taken from, in cm^-1 and relative to the ZPE. Default is None, i.e. every state of the run, which max_states then caps.
irrep (int, optional) – Restrict the diagram to the states of one irrep of the block-diagonalised VCI matrix. Default is None, i.e. all of them.
list_mode (list[int], optional) – CRYSTAL mode index of each VCI-active mode, used to label the configurations. Default is None, in which case the VCI-active modes are numbered from 1.
threshold (float, optional) – Minimum weight for a ribbon to be drawn. Default is 0.01.
weight (str, optional) – ‘square’ to make ribbons proportional to $|A_{n,s}|^2$, ‘abs’ for $|A_{n,s}|$. Default is ‘square’.
color_by (str, optional) – ‘config’ to colour ribbons by configuration, which highlights configurations shared by several states (resonances), or ‘state’ to colour them by VCI state. Default is ‘config’.
cmap (str, optional) – Matplotlib colormap used to colour the ribbons. Default is ‘tab20’.
basis (str, optional) – ‘HO’ or ‘VSCF’, overriding the flavour detected by get_vci(). Default is None.
show_weights (bool, optional) – Whether to print the weight of each ribbon next to the configuration node. Default is False.
max_states (int, optional) – Refuse to draw more states than this, so that an unbounded window fails with a clear message instead of building an unreadable figure. Default is 60.
figsize (tuple, optional) – Image dimensions corresponding to matplotlib figsize. Default is [9, 7].
node_width (float, optional) – Width of the node bars, the diagram being one unit wide. Default is 0.03.
gap (float, optional) – Vertical gap between adjacent nodes, as a fraction of the total flow. Default is 0.02.
label_pitch (float, optional) – Minimum distance between the centres of adjacent nodes, as a fraction of the total flow, which keeps the labels of thin nodes from overlapping. Default is 0.04.
alpha (float, optional) – Opacity of the ribbons. Default is 0.6.
fontsize (int, optional) – Font size of the node labels. Default is 9.
ax (matplotlib.axes.Axes, optional) – Axes the diagram is drawn on. Default is None, in which case a new figure is created.
- Returns:
matplotlib.figure.Figure
matplotlib.axes.Axes
- 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_pes_1D(co, mode, xlim=None, npts=500, harmonic=True, levels=False, nstates=5, scale_wf=None, nbasis=60, npts_wf=500, legend=True, figsize=[7, 6], ax=None)#
The anharmonic potential of one normal mode, from the cubic and quartic derivatives ANHAPES computes.
The abscissa is the dimensionless normal coordinate $xi$, the displacement in units of the classical amplitude at the ground state energy, which is what the derivatives are taken with respect to. CRYSTAL fits them from a scan of a fraction of an amplitude either side of equilibrium, so a wide window is an extrapolation of a quartic and should be read as one.
With
levelsthe one-dimensional vibrational problem is solved in the harmonic basis of the mode and its states are drawn on the potential. Those are this potential’s own states, not the run’s: a VSCF or VCI step couples the modes and lands elsewhere.- Parameters:
co (crystal_io.Crystal_output) – Crystal output object, on which get_anh_const() and get_phonon() have already been called.
mode (int) – CRYSTAL index of the mode to draw.
xlim (list[float], optional) – Bounds of the abscissa, in units of $xi$. Default is None, i.e. [-2, 2]. Whatever it is, levels widens it far enough to hold the states being drawn, since a state cut off at the edge of the window says less than the extrapolation needed to contain it.
npts (int, optional) – Number of points the potential is sampled on. Default is 500.
harmonic (bool, optional) – Whether to draw the harmonic parabola of the mode alongside. Default is True.
levels (bool, optional) – Whether to solve the mode and draw its vibrational states. Default is False.
nstates (int, optional) – Number of states to draw, counting from the ground state. Default is 5.
scale_wf (float, optional) – Height the wavefunctions are drawn at, in cm^-1. Default is None, i.e. the mean spacing of the states being drawn, which fills the gaps without crossing them.
nbasis (int, optional) – Harmonic functions the states are expanded on. Default is 60.
npts_wf (int, optional) – Number of points the wavefunctions are sampled on. Default is 500.
legend (bool, optional) – Whether to label the curves. Default is True.
figsize (list[float], optional) – Image dimensions corresponding to matplotlib figsize. Default is [7, 6].
ax (matplotlib.axes.Axes, optional) – Axes the curves are drawn on. Default is None, in which case a new figure is created.
- Returns:
matplotlib.figure.Figure
matplotlib.axes.Axes
- plot_cry_pes_3D(co, modei, modej, quantity='anharmonic', xlim=[-2.0, 2.0], ylim=None, npts=120, nlevels=21, cmap=None, colorbar=True, contours=False, elev=30.0, azim=-60.0, alpha=1.0, figsize=[8, 6.5], ax=None)#
The potential-energy surface of two coupled normal modes, drawn as a surface rather than a map.
The same quantity
plot_cry_pes_2D()maps, with the same default: the harmonic bowl is one to two orders of magnitude deeper than everything the anharmonic constants add, and a surface of the total is a paraboloid.- Parameters:
co (crystal_io.Crystal_output) – Crystal output object, on which get_anh_const() and get_phonon() have already been called.
modei (int) – CRYSTAL indices of the two modes, in either order.
modej (int) – CRYSTAL indices of the two modes, in either order.
quantity (str, optional) – ‘anharmonic’ for the surface with the harmonic part subtracted, ‘coupling’ for the two-mode terms alone, ‘total’ for the surface itself. Default is ‘anharmonic’.
xlim (list[float], optional) – Bounds of the first mode’s coordinate. Default is [-2, 2].
ylim (list[float], optional) – Bounds of the second mode’s coordinate. Default is None, i.e. the same as xlim.
npts (int, optional) – Grid points along each axis. Default is 120, lower than the map’s since every quad is drawn.
nlevels (int, optional) – Number of colour steps, and of floor contours when they are drawn. Default is 21.
cmap (str, optional) – Matplotlib colormap name. Default is None, i.e. a diverging map centred on zero for a quantity that changes sign and a sequential one for the total surface.
colorbar (bool, optional) – Whether to draw the colorbar. Default is True.
contours (bool, optional) – Whether to project contour lines onto the floor of the box, which is what makes a surface readable quantitatively. Default is False.
elev (float, optional) – Elevation of the view, degrees. Default is 30.
azim (float, optional) – Azimuth of the view, degrees. Default is -60.
alpha (float, optional) – Opacity of the surface. Default is 1, i.e. opaque.
figsize (list[float], optional) – Image dimensions corresponding to matplotlib figsize. Default is [8, 6.5].
ax (mpl_toolkits.mplot3d.axes3d.Axes3D, optional) – Axes the surface is drawn on, which have to have been created with a 3D projection. Default is None, in which case a new figure is created.
- Returns:
matplotlib.figure.Figure
mpl_toolkits.mplot3d.axes3d.Axes3D
- plot_cry_pes_2D(co, modei, modej, quantity='anharmonic', xlim=[-2.0, 2.0], ylim=None, npts=200, nlevels=21, cmap=None, colorbar=True, contours=True, figsize=[7, 6], ax=None)#
The potential-energy surface of two coupled normal modes, from the cubic and quartic derivatives ANHAPES computes.
Both axes are dimensionless normal coordinates $xi$, the displacement in units of the classical amplitude at the ground state energy.
What is mapped is chosen with
quantity. The harmonic bowl is one to two orders of magnitude deeper than everything the anharmonic constants add, so contours of the total surface are ellipses and say nothing about the coupling;'anharmonic', the default, takes it out and maps what the cubic and quartic terms are worth.- Parameters:
co (crystal_io.Crystal_output) – Crystal output object, on which get_anh_const() and get_phonon() have already been called.
modei (int) – CRYSTAL indices of the two modes, in either order.
modej (int) – CRYSTAL indices of the two modes, in either order.
quantity (str, optional) – ‘anharmonic’ for the surface with the harmonic part subtracted, ‘coupling’ for the two-mode terms alone, ‘total’ for the surface itself. Default is ‘anharmonic’.
xlim (list[float], optional) – Bounds of the first mode’s coordinate. Default is [-2, 2].
ylim (list[float], optional) – Bounds of the second mode’s coordinate. Default is None, i.e. the same as xlim.
npts (int, optional) – Grid points along each axis. Default is 200.
nlevels (int, optional) – Number of filled contour levels. Default is 21.
cmap (str, optional) – Matplotlib colormap name. Default is None, i.e. a diverging map centred on zero for a quantity that changes sign and a sequential one for the total surface.
colorbar (bool, optional) – Whether to draw the colorbar. Default is True.
contours (bool, optional) – Whether to draw contour lines over the filled map. Default is True.
figsize (list[float], optional) – Image dimensions corresponding to matplotlib figsize. Default is [7, 6].
ax (matplotlib.axes.Axes, optional) – Axes the map is drawn on. Default is None, in which case a new figure is created.
- Returns:
matplotlib.figure.Figure
matplotlib.axes.Axes
- plot_cry_anscan(co, scale_wf=None, scale_prob=None, harmpot=False, scanpot=True, nstates=None, npts=2000, xlim=None, ylim=None, legend=True, figsize=[10, 10], ax=None)#
Potential and anharmonic vibrational states of an ANSCAN run, drawn against the dimensionless normal coordinate $xi$ the scan is performed on, i.e. the [DISPLAC] column of the output.
The potential is the Taylor expansion ANSCAN fits to the scanned points,
\[V(\xi) = \sum_n \frac{1}{n!} \left(\frac{d^nV}{d\xi^n}\right)\xi^n\]summed over every derivative CRYSTAL prints, and the wavefunctions are rebuilt from the ANSCANWF.DAT coefficients over the harmonic basis of the same coordinate. Wavefunctions are only available for the states written to ANSCANWF.DAT, ten of them in a standard run.
- Parameters:
co (crystal_io.Crystal_output) – Crystal output object, on which get_anscan() has already been called.
scale_wf (float, optional) – Scaling factor of the wavefunctions, which are drawn on top of the level they belong to. Default is None, i.e. no wavefunction is drawn.
scale_prob (float, optional) – Scaling factor of the probability densities, which are filled between the level they belong to and the density itself. Default is None, i.e. no density is drawn.
harmpot (bool, optional) – Whether to draw the harmonic potential of the mode. Default is False.
scanpot (bool, optional) – Whether to draw the points ANSCAN actually computed the potential on. Default is True.
nstates (int, optional) – Number of states, counting from the ground state, to draw a wavefunction or a density for. Default is None, i.e. every state found in ANSCANWF.DAT.
npts (int, optional) – Number of points the curves are sampled on. Default is 2000.
xlim (list[float], optional) – Bounds of the abscissa, in units of $xi$. Default is None, i.e. the range of the scan.
ylim (list[float], optional) – Bounds of the ordinate, in cm^-1. Default is None, in which case it is set around the states being drawn.
legend (bool, optional) – Whether to label the potentials. Default is True.
figsize (list[float], optional) – Image dimensions corresponding to matplotlib figsize. Default is [10, 10].
ax (matplotlib.axes.Axes, optional) – Axes the curves are drawn on. Default is None, in which case a new figure is created.
- Returns:
matplotlib.figure.Figure
matplotlib.axes.Axes
- plot_cry_EOS(eos, formula_unit=[1], 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, available: VvsE, Murnaghan, Birch-Murnaghan, Poirier-Tarantola, and Vinet)
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