mispr.gaussian.workflows.base package¶

Submodules¶

mispr.gaussian.workflows.base.bde module¶

Define the bond dissociation energy workflow.

mispr.gaussian.workflows.base.bde.get_bde(mol_operation_type, mol, ref_charge=0, fragment_charges=None, bonds=None, open_rings=False, db=None, name='bde_calculation', working_dir=None, opt_gaussian_inputs=None, freq_gaussian_inputs=None, solvent_gaussian_inputs=None, solvent_properties=None, cart_coords=True, oxidation_states=None, skips=False, visualize=True, **kwargs)[source]¶

Define a dynamic workflow for calculating the bond dissociation energy.

  • Firework 1: Optimize the principle molecule.

  • Firework 2: Run a frequency analysis.

  • Firework 3: Break the bonds in the molecule, find all unique fragments, and generate new optimization and frequency fireworks for each fragment.

  • Firework N: Run a BDE calculation for each fragment and create a summary BDE document/json file.

Note

Fireworks 1 and 2 are only present if user does not request to skip them.

Note

Charges on the fragments in this workflow are assigned as (following the method in the BDE analysis module in pymatgen):

  1. Neutral molecule: [(0, 0), (1, -1), (-1, 1)]

  2. Molecule with charge -N: [(-N, 0), (-N+1, -N+2), (-N+2, -N+1), (0, -N)]

  3. Molecule with charge +N: [(N, 0), (N-1, N-2), (N-2, N-1), (0, N)]

Note

If multiple bonds are being broken but one fragment results in an error, the workflow will proceed normally and the final document will include all bonds except for the one involving the failed fragment.

Parameters:¶
mol_operation_type : str¶

The type of molecule operation. See process_mol defined in mispr/gaussian/utilities/mol.py for supported operations.

mol : Molecule, GaussianOutput, str, dict¶

Source of the molecule to be processed. Should match the mol_operation_type.

ref_charge : int, optional¶

Charge on the principle molecule. Defaults to 0.

fragment_charges : list, optional¶

List of additional charges to consider on the fragments besides the default ones. If ref_charge is -2, by default all fragments will be calculated with a charge of 0, -1, and -2. If the user provides fragment_charges is [-3], -3 and 1 will be additionally calculated. If the user provides fragment_charges is [-2], this will not cause any change since they are already calculated by the workflow. Defaults to None.

bonds : list, optional¶

List of tuples of the bonds to break; e.g. [(0, 1), (1, 2)] will break the bonds between atoms 0 and 1 and between atoms 1 and 2; if none is specified, will attempt to break all bonds. Defaults to None.

open_rings : bool, optional¶

If True, will open rings encountered during fragmentation using OpenBabel’s local opt. Defaults to False.

db : str or dict, optional¶

Database credentials; could be provided as the path to the “db.json” file or in the form of a dictionary; if none is provided, attempts to get it from the configuration files.

name : str, optional¶

Name of the workflow. Defaults to “bde_calculation”.

working_dir : str, optional¶

Path of the working directory where any required input files can be found and output will be created. Defaults to the current working directory.

opt_gaussian_inputs : dict, optional¶

Dictionary of Gaussian input parameters for the optimization step; e.g.:

{
    "functional": "B3LYP",
    "basis_set": "6-31G(d)",
    "route_parameters": {"Opt": None},
    "link0_parameters": {
        "%chk": "checkpoint.chk",
        "%mem": "45GB",
        "%NProcShared": "24"}
}

The above default parameters will be used if not specified.

freq_gaussian_inputs : dict, optional¶

Dictionary of Gaussian input parameters for the frequency step; default parameters will be used if not specified.

solvent_gaussian_inputs : str, optional¶

Gaussian input parameters corresponding to the implicit solvent model to be used in the ESP calculations, if any; e.g.:

"(Solvent=TetraHydroFuran)"

These parameters should only be specified here and not included in the main gaussian_inputs dictionary for each job (i.e. opt_gaussian_inputs, freq_gaussian_inputs). Defaults to None.

solvent_properties : dict, optional¶

Additional input parameters to be used in the ESP calculations and relevant to the solvent model, if any; e.g., {“EPS”:12}. Defaults to None.

cart_coords : bool, optional¶

Uses cartesian coordinates in writing Gaussian input files if set to True,otherwise uses z-matrix. Defaults to True.

