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)[source]¶ Bases:
object
-
class
schrodinger.application.matsci.bandshape_utils.
Transition
(index, energy, intensity, initial_vib_states, final_vib_states, max_n_imaginary)[source]¶ Bases:
object
-
schrodinger.application.matsci.bandshape_utils.
is_bs_spectrum_file_key
(key)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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¶
-
static
isBandshapeTable
(atable)[source]¶ 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)[source]¶ 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
- 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
-
-
schrodinger.application.matsci.bandshape_utils.
get_translated_xyz_vec
(st)[source]¶ 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)[source]¶ 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
(ground_jo, excited_jo)[source]¶ Return the Huang-Rhys factors for the ground and excited states.
- Parameters
ground_jo (JaguarOutput) – the Jaguar output class for the ground state
excited_jo (JaguarOutput) – the Jaguar output class for the excited state
- Return type
list, list
- Returns
Huang-Rhys factors for ground and excited states
-
schrodinger.application.matsci.bandshape_utils.
get_transitions
(bs_out_file_name, initial_jo=None, final_jo=None)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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
[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.
-
-
class
schrodinger.application.matsci.bandshape_utils.
NormalModeAnalysis
(bs_out_file_name)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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
- Returns
the averaged NormalMode
-
getMaxVibData
(all_states, jagout, include_n_quantum)[source]¶ 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
- Returns
the max (largest weight) NormalMode
-
writeVibFile
(file_name, n_atoms, normal_modes)[source]¶ 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)[source]¶ Write normal mode analysis files.
-
run
(energy_start, energy_stop, average=False, maximum=False, include_n_quantum=False, base_name=None, title=None)[source]¶ 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)[source]¶ 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