schrodinger.application.matsci.reaction_workflow_utils module

Utilities for reaction workflows.

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.reaction_workflow_utils.TempData(temp_start, temp_step, temp_n)

Bases: tuple

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

count(value, /)

Return number of occurrences of value.

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

Return first index of value.

Raises ValueError if the value is not present.

temp_n

Alias for field number 2

temp_start

Alias for field number 0

temp_step

Alias for field number 1

class schrodinger.application.matsci.reaction_workflow_utils.PressData(press_start, press_step, press_n)

Bases: tuple

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

count(value, /)

Return number of occurrences of value.

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

Return first index of value.

Raises ValueError if the value is not present.

press_n

Alias for field number 2

press_start

Alias for field number 0

press_step

Alias for field number 1

class schrodinger.application.matsci.reaction_workflow_utils.ReactProdTS(ts_name, other_name)

Bases: tuple

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

count(value, /)

Return number of occurrences of value.

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

Return first index of value.

Raises ValueError if the value is not present.

other_name

Alias for field number 1

ts_name

Alias for field number 0

class schrodinger.application.matsci.reaction_workflow_utils.SameTypeGSTS(ts_name, other_name, is_gsgs)

Bases: tuple

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

count(value, /)

Return number of occurrences of value.

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

Return first index of value.

Raises ValueError if the value is not present.

is_gsgs

Alias for field number 2

other_name

Alias for field number 1

ts_name

Alias for field number 0

class schrodinger.application.matsci.reaction_workflow_utils.Pair(first, second)

Bases: tuple

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

count(value, /)

Return number of occurrences of value.

first

Alias for field number 0

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

Return first index of value.

Raises ValueError if the value is not present.

second

Alias for field number 1

class schrodinger.application.matsci.reaction_workflow_utils.DfCustomRateColumns(TS_Sibling, Other_Sibling, Temperature_K, Pressure_atm, Energy_Property, Energy_Barrier_kcal_per_mol, TS_Partition_F, Other_Partition_F, Rate_Constant, Rate_Constant_Type, Rate_Constant_Units)

Bases: tuple

Energy_Barrier_kcal_per_mol

Alias for field number 5

Energy_Property

Alias for field number 4

Other_Partition_F

Alias for field number 7

Other_Sibling

Alias for field number 1

Pressure_atm

Alias for field number 3

Rate_Constant

Alias for field number 8

Rate_Constant_Type

Alias for field number 9

Rate_Constant_Units

Alias for field number 10

TS_Partition_F

Alias for field number 6

TS_Sibling

Alias for field number 0

Temperature_K

Alias for field number 2

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

count(value, /)

Return number of occurrences of value.

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

Return first index of value.

Raises ValueError if the value is not present.

class schrodinger.application.matsci.reaction_workflow_utils.DfCustomEqColumns(Sibling, Other_Sibling, Temperature_K, Pressure_atm, Energy_Barrier_kcal_per_mol, Energy_Property, Keq)

Bases: tuple

Energy_Barrier_kcal_per_mol

Alias for field number 4

Energy_Property

Alias for field number 5

Keq

Alias for field number 6

Other_Sibling

Alias for field number 1

Pressure_atm

Alias for field number 3

Sibling

Alias for field number 0

Temperature_K

Alias for field number 2

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

count(value, /)

Return number of occurrences of value.

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

Return first index of value.

Raises ValueError if the value is not present.

class schrodinger.application.matsci.reaction_workflow_utils.MmodEnergyKeys(absolute, relative)

Bases: tuple

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

absolute

Alias for field number 0

count(value, /)

Return number of occurrences of value.

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

Return first index of value.

Raises ValueError if the value is not present.

relative

Alias for field number 1

class schrodinger.application.matsci.reaction_workflow_utils.EnergyAnalysisProperty(sibling_group, conformer_groups, representative_conformers, temperature, pressure, energy_key, property_key, avg_property_key, atom_idx, ensemble, include_x_terms, only_lowest_energy)

Bases: tuple

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

atom_idx

Alias for field number 8

avg_property_key

Alias for field number 7

conformer_groups

Alias for field number 1

count(value, /)

Return number of occurrences of value.

energy_key

Alias for field number 5

ensemble

Alias for field number 9

include_x_terms

Alias for field number 10

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

Return first index of value.

Raises ValueError if the value is not present.

only_lowest_energy

Alias for field number 11

pressure

Alias for field number 4

property_key

Alias for field number 6

representative_conformers

Alias for field number 2

sibling_group

Alias for field number 0

temperature

Alias for field number 3

class schrodinger.application.matsci.reaction_workflow_utils.Site(from_idx, to_idx, hash_idx, structure_idx)

Bases: tuple

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

count(value, /)

Return number of occurrences of value.

from_idx

Alias for field number 0

hash_idx

Alias for field number 2

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

Return first index of value.

Raises ValueError if the value is not present.

structure_idx

Alias for field number 3

to_idx

Alias for field number 1

class schrodinger.application.matsci.reaction_workflow_utils.Source(rgroup_st, site_idxs)

Bases: tuple

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

count(value, /)

Return number of occurrences of value.

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

Return first index of value.

Raises ValueError if the value is not present.

rgroup_st

Alias for field number 0

site_idxs

Alias for field number 1

schrodinger.application.matsci.reaction_workflow_utils.get_msg(site, msg)
schrodinger.application.matsci.reaction_workflow_utils.log(msg, **kwargs)

Add a message to the log file

Parameters

msg (str) – The message to log

Additional keyword arguments are passed to the textlogger.log_msg function

schrodinger.application.matsci.reaction_workflow_utils.get_mmod_energy_key(ffld_name=None)

Returns the corresponding MacroModel energy key for the given forcefield. If no forcefield is given and the license is available, it defaults to S-OPLS. If no forcefield is given and the license is NOT available, it defaults to OPLS2005.

Parameters

ffld_name (str) – The forcefield to get the energy key for. If None, defaults to the latest forcefield available given your licenses.

Return str energy_key

The MacroModel suffix key for the default forcefield. Units are in kJ/mol

schrodinger.application.matsci.reaction_workflow_utils.get_mmod_rel_energy_key(ffld_name=None)

Returns the corresponding MacroModel relative energy key for the given forcefield. If no forcefield is given and the license is available, it defaults to S-OPLS. If no forcefield is given and the license is NOT available, it defaults to OPLS2005.

Parameters

ffld_name (str) – The forcefield to get the energy key for. If None, defaults to the latest forcefield available given your licenses.

Return str energy_key

The MacroModel suffix key for the default forcefield.

schrodinger.application.matsci.reaction_workflow_utils.get_mmod_energy_keys(ffld_name=None)

Returns the corresponding MacroModel energy key for the given forcefield. If no forcefield is given and the license is available, it defaults to S-OPLS. If no forcefield is given and the license is NOT available, it defaults to OPLS2005.

Parameters

ffld_name (str) – The forcefield to get the energy key for. If None, defaults to the latest forcefield available given your licenses.

Return namedtuple energy_keys

A named two-tuple where the first element (with a key of absolute) is the MacroModel suffix for the absolute energy (in kJ/mol), and the second element (with a key of relative) is the MacroModel suffix for the relative energy.

class schrodinger.application.matsci.reaction_workflow_utils.DF_RATE_TYPE(value)

Bases: enum.Enum

An enumeration.

DEFAULT = 'default'
LNQ = 'lnq'
ANH_LNQ = 'anharmonic_lnq'
schrodinger.application.matsci.reaction_workflow_utils.get_reactions_data(sts)

Given conformers dictionary return list of reactions.

Parameters

sts (list[structure.Structure]) – List of structures

Return type

list[Pair]: List of pairs that holds two ReactProdTS (first, second) or SameTypeGSTS (for the Int-Int or TS-TS case) which in turn hold the data for calculating both two rate constants and two equilibrium constants

schrodinger.application.matsci.reaction_workflow_utils.add_remove_props(sts, prop, add_props)

Set additional properties equal to the original property from input structures, original property will be deleted.

Parameters
  • sts (list[structure.Structure]) – List of structures to be modified

  • prop (str) – Value of this property will be used, the property will be deleted

  • add_props (list[str]) – List of properties to be added to the structure

schrodinger.application.matsci.reaction_workflow_utils.set_extra_energy_props(sts, extra_stages_file, press_data, temp_data)

Set temp/pressure dependent extra properties in the input structures based on the original properties.

Parameters
  • sts (list[structure.Structure]) – List of structures to be modified

  • extra_stages_file (str) – Extra stage file name

  • press_data (PressData) – Pressure data

  • temp_data (TempData) – Temperature data

Return type

set[str]

Returns

Set of extra energy properties

