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

__add__

Return self+value.

__class__

alias of builtins.type

__contains__

Return key in self.

__delattr__

Implement delattr(self, name).

__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__getitem__

Return self[key].

__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

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

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__iter__

Implement iter(self).

__le__

Return self<=value.

__len__

Return len(self).

__lt__

Return self<value.

__module__ = 'schrodinger.application.matsci.reaction_workflow_utils'
__mul__

Return self*value.n

__ne__

Return self!=value.

static __new__(_cls, temp_start, temp_step, temp_n)

Create new instance of TempData(temp_start, temp_step, temp_n)

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__()

Return a nicely formatted representation string

__rmul__

Return self*value.

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__slots__ = ()
__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

count(value) → integer -- return number of occurrences of value
index(value[, start[, stop]]) → integer -- 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

schrodinger.application.matsci.reaction_workflow_utils.get_idxs_marked_atoms(st, prop)

Return a list of indices of atoms in the given structure that have the given property defined.

Parameters:
Return type:

list

Returns:

contains indices of atoms

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

__cause__

exception cause

__class__

alias of builtins.type

__context__

exception context

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.matsci.reaction_workflow_utils', '__weakref__': <attribute '__weakref__' of 'InvalidInput' objects>, '__doc__': None})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

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

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.matsci.reaction_workflow_utils'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__setstate__()
__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__suppress_context__
__traceback__
__weakref__

list of weak references to the object (if defined)

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_idx_groups_str(idx_groups)

Get a string representation of the given index groups.

Parameters:idx_groups (list) – contains lists of indices
Return type:str
Returns:the string
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, exception_type=<class 'argparse.ArgumentTypeError'>)

Type cast the seed.

Parameters:
  • seed (str or unicode) – seed for random number generator
  • exception_type (type) – the exception type to raise if invalid
Return type:

int

Returns:

the seed

schrodinger.application.matsci.reaction_workflow_utils.type_cast_jaguar_keywords(jaguar_keywords, reserved_keys={'itrvec', 'tmpstp', 'ntemp', 'igeopt', 'multip', 'molchg', 'ifreq', 'tmpini', 'nhesref'}, 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='OPLS3e')

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.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)

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
Raises:

ValueError – if invalid

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

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
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')

Return a dictionary of structures binned by a property with the given key.

Parameters:
  • sts (list) – the structures
  • key (str) – the key for the property by which to bin
Return type:

dict

Returns:

dictionary where keys are properties and values are lists of structures

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
Raises:

RuntimeError – if the MacroModel job fails

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
class schrodinger.application.matsci.reaction_workflow_utils.ReactionWorkflowFile(rxnwf_file)

Bases: object

Manage a reaction workflow file.

__init__(rxnwf_file)

Create an instance.

Parameters:rxnwf_file (str) – the reaction workflow file
getReactants(return_conf_group_name=False)

Return reactants.

Parameters:return_conf_group_name (bool) – optionally return the conformer group name
Return type:list or list, str
Returns:contains structure.Structure, optional conformer group name
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.matsci.reaction_workflow_utils', '__doc__': '\n Manage a reaction workflow file.\n ', '__init__': <function ReactionWorkflowFile.__init__>, 'getReactants': <function ReactionWorkflowFile.getReactants>, '__dict__': <attribute '__dict__' of 'ReactionWorkflowFile' objects>, '__weakref__': <attribute '__weakref__' of 'ReactionWorkflowFile' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.matsci.reaction_workflow_utils'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.application.matsci.reaction_workflow_utils.ReactionWorkflowEnergyAnalysis(rxnwf_file, energy_keys)

Bases: schrodinger.application.matsci.reaction_workflow_utils.ReactionWorkflowFile

Manage a reaction workflow energy analysis.

__init__(rxnwf_file, energy_keys)

Create an instance.

Parameters:
  • rxnwf_file (str) – the reaction workflow file
  • 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>)’
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 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
getConfAvgRelEnergies()

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

Raises:ReactionWorkflowException – if there is an issue
Return type:dict
Returns:keys are conformer group names, values are dicts with energy keys as keys and energy values as values
static convertNameTitleToHash(name, title)

Convert a conformer group name and original conformer structure title to a combined (name, title) str.

Parameters:
  • name (str) – a conformer group name
  • title (str) – original conformer structure title
Return type:

str

Returns:

combined (name, title) str

static convertHashToNameTitle(ahash)

Convert a combined (name, title) str hash to a conformer group name and original conformer structure title.

Parameters:ahash (str) – combined (name, title) str
Return type:str, str
Returns:conformer group name, original conformer structure title
getGraph()

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

Return type:networkx.DiGraph
Returns:nodes are conformer group names and have a ‘title’ and energy dictionary ‘edict’ kwarg, 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 conformer group names and have a ‘title’ and energy dictionary ‘edict’ kwarg, edges are directed (parent, child) pairs
Return type:list
Returns:contains ordered node names
writeDataFiles()

