schrodinger.application.matsci.bandshape_utils module

Utilities for bandshape calculations.

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.bandshape_utils.NormalMode(frequency, normal_mode)

Bases: tuple

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

count(value, /)

Return number of occurrences of value.

frequency

Alias for field number 0

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

normal_mode

Alias for field number 1

class schrodinger.application.matsci.bandshape_utils.VibState(index, n_quantum, huang_rhys_f)

Bases: object

__init__(index, n_quantum, huang_rhys_f)
class schrodinger.application.matsci.bandshape_utils.Transition(index, energy, intensity, initial_vib_states, final_vib_states, max_n_imaginary)

Bases: object

__init__(index, energy, intensity, initial_vib_states, final_vib_states, max_n_imaginary)
static getSimplified(vib_states)

Return a simplified representation of the transition.

Parameters

vib_states (list) – contains VibState

Return type

str

Returns

the simplified representation of the transition

schrodinger.application.matsci.bandshape_utils.is_bs_spectrum_file_key(key)

Return True if the given structure property key is a bandshape spectrum file key.

Parameters

key (str) – the structure property key to check

Return type

bool

Returns

True if the given key is a bandshape spectrum file key

schrodinger.application.matsci.bandshape_utils.get_temp_from_bs_spectrum_file_key(key)

Return the temperature from the given bandshape spectrum file structure property key.

Parameters

key (str) – the structure property key containing the temperature

Return type

float

Returns

the temperature in K

schrodinger.application.matsci.bandshape_utils.get_bs_spectrum_file_temps_keys(struct)

Return the bandshape spectrum file structure property keys and associated temperatures for the given structure.

Parameters

struct (schrodinger.structure.Structure) – the structure with the property keys

Return type

list

Returns

pair tuples of temperatures in K and bandshape spectrum file structure property keys

schrodinger.application.matsci.bandshape_utils.get_transition_type(atable)

Return the transition type of the given table.

Parameters

atable (table.Table) – the table to check

Return type

str or None

Returns

module constant ABSORPTION or EMISSION or None if it is unknown

class schrodinger.application.matsci.bandshape_utils.BandshapeSpectrumFile(data_file_name, spm_file_name, transition_type=None)

Bases: schrodinger.application.matsci.spectra.SpectrumFile

Manage a bandshape spectrum file.

ENERGY_KEY = 'r_j_Excitation_Energy_(eV)'
ENERGY_TITLE = 'Excitation Energy (eV)'
INTENSITY_KEY = 'r_j_Intensity'
INTENSITY_TITLE = 'Intensity'
SYMMETRY_KEY = 's_j_Symmetry'
SYMMETRY_TITLE = 'Symmetry'
SPECTRUM_KEY = 's_j_spectrum_type'
SPECTRUM_TITLE = 'Electronic Transition w/ Bandshape'
X_KEY = 's_j_x_label'
X_ALIAS = 'r_j_Excitation_Energy_(eV)'
Y_KEY = 's_j_y_label'
Y_ALIAS = 'r_j_Intensity'
HEADERS = {'s_j_spectrum_type': 'Electronic Transition w/ Bandshape', 's_j_x_label': 'r_j_Excitation_Energy_(eV)', 's_j_y_label': 'r_j_Intensity'}
COLUMNS = {'r_j_Excitation_Energy_(eV)': 'Excitation Energy (eV)', 'r_j_Intensity': 'Intensity', 's_j_Symmetry': 'Symmetry'}
EXT = '.uvv.spm'
DEFAULT_BIN_WIDTH = 400.0
__init__(data_file_name, spm_file_name, transition_type=None)

Create an instance.

Parameters
  • data_file_name (str) – the text file containing whitespace separated energies and intensities, one pair per line, energies in eV

  • transition_type (str or None) – module constant ABSORPTION or EMISSION or None if it is unknown

Param

spm_file_name: the name of the *spm file to create

static isBandshapeTable(atable)

Return True if the given table is a bandshape table.

Parameters

atable (table.Table) – the table to check

Return type

bool