schrodinger.application.matsci.reaction_workflow_utils.get_pressures_temps(press_data, temp_data)

Get list of pressures and temepratures from input data.

Parameters
Return type

list[float], list[float]

Returns

List of pressures, list of temperatures

schrodinger.application.matsci.reaction_workflow_utils.set_gas_phase_zpe_props(sts, press_data, temp_data, stage_idx)

Set temp/pressure dependent gas phase + ZPE property in the input structures based on the original property

Parameters
  • sts (list[structure.Structure]) – List of structures to be modified

  • press_data (PressData) – Pressure data

  • temp_data (TempData) – Temperature data

  • stage_idx (int) – Stage index

schrodinger.application.matsci.reaction_workflow_utils.get_eprop_data(eprop)

Get conversion factor to kcal/mol, temperature in K, pressure in atm, from energy property

Parameters

eprop (str) – Energy property

Return type

float, float, float

Returns

conversion factor to kcal/mol, temperature in K, pressure in atm

schrodinger.application.matsci.reaction_workflow_utils.add_custom_eq_rows(name, other_name, avg_props, other_avg_props, eprop, dframe)

Add data with kEQ to the dataframe

Parameters
  • name (str) – Sibling name

  • other_name (str) – Other sibling name

  • avg_props (list[EnergyAnalysisProperty]) – List of average properties of sibling

  • other_avg_props (list[EnergyAnalysisProperty]) – List of average properties of the other sibling

  • eprop (str) – Energy property

  • dframe (pandas.DataFrame) – Input dataframe

Return type

pandas.DataFrame

Returns

Updated dataframe

schrodinger.application.matsci.reaction_workflow_utils.add_custom_rate_rows(reaction, ts_avg_props, other_avg_props, eprop, dframe, is_anharm, wigner_tunnel_corr=False)

Add data with custom rates to the dataframe

Parameters
  • reaction (ReactProdTS) – Reaction/product - TS

  • ts_avg_props (list[EnergyAnalysisProperty]) – List of average properties

  • other_avg_props (list[EnergyAnalysisProperty]) – List of other average properties

  • eprop (str) – Energy property

  • dframe (pandas.DataFrame) – Input dataframe

  • is_anharm (bool) – Whether it is anharmonic calculation

  • wigner_tunnel_corr (bool) – whether to include the Wigner tunneling correction when computing rate constant(s)

Return type

pandas.DataFrame

Returns

Updated dataframe

schrodinger.application.matsci.reaction_workflow_utils.set_temp_press_props(sts, press_data, temp_data, extra_stages_file=None)

Set temperature and pressure dependent properties.

Parameters
  • sts (list[schrodinger.structure.Structure]) – the structures on which to set the properties

  • press_data (PressData) – pressure data

  • temp_data (TempData) – temperature data

  • extra_stages_file (str or None) – extra stage file name or None if there isn’t one

Return type

set[str]

Returns

the property keys set

schrodinger.application.matsci.reaction_workflow_utils.get_custom_keq_rates(out_mae, press_data, temp_data, extra_stages_file=None, compute_rates=True, wigner_tunnel_corr=False)

Given output mae file, write custom equilibrium constants and optionally custom rates to CSV dataframes.

Parameters
  • out_mae (str) – Output file name

  • press_data (PressData) – Pressure data

  • temp_data (TempData) – Temperature data

  • extra_stages_file (str or None) – Extra stage file name or None

  • compute_rates (bool) – Whether to compute rates or only equilibrium constants

  • wigner_tunnel_corr (bool) – whether to include the Wigner tunneling correction when computing rate constant(s)

schrodinger.application.matsci.reaction_workflow_utils.get_keq(energy, temp)

Get k_equilibrium given energy and temperature.

Parameters
  • energy (float) – energy in kcal/mol

  • temp (float) – Temperature in Kelvin

Return type

float

Returns

k_equilibrium

schrodinger.application.matsci.reaction_workflow_utils.get_custom_rate(energy, temp, dlnq=None, ifreq=None, wigner_tunnel_corr=False)

Get custom rate.

Parameters
  • energy (float) – Energy in kcal/mol (!)

  • temp – Temperature in K

  • lnq (None or float) – lnQ to compute rate with partition function, unitless

  • ifreq (None or float) – Lowest negative frequency to compute rate with partition function, in 1/cm

  • wigner_tunnel_corr (bool) – whether to include the Wigner tunneling correction when computing rate constant(s)

Return type

float

Returns

Rate in 1/s

schrodinger.application.matsci.reaction_workflow_utils.get_present_props(en_starter, properties, stage_idx=None)

Get all properties with a certain starter and optionally stage index

Parameters
  • en_starter (str) – Property must start with this

  • properties (list[str]) – List of properties

  • stage_idx (None or int) – Stage index

Return type

list[str]

Returns

List of matching properties

schrodinger.application.matsci.reaction_workflow_utils.get_present_props_from_sts(sts, prefix, stage_idx=None)

Get properties that start with prefix and end with stage index (if provided). Check if pressure/temperature is present. Ensure that all the structures have at least the same list of properties

Parameters
  • sts (list[structure.Structure]) – List of structures

  • prefix (str) – Property must start with this

  • stage_idx (None or int) – Stage index

Return type

set[str]

Returns

Set of properties

schrodinger.application.matsci.reaction_workflow_utils.get_lnq(eprop, averaged_properties, is_anharm)

Get lnQ Boltzmann averaged over energy property.

Parameters
  • e_prop (str) – Energy property

  • averaged_properties (dict) – Averaged Boltzmann properties

  • is_anharm (bool) – Whether to use anharmonic approximation

Return type

float

Returns

Averaged lnQ

schrodinger.application.matsci.reaction_workflow_utils.get_restrain_atom_idxs(st)

Return a list of indices of restrain atoms in the given structure.

Parameters

st (schrodinger.structure.Structure) – the structure

Return type

list

Returns

contains indices of restrain atoms

exception schrodinger.application.matsci.reaction_workflow_utils.InvalidInput

Bases: Exception

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

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

schrodinger.application.matsci.reaction_workflow_utils.get_idx_groups(text)

Get index groups from the given string.

Parameters

text (str) – the string

Raise

InvalidInput if there is a formatting issue

Return type

list

Returns

contains list of indices

schrodinger.application.matsci.reaction_workflow_utils.get_restrain_distance_idxs(st)

Return a list of lists of indices of restrain distances in the given structure.

Parameters

st (schrodinger.structure.Structure) – the structure

Return type

list

Returns

contains lists of restrain distances

schrodinger.application.matsci.reaction_workflow_utils.get_restrain_angle_idxs(st)

Return a list of lists of indices of restrain angles in the given structure.

Parameters

st (schrodinger.structure.Structure) – the structure

Return type

list

Returns

contains lists of restrain angles

schrodinger.application.matsci.reaction_workflow_utils.get_restrain_dihedral_idxs(st)

Return a list of lists of indices of restrain dihedrals in the given structure.

Parameters

st (schrodinger.structure.Structure) – the structure

Return type

list

Returns

contains lists of restrain dihedrals

schrodinger.application.matsci.reaction_workflow_utils.get_jaguar_keywords_list(jaguar_keywords_dict)

Return the Jaguar keywords list from the given dict.

Parameters

jaguar_keywords_dict (OrderedDict) – the Jaguar keywords dict

Return type

list

Returns

the Jaguar keywords list

schrodinger.application.matsci.reaction_workflow_utils.type_cast_seed(seed)

Type cast the seed.

Parameters

seed (str or unicode) – seed for random number generator

Return type

int

Returns

the seed

schrodinger.application.matsci.reaction_workflow_utils.type_cast_jaguar_keywords(jaguar_keywords, reserved_keys={'ifreq', 'igeopt', 'itrvec', 'molchg', 'multip', 'nhesref', 'npress', 'ntemp', 'press', 'press_step', 'tmpini', 'tmpstp'}, exception_type=<class 'argparse.ArgumentTypeError'>)

Type cast the Jaguar keywords.

Parameters
  • jaguar_keywords (str or unicode or list) – the Jaguar keywords, a whitespace delimited string of ‘<key>=<value>’ tokens or a list of such tokens

  • reserved_keys (set) – contains reserved Jaguar keys

  • exception_type (type) – the exception type to raise if invalid

Return type

OrderedDict

Returns

the Jaguar keywords OrderedDict

schrodinger.application.matsci.reaction_workflow_utils.check_ff_assignment(sts, ffld_name=None)

Check the assignment of the given force field to the given structures.

Parameters
  • sts (list) – contains schrodinger.structure.Structure

  • ffld_name (str) – the force field name.

Raises

ValueError – if invalid