oxidation_states : dict, optional¶

Dictionary of oxidation states that can be used in setting the charge and spin multiplicity of the molecule; e.g.: {“Li”:1, “O”:-2}. Defaults to None.

skips : list, optional¶

List of jobs to skip; e.g.: [“opt”, “freq”]; only applicable to the principle molecule. Defaults to None.

visualize : bool, optional¶

If True, will generate a summary plot of the 2D structure of the principle molecule with broken bonds highlighted in color, along with a bar plot of the corresponding BDEs; requires RDKit to be installed for bond highlighting; if RDKit is not found, will throw a warning and proceed normally.

kwargs : keyword arguments¶

Additional kwargs to be passed to the workflow.

Returns:¶

Workflow

mispr.gaussian.workflows.base.binding_energy module¶

Define the binding energy workflow.

mispr.gaussian.workflows.base.binding_energy.get_binding_energies(mol_operation_type, mol, index, bond_order=1, db=None, name='binding_energy_calculation', working_dir=None, opt_gaussian_inputs=None, freq_gaussian_inputs=None, solvent_gaussian_inputs=None, solvent_properties=None, cart_coords=True, oxidation_states=None, skips=None, **kwargs)[source]¶

Define a workflow for calculating the binding energy between two molecules.

  • Fireworks 1 & 2: Optimize the two molecules in parallel.

  • Firework 3 & 4: Run a frequency calculation on each molecule.

  • Firework 5: Link the two optimized molecules at a binding site and optimize the geometry of the generated complex.

  • Firework 6: Run a frequency calculation on the optimized complex.

  • Firework 7: Calculate the binding energy of the complex and create BE document/json file.

Parameters:¶
mol_operation_type : list¶

List of strings of the type of molecule operations. See process_mol defined in Defines the binding energy workflow.mispr/gaussian/utilities/mol.py for supported operations; e.g. [“get_from_mol”, “get_from_file”] to get the first molecule from a Molecule object and the second molecule from a file.

mol : list¶

List of the source of the two molecules to be processed. Should match the order in mol_operation_type; e.g. if mol_operation_type is [“get_from_mol”, “get_from_file”], mol should be [Molecule, path to molecule file].

index : list¶

List of indices of the two sites in the molecules at which they are expected to bind; order should match that in mol_operation_type and mol.

bond_order : int, optional¶

Bond order to calculate the bond length between the two sites. Defaults to 1.

db : str or dict, optional¶

Database credentials; could be provided as the path to the “db.json” file or in the form of a dictionary; if none is provided, attempts to get it from the configuration files.

name : str, optional¶

name of the workflow; defaults to “binding_energy_calculation”.

working_dir : str, optional¶

Path of the working directory where any required input files can be found and output will be created. Defaults to the current working directory.

opt_gaussian_inputs : dict, optional¶

Dictionary of Gaussian input parameters for the optimization step; e.g.:

{
    "functional": "B3LYP",
    "basis_set": "6-31G(d)",
    "route_parameters": {"Opt": None},
    "link0_parameters": {
        "%chk": "checkpoint.chk",
        "%mem": "45GB",
        "%NProcShared": "24"}
}

The above default parameters will be used if not specified.

freq_gaussian_inputs : dict, optional¶

Dictionary of Gaussian input parameters for the frequency step; default parameters will be used if not specified.

solvent_gaussian_inputs : str, optional¶

Gaussian input parameters corresponding to the implicit solvent model to be used in the ESP calculations, if any; e.g.:

"(Solvent=TetraHydroFuran)"

These parameters should only be specified here and not included in the main gaussian_inputs dictionary for each job (i.e. opt_gaussian_inputs, freq_gaussian_inputs, etc.). Defaults to None.

solvent_properties : dict, optional¶

Additional input parameters to be used in the ESP calculations and relevant to the solvent model, if any; for example, {“EPS”:12}. Defaults to None.

cart_coords : bool, optional¶

Uses cartesian coordinates in writing Gaussian input files if set to True, otherwise uses z-matrix. Defaults to True.

oxidation_states : dict, optional¶

Dictionary of oxidation states that can be used in setting the charge and spin multiplicity of the molecule; for example: {“Li”:1, “O”:-2}. Defaults to None.

