energy_scan_step package#

Submodules#

energy_scan_step.energy_scan module#

Non-graphical part of the Energy Scan step in a SEAMM flowchart

class energy_scan_step.energy_scan.EnergyScan(flowchart=None, title='Energy Scan', namespace='org.molssi.seamm', extension=None, logger=<Logger energy_scan_step.energy_scan (WARNING)>)[source]#

Bases: Node

The non-graphical part of a Energy Scan 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 Energy Scan.

Type:

EnergyScanParameters

See also

TkEnergyScan, EnergyScan, EnergyScanParameters

analyze(indent='', **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

calculate_gradients(coordinates)[source]#

Given the new coordinates, calculate the energy and gradients.

Parameters:

coordinates ([3, n_atoms] array of coordinates)

property constraints#
create_parser()[source]#

Setup the command-line / config file parser

description_text(P=None, short=False)[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

property git_revision#

The git version of this module.

parse_constraints()[source]#

Parse the given constraints.

The constraints are stored as a dict of dicts:

"distances": {...}
"angles": {...}
"dihedrals" {
    "constraints": {name1: data1, ...]  # see below
    "key atoms": {
        (j, k): [(constraint_name, match_no), ....]
        ...
    }

where:

data = {  # in constraints above
    "name": <unique name of constraint>,
    "operation": "<scan, freeze or set>",
    "type": "<distance, angle, dihedral>",
    "SMARTS": "<SMARTS string>",
    "value1": "<starting value>",
    "value2": "<end value for scan>",
    "step": "<step in Bohr or degrees>",
    "units": "<units for step>",
    "atoms": [ordered list of tuples of atom numbers],
    "matched atoms": [ordered list of tuples of all atoms matched],
    "mapping": [ordered indices of atoms in <matched atoms>]
}
run()[source]#

Run a Energy Scan 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

setup_constraints(rdkConf)[source]#

Work through the given constraints, turning them into actionable data.

This method takes the constraints as given by the user and turns them into the various forms that geomeTRIC takes. Also, rather than use geomeTRIC for scans, they will be performed in this plug-in with the scan coordinate turned into a “freeze” coordinate.

Parameters:

rdkConf (rdkit.Conformer()) – The RDKit conformer corresponding to the current conformer.

property step#

The calculation number in the scan.

property version#

The semantic version of this module.

property working_configuration#

The configuration being worked on.

property working_directory#

The directory being worked on.

class energy_scan_step.energy_scan.SEAMMEngine(step, molecule)[source]#

Bases: Engine

Helper class that is a geomeTRIC engine and connects to SEAMM.

calc_new(coords, dirname)[source]#

The method to calculate the new energy and forces.

Parameters:
  • coords (np.ndarray) – A 1-D Numpy array of the coordinates, in Bohr

  • dirname (The name of a directory (not used))

Returns:

data

The result returned to geomeTRIC:

”energy” : The energy, in Hartree

”gradient” : The 1st derivative, or gradient, of the energy in Hartree/bohr as a 1-D Numpy array.

Return type:

{str : any}

class energy_scan_step.energy_scan.cd(newPath)[source]#

Bases: object

Context manager for changing the current working directory

energy_scan_step.energy_scan_parameters module#

Control parameters for the Energy Scan step in a SEAMM flowchart

class energy_scan_step.energy_scan_parameters.EnergyScanParameters(defaults={}, data=None)[source]#

Bases: Parameters

The control parameters for Energy Scan.

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

EnergyScan, TkEnergyScan, EnergyScanParameters, EnergyScanStep

parameters = {'constraints': {'default': {}, 'default_units': '', 'description': 'Coordinates to scan:', 'enumeration': (), 'format_string': '', 'help_text': 'The coordinates to scan', 'kind': 'dictionary'}, 'coordinate system': {'default': 'TRIC: translation-rotation internal coordinates', 'default_units': '', 'description': 'The coordinate system to use:', 'enumeration': ('TRIC: translation-rotation internal coordinates', 'TRIC-p: primitive (redundant) TRIC', 'Cart: Cartesian coordinates', 'DLC: delocalized internal coordinates', 'HDLC: hybrid delocalized internal coordinates'), 'format_string': '', 'help_text': 'The coordinates system to use in the calculation.', 'kind': 'integer'}, 'enforce': {'default': '5.0', 'default_units': 'degree', 'description': 'Exactly enforce constraints:', 'enumeration': (), 'format_string': '%.1f', 'help_text': 'The maximum value of the deviation in degrees/angstroms at which to start exactly enforcing the constraints.', 'kind': 'float'}, 'max steps': {'default': 'default', 'default_units': '', 'description': 'Maximum number of optimization steps:', 'enumeration': ('default',), 'format_string': '', 'help_text': 'The maximum number of optimization steps to take for any point in the scan.', 'kind': 'integer'}}#

energy_scan_step.energy_scan_step module#

class energy_scan_step.energy_scan_step.EnergyScanStep(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 Energy Scan 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:

EnergyScan

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:

TkEnergyScan

description()[source]#

Return a description of what this step does.

Returns:

description

Return type:

dict(str, str)

my_description = {'description': 'An interface for calculating the energy along coordinate(s).', 'group': 'Properties', 'name': 'Energy Scan'}#

energy_scan_step.metadata module#

This file contains metadata describing the results from EnergyScan

energy_scan_step.metadata.metadata = {}#

Description of the computational models for EnergyScan.

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",
                    },
                },
            },
        },
    },
}

energy_scan_step.tk_energy_scan module#

The graphical part of a Energy Scan step

class energy_scan_step.tk_energy_scan.TkEnergyScan(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 Energy Scan 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 Energy Scan_parameters.py

Type:

dict

See also

EnergyScan, TkEnergyScan, EnergyScanParameters

create_dialog()[source]#

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

Parameters:

None

Return type:

None

edit()[source]#

Present a dialog for editing the Control Parameters input

Parameters:

None

Return type:

None

See also

TkControlParameters.right_click

handle_dialog(result)[source]#

Handle the closing of the edit dialog

What to do depends on the button used to close the dialog. If the user closes it by clicking the ‘x’ of the dialog window, None is returned, which we take as equivalent to cancel.

Parameters:

result (None or str) – The value of this variable depends on what the button the user clicked.

Return type:

None

reset_constraints(widget=None)[source]#

Re-initialize the constraints.

reset_dialog(widget=None)[source]#

Layout the widgets in the dialog.

The widgets are chosen by default from the information in energy scan 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

reset_scan_frame(widget=None)[source]#

Layout the widgets in the scan 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

Module contents#

energy_scan_step A SEAMM plug-in for calculating energy profiles along coordinates