reaction_path_step package#

Submodules#

reaction_path_step.metadata module#

This file contains metadata describing the results from ReactionPath

reaction_path_step.metadata.metadata = {'results': {'converged': {'description': 'Whether the optimization converged', 'dimensionality': 'scalar', 'type': 'bool', 'units': ''}, 'energy': {'description': 'The total energy', 'dimensionality': 'scalar', 'type': 'float', 'units': 'kJ/mol'}, 'nsteps': {'description': 'The number of steps in the optimization', 'dimensionality': 'scalar', 'type': 'int', 'units': ''}}}#

Description of the computational models for ReactionPath.

Hamiltonians, approximations, and basis set or parameterizations, only if appropriate for this code. For example:

metadata["computational models"] = {
    "Hartree-Fock": {
        "models": {
            "PM7": {
                "parameterizations": {
                    "PM7": {
                        "elements": "1-60,62-83",
                        "periodic": True,
                        "reactions": True,
                        "optimization": True,
                        "code": "mopac",
                    },
                    "PM7-TS": {
                        "elements": "1-60,62-83",
                        "periodic": True,
                        "reactions": True,
                        "optimization": False,
                        "code": "mopac",
                    },
                },
            },
        },
    },
}

reaction_path_step.reaction_path module#

Non-graphical part of the Reaction Path step in a SEAMM flowchart

class reaction_path_step.reaction_path.OutputHandler(*args, keep_newlines=False)[source]#

Bases: object

add_callback(cb)[source]#

Add a new callback.

callbacks()[source]#

Return a list of all the callbacks.

flush()[source]#
remove_callback(cb)[source]#

Remove a callback.

write(txt)[source]#

Pass the text to the callbacks.

Buffer the text until it ends in a newline!

class reaction_path_step.reaction_path.ReactionPath(flowchart=None, title='Reaction Path', namespace='org.molssi.seamm', extension=None, logger=<Logger reaction_path_step.reaction_path (WARNING)>)[source]#

Bases: Node

The non-graphical part of a Reaction Path step in a flowchart.

parser#

The parser object.

Type:

configargparse.ArgParser

options#

It contains a two item tuple containing the populated namespace and the list of remaining argument strings.

Type:

tuple

subflowchart#

A SEAMM Flowchart object that represents a subflowchart, if needed.

Type:

seamm.Flowchart

parameters#

The control parameters for Reaction Path.

Type:

ReactionPathParameters

See also

TkReactionPath, ReactionPath, ReactionPathParameters

analyze(indent='', step=None, **kwargs)[source]#

Do any analysis of the output from this step.

Also print important results to the local step.out file using “printer”.

Parameters:

indent (str) – An extra indentation for the output

attach_calculators(images)[source]#

Attach calculators to the images in the reaction path.

auto_neb(P)[source]#

Do the NEB calculation.

Parameters:

P (dict()) – The control parameters for the step.

auto_neb_handler(txt)[source]#

Track what is going on in AutoNEB from the output

calculator(calculator, properties=['energy'], system_changes=['positions', 'numbers', 'cell', 'pbc', 'initial_charges', 'initial_magmoms'])[source]#

Create a calculator for the reaction path step.

Parameters:
  • ase (ase.calculators.calculator.Calculator) – The ASE calculator we are working for

  • properties (list of str) – The properties to calculate.

  • system_changes (int) – The changes to the system.

Returns:

results – The dictionary of results from the calculation.

Return type:

dict

calculator_for_neb(calculator, properties=['energy'], system_changes=['positions', 'numbers', 'cell', 'pbc', 'initial_charges', 'initial_magmoms'])[source]#

Create a calculator for the ASE NEB method

Parameters:
  • ase (ase.calculators.calculator.Calculator) – The ASE calculator we are working for

  • properties (list of str) – The properties to calculate.

  • system_changes (int) – The changes to the system.

Returns:

results – The dictionary of results from the calculation.

Return type:

dict

create_parser()[source]#

Setup the command-line / config file parser

description_text(P=None, short=False, natoms=None)[source]#

Create the text description of what this step will do. The dictionary of control values is passed in as P so that the code can test values, etc.

Parameters:

P (dict) – An optional dictionary of the current values of the control parameters.

Returns:

A description of the current step.

Return type:

str

energy_profile(step)[source]#

Prepare the energy profile for this step

