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__
¶ Return key in self.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
__len__
¶ Return len(self).
-
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
-
-
class
schrodinger.application.matsci.reaction_workflow_utils.
PressData
(press_start, press_step, press_n)¶ Bases:
tuple
-
__contains__
¶ Return key in self.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
__len__
¶ Return len(self).
-
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.
-
press_n
¶ Alias for field number 2
-
press_start
¶ Alias for field number 0
-
press_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: - st (schrodinger.structure.Structure) – the structure
- prop (str) – the property that marks the atoms
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
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
schrodinger.application.matsci.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={'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='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.
get_molecular_weight
(st, idxs=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
Return type: float
Returns: the molecular weight (amu)
-
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)¶ 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)
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)¶ 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
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.
run_conformational_search
(conformers, n_conformers=5, restrain_idxs=None, seed=123, launch_dir=None, base_name=None, job_dj=None, clean=True)¶ 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
- st (
-
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
-
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
-
-
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
(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
-
-
exception
schrodinger.application.matsci.reaction_workflow_utils.
ReactionWorkflowException
¶ Bases:
Exception
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
class
schrodinger.application.matsci.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, press_data=None, return_jaguar_files=False, rate_constants=False, return_rate_constant_files=False, extra_stages_file=None, n_jmswf_subjobs=1, subhost=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, press_data=None, return_jaguar_files=False, rate_constants=False, return_rate_constant_files=False, extra_stages_file=None, n_jmswf_subjobs=1, subhost=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
- press_data (PressData) – the pressure data for thermochemical properties
- return_jaguar_files (bool) – whether to return all output files from the Jaguar subjobs
- 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
- 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
- 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)
- logger (logging.Logger or None) – output logger or None if there isn’t one
-
validate
()¶ Validate.
Raises: ReactionWorkflowException – if there is an issue
-
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.
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
-
run
()¶ Run the reaction workflow.
-