schrodinger.application.matsci.reaction_workflow_utils.get_molecular_weight(st, idxs=None, decimal=None)

Return the molecular weight (amu) taken over the given atom indices in the given structure.

Parameters
  • st (schrodinger.structure.Structure) – the structure

  • idxs (list) – the atom indices

  • decimal (None or int) – an optional number of decimal places to which to round the weight

Return type

float

Returns

the molecular weight (amu)

schrodinger.application.matsci.reaction_workflow_utils.check_centroid_rep(st)

Check the centroid representation of the given structure.

Parameters

st (schrodinger.structure.Structure) – the structure

Raises

ValueError – if invalid

schrodinger.application.matsci.reaction_workflow_utils.check_conformers(conformers, conformers_group_hash)

Check conformers. If the given structures are conformers then their atom numberings are all changed in place so that they are equivalent to that of the first of the given conformers.

Parameters
  • conformers (list) – contains schrodinger.structure.Structure of conformers

  • conformers_group_hash (str) – a group hash

Raises

ValueError – if invalid

schrodinger.application.matsci.reaction_workflow_utils.check_reaction_wf_structures(rxn_sts, ffld_name=None, mass_conserved=False, keep_atoms_only=False, out_rep=False)

Check the given reaction workflow structues.

Parameters
  • rxn_sts (str or list) – the reaction workflow structures, a file name or list of schrodinger.structure.Structure

  • ffld_name (str) – the force field name to use when optionally checking its assignment to the given structures

  • mass_conserved (bool) – check that mass is conserved (see also keep_atoms_only kwarg)

  • keep_atoms_only (bool) – specifies that only keep atoms be considered when checking if mass is conserved (see also mass_conserved kwarg)

  • out_rep (bool) – check the output representation of haptic ligands

Raises

ValueError – if invalid

schrodinger.application.matsci.reaction_workflow_utils.type_cast_reaction_wf_input(reaction_wf_input, exception_type=<class 'argparse.ArgumentTypeError'>, mass_conserved=False, out_rep=False)

Type cast the reaction workflow input.

Parameters
  • reaction_wf_input (str or unicode or list) – the reaction workflow input, a file name or list of schrodinger.structure.Structure

  • exception_type (type) – the exception type to raise if invalid

  • mass_conserved (bool) – check that mass is conserved

  • out_rep (bool) – check the output representation of haptic ligands

Return type

str or list

Returns

the reaction workflow input, a file name or list of schrodinger.structure.Structure

schrodinger.application.matsci.reaction_workflow_utils.bin_structures_by_property(sts, key='s_matsci_Reaction_Workflow_Conformers_Group', inner_key=None)

Return a dictionary of structures binned by a property with the given key. If inner_key is provided then return a dictionary of dictionaries of structures with the inner dictionaries keyed by inner_key and outer dictionaries keyed by key.

Parameters
  • sts (list) – the structures

  • key (str) – the key for the property by which to bin

  • inner_key (str) – additionally bin by this inner_key

Return type

dict or dict of dict

Returns

dictionary where keys are properties and values are lists of structures or dictionary of dictionaries where the outer dictionary is keyed by key and inner dictionary is keyed by inner_key and values of the inner dictionary are lists of structures

schrodinger.application.matsci.reaction_workflow_utils.append_unique_conformers(sts, unique_sts, rmsd_thresh=0.1, n_conformers=None)

Append any unique conformers found in the given structures to the given unique structures.

Parameters
  • sts (list) – schrodinger.structure.Structure candidate conformers

  • unique_sts (list) – schrodinger.structure.Structure unique conformers

  • rmsd_thresh (float) – the maximum allowable RMSD (Ang.) between two structures before they can be considered different conformers

  • n_conformers (int or None) – number of sought conformers or None if there isn’t one

schrodinger.application.matsci.reaction_workflow_utils.get_conformers(sts, n_conformers, pp_rel_energy_thresh=None, rmsd_thresh=0.1, ffld_name=None, energy_key=None)

Return either (1) at most the given number of conformers or (2) all conformers with relative energies less than the given value. If (2) then an attempt is made to return at least the given number of conformers even if that means having relative energies larger than the given value.

Parameters
  • sts (list) – schrodinger.structure.Structure conformers

  • n_conformers (int) – either the maximum number of conformers if pp_rel_energy_thresh is None or a target minimum number of conformers if pp_rel_energy_thresh is given

  • pp_rel_energy_thresh (None or float) – relative energy threshold, if None then only the n_conformers lowest energy conformers are returned, units are in kJ/mol if there is no energy key given otherwise the same units as energy_key

  • rmsd_thresh (float) – the maximum allowable RMSD (Ang.) between two structures before they can be considered different conformers

  • ffld_name (str or None) – the name of the force field to use for the search, if None, then defaults to the latest forcefield available, not used if energy key is given

  • energy_key (str or None) – the energy key to use for selecting conformers, takes precedence over ffld_name

Return type

list

Returns

schrodinger.structure.Structure conformers

Postprocess a MacroModel conformational search. Rewrite the given MacroModel out *mae file so that the conformers in it have properly updated properties.

Parameters
  • conformer (structure.Structure) – a representative conformer that seeded the search being postprocessed

  • out_mae_path (str) – the file path to the MacroModel out *mae file

  • ffld_name (str) – the name of the force field to use for the search. If None, then defaults to the latest forcefield available.

schrodinger.application.matsci.reaction_workflow_utils.write_com_file(in_mae_fn, out_mae_fn, com_fn, restrain_idxs=None, seed=1234, ffld_name=None, rel_energy_thresh=50.0, rmsd_thresh=0.1, ref_com_fn=None)

Write a MacroModel .com file.

Parameters
  • in_mae_fn (str) – the input .mae file name

  • out_mae_fn (str) – the output .mae file name

  • com_fn (str) – the input .com file name

  • restrain_idxs (list) – indices to restrain

  • seed (int) – seed for random number generator

  • ffld_name (str) – the force field name

  • rel_energy_thresh (float) – relative energy threshold in kJ/mol, structures with energies (relative to that of the global minimum structure) greater than this value are not considered conformers, used in MacroModel

  • rmsd_thresh (float) – the maximum allowable RMSD (Ang.) between two structures before they can be considered different conformers

  • ref_com_fn (None or str) – if given then use the settings in this file for the search rather than the default settings

Raises

ConformationalSearchException – if there is an issue

Perform a restrained MacroModel conformational search seeded with the given conformers.

Parameters
  • conformers (list) – schrodinger.structure.Structure conformers used to seed the search

  • n_conformers (int) – number of sought conformers

  • restrain_idxs (list) – indices to restrain

  • seed (int) – seed for random number generator

  • launch_dir (str) – a launch subdirectory to use for the job

  • base_name (str) – a base name to use for file and job naming

  • job_dj (queue.JobDJ) – if an instance is given then add the current job and return

  • clean (bool) – if not given a job_dj then this option controls cleaning up after the job that was run

  • ffld_name (str) – the force field name

  • rel_energy_thresh (float) – relative energy threshold in kJ/mol, structures with energies (relative to that of the global minimum structure) greater than this value are not considered conformers, used in MacroModel

  • rmsd_thresh (float) – the maximum allowable RMSD (Ang.) between two structures before they can be considered different conformers

  • pp_rel_energy_thresh (None or float) – relative energy threshold in kJ/mol, if None then only the n_conformers lowest energy conformers are returned, used in postprocessing MacroModel results

  • ref_com_fn (None or str) – if given then use the settings in this file for the search rather than the default settings

Raises

ConformationalSearchException – if there is an issue

Return type

list

Returns

schrodinger.structure.Structure conformers, could be less than n_conformers

schrodinger.application.matsci.reaction_workflow_utils.get_int_tuples_from_str_property(st, key, separator=';')

Return a list of tuples of integers from the given string structure property.

Parameters
  • st (schrodinger.structure.Structure) – the structure

  • key (str) – the property key

  • separator (str) – the tuple separator used for the given property

Return type

list

Returns

contains tuples of integers

schrodinger.application.matsci.reaction_workflow_utils.update_index_properties(st, old_to_new)

Update the index properties of the given structure.

Parameters
  • st (structure.Structure) – the structure

  • old_to_new (dict) – a map of old-to-new atom indices

schrodinger.application.matsci.reaction_workflow_utils.get_core_idxs(st)

Return a set of atom indices for the core of the given structure.

Parameters

st (schrodinger.structure.Structure) – the structure

Return type

set

Returns

core atom indices

schrodinger.application.matsci.reaction_workflow_utils.representative_conformers(sibling_conformers_dict, specific_sibling_group=None)

Generator over representative conformers.