get_reactants_and_products(P)[source]#

Get the reactants and products systems.

Parameters:

P (dict()) – The control parameters for the step

property git_revision#

The git version of this module.

interpolate(P)[source]#

Interpolate the structures for the reaction

Parameters:

P (dict()) – The control parameters for the step.

Returns:

configurations – The list of configurations along the path from reactants to products

Return type:

[molsystem._Configuration]

log_calculator(txt)[source]#

Direct captured output to the correct file.

Parameters:

txt (str) – The text to write.

neb(P)[source]#

Do the NEB calculation.

Parameters:

P (dict()) – The control parameters for the step.

plot_path(step, plot_path, path, energies, fit_path, fit_energies, lines)[source]#

Plot the reaction path the to file ‘plot’.

Parameters:
  • plot (pathlib.Path) – The file to write the plot to

  • path ([float]) – The x points of the structures on the path

  • energies ([float]) – The y points, or energies, of the structures

  • fit_path (np.ndarray) – x points for the fit to the path

  • fit_energies (np.ndarray) – y points for the fit path

  • lines ([(float, float)]) – Tangent lines at each structure

run()[source]#

Run a Reaction Path step.

Parameters:

None

Returns:

The next node object in the flowchart.

Return type:

seamm.Node

set_id(node_id=())[source]#

Sequentially number the subnodes

set_subids(node_id=())[source]#

Set the ids of the nodes in the subflowchart

property version#

The semantic version of this module.

write_structure(configuration, path)[source]#

Write the structure to disk for viewing.

Parameters:
  • configuration (molsystem._Configuration) – The structure to write.

  • path (pathlib.Path or str) – The file to write to. The extension will be forced to mmcif and cif

reaction_path_step.reaction_path_parameters module#

Control parameters for the Reaction Path step in a SEAMM flowchart

class reaction_path_step.reaction_path_parameters.ReactionPathParameters(defaults={}, data=None)[source]#

Bases: Parameters

The control parameters for Reaction Path.

You need to replace the “time” entry in dictionary below these comments with the definitions of parameters to control this step. The keys are parameters for the current plugin,the values are dictionaries as outlined below.

Examples

parameters = {
    "time": {
        "default": 100.0,
        "kind": "float",
        "default_units": "ps",
        "enumeration": tuple(),
        "format_string": ".1f",
        "description": "Simulation time:",
        "help_text": ("The time to simulate in the dynamics run.")
    },
}
parameters{str: {str: str}}

A dictionary containing the parameters for the current step. Each key of the dictionary is a dictionary that contains the the following keys:

parameters[“default”] :

The default value of the parameter, used to reset it.

parameters[“kind”]enum()

Specifies the kind of a variable. One of “integer”, “float”, “string”, “boolean”, or “enum”

While the “kind” of a variable might be a numeric value, it may still have enumerated custom values meaningful to the user. For instance, if the parameter is a convergence criterion for an optimizer, custom values like “normal”, “precise”, etc, might be adequate. In addition, any parameter can be set to a variable of expression, indicated by having “$” as the first character in the field. For example, $OPTIMIZER_CONV.

parameters[“default_units”]str

The default units, used for resetting the value.

parameters[“enumeration”]tuple

A tuple of enumerated values.

parameters[“format_string”]str

A format string for “pretty” output.

parameters[“description”]str

A short string used as a prompt in the GUI.

parameters[“help_text”]str

A longer string to display as help for the user.

See also

ReactionPath, TkReactionPath, ReactionPath, ReactionPathStep

