schrodinger.application.jaguar.utils module¶
Jaguar utility functions.
Copyright Schrodinger, LLC. All rights reserved.
- class schrodinger.application.jaguar.utils.FreeEnergy(temp, gibbs, property_key)¶
Bases:
tuple
- __contains__(key, /)¶
Return key in self.
- __len__()¶
Return len(self).
- count(value, /)¶
Return number of occurrences of value.
- gibbs¶
Alias for field number 1
- index(value, start=0, stop=9223372036854775807, /)¶
Return first index of value.
Raises ValueError if the value is not present.
- property_key¶
Alias for field number 2
- temp¶
Alias for field number 0
- class schrodinger.application.jaguar.utils.LewisStructure(charges, bonds, score, unpaired)¶
Bases:
tuple
- __contains__(key, /)¶
Return key in self.
- __len__()¶
Return len(self).
- bonds¶
Alias for field number 1
- charges¶
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.
- score¶
Alias for field number 2
- unpaired¶
Alias for field number 3
- class schrodinger.application.jaguar.utils.ChgAt(index, charge)¶
Bases:
tuple
- __contains__(key, /)¶
Return key in self.
- __len__()¶
Return len(self).
- charge¶
Alias for field number 1
- count(value, /)¶
Return number of occurrences of value.
- index¶
Alias for field number 0
- schrodinger.application.jaguar.utils.append_outfiles_to_recover_file(recover_file, outfiles)[source]¶
Append list of output file paths to a YAML-format .recover file.
- Parameters
recover_file (str) – .recover file name
outfiles (list of str) – list of output file paths
- schrodinger.application.jaguar.utils.get_jobname(prefix, str_to_hash)[source]¶
Construct a jobname based on the given string prefix (typically the backend script name) and a string to be hashed (typically based on the cmdline being used to invoke the job.)
- schrodinger.application.jaguar.utils.basic_windows_path(dos_path)[source]¶
Convert extended length Windows path to standard. Does nothing on other OS’s.
- Parameters
dos_path (string) – a (Windows) file path, which may have WINDOWS_EXTENDED_PATH_TAG to indicate extended path length
- Return type
string
- Returns
A file path which has not extended length tags
- schrodinger.application.jaguar.utils.get_stoichiometry_string(atom_list)[source]¶
Take atom list and return stoichiometry string. For example, atom_list = [‘H’, ‘H’, ‘O’] yields stoichimetry string = ‘H2O’.
- Parameters
atom_list (list) – list of strings
- Returns
stoichiometry string
- Return type
str
- schrodinger.application.jaguar.utils.validate_stoichiometry(reactants, products)[source]¶
This function validates stoichiometry for a reaction defined by the list of reactants and products. If stoichiometry is not valid this function return text string explaining what was wrong. In case of valid stoichiometry returns None.
- Parameters
reactants (list) – list of
JaguarInput
objects for reactantsproducts (list) – list of
JaguarInput
objects products
- Returns
string with warning message or None
- Return type
str or None
- schrodinger.application.jaguar.utils.get_number_electrons(st)[source]¶
Count the number of electrons disregarding charges.
- Parameters
st (Structure instance) – the structure
- Return type
int
- Returns
the number of electrons
- schrodinger.application.jaguar.utils.get_total_charge(structure)[source]¶
Return the total charge of the structure If the property i_m_Molecular_charge is defined we use that, else we sum the formal charges
- Parameters
structure (Structure object) – whose total charge must be calculated
- Returns
total charge of structure
- Return type
int
- schrodinger.application.jaguar.utils.elmnt_mult_dict()[source]¶
make a dictionary of element:multiplicity for all neutral elements up to Lawrencium
The values are from the ground state term symbol as reported by NIST at http://physics.nist.gov/PhysRefData/Elements/index.html as of 4.2014
- schrodinger.application.jaguar.utils.remove_gibbs_energies(st, allowed_temps=())[source]¶
Remove gibbs energy properties from a structure but allow some exceptions. This allows one to ‘unclutter’ the project table.
- Parameters
st (Structure) – structure containing gibbs energy properties
allowed_temps (tuple) – temperatures that are allowed to remain as properties
- schrodinger.application.jaguar.utils.parse_gibbs_energies(st, inf_sep=False, std_conc=False)[source]¶
Extract the temperature, gibbs energy and property keys for free energy and store these in a dict relating temperature to FreeEnergy instances.
- Parameters
st (Structure) – the structure
std_con (bool) – True indicates Gibbs energy at std state concentration
- Returns
a dict relating temperature to a FreeEnergy instance with attributes storing these data
- schrodinger.application.jaguar.utils.gibbs_energy_property_string(temp, inf_sep=False, std_conc=False)[source]¶
Construct the property key string for Gibbs energy at a particular temperature
- Parameters
temp (float) – temperature in Kelvin
inf_sep (bool) – True indicates infinitely separated energy
std_conc (bool) – True indicates Gibbs energy at std state concentration
- Returns
a property key string
- schrodinger.application.jaguar.utils.convert_gibbs_energy_to_std_conc(st)[source]¶
Convert std state (1 atm) Gibbs energies to a std state of 1 Molar concentration. The energies are returned as a dict relating temperature to FreeEnergy instances. The energies are also stored as structure level properties. This is intended to be used with AutoTS for rate calculations and we assume the free energies were computed at 1 atm of pressure.
- Parameters
st (Structure) – the structure
- Returns
a dict relating temperature to a FreeEnergy instance with attributes storing these data
- schrodinger.application.jaguar.utils.compute_std_conc_gibbs_energy(gibbs, temp, press, con)[source]¶
Convert Gibbs energy which was computed at a pressure of press to a concentration of con using the formula G = G_0 + kT log(CRT/P_0) where we’ve used the ideal gas law to relate P = CRT
- Parameters
gibbs (float) – Gibbs free energy in a.u. evaluated at a pressure of press
press (float) – Pressure at which the Gibbs energy was evaluated in atm
temp (float) – Temperature at which the Gibbs energy was evaluated in Kelvin
con (float) – Concentration which defines the standard state in moles/Liter
- schrodinger.application.jaguar.utils.group_items(items, comparator, *args)[source]¶
Put items into groups using a comparator.
These will be returned as a list of lists, each list representing a group. The first item of the first group will be the first item in the list items. The groups have the property that Comparator(item1, item2, args) returns True for all pairs in a group.
- Parameters
items (list) – a list of items to group
comparator (function) – this function compares two items and returns a boolean indicating whether or not they are equivalent.
args (argument list) – arguments passed to the comparator which is called as comparator(item1, item2,
*args
)
- Returns
a list of lists of items
- schrodinger.application.jaguar.utils.copy_structure_bonding(ref_st, updated_st)[source]¶
Copy all bonding and formal charges from reference structure onto a structure instance we want to update. Also update FF atom-typing. Assumes number of atoms and atom numbering is the same in both structures.
- Parameters
ref_st (Structure object) – structure to copy bonding from
updated_st (Structure object) – structure to copy bonding to
- schrodinger.application.jaguar.utils.sync_dummy_atoms(ref_st, st)[source]¶
Sync dummy atoms in ref_st and st. This is useful after calling mmjag_connect to reset bonding. We check atomic number and XYZ coordinates to classify which atoms are the “same” or “different”. But note for dummy atoms, we do not require XYZ to be the same.
We then try to sync the two structures by handling two possibilities:
Existence of new dummy atoms at the end of the atom list in ref_st compared to st; they will be added to the end of st.
Non-existence of dummy atoms at any location in ref_st compared to st; they will be deleted from st.
Otherwise, an AssertionError is raised.
- Parameters
ref_st (Structure object) – structure to copy atoms from
st (Structure object) – structure to copy atoms to
- schrodinger.application.jaguar.utils.mmjag_reset_connectivity(st)[source]¶
Reset connectivity and Lewis structure using mmjag algorithm. i.e input st is modified to have new bonds, bond orders and formal charges. All other properties should be preserved.
- Parameters
st (Structure object) – structure to clean up
- schrodinger.application.jaguar.utils.mmjag_update_lewis(st, mode=0)[source]¶
Update Lewis structure for a given connectivity using mmjag algorithm. This can be used instead of, or to complement, e.g. the mmlewis code. Unlike mmjag_reset_connectivity, the connectivity will be preserved.
If mode is PRINT, the lewis structure determination information will be returned
If mode is RINGCHAIN, special Lewis structure scoring for ring-chain tautomers will be used (and lewis structure information will be returned)
If mode if THOROUGH, the lewis structure search will be lengthened
If mode if FINDALL, the lewis structure search will be lengthened and suboptimal results will be included in the output data (which is sorted to have the best first).
If the mmjag Lewis code fails to update the bonding, the original bonding will be preserved.
- Parameters
st (Structure object) – structure to clean up
mode (int) – specifies if std or ring-chain scoring should be used and whether or not the data is returned from lewis.cpp. Only STD, PRINT, RINGCHAIN, THOROUGH, and FINDALL are acceptable values
- Return type
list of LewisStructure namedtuples
- Returns
If mode is PRINT, RINGCHAIN, THOROUGH, or FINDALL, parsed lewis structure data is returned as namedtuple; an empty list is returned if mode is STD.
- schrodinger.application.jaguar.utils.parse_lewis_data(lewis_data)[source]¶
Parse the string-formatted Lewis data from mmjag into a data structure for easy use.
- Parameters
lewis_data (list of strings:) – the line-by-line output of mmjag/lewis.cpp run on a structure
- Return type
list of LewisStructure namedtuples
- Returns
Namedtuples containing charge, multiple bond, and score
- schrodinger.application.jaguar.utils.get_charges(lewis_output)[source]¶
Parse charges from lewis code string output
- Parameters
lewis_output (list of strings) – the line-by-line output of mmjag/lewis.cpp run on a structure
- Return type
(list of list of ChgAt namedtuples, list of bools)
- Returns
For each structure in the lewis_output (the length of the list), list of the charged atom and their charges, whether or not structure contains unpaired spins
- schrodinger.application.jaguar.utils.get_bonds(lewis_output)[source]¶
Parse bonds from lewis code string output
- Parameters
lewis_output (list of strings) – the line-by-line output of mmjag/lewis.cpp run on a structure
- Return type
list of list of 2-tuples of ints
- Returns
For each structure in the lewis_output (the length of the list), list of the multiple bonds in the structure (NB: a triple bond is noted by being present in the list twice)
- schrodinger.application.jaguar.utils.get_scores(lewis_output)[source]¶
Parse scores from lewis code string output
- Parameters
lewis_output (list of strings) – the line-by-line output of mmjag/lewis.cpp run on a structure
- Return type
list of floats
- Returns
For each structure in the lewis_output (the length of the list), that structures score according to the mmjag/lewis.cpp code (see there for more details)
- schrodinger.application.jaguar.utils.apply_lewis(st, lewis_st)[source]¶
Return a copy of a structure with a Lewis structure as described by the LewisStructure given.
- Parameters
st (Structure instance) – structure on which to apply Lewis structure
lewis_st (LewisStructure namedtuple) – Namedtuple containing charge, multiple bond, and score
- Return type
Structure instance
- Returns
a structure with the desired Lewis structure applied