skips : list, optional¶

List of lists of jobs to skip for each molecule; e.g.: [[“opt”, “freq”], [“opt”]]; order should be consistent with that in mol_operation_type and mol. Defaults to None.

kwargs : keyword arguments¶

Additional kwargs to be passed to the workflow.

Returns:¶

Workflow

mispr.gaussian.workflows.base.core module¶

Define a list of common fireworks used in Gaussian workflows.

exception mispr.gaussian.workflows.base.core.GoutTypeError(msg=None)[source]¶

Bases: Exception

Exception that is thrown when no Gaussian output is provided.

mispr.gaussian.workflows.base.core.common_fw(mol_operation_type, mol, working_dir, opt_gaussian_inputs, freq_gaussian_inputs, cart_coords, oxidation_states, gout_key=None, db=None, process_mol_func=True, mol_name=None, dir_head=None, skips=None, check_result=None, **kwargs)[source]¶

Define a list of Fireworks commonly used in Gaussian workflows.

  • Firework 1: Optimize the molecule.

  • Firework 2: Run a frequency analysis.

Parameters:¶
mol_operation_type : str¶

The type of molecule operation. See process_mol defined in mispr/gaussian/utilities/mol.py for supported operations.

mol : Molecule, GaussianOutput, str, dict¶

Source of the molecule to be processed. Should match the mol_operation_type.

working_dir : str¶

Path of the working directory where any required input files can be found and output will be created.

opt_gaussian_inputs : dict¶

Dictionary of Gaussian input parameters for the optimization step.

freq_gaussian_inputs : dict¶

Dictionary of Gaussian input parameters for the frequency step.

cart_coords : bool¶

Whether to use cartesian coordinates in writing Gaussian input files.

oxidation_states : dict¶

Dictionary of oxidation states that can be used in setting the charge and spin multiplicity of the molecule; e.g.: {“Li”:1, “O”:-2}.

gout_key : str, optional¶

Unique key for the Gaussian output dict; used to differentiate Gaussian output dictionaries generated in the same workflow; if None is provided, the key will be set “mol”.

db : str or dict, optional¶

Database credentials; could be provided as the path to the “db.json” file or in the form of a dictionary; if None is provided, attempts to get it from the configuration files.

process_mol_func : bool, optional¶

Whether to process the molecule; if True, will use the molecular formula as the label. Defaults to True.

mol_name : str, optional¶

The name of the molecule; ignored if process_mol_func is set to True.

dir_head : str, optional¶

The name of the head of the directory where the workflow corresponding to the molecule will be run.

skips : list, optional¶

List of jobs to skip; e.g.: [“opt”, “freq”]; defaults to None.

check_result : list, optional¶

List of properties to check for in the output file when skipping jobs; ensures that properties required by the workflow are available via the molecule format provided as an input (e.g. Gaussian output dictionary).

kwargs : keyword arguments¶

Additional kwargs to be passed to the Fireworks and Firetasks.

Returns:¶

Type varies based on the input mol and the

operations performed inside the function.

str: Molecule label. list: List of Fireworks.

Return type:¶

Molecule, GaussianOutput, str, dict

mispr.gaussian.workflows.base.esp module¶

Define the electrostatic partial charges workflow.

mispr.gaussian.workflows.base.esp.get_esp_charges(mol_operation_type, mol, db=None, name='esp_charges_calculation', working_dir=None, opt_gaussian_inputs=None, freq_gaussian_inputs=None, esp_gaussian_inputs=None, solvent_gaussian_inputs=None, solvent_properties=None, cart_coords=True, oxidation_states=None, skips=None, **kwargs)[source]¶

Define a workflow for calculating the electrostatic partial charges.

  • Firework 1: Optimize the molecule.

  • Firework 2: Run a frequency analysis.

  • Firework 3: Run an ESP calculation.

  • Firework 4: Create ESP document/json file.

Parameters:¶
mol_operation_type : str¶

The type of molecule operation. See process_mol defined in mispr/gaussian/utilities/mol.py for supported operations.

mol : Molecule, GaussianOutput, str, dict¶

Source of the molecule to be processed. Should match the mol_operation_type.

db : str or dict, optional¶

Database credentials; could be provided as the path to the “db.json” file or in the form of a dictionary; if none is provided, attempts to get it from the configuration files.