Parameters
  • sibling_conformers_dict (dict) – dictionary of dictionaries where the outer dictionary is keyed by sibling and inner dictionary is keyed by conformer and values of the inner dictionary are lists of structures

  • specific_sibling_group (str or None) – if not None then restrict conformers to be generated only over this sibling group

Return type

tuple

Returns

the sibling and conformer group names and the representative conformer or None if one doesn’t exist

class schrodinger.application.matsci.reaction_workflow_utils.RepresentativeConformersMixin

Bases: object

representativeConformers(sibling_conformers_dict=None, specific_sibling_group=None)

Generator over representative conformers.

Parameters
  • sibling_conformers_dict (dict or None) – dictionary of dictionaries where the outer dictionary is keyed by sibling and inner dictionary is keyed by conformer and values of the inner dictionary are lists of structures, if None then the class attr is used

  • specific_sibling_group (str or None) – if not None then restrict conformers to be generated only over this sibling group

Return type

tuple

Returns

the sibling and conformer group names and the representative conformer

class schrodinger.application.matsci.reaction_workflow_utils.ReactionWorkflowFile(rxn_sts)

Bases: schrodinger.application.matsci.reaction_workflow_utils.RepresentativeConformersMixin

Manage a reaction workflow file.

__init__(rxn_sts)

Create an instance.

Parameters

rxn_sts (str or list) – the reaction workflow structures, a file name or list of schrodinger.structure.Structure

getReactantsSiblingGroupName()

Return the reactants sibling group name.

Return type

str

Returns

the reactants sibling group name

getReactantsConformersDict()

Return the reactants conformers dictionary.

Return type

dict

Returns

keys are conformer group names, values are lists of structure.Structure

representativeConformers(sibling_conformers_dict=None, specific_sibling_group=None)

Generator over representative conformers.

Parameters
  • sibling_conformers_dict (dict or None) – dictionary of dictionaries where the outer dictionary is keyed by sibling and inner dictionary is keyed by conformer and values of the inner dictionary are lists of structures, if None then the class attr is used

  • specific_sibling_group (str or None) – if not None then restrict conformers to be generated only over this sibling group

Return type

tuple

Returns

the sibling and conformer group names and the representative conformer

class schrodinger.application.matsci.reaction_workflow_utils.UniqueGeomMixin

Bases: object

Manage uniqueifying structures by geometry.

class schrodinger.application.matsci.reaction_workflow_utils.ReactionWorkflowEnergyAnalysis(rxn_sts, energy_keys, dedup_geom_eps=0.25)

Bases: schrodinger.application.matsci.reaction_workflow_utils.ReactionWorkflowFile, schrodinger.application.matsci.reaction_workflow_utils.UniqueGeomMixin

Manage a reaction workflow energy analysis.

__init__(rxn_sts, energy_keys, dedup_geom_eps=0.25)

Create an instance.

Parameters
  • rxn_sts (str or list) – the reaction workflow structures, a file name or list of schrodinger.structure.Structure

  • energy_keys (list) – structure property energy keys to consider, if it is temperature dependent then include the temperature (K) as a number followed by ‘K’ in the key and the corresponding energy must be in supported units (au, kcal/mol, eV, kJ/mol) and must be present in the key as ‘(<units>)’

  • dedup_geom_eps (float) – reduce the number of calculations by deduplicating the input structures based on geometry, using this threshold in Ang., and only calculating the representatives, a value of zero means no deduplicating

getUnitsData(prop)

Get conversion factor to kcal/mol, pressure and temperature from a property, saving the data into a dict.

Parameters

prop (str) – Property to use

Return type

float or None, float or None, float or None

Returns

Conversion to kcal/mol, pressure, temperature

static getHeader(energy_key)

Return a header for the given energy key.

Parameters

energy_key (str) – structure property energy key

Return type

str

Returns

the header

static getTemperature(energy_key)

Return the temperature (K) for the given energy key.

Parameters

energy_key (str) – structure property energy key

Return type

float, None

Returns

the temperature (K) if there is one

static getPressure(energy_key)

Return the pressure (atm) for the given energy key.

Parameters

energy_key (str) – structure property energy key

Return type

float, None

Returns

the pressure (atm) if there is one

static getUnits(energy_key)

Return the units for the given energy key.

Parameters

energy_key (str) – structure property energy key

Return type

str, None

Returns

the units if there is one

static getKcalPerMolConversion(energy_key)

Return the kcal/mol conversion factor for the given energy key.

Parameters

energy_key (str) – structure property energy key

Return type

float, None

Returns

the kcal/mol conversion factor if there is one

static getEnergyPropertyValues(sts, energy_key, include_x_terms=False, property_key=None, atom_idx=None)

Return energy and property value pairs for the given structures.

Parameters
  • sts (list[schrodinger.structure.Structure]) – a collection of conformers, if including cross terms then it is a single conformer from each structure type in the sibling group, otherwise it is all conformers for a given structure type

  • energy_key (str) – the energy key

  • include_x_terms (bool) – whether to include cross terms

  • property_key (str or None) – the relevant property key, if not specified it is the same as the energy key

  • atom_idx (int or None) – if an integer then the given property key is for an atomic property and this is the atom index, if None then the given property key is a structure property

Return type

list[tuple]

Returns

energy and property value pairs for the given structures

getPropertyEnsemble(conformers_dict, energy_key, conversion, temp, do_boltzmann, include_x_terms=False, only_lowest_energy=False, property_key=None, atom_idx=None)

Return an ensemble of properties for the given conformers dictionary of siblings and given energy key.

Parameters
  • conformers_dict (dict) – keys are conformer group names, values are lists of structure.Structure

  • energy_key (str) – the relevant energy key

  • conversion (float) – the energy conversion factor to kcal/mol

  • temp (float) – the temperature in K

  • do_boltzmann (bool) – if True perform a Boltzmann average, otherwise an algebraic average

  • include_x_terms (bool) – whether to include cross terms in the conformational averaging

  • only_lowest_energy (bool) – use only the lowest energy conformer rather than averaging over conformers

  • property_key (str) – the relevant property key, if not specified it is the same as the energy key

  • atom_idx (int or None) – if an integer then the given property key is for an atomic property and this is the atom index, if None then the given property key is a structure property

Raises

ReactionWorkflowException – if there is an issue

Return type

list

Returns

ensemble of properties

getProperties(include_x_terms=False, only_lowest_energy=False, property_key=None, atomic=False, temps=None)

Return the properties.

Parameters
  • include_x_terms (bool) – whether to include cross terms

  • only_lowest_energy (bool) – use only the lowest energy conformer rather than averaging over conformers

  • property_key (str) – the property key, if not specified energy energy keys are used

  • atomic (bool) – if True then the given property key is an atomic property, otherwise is a structure property

  • temps (list) – temperatures in K, only used for temperature independent energy and property keys

Raises

ReactionWorkflowException – if there is an issue

Return type

list[EnergyAnalysisProperty]

Returns

the properties

getConfAvgRelEnergies(include_x_terms=True, only_lowest_energy=False)

Return the conformationally averaged energies relative to that of the reactants.

Parameters
  • include_x_terms (bool) – whether to include cross terms in the conformational averaging

  • only_lowest_energy (bool) – use only the lowest energy conformer rather than averaging over conformers

Raises

ReactionWorkflowException – if there is an issue

Return type

dict

Returns

keys are sibling group names, values are dicts with energy keys as keys and energy values as values

getGraph()

Return a NetworkX directed graph of the reaction workflow energy level diagram.

Return type

networkx.DiGraph

Returns

nodes are sibling group names and have energy dictionary kwargs, edges are directed (parent, child) pairs

static getOrderedNodeNames(graph)

Return an ordered list of node names from the given graph.

Parameters

graph (networkx.DiGraph) – nodes are sibling group names and have energy dictionary kwargs, edges are directed (parent, child) pairs

Return type

list

Returns

contains ordered node names

writeDataFiles()

Write data files.

getReactantsConformersDict()

Return the reactants conformers dictionary.

Return type

dict

Returns

keys are conformer group names, values are lists of structure.Structure

getReactantsSiblingGroupName()

Return the reactants sibling group name.

Return type

str

Returns

the reactants sibling group name

representativeConformers(sibling_conformers_dict=None, specific_sibling_group=None)

Generator over representative conformers.

Parameters
  • sibling_conformers_dict (dict or None) – dictionary of dictionaries where the outer dictionary is keyed by sibling and inner dictionary is keyed by conformer and values of the inner dictionary are lists of structures, if None then the class attr is used

  • specific_sibling_group (str or None) – if not None then restrict conformers to be generated only over this sibling group

Return type

tuple

Returns

the sibling and conformer group names and the representative conformer

