diffusivity_step package#
Submodules#
diffusivity_step.analysis module#
Routines to help do the analysis for diffusivity.
- diffusivity_step.analysis.add_helfand_trace(plot, x_axis, y_axis, species, M, ts, err=None, fit=None, labels=[('x', 'red', 'rgba(255,0,0,0.1)'), ('y', 'green', 'rgba(0,255,0,0.1)'), ('z', 'blue', 'rgba(0,0,255,0.1)'), ('', 'black', 'rgba(0,0,0,0.1)')])[source]#
Add a trace for the Helfand moments.
- Parameters:
plot (seamm_util.plot) – The plot that contains the traces
x_axis – The x axis for the plot
y_axis – The y axis for the plot
species (str) – The label for the species
M (numpy.mdarray(m, 3)) – The Helfand moments, in m^2
ts ([float]) – The times associated with the moments, in ps
err (numpy.mdarray(n, 3 or 4)) – The std error on the moments
fit ({str: any}) – The information for the fit to the curve
labels ({str: xxx}) – The labels for the directions
- diffusivity_step.analysis.add_msd_trace(plot, x_axis, y_axis, species, msd, ts, err=None, fit=None, labels=[('x', 'red', 'rgba(255,0,0,0.1)'), ('y', 'green', 'rgba(0,255,0,0.1)'), ('z', 'blue', 'rgba(0,0,255,0.1)'), ('', 'black', 'rgba(0,0,0,0.1)')])[source]#
Add a trace to the mean square deviation (MSD) plot.
- Parameters:
plot (seamm_util.plot) – The plot that contains the traces
x_axis – The x axis for the plot
y_axis – The y axis for the plot
species (str) – The label for the species
msd (numpy.mdarray(n, 3 or 4)) – The MSD in x, y, and z, and optionally the average
ts ([float]) – The times associated with the MSD, in ps
err (numpy.mdarray(n, 3 or 4)) – The std error on the msd values
fit ({str: any}) – The information for the fit to the curve
labels ({str: xxx}) – The labels for the directions
- diffusivity_step.analysis.compute_msd(xyz, species, average=True)[source]#
Compute the mean square displacement vector, averaging over molecules.
- Parameters:
xyz (numpy.ndarray(nsteps, nmolecules, 3)) – The coordinates at each step
species ([[int]] or numpy.ndarray) – Indices of the molecules for each species
average (bool = True) – Whether to return the average MSD as well as x, y, and z components.
- Returns:
[numpy.ndarray(nsteps, 3 or 4)] * nspecies – The MSD plus the average MSD if <average> == True, as a list over species
[numpy.ndarray(nsteps, 3 or 4)] * nspeceis – The error of the MSD
- diffusivity_step.analysis.create_helfand_moments(v, species, m=None)[source]#
Create the Helfand moments from velocities
- Parameters:
v (numpy.ndarray(nframes, nmols, 3)) – The heat fluxes in x, y, and z
species ([[int]] or numpy.ndarray) – Indices of the molecules for each species
m (int) – The length of the Helfand moments wanted
- Returns:
The Helfand moments
- Return type:
[numpy.ndarray(m, 3)] * nspecies
- diffusivity_step.analysis.fit_slope(y, xs, sigma=None, start=0.1, end=0.9)[source]#
Find the best linear fit to longest possible segment.
- Parameters:
y ([float] or numpy.ndarray()) – The MSD
xs ([float]) – The time (x) coordinate
sigma ([float] or numpy.ndarray()) – Optional standard error of y
start (float) – Fraction of vector to ignore at the beginning
end (float) – The fraction of vector to end at
- Returns:
slope (float) – The fit slope.
stderr (float) – The 95% standard error of the slope
xs ([float]) – The x values (time) for the fit curve
ys ([float]) – The y values for the fit curve.
- diffusivity_step.analysis.plot_helfand_moments(figure, M, ts, err=None, fit=None, labels=[('x', 'red', 'rgba(255,0,0,0.1)'), ('y', 'green', 'rgba(0,255,0,0.1)'), ('z', 'blue', 'rgba(0,0,255,0.1)'), ('', 'black', 'rgba(0,0,0,0.1)')])[source]#
Create a plot for the Helfand moments.
- Parameters:
figure (seamm_util.Figure) – The figure that contains the plots.
M (numpy.mdarray(m, 3)) – The Helfand moments, in m^2
ts ([float]) – The times associated with the moments, in ps
- diffusivity_step.analysis.plot_msd(figure, msd, ts, err=None, fit=None, labels=[('x', 'red', 'rgba(255,0,0,0.1)'), ('y', 'green', 'rgba(0,255,0,0.1)'), ('z', 'blue', 'rgba(0,0,255,0.1)'), ('', 'black', 'rgba(0,0,0,0.1)')])[source]#
Create a plot for the mean square deviation (MSD).
- Parameters:
figure (seamm_util.Figure) – The figure that contains the plots.
msd (numpy.mdarray(n, 3 or 4)) – The MSD in x, y, and z, and optionally the average
ts ([float]) – The times associated with the MSD, in ps
diffusivity_step.diffusivity module#
Non-graphical part of the Diffusivity step in a SEAMM flowchart
- class diffusivity_step.diffusivity.Diffusivity(flowchart=None, title='Diffusivity', namespace='org.molssi.seamm', extension=None, logger=<Logger diffusivity_step.diffusivity (WARNING)>)[source]#
Bases:
Node
The non-graphical part of a Diffusivity 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 Diffusivity.
- Type:
See also
TkDiffusivity
,Diffusivity
,DiffusivityParameters
- analyze(indent='', P=None, run=None, weighted=False, **kwargs)[source]#
Do any analysis of the output from this run.
Also print important results to the local step.out file using “printer”.
- Parameters:
indent (str) – An extra indentation for the output
weighted (bool) – Whether to use the stderr to weight the fit, default False
- analyze_run(indent='', P=None, run=None, weighted=False, **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
weighted (bool) – Whether to use the stderr to weight the fit, default False
- property configuration#
The initial configuration for this run.
- 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.
- property n_molecules#
The number of molecules in the system.
- parse_molecules()[source]#
Get the lists of molecules of each type.
- Returns:
The list of molecule numbers (0-based) for each canonical SMILES string for a species.
- Return type:
{str, [int]}
- process_run(run, run_dir, P=None)[source]#
Get the positions and velocities from the run and do initial processing.
- Parameters:
run (int) – The run number
run_dir (pathlib.Path) – The toplevel directory of the run.
P ([str: any]) – Dictionary of control parameters, or default of None in which case the standard parameters are used.
- property results#
The results data.
- run()[source]#
Run the diffusivity step.
- Parameters:
None
- Returns:
The next node object in the flowchart.
- Return type:
seamm.Node
- property species#
The species and list of molecules for each.
- property version#
The semantic version of this module.
diffusivity_step.diffusivity_parameters module#
Control parameters for the Diffusivity step in a SEAMM flowchart
- class diffusivity_step.diffusivity_parameters.DiffusivityParameters(defaults={}, data=None)[source]#
Bases:
Parameters
The control parameters for Diffusivity.
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
Diffusivity
,TkDiffusivity
,Diffusivity
,DiffusivityStep
- parameters = {'approach': {'default': 'both', 'default_units': '', 'description': 'Approach:', 'enumeration': ('both', 'Helfand moments', 'Mean Square Displacement (MSD)'), 'format_string': '', 'help_text': 'The approach or method for determining the diffusivity.', 'kind': 'enum'}, 'errors': {'default': 'continue to next run', 'default_units': '', 'description': 'On errors', 'enumeration': ('continue to next run', 'exit the thermal conductivity step', 'stop the job'), 'format_string': 's', 'help_text': 'How to handle errors in the runs', 'kind': 'string'}, 'helfand_fit_end': {'default': '1.00', 'default_units': '', 'description': 'End point of Helfand fit (0.0..1.0):', 'enumeration': (), 'format_string': '', 'help_text': 'End point of Helfand fit this far into the data.', 'kind': 'float'}, 'helfand_fit_start': {'default': '0.35', 'default_units': '', 'description': 'Start point of Helfand fit (0.0..1.0):', 'enumeration': (), 'format_string': '', 'help_text': 'Starting point of Helfand fit this far into the data.', 'kind': 'float'}, 'hydrodynamic correction': {'default': 'no', 'description': 'Correction for cell size:', 'enumeration': ('no', 'yes'), 'format_string': 's', 'help_text': 'Apply the Yeh-Hummer hydrodynamic correction for the cell size.', 'kind': 'boolean'}, 'maximum Helfand Integral length': {'default': 1000, 'default_units': '', 'description': 'Maximum Helfand Integral length:', 'enumeration': (), 'format_string': '', 'help_text': 'Maximum length of the Integral used in the Helfand moments.', 'kind': 'integer'}, 'msd_fit_end': {'default': '0.6', 'default_units': '', 'description': 'End point of MSD fit (0.0..1.0):', 'enumeration': (), 'format_string': '', 'help_text': 'End point of fit the MSD this far into the data.', 'kind': 'float'}, 'msd_fit_start': {'default': '0.1', 'default_units': '', 'description': 'Start point of MSD fit (0.0..1.0):', 'enumeration': (), 'format_string': '', 'help_text': 'Starting point of fit the MSD this far into the data.', 'kind': 'float'}, 'nruns': {'default': '5', 'default_units': '', 'description': 'Number of runs to average:', 'enumeration': (), 'format_string': '', 'help_text': 'The number for separate runs to average.', 'kind': 'integer'}, 'results': {'default': {}, 'default_units': None, 'description': 'results', 'enumeration': (), 'format_string': '', 'help_text': 'The results to save to variables or in tables.', 'kind': 'dictionary'}, 'viscosity': {'default': '0.0', 'default_units': 'cP', 'description': 'Viscosity:', 'enumeration': (), 'format_string': '', 'help_text': 'The viscosity for the Yeh-Hummer cell size correction.', 'kind': 'float'}}#
diffusivity_step.diffusivity_step module#
- class diffusivity_step.diffusivity_step.DiffusivityStep(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 Diffusivity 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:
- 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:
- description()[source]#
Return a description of what this step does.
- Returns:
description
- Return type:
dict(str, str)
- my_description = {'description': 'An interface for Diffusivity', 'group': 'Properties', 'name': 'Diffusivity'}#
diffusivity_step.metadata module#
This file contains metadata describing the results from Diffusivity
- diffusivity_step.metadata.metadata = {'results': {'1/L': {'description': '1/length of cell in the diffusion calculation', 'dimensionality': 'scalar', 'type': 'float', 'units': '1/Å'}, '1/L,stderr': {'description': 'Standard error if 1/length of cell in the diffusion calculation', 'dimensionality': 'scalar', 'type': 'float', 'units': '1/Å'}, 'D {key}': {'description': 'The total diffusion coefficient', 'dimensionality': '{species: value}', 'property': 'D#{model}', 'type': 'float', 'units': 'm^2/s'}, 'D {key} (HM)': {'description': 'The total diffusion coefficient from Helfand Moments', 'dimensionality': '{species: value}', 'property': 'D#Helfand Moments#{model}', 'type': 'float', 'units': 'm^2/s'}, 'D {key} (HM),stderr': {'description': 'The standard error of the total diffusion coefficient from Helfand Moments', 'dimensionality': '{species: value}', 'property': 'D,stderr#Helfand Moments#{model}', 'type': 'float', 'units': 'm^2/s'}, 'D {key} (MSD)': {'description': 'The total diffusion coefficient from MSD', 'dimensionality': '{species: value}', 'property': 'D#MSD#{model}', 'type': 'float', 'units': 'm^2/s'}, 'D {key} (MSD),stderr': {'description': 'The standard error of the total diffusion coefficient from MSD', 'dimensionality': '{species: value}', 'property': 'D,stderr#MSD#{model}', 'type': 'float', 'units': 'm^2/s'}, 'D {key},stderr': {'description': 'The standard error of the total diffusion coefficient', 'dimensionality': '{species: value}', 'property': 'D,stderr#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Dx {key}': {'description': 'The diffusion coefficient in x', 'dimensionality': '{species: value}', 'property': 'Dx#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Dx {key} (HM)': {'description': 'The diffusion coefficient in x from Helfand Moments', 'dimensionality': '{species: value}', 'property': 'Dx#Helfand Moments#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Dx {key} (HM),stderr': {'description': 'The standard error of the diffusion coefficient in x from Helfand Moments', 'dimensionality': '{species: value}', 'property': 'Dx,stderr#Helfand Moments#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Dx {key} (MSD)': {'description': 'The diffusion coefficient in x from MSD', 'dimensionality': '{species: value}', 'property': 'Dx#MSD#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Dx {key} (MSD),stderr': {'description': 'The standard error if thediffusion coefficient in x from MSD', 'dimensionality': '{species: value}', 'property': 'Dx,stderr#MSD#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Dx {key},stderr': {'description': 'The standard error of the diffusion coefficient in x', 'dimensionality': '{species: value}', 'property': 'Dx,stderr#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Dy {key}': {'description': 'The diffusion coefficient in y', 'dimensionality': '{species: value}', 'property': 'Dy#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Dy {key} (HM)': {'description': 'The diffusion coefficient in y from Helfand Moments', 'dimensionality': '{species: value}', 'property': 'Dy#Helfand Moments#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Dy {key} (HM),stderr': {'description': 'The standard error of the diffusion coefficient in y from Helfand Moments', 'dimensionality': '{species: value}', 'property': 'Dy,stderr#Helfand Moments#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Dy {key} (MSD)': {'description': 'The diffusion coefficient in y from MSD', 'dimensionality': '{species: value}', 'property': 'Dy#MSD#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Dy {key} (MSD),stderr': {'description': 'The standard error if thediffusion coefficient in y from MSD', 'dimensionality': '{species: value}', 'property': 'Dy,stderr#MSD#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Dy {key},stderr': {'description': 'The standard error of the diffusion coefficient in y', 'dimensionality': '{species: value}', 'property': 'Dy,stderr#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Dz {key}': {'description': 'The diffusion coefficient in z', 'dimensionality': '{species: value}', 'property': 'Dz#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Dz {key} (HM)': {'description': 'The diffusion coefficient in z from Helfand Moments', 'dimensionality': '{species: value}', 'property': 'Dz#Helfand Moments#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Dz {key} (HM),stderr': {'description': 'The standard error of the diffusion coefficient in z from Helfand Moments', 'dimensionality': '{species: value}', 'property': 'Dz,stderr#Helfand Moments#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Dz {key} (MSD)': {'description': 'The diffusion coefficient in z from MSD', 'dimensionality': '{species: value}', 'property': 'Dz#MSD#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Dz {key} (MSD),stderr': {'description': 'The standard error if thediffusion coefficient in z from MSD', 'dimensionality': '{species: value}', 'property': 'Dz,stderr#MSD#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Dz {key},stderr': {'description': 'The standard error of the diffusion coefficient in z', 'dimensionality': '{species: value}', 'property': 'Dz,stderr#{model}', 'type': 'float', 'units': 'm^2/s'}, 'Helfand integral length': {'description': 'The length of the Helfand numerical integration', 'dimensionality': 'scalar', 'type': 'integer'}, 'P': {'description': 'The pressure of the diffusion calculation', 'dimensionality': 'scalar', 'type': 'float', 'units': 'atm'}, 'P,stderr': {'description': 'The standard error of the pressure of the diffusion calculation', 'dimensionality': 'scalar', 'type': 'float', 'units': 'atm'}, 'T': {'description': 'The temperature of the diffusion calculation', 'dimensionality': 'scalar', 'type': 'float', 'units': 'K'}, 'T,stderr': {'description': 'The standard error of the temperature of the diffusion calculation', 'dimensionality': 'scalar', 'type': 'float', 'units': 'K'}, 'approach': {'description': 'Algorithm for diffusion calculation', 'dimensionality': 'scalar', 'type': 'string'}, 'density': {'description': 'The density of the diffusion calculation', 'dimensionality': 'scalar', 'type': 'float', 'units': 'g/mL'}, 'density,stderr': {'description': 'The standard error of the density of the diffusion calculation', 'dimensionality': 'scalar', 'type': 'float', 'units': 'g/mL'}, 'helfand_fit_end': {'description': 'Where to end the fit of the Helfand moments curve', 'dimensionality': 'scalar', 'type': 'float'}, 'helfand_fit_start': {'description': 'Where to start the fit of the Helfand moments curve', 'dimensionality': 'scalar', 'type': 'float'}, 'msd samples': {'description': 'Number of samples to take for the MSD calculation', 'dimensionality': 'scalar', 'type': 'float'}, 'msd_fit_end': {'description': 'Where to end the fit of the MSD curve', 'dimensionality': 'scalar', 'type': 'float'}, 'msd_fit_start': {'description': 'Where to start the fit of the MSD curve', 'dimensionality': 'scalar', 'type': 'float'}, 'nruns': {'description': 'Number of runs to average', 'dimensionality': 'scalar', 'type': 'integer'}, 't_hm': {'description': 'The time taken in the Helfand moments analysis', 'dimensionality': 'scalar', 'type': 'float', 'units': 's'}, 't_msd': {'description': 'The time taken in the MSD analysis', 'dimensionality': 'scalar', 'type': 'float', 'units': 's'}}}#
Description of the computational models for Diffusivity.
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", }, }, }, }, }, }
diffusivity_step.tk_diffusivity module#
The graphical part of a Diffusivity step
- class diffusivity_step.tk_diffusivity.TkDiffusivity(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 Diffusivity 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 Diffusivity_parameters.py
- Type:
dict
See also
Diffusivity
,TkDiffusivity
,DiffusivityParameters
- create_dialog()[source]#
Create the dialog. A set of widgets will be chosen by default based on what is specified in the diffusivity parameters module.
- Parameters:
None
- Return type:
None
See also
- reset_dialog(widget=None)[source]#
Layout the widgets in the dialog.
The widgets are chosen by default from the information in Diffusivity 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
See also
Module contents#
diffusivity_step A SEAMM plug-in for Diffusivity