name : str, optional¶

Name of the workflow. Defaults to “esp_charges_calculation”.

working_dir : str, optional¶

Path of the working directory where any required input files can be found and output will be created. Defaults to the current working directory.

opt_gaussian_inputs : dict, optional¶

Dictionary of Gaussian input parameters for the optimization step; e.g.:

{
    "functional": "B3LYP",
    "basis_set": "6-31G(d)",
    "route_parameters": {"Opt": None},
    "link0_parameters": {
        "%chk": "checkpoint.chk",
        "%mem": "45GB",
        "%NProcShared": "24"}
}

The above default parameters will be used if not specified.

freq_gaussian_inputs : dict, optional¶

Dictionary of Gaussian input parameters for the frequency step; default parameters will be used if not specified.

esp_gaussian_inputs : dict, optional¶

Dictionary of Gaussian input parameters for the ESP step; default parameters will be used if not specified.

solvent_gaussian_inputs : str, optional¶

Gaussian input parameters corresponding to the implicit solvent model to be used in the ESP calculations, if any; e.g.:

"(Solvent=TetraHydroFuran)"

These parameters should only be specified here and not included in the main gaussian_inputs dictionary for each job (i.e. opt_gaussian_inputs, freq_gaussian_inputs, etc.). Defaults to None.

solvent_properties : dict, optional¶

Additional input parameters to be used in the ESP calculations and relevant to the solvent model, if any; e.g., {“EPS”:12}. Defaults to None.

cart_coords : bool, optional¶

Uses cartesian coordinates in writing Gaussian input files if set to True, otherwise uses z-matrix. Defaults to True.

oxidation_states : dict, optional¶

Dictionary of oxidation states that can be used in setting the charge and spin multiplicity of the molecule; e.g.: {“Li”:1, “O”:-2}. Defaults to None.

skips : list, optional¶

List of jobs to skip; e.g.: [“opt”, “freq”]; defaults to None.

kwargs : keyword arguments¶

Additional kwargs to be passed to the workflow.

Returns:¶

  • Workflow

  • str: Label of the molecule (e.g. “H2O”, “water”, etc.).

Return type:¶

tuple

mispr.gaussian.workflows.base.ip_ea module¶

Define the redox potentials workflow.

class mispr.gaussian.workflows.base.ip_ea.Node(state: str, phase: str, num_electrons: int, mol_operation_type=None, mol=None, skips=None, check_result=None, parent: Node | None = None, ref_charge=None, branch_cation_from_anion: bool = False, h_index: list | None = None)[source]¶

Bases: object

Generate the fireworks corresponding to different molecule states in the IP/EA workflow. Each molecule state corresponds to a node in the tree. The node is a leaf if it is the last node in the tree, otherwise it is a branch. Not meant to be instantiated directly.

Parameters:¶
state : str¶

Current state of the molecule: cation or anion.

phase : str¶

Current phase of the molecule: gas or solution.

num_electrons : int¶

Number of electrons to transfer.

mol_operation_type : str, optional¶

Type of molecule operation; required for the parent node, i.e. initial molecule state, but not for the child nodes.

mol : Molecule, GaussianOutput, str, dict, optional¶

Molecule to be processed; required for the parent node, i.e. initial molecule state, but not for the child nodes since these are generated from the parent node.

skips : list, optional¶

List of jobs to skip; only relevant to the parent node, i.e. initial molecule state. Defaults to None.

check_result : list, optional¶

List of properties to check for in the output file; only relevant when skipping jobs at the parent node;

currently checks for “final_energy” and “Gibbs Free Energy”, since these are used in calculating the redox potential.

parent : str, optional¶

Parent node of the current node; None if the node corresponds to the initial molecule state.

ref_charge : int, optional¶

The initial charge on the molecule; only relevant to the parent node.

branch_cation_from_anion : bool, optional¶

Whether to add a hydrogen atom at the current node; relevant for PCET calculations.

h_index : int, optional¶

The site index in the molecule at which to attach the hydrogen atoms in the PCET calculations.

branch(branching_states, branching_phases, num_of_electrons, branch_cation_from_anion, h_index, vertical)[source]¶

Generate the children nodes of the current node in the tree representing the IP/EA workflow.