schrodinger.application.matsci.reaction_workflow_utils.get_stage_idx(astr, is_filename=False)

Return the stage index from the given string, can be a filename.

Parameters
  • astr (str) – the string

  • is_filename (bool) – Whether astr is filename or not

Return type

int

Returns

the stage index

schrodinger.application.matsci.reaction_workflow_utils.check_TS_vetting(out_file)

Return False if TS vetting failed in the given Jaguar out file.

Parameters

out_file (str) – Jaguar out file

Return type

bool

Returns

False if TS vetting failed

schrodinger.application.matsci.reaction_workflow_utils.get_sub_host_str(obj, sub_host_attr, n_procs_attr)

Return the command line -HOST argument for using a subhost.

Parameters
  • obj (object) – the object, possibly having the given attributes defined

  • sub_host_attr (str) – the attribute for the subhost

  • n_procs_attr (str) – the attribute for the number of processors

exception schrodinger.application.matsci.reaction_workflow_utils.ConformationalSearchException

Bases: Exception

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

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

class schrodinger.application.matsci.reaction_workflow_utils.ConformationalSearchMixin

Bases: object

Manage a MacroModel conformational search.

static genEtaRotamers(sibling_conformers_dict, only_rings=True)

Generate eta-rotamers.

Parameters
  • sibling_conformers_dict (dict) – dictionary of dictionaries where the outer dictionary is keyed by sibling and inner dictionary is keyed by conformer and values of the inner dictionary are lists of structures

  • only_rings (bool) – if True then only allow rotation of eta-bound rings, if False then also allow rotation of ligands where the eta-bound motif is acyclic, for example ethene, etc.

Return type

dict, dict

Returns

dictionary of dictionaries where the outer dictionary is keyed by sibling and inner dictionary is keyed by conformer and values of the inner dictionary are lists of structures, for eta-complexes incoming conformers have been replaced with all possible rotamers, another dictionary mapping the structure titles of generated rotamers to the structure title of the structure from which they were generated

createConformers(sts)

Create the conformers.

Parameters

sts (list) – contains schrodinger.structure.Structure, the structures for which to create conformers, each unique type of structure should have a unique conformer group structure property keyed by CONFORMERS_GROUP_KEY, structures sharing the same CONFORMERS_GROUP_KEY should be conformers of the same structure and are used to seed the conformational search, an additional optional SIBLING_GROUP_KEY can be used to distinguish related groups of conformers, atoms marked with the property RESTRAINED_ATOM_KEY will be restrained

Raises

ConformationalSearchException – if there is an issue

exception schrodinger.application.matsci.reaction_workflow_utils.MopacException

Bases: Exception

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

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

class schrodinger.application.matsci.reaction_workflow_utils.MopacMixin

Bases: object

Manage Mopac jobs.

writeInput(mopac_launch_dir, mopac_in_mae_file)

Write the input.

Parameters
  • mopac_launch_dir (str) – the Mopac launch directory

  • mopac_in_mae_file (str) – the Mopac input file name

runJob(mopac_launch_dir, mopac_in_mae_file)

Run the Mopac job.

Parameters
  • mopac_launch_dir (str) – the Mopac launch directory

  • mopac_in_mae_file (str) – the Mopac input file name

Raises

MopacException – if there is an issue

Return type

str

Returns

the Mopac output file name

selectMopacConformers(sts)

Select representative conformers from the given structures.

Parameters

sts (list[schrodinger.structure.Structure]) – all conformers

Return type

list

Returns

representative conformers

runMopac()

Run Mopac.

Return type

str

Returns

the Mopac output file name

exception schrodinger.application.matsci.reaction_workflow_utils.JMSWFException

Bases: Exception

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

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

class schrodinger.application.matsci.reaction_workflow_utils.JMSWFMixin

Bases: schrodinger.application.matsci.reaction_workflow_utils.RepresentativeConformersMixin

Manage a Jaguar multistage workflow.

runJMSWF()

Run the Jaguar multistage workflow.

Raises

JMSWFException – if there is an issue

prepareJMSWFOutput()

Prepare Jaguar multistage workflow output.

checkJMSWFOutputs(out_files)

Raises JMSWFException if any of the given Jaguar out files should be treated as a failure.

Parameters

out_files (list) – contains Jaguar output files

Raises

JMSWFException – if any of the given Jaguar out files should be treated as a failure

selectJMSWFConformers(sts)

Select representative conformers from the given structures.

Parameters

sts (list[schrodinger.structure.Structure]) – the structures

Raises

JMSWFException – if there is an issue

Return type

list

Returns

the representative conformers

setRepresentatives()

Associated with each structure is output data from potentially multiple Jaguar multistage workflow stages. Pick representative structures to carry the data for all stages.

Raises

JMSWFException – if there is an issue

finalizeJMSWFOutput()

Finalize the Jaguar multistage workflow output.

Return type

str

Returns

the Jaguar multistage workflow output file

getFreqStageIdxs()

Return the stage indices of frequency stages.

Return type

tuple[int]

Returns

the stage indices

representativeConformers(sibling_conformers_dict=None, specific_sibling_group=None)

Generator over representative conformers.

Parameters
  • sibling_conformers_dict (dict or None) – dictionary of dictionaries where the outer dictionary is keyed by sibling and inner dictionary is keyed by conformer and values of the inner dictionary are lists of structures, if None then the class attr is used

  • specific_sibling_group (str or None) – if not None then restrict conformers to be generated only over this sibling group

Return type

tuple

Returns

the sibling and conformer group names and the representative conformer

class schrodinger.application.matsci.reaction_workflow_utils.DescriptorsMixin

Bases: object

Manage running descriptors.

DEFAULT_JOB_NAME = 'automatic_reaction_workflow'
getJaguarFlags(jaguar)

Return Jaguar flags.

Parameters

jaguar (bool) – whether to run Jaguar descriptors

Return type

list

Returns

the Jaguar flags

getMoldesFlags(mopac)

Return moldescriptors flags.

Parameters

mopac (bool) – whether to run Mopac descriptors

Return type

list

Returns

the moldescriptors flags

runDescriptors(files, jaguar=True, mopac=False)

Run descriptors.

Parameters
  • files (list) – the files on which to run descriptors

  • jaguar (bool) – whether to run Jaguar descriptors

  • mopac (bool) – whether to run Mopac descriptors

Return type

list

Returns

The output file paths. The returned list will be the same length as the input files list.

schrodinger.application.matsci.reaction_workflow_utils.has_transition_state(rxnwf_file_path=None, rxnwf_sts=None)

Return True if the reaction workflow features a transition state, False otherwise.

Return type

bool

Returns

True if the reaction workflow features a transition state, False otherwise

schrodinger.application.matsci.reaction_workflow_utils.get_rep_stage_idx(rxnwf_file_path=None, rxnwf_sts=None)

Return the representative stage index.

Return type

int

Returns

the representative stage index

exception schrodinger.application.matsci.reaction_workflow_utils.ReactionWorkflowException

Bases: Exception

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

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

class schrodinger.application.matsci.reaction_workflow_utils.ReactionWorkflow(reaction_wf_input_sts, dedup_geom_eps=0.25, n_conformers=5, skip_eta_rotamers=False, pp_rel_energy_thresh=None, seed=1234, only_rings=True, return_csearch_files=False, jaguar_keywords={'basis': 'LACVP**', 'dftname': 'B3LYP'}, temp_data=None, press_data=None, return_jaguar_files=False, anharm=False, return_anharm_files=False, anharm_max_freq=300, anharm_factor_data=None, rate_constants=False, return_rate_constant_files=False, custom_rate_constants=False, wigner_tunnel_corr=False, extra_stages_file=None, max_i_freq=0, out_rep=None, n_jmswf_subjobs=1, subhost=None, tpp=1, ffld_name=None, logger=None)

Bases: schrodinger.application.matsci.reaction_workflow_utils.ConformationalSearchMixin, schrodinger.application.matsci.reaction_workflow_utils.JMSWFMixin, schrodinger.application.matsci.reaction_workflow_utils.UniqueGeomMixin

Manage a reaction workflow.

__init__(reaction_wf_input_sts, dedup_geom_eps=0.25, n_conformers=5, skip_eta_rotamers=False, pp_rel_energy_thresh=None, seed=1234, only_rings=True, return_csearch_files=False, jaguar_keywords={'basis': 'LACVP**', 'dftname': 'B3LYP'}, temp_data=None, press_data=None, return_jaguar_files=False, anharm=False, return_anharm_files=False, anharm_max_freq=300, anharm_factor_data=None, rate_constants=False, return_rate_constant_files=False, custom_rate_constants=False, wigner_tunnel_corr=False, extra_stages_file=None, max_i_freq=0, out_rep=None, n_jmswf_subjobs=1, subhost=None, tpp=1, ffld_name=None, logger=None)