Returns

True if the given table is a bandshape table

static getTrimmedTable(filepath, bin_width=None)

Return a table of trimmed data for the given file path and bin width.

Parameters
  • filepath (str) – the file path to the file with the data

  • bin_width (float) – the bin width in wavenumbers (cm-1) used for binning

Raises

ValueError – if there isn’t any data

Return type

table.Table

Returns

table of trimmed data

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.

schrodinger.application.matsci.bandshape_utils.get_translated_xyz_vec(st)

Return a vector of cartesian coordinates of the given structure which have been translated so that the center of mass is at the (0, 0, 0) origin.

Parameters

st (schrodinger.structure.Structure) – the structure

Return type

numpy.array

Returns

the translated cartesian coordinates

schrodinger.application.matsci.bandshape_utils.get_mwc_to_nm_transform(jagout)

Return the mass-weighted Cartesian coordinate to normal mode transformation matrix.

Parameters

jagout (JaguarOutput) – the Jaguar output class

Return type

numpy.array or None

Returns

the transformation matrix or None if there isn’t one

schrodinger.application.matsci.bandshape_utils.get_huang_rhys_fs(spectrum_type, initial_vib_jo, final_vib_jo, geoms_base_name=None)

Return the Huang-Rhys factors for the initial and final states.

Parameters
  • spectrum_type (str) – the spectrum type, either module constant ABSORPTION or EMISSION

  • initial_vib_jo (JaguarOutput) – the Jaguar output class for the initial state frequency calculation

  • final_vib_jo (JaguarOutput) – the Jaguar output class for the final state frequency calculation

  • geoms_base_name (str or None) – if given use geometries from Jaguar restart .01.in files rather than from the input Jaguar objects

Return type

list, list

Returns

Huang-Rhys factors for initial and final states

schrodinger.application.matsci.bandshape_utils.get_transitions(bs_out_file_name, initial_jo=None, final_jo=None)

Return a list of transitions from the given band shape output file.

Parameters
  • bs_out_file_name (str) – the band shape output file name

  • initial_jo (JaguarOutput or None) – the Jaguar output class for the initial state

  • final_jo (JaguarOutput or None) – the Jaguar output class for the final state

Return type

list

Returns

contains Transition

schrodinger.application.matsci.bandshape_utils.get_bs_base_name(name)

Return the base name of the given bandshape name.

Parameters

name (str) – the bandshape name

Return type

str

Returns

the base name

schrodinger.application.matsci.bandshape_utils.get_bs_ext(name)

Return the extension of the given bandshape name.

Parameters

name (str) – the bandshape name

Return type

str

Returns

the extension

schrodinger.application.matsci.bandshape_utils.get_out_file_paths(source_path, patterns)

Return the output file paths.

Parameters
  • source_path (str) – the source path to the output files

  • patterns (list) – the glob patterns of the output files

Raises

NormalModeAnalysisException – if there is an issue

Return type

list

Returns

contains the output file paths in the same order as patterns

exception schrodinger.application.matsci.bandshape_utils.NormalModeAnalysisException

Bases: Exception

__init__(*args, **kwargs)
args
with_traceback()

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

class schrodinger.application.matsci.bandshape_utils.NormalModeAnalysis(bs_out_file_name)

Bases: object

Manage normal mode analysis.

TAG = 'normal_mode_analysis'
N_ATOMS_KEY = 'i_j_atom_total'
FREQ_KEY = 'r_j_Frequency'
FREQ_TITLE = 'Frequency'
SYMM_KEY = 's_j_Symmetry'
SYMM_TITLE = 'Symmetry'
INTENSITY_KEY = 'r_j_Intensity'
INTENSITY_TITLE = 'Intensity'
RAMAN_ACT_KEY = 'r_j_Raman_Act'
RAMAN_ACT_TITLE = 'Raman Act'
RAMAN_INT_KEY = 'r_j_Raman_Int'
RAMAN_INT_TITLE = 'Raman Int'
X_KEY = 'r_j_x%s'
X_TITLE = 'x%s'
Y_KEY = 'r_j_y%s'
Y_TITLE = 'y%s'
Z_KEY = 'r_j_z%s'
Z_TITLE = 'z%s'
COLUMNS = {'r_j_Frequency': 'Frequency', 'r_j_Intensity': 'Intensity', 'r_j_Raman_Act': 'Raman Act', 'r_j_Raman_Int': 'Raman Int', 's_j_Symmetry': 'Symmetry'}
__init__(bs_out_file_name)