create_fireworks(opt_gaussian_inputs, freq_gaussian_inputs, solvent_gaussian_inputs, solvent_properties, working_dir, db, cart_coords, branch_cation_from_anion, **kwargs)[source]¶

Generate the optimization and/or frequency fireworks corresponding to the current node.

mispr.gaussian.workflows.base.ip_ea.get_ip_ea(mol_operation_type, mol, ref_charge, single_step=False, vertical=False, pcet=False, h_index=None, num_electrons=1, opt_gaussian_inputs=None, freq_gaussian_inputs=None, solvent_gaussian_inputs=None, solvent_properties=None, states=None, phases=None, electrode_potentials=None, gibbs_elec=-0.001378786, gibbs_h=-0.41816, db=None, name='ip_ea_calculation', working_dir=None, cart_coords=True, ref_skips=None, **kwargs)[source]¶

Define a workflow for calculating the ionization potential (IP) and electron affinity (EA) in eV. Supports multiple methods for calculating redox potentials in gas and/or solution:

  • Direct electron transfer

  • Vertical calculation of IP and EA

  • Adiabatic IP/EA

  • Sequential PCET

Uses a tree structure to dynamically define the dependencies of the fireworks. The structure of the tree varies based on the inputs to the workflow.

Parameters:¶
mol_operation_type : str¶

The type of molecule operation. See process_mol defined in mispr/gaussian/utilities/mol.py for supported operations.

mol : Molecule, GaussianOutput, str, dict¶

Source of the molecule to be processed. Should match the mol_operation_type.

ref_charge : int¶

The initial charge on the molecule.

single_step : bool, optional¶

Whether to run the electron transfer in a single or multiple steps; e.g. if num_electrons is set to 2 and single_step is False, the workflow will run the electron transfer in two steps; defaults to False.

vertical : bool, optional¶

Whether to run the vertical IP/EA calculations, in which optimization is performed only at the reference state at each phase specified, thereby skipping the optimization step at the charge states; defaults to False.

pcet : bool, optional¶

Whether to run sequential proton-coupled electron transfer calculations; number of hydrogen transfer steps is assumed to be equal to the number of electron transfers. Defaults to False.

h_index : int, optional¶

The site index in the molecule at which to attach the hydrogen atoms in the PCET calculations. Defaults to None.

num_electrons : int, optional¶

The number of electrons to be transferred; defaults to 1.

opt_gaussian_inputs : dict, optional¶

Dictionary of Gaussian input parameters for the optimization step; e.g.:

{
    "functional": "B3LYP",
    "basis_set": "6-31G(d)",
    "route_parameters": {"Opt": None},
    "link0_parameters": {
        "%chk": "checkpoint.chk",
        "%mem": "45GB",
        "%NProcShared": "24"}
}

The above default parameters will be used if not specified.

freq_gaussian_inputs : dict, optional¶

Dictionary of Gaussian input parameters for the frequency step; default parameters will be used if not specified.

solvent_gaussian_inputs : str, optional¶

Gaussian input parameters corresponding to the implicit solvent model to be used in the redox potential calculations, if any; e.g.:

"(Solvent=TetraHydroFuran)"

These parameters should only be specified here and not included in the main gaussian_inputs dictionary for each job (i.e. opt_gaussian_inputs, freq_gaussian_inputs). Defaults to None.

solvent_properties : dict, optional¶

Additional input parameters to be used in the ESP calculations and relevant to the solvent model, if any; e.g., {“EPS”:12}. Defaults to None.

states : list, optional¶

List of states to be calculated; e.g. [“cation”] for oxidation, [“anion”] for reduction, or [“cation”, “anion”] for oxidation and reduction calculations; runs both if None is specified.

phases : list, optional¶

List of phases to be calculated; e.g. [“solution”] for liquid phase, [“gas”] for gas phase, or [“gas”, “solution”] for the full thermodynamic cycle; runs both if None is specified.

electrode_potentials : dict, optional¶

Dictionary of electrode potentials to be used in converting the absolute oxidation and reduction potentials to commonly used potential scales; e.g.:

{
 lithium": {
            "potential": 1.40,
            "ref": bibtex_parser("li_pot.bib", data_dir),
        }
}

Uses hydrogen, magnesium, and lithium if None is specified; overwrites the existing values if any of these are specified; if different potential scales are specified, computes the potential relative to the three default scales as well as the new ones specified.

