crystal_builder_step package
Submodules
crystal_builder_step.crystal_builder module
Non-graphical part of the Crystal Builder step in a SEAMM flowchart
- class crystal_builder_step.crystal_builder.CrystalBuilder(flowchart=None, title='Crystal Builder', extension=None)[source]
Bases:
Node
The non-graphical part of a Crystal Builder 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 Crystal Builder.
- Type:
See also
TkCrystalBuilder
,CrystalBuilder
,CrystalBuilderParameters
- 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:
description – A description of the current step.
- Return type:
str
- property git_revision
The git version of this module.
- run()[source]
Run a Crystal Builder step.
- Returns:
next_node – The next node object in the flowchart.
- Return type:
seamm.Node
- property version
The semantic version of this module.
crystal_builder_step.crystal_builder_parameters module
Control parameters for the Crystal Builder step in a SEAMM flowchart
- class crystal_builder_step.crystal_builder_parameters.CrystalBuilderParameters(defaults={}, data=None)[source]
Bases:
Parameters
The control parameters for Crystal Builder.
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
‘format_string’, description’, help_text’}
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.
- Type:
{‘kind’, ‘default’, ‘default_units’, ‘enumeration’,
- parameters['kind']
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.
- Type:
custom
- parameters['default']
‘enum’ The default value of the parameter, used to reset it.
- Type:
‘integer’ or ‘float’ or ‘string’ or ‘boolean’ or
- parameters['default_units']
The default units, used for resetting the value.
- Type:
str
- parameters['enumeration']
A tuple of enumerated values.
- Type:
tuple
- parameters['format_string']
A format string for ‘pretty’ output.
- Type:
str
- parameters['description']
A short string used as a prompt in the GUI.
- Type:
str
- parameters['help_text']
A longer string to display as help for the user.
- Type:
tuple
See also
CrystalBuilder
,TkCrystalBuilder
,CrystalBuilder
,CrystalBuilderParameters
,Crystal
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 = {'AFLOW prototype': {'default': '', 'default_units': None, 'description': 'AFLOW Prototype:', 'enumeration': (), 'format_string': '', 'help_text': 'The AFLOW prototype', 'kind': 'string'}, 'a': {'default': 10.0, 'default_units': 'Å', 'description': 'a:', 'enumeration': None, 'format_string': '.2f', 'help_text': 'The length of the first side of the cell.', 'kind': 'float'}, 'alpha': {'default': 90.0, 'default_units': 'degree', 'description': 'alpha:', 'enumeration': None, 'format_string': '.1f', 'help_text': 'The angle between a and b.', 'kind': 'float'}, 'b': {'default': 10.0, 'default_units': 'Å', 'description': 'b:', 'enumeration': None, 'format_string': '.2f', 'help_text': 'The length of the second side of the cell.', 'kind': 'float'}, 'beta': {'default': 90.0, 'default_units': 'degree', 'description': 'beta:', 'enumeration': None, 'format_string': '.1f', 'help_text': 'The angle between a and c.', 'kind': 'float'}, 'c': {'default': 10.0, 'default_units': 'Å', 'description': 'c:', 'enumeration': None, 'format_string': '.2f', 'help_text': 'The length of the third side of the cell.', 'kind': 'float'}, 'coordinates': {'default': [], 'default_units': None, 'description': 'Coordinates:', 'enumeration': (), 'format_string': '', 'help_text': 'The coordinates of the site.', 'kind': 'list'}, 'elements': {'default': ['Al'], 'default_units': None, 'description': 'Elements:', 'enumeration': (), 'format_string': '', 'help_text': 'The elements at the different sites.', 'kind': 'list'}, 'gamma': {'default': 90.0, 'default_units': 'degree', 'description': 'gamma:', 'enumeration': None, 'format_string': '.1f', 'help_text': 'The angle between b and c.', 'kind': 'float'}, 'n_elements': {'default': 'any', 'default_units': None, 'description': 'Number of elements:', 'enumeration': ('any',), 'format_string': '', 'help_text': 'The number of elements in the structure.', 'kind': 'int'}, 'n_sites': {'default': 'any', 'default_units': None, 'description': 'Number of occupied sites:', 'enumeration': ('any',), 'format_string': '', 'help_text': 'The number of occupied sites in the structure.', 'kind': 'int'}, 'pearson_symbol': {'default': 'any', 'default_units': None, 'description': 'Pearson:', 'enumeration': ('any',), 'format_string': '', 'help_text': 'The Pearson symbol.', 'kind': 'int'}, 'prototype': {'default': '', 'default_units': None, 'description': 'Prototype:', 'enumeration': ('place', 'holders'), 'format_string': '', 'help_text': 'The prototype to use', 'kind': 'enumeration'}, 'prototype_group': {'default': 'common', 'default_units': None, 'description': 'Which prototypes:', 'enumeration': ('common', 'Strukturbericht', 'AFLOW', 'prototype', 'description'), 'format_string': '', 'help_text': 'The group of prototypes to display', 'kind': 'enumeration'}, 'spacegroup': {'default': 'any', 'default_units': None, 'description': 'Space group (or number):', 'enumeration': ('any',), 'format_string': '', 'help_text': 'The space group for the structure.', 'kind': 'int'}}
crystal_builder_step.crystal_builder_step module
- class crystal_builder_step.crystal_builder_step.CrystalBuilderStep(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
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.
- Type:
{description, group, name}
- my_description['description']
A description of the Crystal Builder step. It must be clear to non-experts.
- Type:
tuple
- my_description['group']
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’.
- Type:
str
- my_description['name']
The name of this step, to be displayed in the menus.
- Type:
str
- 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
CrystalBuilder
- 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
TkCrystalBuilder
- my_description = {'description': 'An interface for the pyiron crystal builder', 'group': 'Building', 'name': 'Crystal Builder'}
crystal_builder_step.crystal_metadata module
Non-graphical part of the Crystal Builder step in a SEAMM flowchart
crystal_builder_step.parse module
Process the prototype data from the AFLOW library.
Steps:
Manually get the tabular data from the index page http://aflowlib.org/prototype-encyclopedia/prototype_index.html
I did this by opening in Safari, using the Developer module to show the sources, open the scripts in th left panel, and downloading table_sort.min.js
In an editor, I copied the array u from the text ‘u=[…],v=[]’ by search from the bracket in ‘u=[’ to ‘v=[]’ and then backup up to closing bracket of the u-array.
I used black to format it so that I could see the data more nicely. This file is ‘index.json’
I also had to enclose Prototype and Notes to make correct JSON. And there are a couple places where quoted strings have “, so are quoted with ‘. I flipped the quotes to make “good” json.
I manually patched the 4 special case in the index.json file:
"A_hR1_166_a Hg": "A_hR1_166_a.alpha-Hg", "A_hR1_166_a Po": "A_hR1_166_a.beta-Po", "AB_mP32_14_4e_4e AsS": "AB_mP32_14_4e_4e.realgar", "AB_mP32_14_4e_4e AsS": "AB_mP32_14_4e_4e.pararealgar", "AB_cP2_221_a_b H4NNO3": "AB_cP2_221_a_b.NH4.NO3",
The download function then downloads any CIF files to the CIF/ subdirectory. It only downloads missing files. The url is like this
http://aflowlib.org/prototype-encyclopedia/CIF/<AFLOW prototype>.cif
crystal_builder_step.tk_crystal_builder module
The graphical part of a Crystal Builder step
- class crystal_builder_step.tk_crystal_builder.TkCrystalBuilder(tk_flowchart=None, node=None, canvas=None, x=None, y=None, w=200, h=50)[source]
Bases:
TkNode
The graphical part of a Crystal Builder step in a flowchart.
- namespace
The namespace of the current step.
- Type:
str
- node
The corresponding node of the non-graphical flowchart
- Type:
Node
- dialog
The Pmw dialog object
- Type:
Dialog
- sub_tk_flowchart
A graphical Flowchart representing a subflowchart
- Type:
TkFlowchart
- self[widget]
A dictionary of tk widgets built using the information contained in Crystal Builder_parameters.py
- Type:
dict
See also
CrystalBuilder
,TkCrystalBuilder
,CrystalBuilderParameters
- create_dialog()[source]
Create the dialog. A set of widgets will be chosen by default based on what is specified in the Crystal Builder_parameters module.
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.
- reset_dialog(widget=None)[source]
Layout the widgets in the dialog.
The widgets are chosen by default from the information in Crystal Builder_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.
- Parameters:
widget –
See also
Module contents
crystal_builder_step A step for building crystals in SEAMM