Create an instance.

Parameters
  • reaction_wf_input_sts (list) – reaction workflow input structures

  • dedup_geom_eps (float) – reduce the number of calculations by deduplicating the input structures based on geometry, using this threshold in Ang., and only calculating the representatives, a value of zero means no deduplicating

  • n_conformers (int) – number of conformers to search for

  • skip_eta_rotamers (bool) – skip eta rotamers generation if true

  • pp_rel_energy_thresh (None or float) – relative energy threshold in kJ/mol, if None then only the n_conformers lowest energy conformers are returned

  • seed (int) – seed for random number generator

  • only_rings (bool) – if True then only allow rotation of eta-bound rings, if False then also allow rotation of ligands where the eta-bound motif is acyclic, for example ethene, etc.

  • return_csearch_files (bool) – whether to return all output files from the conformational search subjobs

  • jaguar_keywords (OrderedDict) – Jaguar keywords

  • temp_data (TempData) – the temperature data for thermochemical properties

  • press_data (PressData) – the pressure data for thermochemical properties

  • return_jaguar_files (bool) – whether to return all output files from the Jaguar subjobs

  • anharm (bool) – whether to run the anharmonic workflow

  • return_anharm_files (bool) – whether to return all output files from the anharmonic workflow

  • anharm_max_freq (float) – anharmonic potentials are created for normal modes with harmonic frequencies less than this value in wavenumbers (cm^-1)

  • anharm_factor_data (anharmonic.SeqData or None) – unitless factor data for factors that multiply a normal mode displacement, if None then the defaults are used, the number of points is in the positive direction only, excluding zero and the negative direction, for example using a value of 4 in turn means 2 * 4 + 1 = 9 points total

  • rate_constants (bool) – whether to report rate constant(s) for the rate determining step of the reaction using canonical transition state theory

  • return_rate_constant_files (bool) – whether to return all output files from the rate constant subjobs

  • custom_rate_constants (bool) – whether to compute custom rate constants

  • wigner_tunnel_corr (bool) – whether to include the Wigner tunneling correction when computing rate constant(s)

  • extra_stages_file (str) – the name of a file containing extra stages for a Jaguar Multistage Workflow subjob that will be performed on all output structures from the reaction workflow, the first of these extra stages is always skipped so as to allow analysis to potentially be the first extra stage

  • max_i_freq (float) – tolerate small imaginary frequencies less than this value in wavenumbers (cm^-1)

  • out_rep – if a string then must be either module constant parserutils.CENTROID or parserutils.ETA, if None then do nothing

  • n_jmswf_subjobs (int) – the maximum number of simultaneous Jaguar multistage workflow subjobs

  • subhost (str) – the host to use for subjobs

  • tpp (int) – the number of threads to use for Jaguar subjobs, i.e. -TPP (threads-per-process)

  • ffld_name (str) – the name of the force field to use (e.g., OPLS2005 or S-OPLS)

  • logger (logging.Logger or None) – output logger or None if there isn’t one

validateRateConstants()

Validate rate constants.

Raises

ReactionWorkflowException – if there is an issue

validateAnharmonic()

Validate anharmonic.

Raises

ReactionWorkflowException – if there is an issue

validateSubhost()

Validate subhost.

Raises

ReactionWorkflowException – if there is an issue

validate()

Validate.

Raises

ReactionWorkflowException – if there is an issue

runAnharmonic()

Run the anharmonic workflow.

processAnharmonic()

Process the anharmonic workflow.

Raises

ReactionWorkflowException – if there is an issue

runCTST()

Run canonical transition state theory calculations to determine rate constant(s) for the rate determining step of the reaction.

prepareCTSTOutput()

Prepare CTST output.

Raises

ReactionWorkflowException – if there is an issue

exportEnergyDiagrams()

Export the energy diagrams if the parents file exists

run()

Run the reaction workflow.

Raises

ReactionWorkflowException – if there is an issue

checkJMSWFOutputs(out_files)

Raises JMSWFException if any of the given Jaguar out files should be treated as a failure.

Parameters

out_files (list) – contains Jaguar output files

Raises

JMSWFException – if any of the given Jaguar out files should be treated as a failure

createConformers(sts)

Create the conformers.

Parameters

sts (list) – contains schrodinger.structure.Structure, the structures for which to create conformers, each unique type of structure should have a unique conformer group structure property keyed by CONFORMERS_GROUP_KEY, structures sharing the same CONFORMERS_GROUP_KEY should be conformers of the same structure and are used to seed the conformational search, an additional optional SIBLING_GROUP_KEY can be used to distinguish related groups of conformers, atoms marked with the property RESTRAINED_ATOM_KEY will be restrained

Raises

ConformationalSearchException – if there is an issue

finalizeJMSWFOutput()

Finalize the Jaguar multistage workflow output.

Return type

str

Returns

the Jaguar multistage workflow output file

static genEtaRotamers(sibling_conformers_dict, only_rings=True)

Generate eta-rotamers.

Parameters
  • sibling_conformers_dict (dict) – dictionary of dictionaries where the outer dictionary is keyed by sibling and inner dictionary is keyed by conformer and values of the inner dictionary are lists of structures

  • only_rings (bool) – if True then only allow rotation of eta-bound rings, if False then also allow rotation of ligands where the eta-bound motif is acyclic, for example ethene, etc.

Return type

dict, dict

Returns

dictionary of dictionaries where the outer dictionary is keyed by sibling and inner dictionary is keyed by conformer and values of the inner dictionary are lists of structures, for eta-complexes incoming conformers have been replaced with all possible rotamers, another dictionary mapping the structure titles of generated rotamers to the structure title of the structure from which they were generated

getFreqStageIdxs()

Return the stage indices of frequency stages.

Return type

tuple[int]

Returns

the stage indices

prepareJMSWFOutput()

Prepare Jaguar multistage workflow output.

representativeConformers(sibling_conformers_dict=None, specific_sibling_group=None)

Generator over representative conformers.

Parameters
  • sibling_conformers_dict (dict or None) – dictionary of dictionaries where the outer dictionary is keyed by sibling and inner dictionary is keyed by conformer and values of the inner dictionary are lists of structures, if None then the class attr is used

  • specific_sibling_group (str or None) – if not None then restrict conformers to be generated only over this sibling group

Return type

tuple

Returns

the sibling and conformer group names and the representative conformer

runJMSWF()

Run the Jaguar multistage workflow.

Raises

JMSWFException – if there is an issue

selectJMSWFConformers(sts)

Select representative conformers from the given structures.

Parameters

sts (list[schrodinger.structure.Structure]) – the structures

Raises

JMSWFException – if there is an issue

Return type

list

Returns

the representative conformers

setRepresentatives()

Associated with each structure is output data from potentially multiple Jaguar multistage workflow stages. Pick representative structures to carry the data for all stages.

Raises

JMSWFException – if there is an issue

class schrodinger.application.matsci.reaction_workflow_utils.Sites

Bases: object

Manage enumeration sites.

static getSites(sites_data, n_structures=1)

Return a list of Site from the given sites data.

Parameters
  • sites_data (list) – contains for each site a list of data [from_idx, to_idx, hash_idx] with an optional fourth item structure_idx

  • n_structures (int) – the number of structures, used if the given sites lack the optional fourth item

Raises

InvalidInput – if there is an issue

Return type

list

Returns

contains Site

static validateSitesFormat(sites)

Validate the given sites format.

Parameters

sites (list) – contains Site

Raises

InvalidInput – if there is an issue

static delete_substitution_site_bonds(st, sites)

Delete bonds in the given structure that occur after the given substitution sites and return extracted core information.

Parameters
  • st (structure.Structure) – the structure

  • sites (list) – contains Site

Return type

structure.Structure, dict

Returns

the extracted core and old-to-new atom index map

static validateSitesData(sites, st)

Validate the given sites data.

Parameters
  • sites (list) – contains Site

  • st (structure.Structure) – the structure

Raises

InvalidInput – if there is an issue

static getBinnedSites(sites)

Get the sites binned firstly by structure_idx and secondly by hash_idx.

Parameters

sites (list) – contains Site

Return type

dict

Returns

keys are structure_idx, values are dicts whose keys are hash_idx and values are lists of Site

schrodinger.application.matsci.reaction_workflow_utils.get_RGE_sources(rgroup_sts, binned_sites, old_to_new)

Return a list of Source that is prepared for enumeration using the R-Group Enumeration module.

Parameters
  • rgroup_sts (list of structure.Structure) – the R-group structures

  • binned_sites (list of lists of Site) – the binned sites

  • old_to_new (dict) – a map of old-to-new atom indices