gibbs_elec : float, optional¶

The electron gibbs free energy in Hartree; defaults to -0.001378786.

gibbs_h : float, optional¶

The hydrogen gibbs free energy in Hartree; defaults to -0.41816.

db : str or dict, optional¶

Database credentials; could be provided as the path to the “db.json” file or in the form of a dictionary; if none is provided, attempts to get it from the configuration files.

name : str, optional¶

Name of the workflow. Defaults to “ip_ea_calculation”.

working_dir : str, optional¶

Path of the working directory where any required input files can be found and output will be created. Defaults to the current working directory.

cart_coords : bool, optional¶

Uses cartesian coordinates in writing Gaussian input files if set to True, otherwise uses z-matrix. Defaults to True.

ref_skips : list, optional¶

List of jobs to skip; e.g.: [“opt”, “freq”]; only applies to the molecule in the reference state. Defaults to None.

kwargs : keyword arguments¶

Additional kwargs to be passed to the workflow.

Returns:¶

Workflow

mispr.gaussian.workflows.base.nmr module¶

Define the nuclear magnetic resonance workflow.

mispr.gaussian.workflows.base.nmr.get_nmr_tensors(mol_operation_type, mol, db=None, name='nmr_tensor_calculation', working_dir=None, opt_gaussian_inputs=None, freq_gaussian_inputs=None, nmr_gaussian_inputs=None, solvent_gaussian_inputs=None, solvent_properties=None, cart_coords=True, oxidation_states=None, skips=None, **kwargs)[source]¶

Define a workflow for calculating the nuclear magnetic resonance tensors.

  • Firework 1: Optimize the molecule.

  • Firework 2: Calculate the frequencies.

  • Firework 3: Calculate the NMR tensors.

  • Firework 4: Create NMR document/json file.

Parameters:¶
mol_operation_type : str¶

The type of molecule operation. See process_mol defined in mispr/gaussian/utilities/mol.py for supported operations.

mol : Molecule, GaussianOutput, str, dict¶

Source of the molecule to be processed. Should match the mol_operation_type.

db : str or dict, optional¶

Database credentials; could be provided as the path to the “db.json” file or in the form of a dictionary; if none is provided, attempts to get it from the configuration files.

name : str, optional¶

Name of the workflow. Defaults to “nmr_tensor_calculation”.

working_dir : str, optional¶

Path of the working directory where any required input files can be found and output will be created. Defaults to the current working directory.

opt_gaussian_inputs : dict, optional¶

Dictionary of Gaussian input parameters; e.g.:

{
    "functional": "B3LYP",
    "basis_set": "6-31G(d)",
    "route_parameters": {"Opt": None},
    "link0_parameters": {
        "%chk": "checkpoint.chk",
        "%mem": "45GB",
        "%NProcShared": "24"}
}

The above default parameters will be used if not specified.

freq_gaussian_inputs : dict, optional¶

Dictionary of Gaussian input parameters for the frequency step; default parameters will be used if not specified.

nmr_gaussian_inputs : dict, optional¶

Dictionary of Gaussian input parameters for the NMR step; default parameters will be used if not specified.

solvent_gaussian_inputs : str, optional¶

Gaussian input parameters corresponding to the implicit solvent model to be used in the NMR calculations, if any; e.g.:

"(Solvent=TetraHydroFuran)"

These parameters should only be specified here and not included in the main gaussian_inputs dictionary for each job (i.e. opt_gaussian_inputs, freq_gaussian_inputs, etc.). Defaults to None.

solvent_properties : dict, optional¶

Additional input parameters to be used in the NMR calculations and relevant to the solvent model, if any; e.g., {“EPS”:12}. Defaults to None.

cart_coords : bool, optional¶

Uses cartesian coordinates in writing Gaussian input files if set to True, otherwise uses z-matrix. Defaults to True.

oxidation_states : dict, optional¶

Dictionary of oxidation states that can be used in setting the charge and spin multiplicity of the molecule; e.g.: {“Li”:1, “O”:-2}. Defaults to None.

skips : list, optional¶

List of jobs to skip; e.g.: [“opt”, “freq”]; defaults to None.

kwargs : keyword arguments¶

Additional kwargs to be passed to the workflow.

Returns:¶

Workflow

Module contents¶