parameters = {'approach': {'default': 'Nudged Elastic Band (NEB)', 'default_units': '', 'description': 'Approach:', 'enumeration': ('Interpolate path', 'Nudged Elastic Band (NEB)'), 'format_string': '', 'help_text': 'The approach or method for determining the reaction path.', 'kind': 'enum'}, 'climbing image': {'default': 'no', 'default_units': '', 'description': 'Use climbing image (CI-NEB):', 'enumeration': ('yes', 'no'), 'format_string': '', 'help_text': 'Whether to use a climbing image after convergence.', 'kind': 'boolean'}, 'continue if not converged': {'default': 'no', 'default_units': '', 'description': 'Continue if not converged:', 'enumeration': ('yes', 'no'), 'format_string': '', 'help_text': 'Whether to stop if the optimizer does not converge.', 'kind': 'boolean'}, 'convergence': {'default': 100.0, 'default_units': 'kJ/mol/Å', 'description': 'Convergence criterion:', 'enumeration': (), 'format_string': '.g', 'help_text': 'The criterion for convergence of the optimizer.', 'kind': 'float'}, 'initial optimizer': {'default': 'BFGSLineSearch', 'default_units': '', 'description': 'Reactant/product optimizer:', 'enumeration': ('BFGSLineSearch', 'BFGS', 'FIRE'), 'format_string': '', 'help_text': 'The optimizer to use for the reactant and product.', 'kind': 'enum'}, 'intermediate structures': {'default': 'interpolation', 'default_units': '', 'description': 'Intermediates:', 'enumeration': ('interpolatation', 'intermediate*', '<system>/<configuration>, ...'), 'format_string': '', 'help_text': 'The intermediate structures.', 'kind': 'string'}, 'interpolation method': {'default': '', 'default_units': '', 'description': 'Interpolation method:', 'enumeration': ('Image Dependent Pair Potential (IDPP)', 'Linear'), 'format_string': '', 'help_text': 'How to interpolate needed structures at the beginning', 'kind': 'enum'}, 'max climbing steps': {'default': '100', 'default_units': '', 'description': 'Maximum # of CI-NEB steps:', 'enumeration': (), 'format_string': '', 'help_text': 'The maximum number of steps to take in the climbing image phase.', 'kind': 'integer'}, 'max steps': {'default': '300', 'default_units': '', 'description': 'Maximum # of steps:', 'enumeration': (), 'format_string': '', 'help_text': 'The maximum number of steps to take.', 'kind': 'integer'}, 'neb algorithm': {'default': 'aseneb', 'default_units': '', 'description': 'Algorithm:', 'enumeration': ('ase neb', 'improved tangent', 'eb', 'spline', 'string'), 'format_string': '', 'help_text': 'The NEB algorithm to use.', 'kind': 'enum'}, 'neb method': {'default': 'NEB', 'default_units': '', 'description': 'Method:', 'enumeration': ('NEB', 'AutoNEB'), 'format_string': '', 'help_text': 'The NEB method to use.', 'kind': 'enum'}, 'neb optimizer': {'default': 'BFGS', 'default_units': '', 'description': 'NEB optimizer:', 'enumeration': ('BFGS', 'FIRE', 'MDMin', 'GPMin'), 'format_string': '', 'help_text': 'The optimizer to use in the NEB part.', 'kind': 'enum'}, 'number of active images': {'default': 3, 'default_units': '', 'description': 'Number of active images:', 'enumeration': (), 'format_string': '', 'help_text': 'The number of simultaneously active images to use.', 'kind': 'integer'}, 'number of intermediate structures': {'default': 5, 'default_units': '', 'description': 'Number of intermediates:', 'enumeration': (), 'format_string': '', 'help_text': 'The number of intermediate structures between reactants and products.', 'kind': 'integer'}, 'on error': {'default': 'keep all subdirectories', 'default_units': '', 'description': 'On error:', 'enumeration': ('keep last subdirectory', 'keep all subdirectories', 'delete all subdirectories'), 'format_string': '', 'help_text': 'Which subdirectories to keep if there is an error.', 'kind': 'enum'}, 'on success': {'default': 'keep last subdirectory', 'default_units': '', 'description': 'On success:', 'enumeration': ('keep last subdirectory', 'keep all subdirectories', 'delete all subdirectories'), 'format_string': '', 'help_text': 'Which subdirectories to keep.', 'kind': 'enum'}, 'product': {'default': '', 'default_units': '', 'description': 'Product:', 'enumeration': ('current configuration', '<system>/<configuration>'), 'format_string': '', 'help_text': 'The product structure.', 'kind': 'string'}, 'reactant': {'default': '', 'default_units': '', 'description': 'Reactant:', 'enumeration': ('current configuration', '<system>/<configuration>'), 'format_string': '', 'help_text': 'The reactant structure.', 'kind': 'string'}, 'remove rotation and translation': {'default': 'once before starting', 'default_units': '', 'description': 'Remove rotation and translation:', 'enumeration': ('once before starting', 'every step', 'no'), 'format_string': '', 'help_text': 'Whether to remove any rotation and translation between reactants and products', 'kind': 'enum'}, 'results': {'default': {}, 'default_units': None, 'description': 'results', 'enumeration': (), 'format_string': '', 'help_text': 'The results to save to variables or in tables.', 'kind': 'dictionary'}, 'spring constant': {'default': 500, 'default_units': 'kJ/mol/Å^2', 'description': 'Spring constant:', 'enumeration': (), 'format_string': '.g', 'help_text': 'The force constant of the springs between images in the NEB.', 'kind': 'float'}}#

