strain_step package
Submodules
strain_step.metadata module
This file contains metadata describing the results from the strain step
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#strain#{model}",
"type": "float",
"units": "E_h",
},
}
The keys for the metadata are the following:
- 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.
- strain_step.metadata.metadata = {}
Properties that Strain produces.
strain_step.strain module
Non-graphical part of the Strain step in a SEAMM flowchart
- class strain_step.strain.Strain(flowchart=None, title='Strain', extension=None, logger=<Logger strain_step.strain (WARNING)>)[source]
Bases:
Node
The non-graphical part of a Strain 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 Strain.
- Type:
See also
TkStrain
,Strain
,StrainParameters
- 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
- 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 Strain step.
- Parameters:
None –
- Returns:
The next node object in the flowchart.
- Return type:
seamm.Node
- property version
The semantic version of this module.
strain_step.strain_parameters module
Control parameters for the Strain step in a SEAMM flowchart.
- class strain_step.strain_parameters.StrainParameters(defaults={}, data=None)[source]
Bases:
Parameters
The control parameters for Strain.
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.
- 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: kind, default, default_units, enumeration, format_string, description and help text.
- parameters[“kind”]: custom
Specifies the kind of a variable. 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”]“integer” or “float” or “string” or “boolean” or
“enum” The default value of the parameter, used to reset it.
- 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”]: tuple
A longer string to display as help for the user.
See also
Strain
,TkStrain
,Strain
,StrainParameters
,StrainStep
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 = {'strain_xx': {'default': 0.0, 'default_units': '', 'description': 'ε(xx) = ε₁:', 'enumeration': (), 'format_string': '.3f', 'help_text': 'Strain in the XX direction.', 'kind': 'float'}, 'strain_xy': {'default': 0.0, 'default_units': '', 'description': '2ε(xy) = ε₆:', 'enumeration': (), 'format_string': '.3f', 'help_text': 'Strain in the XY direction.', 'kind': 'float'}, 'strain_xz': {'default': 0.0, 'default_units': '', 'description': '2ε(xz) = ε₅:', 'enumeration': (), 'format_string': '.3f', 'help_text': 'Strain in the XZ direction.', 'kind': 'float'}, 'strain_yy': {'default': 0.0, 'default_units': '', 'description': 'ε(yy) = ε₂:', 'enumeration': (), 'format_string': '.3f', 'help_text': 'Strain in the YY direction.', 'kind': 'float'}, 'strain_yz': {'default': 0.0, 'default_units': '', 'description': '2ε(yz) = ε₄:', 'enumeration': (), 'format_string': '.3f', 'help_text': 'Strain in the YZ direction.', 'kind': 'float'}, 'strain_zz': {'default': 0.0, 'default_units': '', 'description': 'ε(zz) = ε₃:', 'enumeration': (), 'format_string': '.3f', 'help_text': 'Strain in the ZZ direction.', 'kind': 'float'}}
strain_step.strain_step module
- class strain_step.strain_step.StrainStep(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.
- my_description{description, group, name}
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 Strain 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”, “Calculations”, “Control” and “Data”.
- 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 (keyworded arguments) – Various keyworded 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:
See also
Strain
- create_tk_node(canvas=None, **kwargs)[source]
Create and return the graphical Tk node object.
- Parameters:
canvas (tk.Canvas) – The Tk Canvas widget
**kwargs (keyworded arguments) – Various keyworded 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:
See also
TkStrain
- my_description = {'description': 'A plug-in for straining systems', 'group': 'Building', 'name': 'Strain'}
strain_step.tk_strain module
The graphical part of a Strain step
- class strain_step.tk_strain.TkStrain(tk_flowchart=None, node=None, canvas=None, x=None, y=None, w=200, h=50)[source]
Bases:
TkNode
The graphical part of a Strain 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
- namespace
The namespace of the current step.
- Type:
str
- tk_subflowchart
A graphical Flowchart representing a subflowchart
- Type:
TkFlowchart
- 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 Strain_parameters.py
- Type:
dict
See also
Strain
,TkStrain
,StrainParameters
- create_dialog()[source]
Create the dialog. A set of widgets will be chosen by default based on what is specified in the Strain_parameters module.
- Parameters:
None –
- Return type:
None
See also
- edit()[source]
Present a dialog for editing the Strain input
- Parameters:
None –
- Return type:
None
See also
- 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
- handle_help()[source]
Shows the help to the user when click on help button.
- 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 Strain_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
See also
Module contents
strain_step A SEAMM plug-in for straining periodic systems