Write data files.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.matsci.reaction_workflow_utils', '__doc__': '\n Manage a reaction workflow energy analysis.\n ', '__init__': <function ReactionWorkflowEnergyAnalysis.__init__>, 'getHeader': <staticmethod object>, 'getTemperature': <staticmethod object>, 'getUnits': <staticmethod object>, 'getKcalPerMolConversion': <staticmethod object>, 'getConfAvgRelEnergies': <function ReactionWorkflowEnergyAnalysis.getConfAvgRelEnergies>, 'convertNameTitleToHash': <staticmethod object>, 'convertHashToNameTitle': <staticmethod object>, 'getGraph': <function ReactionWorkflowEnergyAnalysis.getGraph>, 'getOrderedNodeNames': <staticmethod object>, 'writeDataFiles': <function ReactionWorkflowEnergyAnalysis.writeDataFiles>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.matsci.reaction_workflow_utils'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

getReactants(return_conf_group_name=False)

Return reactants.

Parameters:return_conf_group_name (bool) – optionally return the conformer group name
Return type:list or list, str
Returns:contains structure.Structure, optional conformer group name
exception schrodinger.application.matsci.reaction_workflow_utils.ReactionWorkflowException

Bases: Exception

__cause__

exception cause

__class__

alias of builtins.type

__context__

exception context

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.matsci.reaction_workflow_utils', '__weakref__': <attribute '__weakref__' of 'ReactionWorkflowException' objects>, '__doc__': None})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

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

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.matsci.reaction_workflow_utils'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__setstate__()
__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__suppress_context__
__traceback__
__weakref__

list of weak references to the object (if defined)

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, n_conformers=5, seed=123, return_csearch_files=False, jaguar_keywords={'basis': 'LACVP**', 'dftname': 'B3LYP'}, temp_data=None, rate_constants=False, return_jaguar_files=False, extra_stages_file=None, tpp=1, logger=None)

Bases: object

Manage a reaction workflow.

__init__(reaction_wf_input_sts, n_conformers=5, seed=123, return_csearch_files=False, jaguar_keywords={'basis': 'LACVP**', 'dftname': 'B3LYP'}, temp_data=None, rate_constants=False, return_jaguar_files=False, extra_stages_file=None, tpp=1, logger=None)

Create an instance.

Parameters:
  • reaction_wf_input_sts (list) – reaction workflow input structures
  • n_conformers (int) – number of conformers to search for
  • seed (int) – seed for random number generator
  • 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
  • rate_constants (bool) – whether to report rate constant(s) for the rate determining step of the reaction using canonical transition state theory
  • return_jaguar_files (bool) – whether to return all output files from the Jaguar subjobs
  • 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
  • tpp (int) – the number of threads to use for Jaguar subjobs, i.e. -TPP (threads-per-process)
  • logger (logging.Logger or None) – output logger or None if there isn’t one
createConformers()

Create the conformers.

Raises:ReactionWorkflowException – if there is an issue
runJMSWF()

Run the Jaguar multistage workflow.

Raises:ReactionWorkflowException – if there is an issue
prepareJMSWFOutput()

Prepare Jaguar multistage workflow output.

prepareRXNWFOutput()

Prepare reaction workflow output.

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
run()

Run the reaction workflow.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.matsci.reaction_workflow_utils', '__doc__': '\n Manage a reaction workflow.\n ', '__init__': <function ReactionWorkflow.__init__>, 'createConformers': <function ReactionWorkflow.createConformers>, '_overwriteConformerEIDS': <function ReactionWorkflow._overwriteConformerEIDS>, '_getJMSWFGenResKeywords': <function ReactionWorkflow._getJMSWFGenResKeywords>, '_getJMSWFOptKeywords': <function ReactionWorkflow._getJMSWFOptKeywords>, '_getJMSWFCoords': <function ReactionWorkflow._getJMSWFCoords>, '_getJMSWFTSKeywords': <function ReactionWorkflow._getJMSWFTSKeywords>, '_getJMSWFStages': <function ReactionWorkflow._getJMSWFStages>, '_updateJMSWFStages': <function ReactionWorkflow._updateJMSWFStages>, '_setUpJMSWF': <function ReactionWorkflow._setUpJMSWF>, 'runJMSWF': <function ReactionWorkflow.runJMSWF>, 'prepareJMSWFOutput': <function ReactionWorkflow.prepareJMSWFOutput>, 'prepareRXNWFOutput': <function ReactionWorkflow.prepareRXNWFOutput>, '_setRateDeterminingSteps': <function ReactionWorkflow._setRateDeterminingSteps>, '_setUpCTST': <function ReactionWorkflow._setUpCTST>, 'runCTST': <function ReactionWorkflow.runCTST>, 'prepareCTSTOutput': <function ReactionWorkflow.prepareCTSTOutput>, 'run': <function ReactionWorkflow.run>, '__dict__': <attribute '__dict__' of 'ReactionWorkflow' objects>, '__weakref__': <attribute '__weakref__' of 'ReactionWorkflow' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.matsci.reaction_workflow_utils'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)