schrodinger.application.matsci.spectra module

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.matsci.spectra.convert_nm_and_wavenumber(value)

Convert value in wavenumbers to nanometers or vice versa, the conversion is the same.

Parameters:value (int or float) – Number to convert
Return type:float
Returns:value converted from wavenumbers to nanometers or vice versa
schrodinger.application.matsci.spectra.get_file_data(filename)

Read the data from the file

Parameters:name (str) – The name for the spectrum. If none, it will be derived from the file name.
Return type:tuple of (str, str, schrodinger.infra.table.Table)
Returns:First two members of the tuple are the s_j_x_lable and s_j_y_label properties. The third member of the tuple is a Table object from the schrodinger.infra.table module. This object holds the actual data.
schrodinger.application.matsci.spectra.generate_curve(mytable, line_width, xprop, intensity, x_scale=1.0, uvvis=False, smin=None, smax=None, stride=None, function='Lorentzian', line_width_nm=False)

Generate a full curve for a series of frequency/intensity lines. The curve is generated by broadening the lines with Gaussian or Lorentzian curves centered on each line, and summing the curves together.

Parameters:
  • mytable (table.Table object) – table of raw data
  • line_width (float) – the half-bandwidth to use when generating spectrum
  • x_scale (float) – the x-axis scale factor
  • intensity (str) – The label of the intensity property in mytable
  • xprop (str) – The label of the x-axis property in mytable
  • uvvis (bool) – True if this is a uv/vis spectrum, False if not (default is False, vibrational spectrum)
  • smin (int) – The minimum x-value in wavenumbers.
  • smax (int) – The maximum x-value in wavenumbers.
  • stride (int) – Compute the intensity every stride values of x
  • function (str) – The function used to broaden singular intensity values to a full spectrum curve. Default is Lorentzian, other option is Gaussian. Use the LORENTZIAN or GAUSSIAN module constants.
  • line_width_nm (bool) – Linewidth is given in nm. Default is wavenumbers. Not used for non-UV/Vis spectra.
Return type:

tuple of 1-D numpy arrays

Returns:

(xvalues, yvalues) with xvalues running from smin to smax with Xn = X(n-1) + stride. Note that the X unit will be wavenumbers for all spectra.

exception schrodinger.application.matsci.spectra.PowderDiffractionException

Bases: Exception

__init__

Initialize self. See help(type(self)) for accurate signature.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

schrodinger.application.matsci.spectra.get_powder_diffraction_pattern(st, wave_length=None, debye_waller_factors=None, two_theta_range=(0, 90), compute_intensities=True)

Get a pymatgen powder diffraction pattern.

Parameters:
  • st (schrodinger.structure.Structure) – the structure
  • wave_length (float) – the wave length in Ang.
  • debye_waller_factors (dict) – the temperature dependent Debye-Waller factors, keys are elemental symbols, values are factors in Ang.^2
  • two_theta_range (tuple or None) – (min, max) pair tuple specifying the x-axis two theta range in degrees over which to calculate the powder diffraction pattern or None if it is to be calculated at all diffracted beams within the limiting sphere of 2 * radius / wave_length
  • compute_intensities (bool) – If True, compute peaks intensities (requires atoms in the structure), otherwise only peak locations
Raise:

PowderDiffractionException if there is an issue

Return type:

pymatgen.analysis.diffraction.core.DiffractionPattern

Returns:

the pymatgen powder diffraction pattern

class schrodinger.application.matsci.spectra.SpectrumFile(data_file_name, spm_file_name)

Bases: object

Manage a spectrum file.

HEADERS = {}
COLUMNS = {}
__init__(data_file_name, spm_file_name)

Create an instance.

Parameters:
  • data_file_name (str) – the text file containing the data
  • spm_file_name (str) – the name of the *spm file to create
static getData(data_file_name, separator=None, types=None)

Return the data from the given data file.

Parameters:
  • data_file_name (str) – the text file containing the data
  • separator (str) – the data separator
  • types (list) – a list of types used to type cast the data
Return type:

list

Returns:

contains data tuples

write()

Write the *spm file.

class schrodinger.application.matsci.spectra.PowderDiffractionFile(data_file_name, spm_file_name)

Bases: schrodinger.application.matsci.spectra.SpectrumFile

Manage a powder diffraction pattern file.

