schrodinger.application.matsci.spectra module

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.matsci.spectra.rubberband_method(x_data, y_data, parameters)[source]

Apply a rubberband to the data

Parameters
  • x_data (list) – list of 2 theta values

  • y_data (list) – list of intensity values

  • parameters (SimpleNamespace) – all the tunable parameters for the method

Return type

list

Returns

list of intensity values

schrodinger.application.matsci.spectra.least_square_method(x_data, y_data, parameters)[source]

Smooth data using least sqaure method

Parameters
  • x_data (list) – list of 2 theta values

  • y_data (list) – list of intensity values

  • parameters (SimpleNamespace) – all the tunable parameters for the method

Return type

list

Returns

list of intensity values

schrodinger.application.matsci.spectra.savgol_method(x_data, y_data, parameters)[source]

Apply a Savitzky-Golay filter to the data

Parameters
  • x_data (list) – list of 2 theta values

  • y_data (list) – list of intensity values

  • parameters (SimpleNamespace) – all the tunable parameters for the method

Return type

list

Returns

list of intensity values

schrodinger.application.matsci.spectra.convert_nm_and_wavenumber(value)[source]

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)[source]

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)[source]

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[source]

Bases: Exception

__init__(*args, **kwargs)

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)[source]

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, spectrum_data=None)[source]

Bases: object

Manage a spectrum file.

HEADERS = {}
COLUMNS = {}
__init__(data_file_name, spm_file_name, spectrum_data=None)[source]

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

  • spectrum_data (list of lists) – Spectrum data. If provided, used to fill table/write file. Otherwise, data obtained from data_file_name

static getData(data_file_name, separator=None, types=None)[source]

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()[source]

Write the *spm file.

class schrodinger.application.matsci.spectra.PowderDiffractionFile(data_file_name, spm_file_name, spectrum_data=None)[source]

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)[source]

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, spectrum_data=None)

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

  • spectrum_data (list of lists) – Spectrum data. If provided, used to fill table/write file. Otherwise, data obtained from data_file_name

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)[source]

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_file_name, spm_file_name, spectrum_data=None)[source]

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 SpectrumFile’s init() fxn’s spectrum_data argument, as opposed to filled after initialization via reading a file.

In the future, if we want to initialize via reading a file, we’ll have to implement a getData() as in PowderDiffractionFile.

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_file_name, spm_file_name, spectrum_data=None)

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

  • spectrum_data (list of lists) – Spectrum data. If provided, used to fill table/write file. Otherwise, data obtained from data_file_name

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.ECD_Spectrum(data_file_name, spm_file_name, spectrum_data=None)[source]

Bases: schrodinger.application.matsci.spectra.SpectrumFile

Manage a ECD (Electronic Circular Dichroism) file.

Note that this class expects it’s data to be provided upon initialization via SpectrumFile’s init() fxn’s spectrum_data argument, as opposed to filled after initialization via reading a file. In the future, if we want to initialize via reading a file, we’ll have to implement a getData() as in PowderDiffractionFile.

ENERGY_KEY = 'r_j_Electronic_Circular_Dichroism_Energy_(eV)'
ENERGY_TITLE = 'ECD Energy (eV)'
INTENSITY_KEY = 'r_j_Molar_Circular_Dichroism_(L_mol-1_cm-1)'
INTENSITY_TITLE = 'Molar Circular Dichroism (L mol-1 cm-1)'
SPECTRUM_KEY = 's_j_spectrum_type'
SPECTRUM_TITLE = 'Electronic Circular Dichroism'
X_KEY = 's_j_x_label'
X_ALIAS = 'r_j_Electronic_Circular_Dichroism_Energy_(eV)'
Y_KEY = 's_j_y_label'
Y_ALIAS = 'r_j_Molar_Circular_Dichroism_(L_mol-1_cm-1)'
HEADERS = {'s_j_spectrum_type': 'Electronic Circular Dichroism', 's_j_x_label': 'r_j_Electronic_Circular_Dichroism_Energy_(eV)', 's_j_y_label': 'r_j_Molar_Circular_Dichroism_(L_mol-1_cm-1)'}
COLUMNS = {'r_j_Electronic_Circular_Dichroism_Energy_(eV)': 'ECD Energy (eV)', 'r_j_Molar_Circular_Dichroism_(L_mol-1_cm-1)': 'Molar Circular Dichroism (L mol-1 cm-1)', 's_j_Symmetry': 'Symmetry'}
TYPES = [<class 'float'>, <class 'float'>, <class 'str'>]
__init__(data_file_name, spm_file_name, spectrum_data=None)

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

  • spectrum_data (list of lists) – Spectrum data. If provided, used to fill table/write file. Otherwise, data obtained from data_file_name

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.IR_Spectrum(data_file_name, spm_file_name, spectrum_data=None)[source]

Bases: schrodinger.application.matsci.spectra.SpectrumFile

Manage an IR (Infrared/Vibrational) file.

Note that this class expects it’s data to be provided upon initialization via SpectrumFile’s init() fxn’s spectrum_data argument, as opposed to filled after initialization via reading a file. In the future, if we want to initialize via reading a file, we’ll have to implement a getData() as in PowderDiffractionFile.

FREQ_KEY = 'r_j_Frequency_(cm-1)'
FREQ_TITLE = 'Frequency (cm-1)'
INTENSITY_KEY = 'r_j_Intensity_(km/mol)'
INTENSITY_TITLE = 'Intensity (km/mol)'
SPECTRUM_KEY = 's_j_spectrum_type'
SPECTRUM_TITLE = 'Infrared Vibrational Frequencies'
X_KEY = 's_j_x_label'
X_ALIAS = 'r_j_Frequency_(cm-1)'
Y_KEY = 's_j_y_label'
Y_ALIAS = 'r_j_Intensity_(km/mol)'
HEADERS = {'s_j_spectrum_type': 'Infrared Vibrational Frequencies', 's_j_x_label': 'r_j_Frequency_(cm-1)', 's_j_y_label': 'r_j_Intensity_(km/mol)'}
COLUMNS = {'r_j_Frequency_(cm-1)': 'Frequency (cm-1)', 'r_j_Intensity_(km/mol)': 'Intensity (km/mol)', 's_j_Symmetry': 'Symmetry'}
TYPES = [<class 'float'>, <class 'float'>, <class 'str'>]
__init__(data_file_name, spm_file_name, spectrum_data=None)

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

  • spectrum_data (list of lists) – Spectrum data. If provided, used to fill table/write file. Otherwise, data obtained from data_file_name

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.