Return type

list

Returns

contains Source

schrodinger.application.matsci.reaction_workflow_utils.substitute(st, rgroups_dict, sites_dict)

Return a copy of the given structure that has been substituted with the given R-groups at the given sites.

Parameters
  • st (structure.Structure) – the structure on which the substitution is performed

  • rgroups_dict (dict) – keys are integer hashes relating to sites, values are structure.Structure

  • sites_dict (dict) – keys are integer hashes relating to R-groups, values are lists of Site

Raises

InvalidInput – if there is an issue

Return type

structure.Structure

Returns

the substituted structure

class schrodinger.application.matsci.reaction_workflow_utils.EnumerateReactionWorkflow(rxnwf_file, rgroup_files, sites, force_hetero_substitution=False, out_rep=None, base_name='enumerate_reaction_workflow', logger=None)

Bases: object

Manage enumeration of a reaction workflow.

__init__(rxnwf_file, rgroup_files, sites, force_hetero_substitution=False, out_rep=None, base_name='enumerate_reaction_workflow', logger=None)

Create an instance.

Parameters
  • rxnwf_file (str) – the reaction workflow file

  • rgroup_files (dict) – keys are hash_idx (see sites), values are file names

  • sites (list) – contains Site

  • force_hetero_substitution (bool) – if True then for hetero-eumeration do not additionally include homo-enumeration results

  • out_rep – if a string then must be either module constant parserutils.CENTROID or parserutils.ETA, if None then do nothing

  • base_name (str) – the base name to use in naming the enumerated output files

  • logger (logging.Logger) – the logger

validate()

Validate.

Raises

InvalidInput – if there is an issue

setRGroupStructures()

Set the R-group structures.

setHasStructureSpecificSites()

Set has structure specific sites.

getStructures()

Generates structure dictionaries where keys are enumeration indices and values are structures.

Return type

dict

Returns

keys are enumeration indices, values are structure.Structure

doEnumeration()

Do the enumeration.

run()

Run it.

schrodinger.application.matsci.reaction_workflow_utils.replace_rxnwf_file_suffix(rxnwf_file, suffix)

Replace the suffix in the given reaction workflow file with a new suffix.

Parameters
  • rxnwf_file (str) – the reaction workflow file

  • suffix (str) – the new suffix

Return type

str

Returns

the new string

class schrodinger.application.matsci.reaction_workflow_utils.EnumerateSwapMixin

Bases: object

Manage enumeration and swapping.

runEnumerateRXNWF(tag)

Run enumerate reaction workflow.

Parameters

tag (str) – either the REFERENCE or NOVEL module constant

Raises

ReactionWorkflowException – if there is an issue

Return type

set

Returns

the names of the enumerated reaction workflow files

runSwapFragments(enumerated_novel_files, reference_rxnwf_file)

Run swap fragments.

Parameters
  • enumerated_novel_files (set) – the names of the enumerated novel files

  • reference_rxnwf_file (str) – the reference reaction workflow file

Raises

ReactionWorkflowException – if there is an issue

Return type

set

Returns

the names of the enumerated reaction workflow files

getRXNWFInputFiles()

Return all reaction workflow input files.

Return type

set

Returns

all reaction workflow input files

class schrodinger.application.matsci.reaction_workflow_utils.EnumerateSwap(reference_rxnwf_file, novel_rxnwf_file=None, rgroup_files=None, reference_sites=None, novel_sites=None, force_hetero_substitution=False, require_identical_bonds=False, logger=None)

Bases: schrodinger.application.matsci.reaction_workflow_utils.EnumerateSwapMixin

Manage enumeration and swapping.

__init__(reference_rxnwf_file, novel_rxnwf_file=None, rgroup_files=None, reference_sites=None, novel_sites=None, force_hetero_substitution=False, require_identical_bonds=False, logger=None)

Create an instance.

Parameters
  • reference_rxnwf_file (str) – the reaction workflow file containing the reference structures

  • novel_rxnwf)file – the reaction workflow file containing the single novel structure

  • rgroup_files (dict) – keys are hash_idx (see sites), values are file names

  • reference_sites (list) – contains Site for the reference structures

  • novel_sites (list) – contains Site for the novel structure

  • force_hetero_substitution (bool) – if True then for hetero-eumeration do not additionally include homo-enumeration results

  • require_identical_bonds (bool) – whether to require that bonds to be created must exist in both novel and reference structures and be of the same bond order

  • logger (logging.Logger or None) – output logger or None if there isn’t one

run()

Run it.

Return type

set

Returns

all reaction workflow input files

getRXNWFInputFiles()

Return all reaction workflow input files.

Return type

set

Returns

all reaction workflow input files

runEnumerateRXNWF(tag)

Run enumerate reaction workflow.

Parameters

tag (str) – either the REFERENCE or NOVEL module constant

Raises

ReactionWorkflowException – if there is an issue

Return type

set

Returns

the names of the enumerated reaction workflow files

runSwapFragments(enumerated_novel_files, reference_rxnwf_file)

Run swap fragments.

Parameters
  • enumerated_novel_files (set) – the names of the enumerated novel files

  • reference_rxnwf_file (str) – the reference reaction workflow file

Raises

ReactionWorkflowException – if there is an issue

Return type

set

Returns

the names of the enumerated reaction workflow files

schrodinger.application.matsci.reaction_workflow_utils.enumerate_swap(reference_rxnwf_file, novel_rxnwf_file=None, rgroup_files=None, reference_sites=None, novel_sites=None, force_hetero_substitution=False)

Return all reaction workflow files created by R-group enumerating the given reference and novel structures and swapping reference fragments for novel fragments.

Parameters
  • reference_rxnwf_file (str) – the reaction workflow file containing the reference structures

  • novel_rxnwf)file – the reaction workflow file containing the single novel structure

  • rgroup_files (dict) – keys are hash_idx (see sites), values are file names

  • reference_sites (list) – contains Site for the reference structures

  • novel_sites (list) – contains Site for the novel structure

  • force_hetero_substitution (bool) – if True then for hetero-eumeration do not additionally include homo-enumeration results

Return type

set

Returns

all reaction workflow input files

schrodinger.application.matsci.reaction_workflow_utils.get_sites(sites)

Return the reference and novel sites.

Parameters

sites (list) – contains for each site a list of data [from_idx, to_idx, hash_idx] with an optional fourth item structure_idx and an optional fifth item reaction_workflow_utils.REFERENCE or reaction_workflow_utils.NOVEL module constants

Raises

ReactionWorkflowException – if there is an issue

Return type

list, list

Returns

the reference and novel sites, each containing rxnwfu.Site

schrodinger.application.matsci.reaction_workflow_utils.validate_auto_reaction_workflow_files(reaction_wf_input, novel_rxnwf_file=None, mass_conserved=False, sites=None)

Validate workflow input file, novel reaction workflow file

Parameters
  • reaction_wf_input (str) – reference reaction workflow file name

  • novel_rxnwf_file (str) – the reaction workflow file containing the single novel structure

  • mass_conserved (bool) – True if mass is conserved else false

  • sites (list) – contains for each site a list of data [from_idx, to_idx, hash_idx] with an optional fourth item structure_idx and an optional fifth item reaction_workflow_utils.REFERENCE or reaction_workflow_utils.NOVEL module constants

Raises

ReactionWorkflowException – if there is an issue

schrodinger.application.matsci.reaction_workflow_utils.validate_custom_rate_with_extra_stages(options)

Validate that if custom rates are requested and extra stages file is present, custom property has one of the known energy units

Parameters

options (SimpleNamespace) – Options

Raises

ReactionWorkflowException – if custom property has no known unit

schrodinger.application.matsci.reaction_workflow_utils.has_keep_and_superpose_atoms(input_st)

Return True if the given structure has at least a single keep atom and a single superpose atom.

Parameters

input_st (structure.Structure) – the structure

Return type

bool

Returns

True if the structure has at least a single keep atom and a single superpose atom

schrodinger.application.matsci.reaction_workflow_utils.validate_auto_reaction_workflow_options(reaction_wf_input, novel_rxnwf_file=None, n_conformers=5, jaguar_keywords={'basis': 'LACVP**', 'dftname': 'B3LYP'}, ffld_name='S-OPLS')

Validate auto reaction workflow options.

Parameters
  • reaction_wf_input (str) – reference reaction workflow file name

  • novel_rxnwf_file (str) – the reaction workflow file containing the single novel structure

  • n_conformers (int) – number of conformers to search for

  • jaguar_keywords (str) – whitespace separated Jaguar <key>=<value> tokens

  • ffld_name (str) – the name of the force field to use (e.g., OPLS2005 or S-OPLS)