TWO_THETA_KEY = 'r_matsci_Two_Theta_(degrees)'
TWO_THETA_TITLE = '2*Theta/deg.'
INTENSITY_KEY = 'r_matsci_Intensity'
INTENSITY_TITLE = 'Intensity'
HKLS_KEY = 's_matsci_HKLs'
HKLS_TITLE = 'HKLs'
MULTIPLICITIES_KEY = 's_matsci_HKL_Multiplicities'
MULTIPLICITIES_TITLE = 'Mults'
INTERPLANAR_SPACING_KEY = 'r_matsci_Interplanar_Spacing_(Ang.)'
INTERPLANAR_SPACING_TITLE = 'd_HKL/Ang.'
SPECTRUM_KEY = 's_j_spectrum_type'
SPECTRUM_TITLE = 'Powder Diffraction Pattern'
X_KEY = 's_j_x_label'
X_ALIAS = 'r_matsci_Two_Theta_(degrees)'
Y_KEY = 's_j_y_label'
Y_ALIAS = 'r_matsci_Intensity'
HEADERS = {'s_j_spectrum_type': 'Powder Diffraction Pattern', 's_j_x_label': 'r_matsci_Two_Theta_(degrees)', 's_j_y_label': 'r_matsci_Intensity'}
COLUMNS = {'r_matsci_Intensity': 'Intensity', 'r_matsci_Interplanar_Spacing_(Ang.)': 'd_HKL/Ang.', 'r_matsci_Two_Theta_(degrees)': '2*Theta/deg.', 's_matsci_HKL_Multiplicities': 'Mults', 's_matsci_HKLs': 'HKLs'}
SEPARATOR = '; '
TYPES = [<class 'float'>, <class 'float'>, <class 'str'>, <class 'str'>, <class 'float'>]
static getData(data_file_name, separator=None, types=None)

Return the data from the given data file.

Parameters:
  • data_file_name (str) – the text file containing the data
  • separator (str) – the data separator
  • types (list) – a list of types used to type cast the data
Return type:

list

Returns:

contains data tuples

__init__(data_file_name, spm_file_name)

Create an instance.

Parameters:
  • data_file_name (str) – the text file containing the data
  • spm_file_name (str) – the name of the *spm file to create
write()

Write the *spm file.

schrodinger.application.matsci.spectra.write_powder_diffraction_pattern(st, wave_length=None, debye_waller_factors=None, two_theta_range=(0, 90), file_name=None)

Write a powder diffraction pattern file.

Parameters:
  • st (schrodinger.structure.Structure) – the structure
  • wave_length (float) – the wave length in Ang.
  • debye_waller_factors (dict) – the temperature dependent Debye-Waller factors, keys are elemental symbols, values are factors in Ang.^2
  • two_theta_range (tuple or None) – (min, max) pair tuple specifying the x-axis two theta range in degrees over which to calculate the powder diffraction pattern or None if it is to be calculated at all diffracted beams within the limiting sphere of 2 * radius / wave_length
  • file_name (str) – the file name to which the pattern will be written
Return type:

str

Returns:

the file name to which the pattern was written

class schrodinger.application.matsci.spectra.VCD_Spectrum(data, spm_file_name)

Bases: schrodinger.application.matsci.spectra.SpectrumFile

Manage a VCD (Vibrational Circular Dichroism) file. Note that this class expects it’s data to be provided upon initialization via a Python array, as opposed to filled after initialization via reading a file. Thus, fxns related to reading in data have not been created. Can do so if the need arises in the future. One consequence of this is the overwritten _buildTable fxn.

FREQ_KEY = 'r_j_Frequency_(cm-1)'
FREQ_TITLE = 'Frequency (cm-1)'
ROT_STR_KEY = 'r_j_Rotational_Strength_(10**-40_esu**2_cm**2)'
ROT_STR_TITLE = 'Rotational Strength (10**-40 esu**2 cm**2)'
SPECTRUM_KEY = 's_j_spectrum_type'
SPECTRUM_TITLE = 'Vibrational Circular Dichroism'
X_KEY = 's_j_x_label'
X_ALIAS = 'r_j_Frequency_(cm-1)'
Y_KEY = 's_j_y_label'
Y_ALIAS = 'r_j_Rotational_Strength_(10**-40_esu**2_cm**2)'
HEADERS = {'s_j_spectrum_type': 'Vibrational Circular Dichroism', 's_j_x_label': 'r_j_Frequency_(cm-1)', 's_j_y_label': 'r_j_Rotational_Strength_(10**-40_esu**2_cm**2)'}
COLUMNS = {'r_j_Frequency_(cm-1)': 'Frequency (cm-1)', 'r_j_Rotational_Strength_(10**-40_esu**2_cm**2)': 'Rotational Strength (10**-40 esu**2 cm**2)', 'r_j_edtm_x': 'edtm x', 'r_j_edtm_y': 'edtm y', 'r_j_edtm_z': 'edtm z', 'r_j_mdtm_x': 'mdtm x', 'r_j_mdtm_y': 'mdtm y', 'r_j_mdtm_z': 'mdtm z', 's_j_Symmetry': 'Symmetry'}
TYPES = [<class 'float'>, <class 'float'>, <class 'str'>, <class 'float'>, <class 'float'>, <class 'float'>, <class 'float'>, <class 'float'>, <class 'float'>]
__init__(data, spm_file_name)
Parameters:data (list of lists) – Data per peak. Order is same as self.COLUMNS. Must have at least FREQ/ROT_STR

Example: [[freq1, rot1], [freq2, rot2], …]

Parameters:spm_file_name (str) – Name of spm file to output to via write()
static getData(data_file_name, separator=None, types=None)

Return the data from the given data file.

Parameters:
  • data_file_name (str) – the text file containing the data
  • separator (str) – the data separator
  • types (list) – a list of types used to type cast the data
Return type:

list

Returns:

contains data tuples

write()

Write the *spm file.