reaction_path_step.reaction_path_step module#

class reaction_path_step.reaction_path_step.ReactionPathStep(flowchart=None, gui=None)[source]#

Bases: object

Helper class needed for the stevedore integration.

This must provide a description() method that returns a dict containing a description of this node, and create_node() and create_tk_node() methods for creating the graphical and non-graphical nodes.

The dictionary for the description is the class variable just below these comments. The felds are as follows:

my_description{str, str}

A human-readable description of this step. It can be several lines long, and needs to be clear to non-expert users. It contains the following keys: description, group, name.

my_description[“description”]tuple

A description of the Reaction Path step. It must be clear to non-experts.

my_description[“group”]str

Which group in the menus to put this step. If the group does not exist it will be created. Common groups are “Building”, “Control”, “Custom”, “Data”, and “Simulations”.

my_description[“name”]str

The name of this step, to be displayed in the menus.

create_node(flowchart=None, **kwargs)[source]#

Create and return the new node object.

Parameters:
  • flowchart (seamm.Node) – A non-graphical SEAMM node

  • **kwargs (keyword arguments) – Various keyword arguments such as title, namespace or extension representing the title displayed in the flowchart, the namespace for the plugins of a subflowchart and the extension, respectively.

Return type:

ReactionPath

create_tk_node(canvas=None, **kwargs)[source]#

Create and return the graphical Tk node object.

Parameters:
  • canvas (tk.Canvas) – The Tk Canvas widget

  • **kwargs (keyword arguments) – Various keyword arguments such as tk_flowchart, node, x, y, w, h representing a graphical flowchart object, a non-graphical node for a step, and dimensions of the graphical node.

Return type:

TkReactionPath

description()[source]#

Return a description of what this step does.

Returns:

description

Return type:

dict(str, str)

my_description = {'description': 'An interface for calculating reaction paths and transition states.', 'group': 'Properties', 'name': 'Reaction Path'}#

reaction_path_step.tk_reaction_path module#

The graphical part of a Reaction Path step

class reaction_path_step.tk_reaction_path.TkReactionPath(tk_flowchart=None, node=None, namespace='org.molssi.seamm.tk', canvas=None, x=None, y=None, w=200, h=50)[source]#

Bases: TkNode

The graphical part of a Reaction Path step in a flowchart.

tk_flowchart#

The flowchart that we belong to.

Type:

TkFlowchart = None

node#

The corresponding node of the non-graphical flowchart

Type:

Node = None

canvas#

The Tk Canvas to draw on

Type:

tkCanvas = None

dialog#

The Pmw dialog object

Type:

Dialog

x#

The x-coordinate of the center of the picture of the node

Type:

int = None

y#

The y-coordinate of the center of the picture of the node

Type:

int = None

w#

The width in pixels of the picture of the node

Type:

int = 200

h#

The height in pixels of the picture of the node

Type:

int = 50

self[widget]#

A dictionary of tk widgets built using the information contained in reaction_path_parameters.py

Type:

dict

See also

ReactionPath, TkReactionPath, ReactionPathParameters

create_dialog()[source]#

Create the dialog. A set of widgets will be chosen by default based on what is specified in the ReactionPathParameters module.

Parameters:

None

Return type:

None

reset_dialog(widget=None)[source]#

Layout the widgets in the dialog.

The widgets are chosen by default from the information in Diffusivity parameters.

This function simply lays them out row by row with aligned labels. You may wish a more complicated layout that is controlled by values of some of the control parameters. If so, edit or override this method

Parameters:

widget (Tk Widget = None)

Return type:

None

See also

TkDiffusivity.create_dialog

reset_reaction_path_frame(widget=None)[source]#

Layout the widgets in the reaction path frame as needed for the current state

right_click(event)[source]#

Handles the right click event on the node.

Parameters:

event (Tk Event)

Return type:

None

See also

TkReactionPath.edit

Module contents#

reaction_path_step A SEAMM plugin for finding transition states and reaction paths