Create an instance.

Parameters

bs_out_file_name (str) – the band shape output file name

Raises

NormalModeAnalysisException – if there is an issue

getVibStates(energy_start, energy_stop)

Get all vibrational states within the given energy window for the initial and final states.

Parameters
  • energy_start (float) – the lower bound on the energy in eV

  • energy_stop (float) – the upper bound on the energy in eV

Return type

dict, dict

Returns

initial and final vibrational states, keys are indices, values are sets of VibState

getVibStateWeight(state)

Return the weight of the given vibrational state.

Parameters

state (VibState) – the vibrational state

Return type

float

Returns

the weight

getAllVibData(all_states, jagout, include_n_quantum)

Return all frequencies and normal modes from the given vibrational states.

Parameters
  • all_states (dict) – vibrational states, keys are indices, values are sets of VibState

  • jagout (JaguarOutput) – the Jaguar output class

  • include_n_quantum (bool) – whether to include effects due to vibrational quantum numbers

Return type

list

Returns

contains NormalMode

getAvgVibData(all_states, jagout, include_n_quantum)

Return an averaged frequency and normal mode from the given vibrational states.

Parameters
  • all_states (dict) – vibrational states, keys are indices, values are sets of VibState

  • jagout (JaguarOutput) – the Jaguar output class

  • include_n_quantum (bool) – whether to include effects due to vibrational quantum numbers

Return type

NormalMode

Returns

the averaged NormalMode

getMaxVibData(all_states, jagout, include_n_quantum)

Return the frequency and normal mode with the largest weight from the given vibrational states.

Parameters
  • all_states (dict) – vibrational states, keys are indices, values are sets of VibState

  • jagout (JaguarOutput) – the Jaguar output class

  • include_n_quantum (bool) – whether to include effects due to vibrational quantum numbers

Return type

NormalMode

Returns

the max (largest weight) NormalMode

classmethod writeVibFile(file_name, n_atoms, normal_modes)

Write the *.vib file for the given normal modes.

Parameters
  • file_name (str) – the file name

  • n_atoms (int) – the number of atoms

  • normal_modes (list) – contains NormalMode

writeFiles(base_name, initial_normal_modes, final_normal_modes, title=None)

Write normal mode analysis files.

Parameters
  • base_name (str) – a base name for the files

  • initial_normal_modes (list or None) – contains NormalMode for the initial state

  • final_normal_modes (list or None) – contains NormalMode for the final state

  • title (str) – a title to use for structures in the normal mode analysis output files

run(energy_start, energy_stop, average=False, maximum=False, include_n_quantum=False, base_name=None, title=None)

Run it.

Parameters
  • energy_start (float) – the lower bound on the energy in eV

  • energy_stop (float) – the upper bound on the energy in eV

  • average (bool) – whether to average the normal modes

  • maximum (bool) – whether to report only the normal mode with the largest weight

  • include_n_quantum (bool) – whether to include effects due to vibrational quantum numbers

  • base_name (str) – a base name to use for the normal mode analysis output files

  • title (str) – a title to use for structures in the normal mode analysis output files

Raises

NormalModeAnalysisException – if there is an issue

Return type

str

Returns

the name of the Maestro file written

schrodinger.application.matsci.bandshape_utils.write_simplified_transitions_file(bs_out_file_name, s_bs_out_file_name=None)

Write a simplified transitions file.

Parameters
  • bs_out_file_name (str) – the band shape output file name

  • s_bs_out_file_name (str or None) – the simplified band shape output file name, if None then it will be determined from bs_out_file_name