structure-step 2024.8.4__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- structure_step/__init__.py +26 -0
- structure_step/_version.py +21 -0
- structure_step/data/properties.csv +1 -0
- structure_step/data/references.bib +40 -0
- structure_step/metadata.py +177 -0
- structure_step/structure.py +754 -0
- structure_step/structure_parameters.py +193 -0
- structure_step/structure_step.py +95 -0
- structure_step/tk_structure.py +289 -0
- structure_step-2024.8.4.dist-info/AUTHORS.rst +5 -0
- structure_step-2024.8.4.dist-info/LICENSE +31 -0
- structure_step-2024.8.4.dist-info/METADATA +96 -0
- structure_step-2024.8.4.dist-info/RECORD +17 -0
- structure_step-2024.8.4.dist-info/WHEEL +6 -0
- structure_step-2024.8.4.dist-info/entry_points.txt +5 -0
- structure_step-2024.8.4.dist-info/top_level.txt +1 -0
- structure_step-2024.8.4.dist-info/zip-safe +1 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Control parameters for the Structure step in a SEAMM flowchart
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import logging
|
|
7
|
+
import seamm
|
|
8
|
+
|
|
9
|
+
logger = logging.getLogger(__name__)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class StructureParameters(seamm.Parameters):
|
|
13
|
+
"""
|
|
14
|
+
The control parameters for Structure.
|
|
15
|
+
|
|
16
|
+
You need to replace the "time" entry in dictionary below these comments with the
|
|
17
|
+
definitions of parameters to control this step. The keys are parameters for the
|
|
18
|
+
current plugin,the values are dictionaries as outlined below.
|
|
19
|
+
|
|
20
|
+
Examples
|
|
21
|
+
--------
|
|
22
|
+
::
|
|
23
|
+
|
|
24
|
+
parameters = {
|
|
25
|
+
"time": {
|
|
26
|
+
"default": 100.0,
|
|
27
|
+
"kind": "float",
|
|
28
|
+
"default_units": "ps",
|
|
29
|
+
"enumeration": tuple(),
|
|
30
|
+
"format_string": ".1f",
|
|
31
|
+
"description": "Simulation time:",
|
|
32
|
+
"help_text": ("The time to simulate in the dynamics run.")
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
parameters : {str: {str: str}}
|
|
37
|
+
A dictionary containing the parameters for the current step.
|
|
38
|
+
Each key of the dictionary is a dictionary that contains the
|
|
39
|
+
the following keys:
|
|
40
|
+
|
|
41
|
+
parameters["default"] :
|
|
42
|
+
The default value of the parameter, used to reset it.
|
|
43
|
+
|
|
44
|
+
parameters["kind"] : enum()
|
|
45
|
+
Specifies the kind of a variable. One of "integer", "float", "string",
|
|
46
|
+
"boolean", or "enum"
|
|
47
|
+
|
|
48
|
+
While the "kind" of a variable might be a numeric value, it may still have
|
|
49
|
+
enumerated custom values meaningful to the user. For instance, if the parameter
|
|
50
|
+
is a convergence criterion for an optimizer, custom values like "normal",
|
|
51
|
+
"precise", etc, might be adequate. In addition, any parameter can be set to a
|
|
52
|
+
variable of expression, indicated by having "$" as the first character in the
|
|
53
|
+
field. For example, $OPTIMIZER_CONV.
|
|
54
|
+
|
|
55
|
+
parameters["default_units"] : str
|
|
56
|
+
The default units, used for resetting the value.
|
|
57
|
+
|
|
58
|
+
parameters["enumeration"] : tuple
|
|
59
|
+
A tuple of enumerated values.
|
|
60
|
+
|
|
61
|
+
parameters["format_string"] : str
|
|
62
|
+
A format string for "pretty" output.
|
|
63
|
+
|
|
64
|
+
parameters["description"] : str
|
|
65
|
+
A short string used as a prompt in the GUI.
|
|
66
|
+
|
|
67
|
+
parameters["help_text"] : str
|
|
68
|
+
A longer string to display as help for the user.
|
|
69
|
+
|
|
70
|
+
See Also
|
|
71
|
+
--------
|
|
72
|
+
Structure, TkStructure, Structure StructureParameters, StructureStep
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
parameters = {
|
|
76
|
+
"approach": {
|
|
77
|
+
"default": "Optimization",
|
|
78
|
+
"kind": "enum",
|
|
79
|
+
"default_units": "",
|
|
80
|
+
"enumeration": ("Optimization",),
|
|
81
|
+
"format_string": "",
|
|
82
|
+
"description": "Approach:",
|
|
83
|
+
"help_text": "The approach or method for determining the structure.",
|
|
84
|
+
},
|
|
85
|
+
"optimizer": {
|
|
86
|
+
"default": "BFGS",
|
|
87
|
+
"kind": "enum",
|
|
88
|
+
"default_units": "",
|
|
89
|
+
"enumeration": (
|
|
90
|
+
"BFGS",
|
|
91
|
+
"BFGSLineSearch",
|
|
92
|
+
"LBFGS",
|
|
93
|
+
"LBFGSLineSearch",
|
|
94
|
+
"GPMin",
|
|
95
|
+
"MDMin",
|
|
96
|
+
"FIRE",
|
|
97
|
+
),
|
|
98
|
+
"format_string": "",
|
|
99
|
+
"description": "Method:",
|
|
100
|
+
"help_text": "The optimizer to use.",
|
|
101
|
+
},
|
|
102
|
+
"convergence": {
|
|
103
|
+
"default": 0.001,
|
|
104
|
+
"kind": "float",
|
|
105
|
+
"default_units": "kJ/mol/Å",
|
|
106
|
+
"enumeration": tuple(),
|
|
107
|
+
"format_string": ".g",
|
|
108
|
+
"description": "Convergence criterion:",
|
|
109
|
+
"help_text": "The criterion for convergence of the optimizer.",
|
|
110
|
+
},
|
|
111
|
+
"max steps": {
|
|
112
|
+
"default": "12 * natoms",
|
|
113
|
+
"kind": "integer",
|
|
114
|
+
"default_units": "",
|
|
115
|
+
"enumeration": ("6 * natoms", "12 * natoms", "18 * natoms"),
|
|
116
|
+
"format_string": "",
|
|
117
|
+
"description": "Maximum # of steps:",
|
|
118
|
+
"help_text": "The maximum number of steps to take.",
|
|
119
|
+
},
|
|
120
|
+
"continue if not converged": {
|
|
121
|
+
"default": "no",
|
|
122
|
+
"kind": "boolean",
|
|
123
|
+
"default_units": "",
|
|
124
|
+
"enumeration": ("yes", "no"),
|
|
125
|
+
"format_string": "",
|
|
126
|
+
"description": "Continue if not converged:",
|
|
127
|
+
"help_text": "Whether to stop if the optimizer does not converge.",
|
|
128
|
+
},
|
|
129
|
+
"on success": {
|
|
130
|
+
"default": "keep last subdirectory",
|
|
131
|
+
"kind": "enum",
|
|
132
|
+
"default_units": "",
|
|
133
|
+
"enumeration": (
|
|
134
|
+
"keep last subdirectory",
|
|
135
|
+
"keep all subdirectories",
|
|
136
|
+
"delete all subdirectories",
|
|
137
|
+
),
|
|
138
|
+
"format_string": "",
|
|
139
|
+
"description": "On success:",
|
|
140
|
+
"help_text": "Which subdirectories to keep.",
|
|
141
|
+
},
|
|
142
|
+
"on error": {
|
|
143
|
+
"default": "keep all subdirectories",
|
|
144
|
+
"kind": "enum",
|
|
145
|
+
"default_units": "",
|
|
146
|
+
"enumeration": (
|
|
147
|
+
"keep last subdirectory",
|
|
148
|
+
"keep all subdirectories",
|
|
149
|
+
"delete all subdirectories",
|
|
150
|
+
),
|
|
151
|
+
"format_string": "",
|
|
152
|
+
"description": "On error:",
|
|
153
|
+
"help_text": "Which subdirectories to keep if there is an error.",
|
|
154
|
+
},
|
|
155
|
+
"results": {
|
|
156
|
+
"default": {},
|
|
157
|
+
"kind": "dictionary",
|
|
158
|
+
"default_units": None,
|
|
159
|
+
"enumeration": tuple(),
|
|
160
|
+
"format_string": "",
|
|
161
|
+
"description": "results",
|
|
162
|
+
"help_text": "The results to save to variables or in tables.",
|
|
163
|
+
},
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
def __init__(self, defaults={}, data=None):
|
|
167
|
+
"""
|
|
168
|
+
Initialize the parameters, by default with the parameters defined above
|
|
169
|
+
|
|
170
|
+
Parameters
|
|
171
|
+
----------
|
|
172
|
+
defaults: dict
|
|
173
|
+
A dictionary of parameters to initialize. The parameters
|
|
174
|
+
above are used first and any given will override/add to them.
|
|
175
|
+
data: dict
|
|
176
|
+
A dictionary of keys and a subdictionary with value and units
|
|
177
|
+
for updating the current, default values.
|
|
178
|
+
|
|
179
|
+
Returns
|
|
180
|
+
-------
|
|
181
|
+
None
|
|
182
|
+
"""
|
|
183
|
+
|
|
184
|
+
logger.debug("StructureParameters.__init__")
|
|
185
|
+
|
|
186
|
+
super().__init__(
|
|
187
|
+
defaults={
|
|
188
|
+
**StructureParameters.parameters,
|
|
189
|
+
**seamm.standard_parameters.structure_handling_parameters,
|
|
190
|
+
**defaults,
|
|
191
|
+
},
|
|
192
|
+
data=data,
|
|
193
|
+
)
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
import structure_step
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class StructureStep(object):
|
|
7
|
+
"""Helper class needed for the stevedore integration.
|
|
8
|
+
|
|
9
|
+
This must provide a `description()` method that returns a dict containing a
|
|
10
|
+
description of this node, and `create_node()` and `create_tk_node()` methods
|
|
11
|
+
for creating the graphical and non-graphical nodes.
|
|
12
|
+
|
|
13
|
+
The dictionary for the description is the class variable just below these
|
|
14
|
+
comments. The felds are as follows:
|
|
15
|
+
|
|
16
|
+
my_description : {str, str}
|
|
17
|
+
A human-readable description of this step. It can be
|
|
18
|
+
several lines long, and needs to be clear to non-expert users.
|
|
19
|
+
It contains the following keys: description, group, name.
|
|
20
|
+
|
|
21
|
+
my_description["description"] : tuple
|
|
22
|
+
A description of the Structure step. It must be
|
|
23
|
+
clear to non-experts.
|
|
24
|
+
|
|
25
|
+
my_description["group"] : str
|
|
26
|
+
Which group in the menus to put this step. If the group does
|
|
27
|
+
not exist it will be created. Common groups are "Building",
|
|
28
|
+
"Control", "Custom", "Data", and "Simulations".
|
|
29
|
+
|
|
30
|
+
my_description["name"] : str
|
|
31
|
+
The name of this step, to be displayed in the menus.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
my_description = {
|
|
35
|
+
"description": "An interface for predicting structures",
|
|
36
|
+
"group": "Properties",
|
|
37
|
+
"name": "Structure",
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
def __init__(self, flowchart=None, gui=None):
|
|
41
|
+
"""Initialize this helper class, which is used by
|
|
42
|
+
the application via stevedore to get information about
|
|
43
|
+
and create node objects for the flowchart
|
|
44
|
+
"""
|
|
45
|
+
pass
|
|
46
|
+
|
|
47
|
+
def create_node(self, flowchart=None, **kwargs):
|
|
48
|
+
"""Create and return the new node object.
|
|
49
|
+
|
|
50
|
+
Parameters
|
|
51
|
+
----------
|
|
52
|
+
flowchart: seamm.Node
|
|
53
|
+
A non-graphical SEAMM node
|
|
54
|
+
|
|
55
|
+
**kwargs : keyword arguments
|
|
56
|
+
Various keyword arguments such as title, namespace or
|
|
57
|
+
extension representing the title displayed in the flowchart,
|
|
58
|
+
the namespace for the plugins of a subflowchart and
|
|
59
|
+
the extension, respectively.
|
|
60
|
+
|
|
61
|
+
Returns
|
|
62
|
+
-------
|
|
63
|
+
Structure
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
return structure_step.Structure(flowchart=flowchart, **kwargs)
|
|
67
|
+
|
|
68
|
+
def create_tk_node(self, canvas=None, **kwargs):
|
|
69
|
+
"""Create and return the graphical Tk node object.
|
|
70
|
+
|
|
71
|
+
Parameters
|
|
72
|
+
----------
|
|
73
|
+
canvas : tk.Canvas
|
|
74
|
+
The Tk Canvas widget
|
|
75
|
+
|
|
76
|
+
**kwargs : keyword arguments
|
|
77
|
+
Various keyword arguments such as tk_flowchart, node, x, y, w, h
|
|
78
|
+
representing a graphical flowchart object, a non-graphical node for
|
|
79
|
+
a step, and dimensions of the graphical node.
|
|
80
|
+
|
|
81
|
+
Returns
|
|
82
|
+
-------
|
|
83
|
+
TkStructure
|
|
84
|
+
"""
|
|
85
|
+
|
|
86
|
+
return structure_step.TkStructure(canvas=canvas, **kwargs)
|
|
87
|
+
|
|
88
|
+
def description(self):
|
|
89
|
+
"""Return a description of what this step does.
|
|
90
|
+
|
|
91
|
+
Returns
|
|
92
|
+
-------
|
|
93
|
+
description : dict(str, str)
|
|
94
|
+
"""
|
|
95
|
+
return StructureStep.my_description
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
"""The graphical part of a Structure step"""
|
|
4
|
+
|
|
5
|
+
import pprint # noqa: F401
|
|
6
|
+
import tkinter as tk # noqa: F401
|
|
7
|
+
import tkinter.ttk as ttk
|
|
8
|
+
|
|
9
|
+
from .structure_parameters import StructureParameters
|
|
10
|
+
import seamm
|
|
11
|
+
from seamm_util import ureg, Q_, units_class # noqa: F401
|
|
12
|
+
import seamm_widgets as sw
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class TkStructure(seamm.TkNode):
|
|
16
|
+
"""
|
|
17
|
+
The graphical part of a Structure step in a flowchart.
|
|
18
|
+
|
|
19
|
+
Attributes
|
|
20
|
+
----------
|
|
21
|
+
tk_flowchart : TkFlowchart = None
|
|
22
|
+
The flowchart that we belong to.
|
|
23
|
+
node : Node = None
|
|
24
|
+
The corresponding node of the non-graphical flowchart
|
|
25
|
+
canvas: tkCanvas = None
|
|
26
|
+
The Tk Canvas to draw on
|
|
27
|
+
dialog : Dialog
|
|
28
|
+
The Pmw dialog object
|
|
29
|
+
x : int = None
|
|
30
|
+
The x-coordinate of the center of the picture of the node
|
|
31
|
+
y : int = None
|
|
32
|
+
The y-coordinate of the center of the picture of the node
|
|
33
|
+
w : int = 200
|
|
34
|
+
The width in pixels of the picture of the node
|
|
35
|
+
h : int = 50
|
|
36
|
+
The height in pixels of the picture of the node
|
|
37
|
+
self[widget] : dict
|
|
38
|
+
A dictionary of tk widgets built using the information
|
|
39
|
+
contained in Structure_parameters.py
|
|
40
|
+
|
|
41
|
+
See Also
|
|
42
|
+
--------
|
|
43
|
+
Structure, TkStructure,
|
|
44
|
+
StructureParameters,
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
def __init__(
|
|
48
|
+
self,
|
|
49
|
+
tk_flowchart=None,
|
|
50
|
+
node=None,
|
|
51
|
+
namespace="org.molssi.seamm.tk",
|
|
52
|
+
canvas=None,
|
|
53
|
+
x=None,
|
|
54
|
+
y=None,
|
|
55
|
+
w=200,
|
|
56
|
+
h=50,
|
|
57
|
+
):
|
|
58
|
+
"""
|
|
59
|
+
Initialize a graphical node.
|
|
60
|
+
|
|
61
|
+
Parameters
|
|
62
|
+
----------
|
|
63
|
+
tk_flowchart: Tk_Flowchart
|
|
64
|
+
The graphical flowchart that we are in.
|
|
65
|
+
node: Node
|
|
66
|
+
The non-graphical node for this step.
|
|
67
|
+
namespace: str
|
|
68
|
+
The stevedore namespace for finding sub-nodes.
|
|
69
|
+
canvas: Canvas
|
|
70
|
+
The Tk canvas to draw on.
|
|
71
|
+
x: float
|
|
72
|
+
The x position of the nodes center on the canvas.
|
|
73
|
+
y: float
|
|
74
|
+
The y position of the nodes cetner on the canvas.
|
|
75
|
+
w: float
|
|
76
|
+
The nodes graphical width, in pixels.
|
|
77
|
+
h: float
|
|
78
|
+
The nodes graphical height, in pixels.
|
|
79
|
+
|
|
80
|
+
Returns
|
|
81
|
+
-------
|
|
82
|
+
None
|
|
83
|
+
"""
|
|
84
|
+
self.namespace = namespace
|
|
85
|
+
self.dialog = None
|
|
86
|
+
|
|
87
|
+
super().__init__(
|
|
88
|
+
tk_flowchart=tk_flowchart,
|
|
89
|
+
node=node,
|
|
90
|
+
canvas=canvas,
|
|
91
|
+
x=x,
|
|
92
|
+
y=y,
|
|
93
|
+
w=w,
|
|
94
|
+
h=h,
|
|
95
|
+
)
|
|
96
|
+
self.create_dialog()
|
|
97
|
+
|
|
98
|
+
def create_dialog(self):
|
|
99
|
+
"""
|
|
100
|
+
Create the dialog. A set of widgets will be chosen by default
|
|
101
|
+
based on what is specified in the Structure_parameters
|
|
102
|
+
module.
|
|
103
|
+
|
|
104
|
+
Parameters
|
|
105
|
+
----------
|
|
106
|
+
None
|
|
107
|
+
|
|
108
|
+
Returns
|
|
109
|
+
-------
|
|
110
|
+
None
|
|
111
|
+
|
|
112
|
+
See Also
|
|
113
|
+
--------
|
|
114
|
+
TkStructure.reset_dialog
|
|
115
|
+
"""
|
|
116
|
+
|
|
117
|
+
frame = super().create_dialog(title="Structure", widget="notebook")
|
|
118
|
+
# make it large!
|
|
119
|
+
screen_w = self.dialog.winfo_screenwidth()
|
|
120
|
+
screen_h = self.dialog.winfo_screenheight()
|
|
121
|
+
w = int(0.9 * screen_w)
|
|
122
|
+
h = int(0.8 * screen_h)
|
|
123
|
+
x = int(0.05 * screen_w / 2)
|
|
124
|
+
y = int(0.1 * screen_h / 2)
|
|
125
|
+
|
|
126
|
+
self.dialog.geometry(f"{w}x{h}+{x}+{y}")
|
|
127
|
+
|
|
128
|
+
# Add a frame for the flowchart
|
|
129
|
+
notebook = self["notebook"]
|
|
130
|
+
flowchart_frame = ttk.Frame(notebook)
|
|
131
|
+
self["flowchart frame"] = flowchart_frame
|
|
132
|
+
notebook.add(flowchart_frame, text="Flowchart", sticky=tk.NSEW)
|
|
133
|
+
|
|
134
|
+
self.tk_subflowchart = seamm.TkFlowchart(
|
|
135
|
+
master=flowchart_frame,
|
|
136
|
+
flowchart=self.node.subflowchart,
|
|
137
|
+
namespace=self.namespace,
|
|
138
|
+
)
|
|
139
|
+
self.tk_subflowchart.draw()
|
|
140
|
+
|
|
141
|
+
# Fill in the control parameters
|
|
142
|
+
# Shortcut for parameters
|
|
143
|
+
P = self.node.parameters
|
|
144
|
+
|
|
145
|
+
# diffusivity frame to isolate widgets
|
|
146
|
+
frame = self["structure frame"] = ttk.LabelFrame(
|
|
147
|
+
self["frame"],
|
|
148
|
+
borderwidth=4,
|
|
149
|
+
relief="sunken",
|
|
150
|
+
text="Structure Parameters",
|
|
151
|
+
labelanchor="n",
|
|
152
|
+
padding=10,
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
for key in StructureParameters.parameters:
|
|
156
|
+
if key not in ("results",):
|
|
157
|
+
self[key] = P[key].widget(frame)
|
|
158
|
+
|
|
159
|
+
# and binding to change as needed
|
|
160
|
+
for key in ("approach",):
|
|
161
|
+
self[key].combobox.bind("<<ComboboxSelected>>", self.reset_structure_frame)
|
|
162
|
+
|
|
163
|
+
# structure handling frame to isolate widgets
|
|
164
|
+
frame = self["handling frame"] = ttk.LabelFrame(
|
|
165
|
+
self["frame"],
|
|
166
|
+
borderwidth=4,
|
|
167
|
+
relief="sunken",
|
|
168
|
+
text="Structure Handling",
|
|
169
|
+
labelanchor="n",
|
|
170
|
+
padding=10,
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
widgets = []
|
|
174
|
+
row = 0
|
|
175
|
+
for key in ("structure handling", "system name", "configuration name"):
|
|
176
|
+
self[key] = P[key].widget(frame)
|
|
177
|
+
self[key].grid(row=row, column=0, sticky=tk.EW)
|
|
178
|
+
widgets.append(self[key])
|
|
179
|
+
row += 1
|
|
180
|
+
sw.align_labels(widgets, sticky=tk.E)
|
|
181
|
+
|
|
182
|
+
# and lay them out
|
|
183
|
+
self.reset_dialog()
|
|
184
|
+
|
|
185
|
+
self.setup_results()
|
|
186
|
+
|
|
187
|
+
def reset_dialog(self, widget=None):
|
|
188
|
+
"""Layout the widgets in the dialog.
|
|
189
|
+
|
|
190
|
+
The widgets are chosen by default from the information in
|
|
191
|
+
Diffusivity parameters.
|
|
192
|
+
|
|
193
|
+
This function simply lays them out row by row with
|
|
194
|
+
aligned labels. You may wish a more complicated layout that
|
|
195
|
+
is controlled by values of some of the control parameters.
|
|
196
|
+
If so, edit or override this method
|
|
197
|
+
|
|
198
|
+
Parameters
|
|
199
|
+
----------
|
|
200
|
+
widget : Tk Widget = None
|
|
201
|
+
|
|
202
|
+
Returns
|
|
203
|
+
-------
|
|
204
|
+
None
|
|
205
|
+
|
|
206
|
+
See Also
|
|
207
|
+
--------
|
|
208
|
+
TkDiffusivity.create_dialog
|
|
209
|
+
"""
|
|
210
|
+
|
|
211
|
+
# Remove any widgets previously packed
|
|
212
|
+
frame = self["frame"]
|
|
213
|
+
for slave in frame.grid_slaves():
|
|
214
|
+
slave.grid_forget()
|
|
215
|
+
|
|
216
|
+
row = 0
|
|
217
|
+
|
|
218
|
+
self["structure frame"].grid(row=row, column=0, sticky=tk.EW, pady=10)
|
|
219
|
+
row += 1
|
|
220
|
+
self.reset_structure_frame()
|
|
221
|
+
|
|
222
|
+
self["handling frame"].grid(row=row, column=0, sticky=tk.EW, pady=10)
|
|
223
|
+
row += 1
|
|
224
|
+
|
|
225
|
+
return row
|
|
226
|
+
|
|
227
|
+
def reset_structure_frame(self, widget=None):
|
|
228
|
+
"""Layout the widgets in the structure frame
|
|
229
|
+
as needed for the current state"""
|
|
230
|
+
|
|
231
|
+
approach = self["approach"].get()
|
|
232
|
+
|
|
233
|
+
frame = self["structure frame"]
|
|
234
|
+
for slave in frame.grid_slaves():
|
|
235
|
+
slave.grid_forget()
|
|
236
|
+
|
|
237
|
+
row = 0
|
|
238
|
+
|
|
239
|
+
# Main controls
|
|
240
|
+
widgets = []
|
|
241
|
+
widgets2 = []
|
|
242
|
+
for key in ("approach",):
|
|
243
|
+
self[key].grid(row=row, column=0, columnspan=2, sticky=tk.W)
|
|
244
|
+
widgets.append(self[key])
|
|
245
|
+
row += 1
|
|
246
|
+
|
|
247
|
+
if approach == "Optimization":
|
|
248
|
+
for key in (
|
|
249
|
+
"optimizer",
|
|
250
|
+
"convergence",
|
|
251
|
+
"max steps",
|
|
252
|
+
"continue if not converged",
|
|
253
|
+
"on success",
|
|
254
|
+
"on error",
|
|
255
|
+
):
|
|
256
|
+
self[key].grid(row=row, column=0, columnspan=2, sticky=tk.EW)
|
|
257
|
+
widgets2.append(self[key])
|
|
258
|
+
row += 1
|
|
259
|
+
|
|
260
|
+
for key in ("structure handling", "system name", "configuration name"):
|
|
261
|
+
self[key].grid(row=row, column=0, columnspan=2, sticky=tk.EW)
|
|
262
|
+
widgets.append(self[key])
|
|
263
|
+
row += 1
|
|
264
|
+
|
|
265
|
+
w1 = sw.align_labels(widgets, sticky=tk.E)
|
|
266
|
+
w2 = sw.align_labels(widgets2, sticky=tk.E)
|
|
267
|
+
frame.columnconfigure(0, minsize=w1 - w2 + 50)
|
|
268
|
+
|
|
269
|
+
def right_click(self, event):
|
|
270
|
+
"""
|
|
271
|
+
Handles the right click event on the node.
|
|
272
|
+
|
|
273
|
+
Parameters
|
|
274
|
+
----------
|
|
275
|
+
event : Tk Event
|
|
276
|
+
|
|
277
|
+
Returns
|
|
278
|
+
-------
|
|
279
|
+
None
|
|
280
|
+
|
|
281
|
+
See Also
|
|
282
|
+
--------
|
|
283
|
+
TkStructure.edit
|
|
284
|
+
"""
|
|
285
|
+
|
|
286
|
+
super().right_click(event)
|
|
287
|
+
self.popup_menu.add_command(label="Edit..", command=self.edit)
|
|
288
|
+
|
|
289
|
+
self.popup_menu.tk_popup(event.x_root, event.y_root, 0)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
BSD 3-Clause License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2024, the Molecular Sciences Software Institute at Virginia Tech
|
|
5
|
+
All rights reserved.
|
|
6
|
+
|
|
7
|
+
Redistribution and use in source and binary forms, with or without
|
|
8
|
+
modification, are permitted provided that the following conditions are met:
|
|
9
|
+
|
|
10
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
11
|
+
list of conditions and the following disclaimer.
|
|
12
|
+
|
|
13
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
14
|
+
this list of conditions and the following disclaimer in the documentation
|
|
15
|
+
and/or other materials provided with the distribution.
|
|
16
|
+
|
|
17
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
18
|
+
contributors may be used to endorse or promote products derived from
|
|
19
|
+
this software without specific prior written permission.
|
|
20
|
+
|
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
22
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
23
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
24
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
25
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
26
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
27
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
28
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
29
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
30
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
31
|
+
|