quickmin_step package#

Submodules#

quickmin_step.metadata module#

This file contains metadata describing the results from QuickMin

quickmin_step.metadata.metadata = {'results': {'energy': {'description': 'The total energy', 'dimensionality': 'scalar', 'property': 'total energy#QuickMin#{model}', 'type': 'float', 'units': 'kJ/mol'}, 'forcefield': {'description': 'The forcefield used', 'dimensionality': 'scalar', 'type': 'string'}, 'gradients': {'description': 'The gradients', 'dimensionality': '[3, n_atoms]', 'type': 'float', 'units': 'kJ/mol/Å'}, 'model': {'description': 'The model string', 'dimensionality': 'scalar', 'type': 'string'}}}#

Properties that QuickMin produces. metadata[“results”] describes the results that this step can produce. It is a dictionary where the keys are the internal names of the results within this step, and the values are a dictionary describing the result. For example:

metadata["results"] = {
    "total_energy": {
        "calculation": [
            "energy",
            "optimization",
        ],
        "description": "The total energy",
        "dimensionality": "scalar",
        "methods": [
            "ccsd",
            "ccsd(t)",
            "dft",
            "hf",
        ],
        "property": "total energy#QuickMin#{model}",
        "type": "float",
        "units": "E_h",
    },
}

Fields#

calculation[str]

Optional metadata describing what subtype of the step produces this result. The subtypes are completely arbitrary, but often they are types of calculations which is why this is name calculation. To use this, the step or a substep define self._calculation as a value. That value is used to select only the results with that value in this field.

descriptionstr

A human-readable description of the result.

dimensionalitystr

The dimensions of the data. The value can be “scalar” or an array definition of the form “[dim1, dim2,…]”. Symmetric tringular matrices are denoted “triangular[n,n]”. The dimensions can be integers, other scalar results, or standard parameters such as n_atoms. For example, ‘[3]’, [3, n_atoms], or “triangular[n_aos, n_aos]”.

methodsstr

Optional metadata like the calculation data. methods provides a second level of filtering, often used for the Hamiltionian for ab initio calculations where some properties may or may not be calculated depending on the type of theory.

propertystr

An optional definition of the property for storing this result. Must be one of the standard properties defined either in SEAMM or in this steps property metadata in data/properties.csv.

typestr

The type of the data: string, integer, or float.

unitsstr

Optional units for the result. If present, the value should be in these units.

quickmin_step.quickmin module#

Non-graphical part of the QuickMin step in a SEAMM flowchart

class quickmin_step.quickmin.OutputGrabber(stream=None, threaded=False)[source]#

Bases: object

Class used to grab standard output or another stream.

see https://stackoverflow.com/questions/24277488/in-python-how-to-capture-the-stdout-from-a-c-shared-library-to-a-variable/29834357#29834357 # noqa: E501

escape_char = '\x08'#
readOutput()[source]#

Read the stream data (one byte at a time) and save the text in capturedtext.

start()[source]#

Start capturing the stream data.

stop()[source]#

Stop capturing the stream data and save the text in capturedtext.

class quickmin_step.quickmin.QuickMin(flowchart=None, title='QuickMin', extension=None, logger=<Logger quickmin_step.quickmin (WARNING)>)[source]#

Bases: Node

The non-graphical part of a QuickMin step in a flowchart.

Parameters:
  • parser (configargparse.ArgParser) – The parser object.

  • options (tuple) – It contains a two item tuple containing the populated namespace and the list of remaining argument strings.

  • subflowchart (seamm.Flowchart) – A SEAMM Flowchart object that represents a subflowchart, if needed.

  • parameters (QuickMinParameters) – The control parameters for QuickMin.

See also

TkQuickMin, QuickMin, QuickMinParameters

description_text(P=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

property git_revision#

The git version of this module.

run()[source]#

Run a QuickMin step.

Parameters:

None

Returns:

The next node object in the flowchart.

Return type:

seamm.Node

property version#

The semantic version of this module.

quickmin_step.quickmin_parameters module#

Control parameters for the QuickMin step in a SEAMM flowchart

class quickmin_step.quickmin_parameters.QuickMinParameters(defaults={}, data=None)[source]#

Bases: Parameters

The control parameters for QuickMin.

The developer will add a dictionary of Parameters to this class. The keys are parameters for the current plugin, which themselves might be dictionaries.

You need to replace the “time” example below with one or more definitions of the control parameters for your plugin and application.

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

QuickMin, TkQuickMin, QuickMin, QuickMinParameters, QuickMinStep

parameters = {'calculation': {'default': 'optimization', 'description': 'Calculation:', 'enumeration': ('optimization', 'single-point energy'), 'format_string': '', 'help_text': 'The type of calculation to perform.', 'kind': 'enum'}, 'forcefield': {'default': 'best available', 'description': 'Forcefield:', 'enumeration': ('best available', 'GAFF -- General Amber Force Field', 'Ghemical -- Ghemical force field', 'MMFF94 -- MMFF94 force field', 'MMFF94s -- MMFF94s force field for minimization', 'UFF -- Universal Force Field'), 'format_string': '', 'help_text': 'The forcefield to use.', 'kind': 'enum'}, 'n_steps': {'default': 1000, 'default_units': '', 'description': 'Maximum steps:', 'enumeration': (), 'format_string': '', 'help_text': 'The maximum number of steps to run.', 'kind': 'integer'}, 'results': {'default': {}, 'default_units': '', 'description': 'results', 'enumeration': (), 'format_string': '', 'help_text': 'The results to save to variables or in tables.', 'kind': 'dictionary'}}#

quickmin_step.quickmin_step module#

class quickmin_step.quickmin_step.QuickMinStep(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 fields 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 QuickMin 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:

QuickMin

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:

TkQuickMin

description()[source]#

Return a description of what this step does.

Returns:

description

Return type:

dict(str, str)

my_description = {'description': 'An interface for QuickMin', 'group': 'Simulations', 'name': 'QuickMin'}#

quickmin_step.tk_quickmin module#

The graphical part of a QuickMin step

class quickmin_step.tk_quickmin.TkQuickMin(tk_flowchart=None, node=None, canvas=None, x=None, y=None, w=200, h=50)[source]#

Bases: TkNode

The graphical part of a QuickMin step in a flowchart.

Parameters:
  • tk_flowchart (TkFlowchart = None) – The flowchart that we belong to.

  • node (Node = None) – The corresponding node of the non-graphical flowchart

  • namespace (str) – The namespace of the current step.

  • tk_subflowchart (TkFlowchart) – A graphical Flowchart representing a subflowchart

  • canvas (tkCanvas = None) – The Tk Canvas to draw on

  • dialog (Dialog) – The Pmw dialog object

  • x (int = None) – The x-coordinate of the center of the picture of the node

  • y (int = None) – The y-coordinate of the center of the picture of the node

  • w (int = 200) – The width in pixels of the picture of the node

  • h (int = 50) – The height in pixels of the picture of the node

  • self[widget] (dict) – A dictionary of tk widgets built using the information contained in QuickMin_parameters.py

See also

QuickMin, TkQuickMin, QuickMinParameters

create_dialog()[source]#

Create the dialog. A set of widgets will be chosen by default based on what is specified in the QuickMin_parameters 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 QuickMin_parameter.

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

right_click(event)[source]#

Handles the right click event on the node.

Parameters:

event (Tk Event)

Return type:

None

See also

TkQuickMin.edit

Module contents#

quickmin_step A SEAMM plug-in for simple, quick minimization