Raises

ReactionWorkflowException – if there is an issue

schrodinger.application.matsci.reaction_workflow_utils.validate_all_auto_reaction_workflow_options(reaction_wf_input, novel_rxnwf_file=None, mass_conserved=False, sites=None, n_conformers=5, jaguar_keywords={'basis': 'LACVP**', 'dftname': 'B3LYP'}, ffld_name='S-OPLS')

Validate all auto reaction workflow options or raise ReactionWorkflowException error.

Parameters
  • reaction_wf_input (str) – reference reaction workflow file name

  • novel_rxnwf_file (str) – the reaction workflow file containing the single novel structure

  • mass_conserved (bool) – True if mass is conserved else false

  • sites (list) – contains for each site a list of data [from_idx, to_idx, hash_idx] with an optional fourth item structure_idx and an optional fifth item reaction_workflow_utils.REFERENCE or reaction_workflow_utils.NOVEL module constants

  • n_conformers (int) – number of conformers to search for

  • jaguar_keywords (str) – whitespace separated Jaguar <key>=<value> tokens

  • ffld_name (str) – the name of the force field to use (e.g., OPLS2005 or S-OPLS)

Raises

rxnwfu.ReactionWorkflowException – if there is an issue

schrodinger.application.matsci.reaction_workflow_utils.get_sibling_ownership_information(file_path=None, sts=None)

Get the parents and children information of sibling groups from a structure file or a list of structures

Parameters
  • file_path (str) – The path to the structure file to read

  • sts (iterable) – The structures to get information from, if file_path is not provided

Raises

ReactionWorkflowException – if there is an issue with the inputs

Return type

dict, dict

Returns

first dict maps each sibling group to its parents, second dict maps each sibling group to its children

schrodinger.application.matsci.reaction_workflow_utils.get_smiles(st)

Return the smiles of the given metal complex.

Parameters

st (schrodinger.structure.Structure) – the metal complex

Raise

(rdkit_adapter.InconsistentStructureError, rdkit_adapter.UnsupportedStructureError)

Return type

str

Returns

smiles

schrodinger.application.matsci.reaction_workflow_utils.bin_by_geometry(sts, eps=0.25)

Return a dictionary of structures binned by common geometry.

Parameters
  • sts (list[schrodinger.structure.Structure]) – the structures

  • eps (float) – the RMSD precision in Angstrom that controls the size of the clusters, see sklearn.cluster.DBSCAN documentation for more details

Return type

dict

Returns

keys are representative structures from each geometry bin, values are lists of other structures in the same geometry bin

schrodinger.application.matsci.reaction_workflow_utils.get_orig_title(title, unique_geom_dict)

Return the original title of the given title.

Parameters
  • title (str) – the title

  • unique_geom_dict (dict) – keys are original titles, values are structures in the same geometry bin, with the representative structure at index 0

Return type

str, str

Returns

the original title and the extension

schrodinger.application.matsci.reaction_workflow_utils.get_unique_geom_title(title, unique_geom_dict)

Return the title of the unique geometry representative for the given title.

Parameters
  • title (str) – the title

  • unique_geom_dict (dict) – keys are original titles, values are structures in the same geometry bin, with the representative structure at index 0

Return type

str

Returns

the title of the representative

schrodinger.application.matsci.reaction_workflow_utils.get_titles_of_duplicates(title, unique_geom_dict)

Return the structure titles of structures represented by a unique structure with the given structure title.

Parameters
  • title (str) – the structure title of the unique representative structure

  • unique_geom_dict (dict) – keys are original titles, values are structures in the same geometry bin, with the representative structure at index 0

Return type

list[str]

Returns

the titles of the duplicate structures

schrodinger.application.matsci.reaction_workflow_utils.get_file_names_of_duplicates(file_name, unique_geom_dict)

Return duplicate file names from the given representative file name. Files are named by structure title.

Parameters
  • file_name (str) – the representative file name

  • unique_geom_dict (dict) – keys are original titles, values are structures in the same geometry bin, with the representative structure at index 0

Return type

list[str]

Returns

the duplicate file names

schrodinger.application.matsci.reaction_workflow_utils.get_energy_db_term(rxnwf_file_path=None, rxnwf_sts=None, tstart=298.15, tstep=10.0, ntemp=1, pstart=1.0, pstep=1.0, npress=1, anharm=False, extra_stages_file=False, **kwargs)

Get a dict containing all the energy term generated by reaction workflow

Parameters
  • rxnwf_file_path (str or None) – the path to a reaction workflow file

  • rxnwf_sts (list[schrodinger.structure.Structure] or None) – reaction workflow structures

  • tstart (float) – the starting temperature (K)

  • tstep (float) – the step size of the temperature (K)

  • ntemp (int) – the number of temperature points

  • pstart (float) – the starting pressure (atm)

  • pstep (float) – the step size of the pressure (atm)

  • npress (int) – the number of pressure points

  • anharm (bool) – True if anharmonic calculation is performed else False

  • extra_stages_file (string) – name of stage file

Rtype energy_term_dict

dict

Returns

dictionary of energy keys.

class schrodinger.application.matsci.reaction_workflow_utils.SiblingNode(name, axes)

Bases: object

Contains parent-child information for a sibling group as well as features for creating an energy diagram

LINE_LENGTH = 1
X_GAP = 0.5
__init__(name, axes)
Parameters
  • name (str) – The name of the sibling group

  • axes (matplotlib.axes.Axes) – The plot’s axes object

addToPlot(y_val, energy, text_offset)

Add this sibling group to the plot

Parameters
  • y_val (float) – The y-value of the sibling on the plot

  • energy (float) – The energy to show on the label

  • text_offset (float) – The offset for showing the label above horizontal lines

class schrodinger.application.matsci.reaction_workflow_utils.EnergyDiagramPlotter(json_path, csv_path, logger=None)

Bases: object

Class for exporting energy level diagrams

TOTAL_FREE_ENERGY = 'Total_Free_Energy'
TEXT_OFFSET_DIVISOR = 50
VERTICAL_SPACING_DIVISOR = 23
PDF_FILE_ENDING = '_e_diagrams.pdf'
PNG_FILE_ENDING = '_std_e_diagram.png'
__init__(json_path, csv_path, logger=None)
Parameters
  • json_path (str) – Path to _conf_avg_wo_x_rel_parents.json file

  • csv_path (str) – Path to _conf_avg_wo_x_rel_reactants.csv file

run()

Export the energy level diagrams

findTotalEnergyProp()

Find the Total Free Energy property with temperature and pressure closest to 298.15 K and 1.0 atm

getSibling(name)

Get an existing sibling or create a new one and return it

Parameters

name (str) – The name of the sibling

Return type

SiblingNode

Returns

A SiblingNode object

parseSiblings()

Read the siblings and parent child info from json file and find the generation of each sibling

setColors()

Set colors for paths that have one parent and one child for all nodes, excluding the reactant

findGenerations()

Determine the generations of the siblings

Each child’s generation is the largest generation of its parents, plus 1 which means that if we have the following ownerships: 1 -> 2 -> 3 -> 4 1 -> 5 -> 4 “4” will be a 4th generation and “5” will be a 2nd generation, so the plot will look like this: 1 – 2 – 3 – 4 1 – 5 ——- 4 as opposed to 1 ——- 5 – 4

findSameGenerationIndices()

Find groups of csv indices that belong to the same generation

plotDiagram(prop)

Plot the energy diagram for the passed property

adjustLabels()

Adjust the size of labels. If a label’s width is large enough to overlap with a neighbour’s label, reduce the font and redraw

getAdjustedYValues(prop)

Adjust the y values so that there is enough gap between all consecutive values in the same generation so there is no overlap.

Parameters

prop (str) – The property to adjust values for

Return type

numpy.array

Returns

The adjusted Y values as a numpy array

schrodinger.application.matsci.reaction_workflow_utils.flatten_sibling_conformers(sibling_conformers_dict)

Return a list of structures from the given sibling conformers dictionary.

Parameters

sibling_conformers_dict (dict) – dictionary of dictionaries where the outer dictionary is keyed by sibling and inner dictionary is keyed by conformer and values of the inner dictionary are lists of structures

Return type

list[schrodinger.structure.Structure]

Returns

the structures

schrodinger.application.matsci.reaction_workflow_utils.get_out_rep(sts)

Return the output representation of haptic ligands.

Parameters

sts (list[schrodinger.structure.Structure]) – the structures to search

Raises

ValueError – if there are conflicting output representations, if the output representation is unknown

Return type

str or None

Returns

the output representation, either module constant parserutils.CENTROID or parserutils.ETA, if None then none was found