viscosity_step package#
Submodules#
viscosity_step.metadata module#
This file contains metadata describing the results from Viscosity
- viscosity_step.metadata.metadata = {'results': {'P': {'description': 'The mean pressure', 'dimensionality': 'scalar', 'type': 'float', 'units': 'atm'}, 'P,stderr': {'description': 'The standard error of the pressure', 'dimensionality': 'scalar', 'type': 'float', 'units': 'atm'}, 'T': {'description': 'The mean temperature', 'dimensionality': 'scalar', 'type': 'float', 'units': 'K'}, 'T,stderr': {'description': 'The standard error of the temperature', 'dimensionality': 'scalar', 'type': 'float', 'units': 'K'}, 'V': {'description': 'The mean volume', 'dimensionality': 'scalar', 'type': 'float', 'units': 'Å^3'}, 'bulk modulus': {'description': 'The bulk modulus used for the equilibrium density, from an NPT run', 'dimensionality': 'scalar', 'type': 'float', 'units': 'atm'}, 'density': {'description': 'The mean density', 'dimensionality': 'scalar', 'type': 'float', 'units': 'g/mL'}, 'density,stderr': {'description': 'The standard error of the density', 'dimensionality': 'scalar', 'type': 'float', 'units': 'g/mL'}, 'equilibrium density': {'description': 'The estimated density at the target pressure of runs at constant volume', 'dimensionality': 'scalar', 'type': 'float', 'units': 'g/mL'}, 'equilibrium density,stderr': {'description': 'The standard error of the estimated equilibrium density', 'dimensionality': 'scalar', 'type': 'float', 'units': 'g/mL'}, 'nruns': {'description': 'The number of runs or blocks averaged', 'dimensionality': 'scalar', 'type': 'integer'}, 'viscosity': {'description': 'The shear viscosity, by Green-Kubo', 'dimensionality': 'scalar', 'property': 'viscosity#Green-Kubo#{model}', 'type': 'float', 'units': 'mPa*s'}, 'viscosity (Helfand)': {'description': 'The shear viscosity, from the Helfand moments', 'dimensionality': 'scalar', 'property': 'viscosity#Helfand#{model}', 'type': 'float', 'units': 'mPa*s'}, 'viscosity (Helfand),stderr': {'description': 'The standard error of the shear viscosity, from the Helfand moments', 'dimensionality': 'scalar', 'property': 'viscosity,stderr#Helfand#{model}', 'type': 'float', 'units': 'mPa*s'}, 'viscosity,stderr': {'description': 'The standard error of the shear viscosity, by Green-Kubo', 'dimensionality': 'scalar', 'property': 'viscosity,stderr#Green-Kubo#{model}', 'type': 'float', 'units': 'mPa*s'}}}#
Description of the computational models for Viscosity.
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", }, }, }, }, }, }
viscosity_step.tk_viscosity module#
The graphical part of a Viscosity step
- class viscosity_step.tk_viscosity.TkViscosity(tk_flowchart=None, node=None, namespace='org.molssi.seamm.tk', canvas=None, x=None, y=None, w=200, h=50)[source]#
Bases:
TkNodeThe graphical part of a Viscosity 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
- 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 Viscosity parameterss.py
- Type:
dict
See also
Viscosity,TkViscosity,ViscosityParameters
viscosity_step.viscosity module#
Non-graphical part of the Viscosity step in a SEAMM flowchart
The shear viscosity from the fluctuations of the pressure tensor in equilibrium MD, by Green-Kubo and from the Helfand moments. The five independent shear components of the pressure tensor (Pxy, Pxz, Pyz, (Pxx-Pyy)/2 and (Pyy-Pzz)/2) are analyzed separately and averaged within each run.
The MD is run before this step – in a Loop for independent runs – or read from files; the step analyzes it.
- viscosity_step.viscosity.COMPONENTS = ('xy', 'xz', 'yz', '(xx-yy)/2', '(yy-zz)/2', 'average')#
The labels of the components and their average, for tables and results
- viscosity_step.viscosity.MAX_INTERVAL = <Quantity(5.0, 'femtosecond')>#
The longest acceptable interval between samples of the pressure tensor
- viscosity_step.viscosity.METHODS = ('Green-Kubo', 'Helfand')#
The methods, in the order they are reported
- viscosity_step.viscosity.MIN_BLOCK_SAMPLES = 2000#
The fewest samples in each block when a single run is divided into blocks
- viscosity_step.viscosity.UNITS = 'mPa·s'#
The units of the viscosity in the output
- class viscosity_step.viscosity.Viscosity(flowchart=None, title='Viscosity', extension=None, logger=<Logger viscosity_step.viscosity (WARNING)>)[source]#
Bases:
NodeThe non-graphical part of a Viscosity step in a flowchart.
- parameters#
The control parameters for Viscosity.
- Type:
See also
TkViscosity,Viscosity,ViscosityParameters- analyze(indent='', P=None, configuration=None, source='runs', **kwargs)[source]#
Fit, print, plot and store the viscosity.
- Parameters:
indent (str) – An extra indentation for the output
P (dict) – The values of the parameters.
configuration (molsystem._Configuration) – The configuration, for storing the results as properties.
source (str) – What the samples are: “runs” or “blocks” of a single run.
- check_configuration(configuration)[source]#
Called by an MD step before it runs MD that this step will analyze.
- Returns:
Warnings about the structure, e.g. that it is small.
- Return type:
[str]
- Raises:
RuntimeError – If the system is not periodic.
- check_flowchart(preceding)[source]#
Check, before the job runs, that the MD will sample what is needed and is set up for the analysis.
- Parameters:
preceding ([seamm.Node]) – The steps that run before this one.
- Returns:
A description of each problem; empty if none.
- Return type:
[str]
- description_text(P=None, short=False)[source]#
Create the text description of what this step will do.
- Parameters:
P (dict) – An optional dictionary of the current values of the control parameters.
short (bool = False) – Unused: the description is always short.
- Returns:
A description of the current step.
- Return type:
str
- property git_revision#
The git version of this module.
- md_requirements(P=None)[source]#
What the analysis needs from the MD: the pressure tensor every 5 fs, in a periodic cell, with dynamics that are not perturbed by the thermostat.
- process_run(data)[source]#
Compute the correlation functions and Helfand moments of one run.
- Parameters:
data ((numpy.ndarray(n, 3, 3), pint.Quantity, float, float)) – The pressure tensor in Pa, the interval between samples, the mean temperature in K and the mean volume in Å^3.
- run()[source]#
Run a Viscosity step.
- Returns:
The next node object in the flowchart.
- Return type:
seamm.Node
- property version#
The semantic version of this module.
viscosity_step.viscosity_parameters module#
Control parameters for the Viscosity step in a SEAMM flowchart
- class viscosity_step.viscosity_parameters.ViscosityParameters(defaults={}, data=None)[source]#
Bases:
ParametersThe control parameters for Viscosity.
The MD to analyze is run earlier in the flowchart – in a Loop for independent runs – or in other jobs (see seamm_md_analysis.step_support.source_parameters).
- parameters = {'md files': {'applies_when': {'md source': 'files'}, 'default': '', 'default_units': '', 'description': 'H5MD files:', 'enumeration': (), 'format_string': 's', 'help_text': 'The md.h5md files to analyze, separated by spaces or commas. Each is an independent run. A relative path is in this job; job://<n>/<path> is in job n.', 'kind': 'string'}, 'md source': {'default': 'the last MD run of each loop iteration', 'default_units': '', 'description': 'MD to analyze:', 'enumeration': ('the last MD run', 'the last MD run of each loop iteration', 'files'), 'format_string': 's', 'help_text': "Where the MD for the viscosity comes from: the last MD run of each iteration of the loop around the MD, as independent runs (or the one run, without a loop); the last MD run earlier in the flowchart; or the H5MD files (md.h5md) of earlier runs, including other jobs' (job://<n>/<path>).", 'kind': 'enum'}, 'number of blocks': {'default': 5, 'default_units': '', 'description': 'Blocks for errors from one run:', 'enumeration': (), 'format_string': 'd', 'help_text': 'When a single MD run is analyzed, it is divided into this many consecutive blocks, which are analyzed separately to estimate the errors. Each block must be much longer than the correlation time.', 'kind': 'integer'}}#
- retired = ('nruns', 'errors')#
an older flowchart that stores them can still be read, and they are ignored. Any other unknown parameter is an error. A plug-in’s Parameters class sets this.
- Type:
Parameters the step had once and has dropped
viscosity_step.viscosity_step module#
- class viscosity_step.viscosity_step.ViscosityStep(flowchart=None, gui=None)[source]#
Bases:
objectHelper 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 Viscosity 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': 'The shear viscosity from MD, by Green-Kubo and Helfand moments', 'group': 'Properties', 'name': 'Viscosity'}#
Module contents#
viscosity_step A SEAMM plug-in for Viscosity