ionic_conductivity_step package#

Submodules#

ionic_conductivity_step.ionic_conductivity module#

Non-graphical part of the Ionic Conductivity step in a SEAMM flowchart

The ionic conductivity of an electrolyte from equilibrium MD with fixed charges: by Einstein-Helfand, from the collective displacement of the ions’ charges, σ = lim ⟨‖P(t) − P(0)‖²⟩ / (6 V kB t) with P = Σ qᵢ rᵢ over the ions; by Nernst-Einstein, from the ions’ self-diffusion; and their ratio, the ionicity. The analysis is in seamm_md_analysis.electric.

The MD is run before this step – in a Loop for independent runs – or read from files; the step analyzes it.

ionic_conductivity_step.ionic_conductivity.A2_PER_PS = 1e-08#

Ų/ps in m²/s

ionic_conductivity_step.ionic_conductivity.D_UNIT = 1e-09#

The unit of the self-diffusion coefficients in the output, m²/s

class ionic_conductivity_step.ionic_conductivity.IonicConductivity(flowchart=None, title='Ionic Conductivity', extension=None, logger=<Logger ionic_conductivity_step.ionic_conductivity (WARNING)>)[source]#

Bases: Node

The non-graphical part of a Ionic Conductivity step in a flowchart.

parameters#

The control parameters for Ionic Conductivity.

Type:

IonicConductivityParameters

analyze(indent='', P=None, configuration=None, **kwargs)[source]#

Analyze, print, plot and store the ionic conductivity.

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 or has too few ions.

Return type:

[str]

check_flowchart(preceding)[source]#

Check, before the job runs, that the MD will sample what is needed and is set up for the analysis.

create_parser()[source]#

Setup the command-line / config file parser

description_text(P=None, short=False)[source]#

Create the text description of what this step will do.

property git_revision#

The git version of this module.

md_requirements(P=None)[source]#

What the analysis needs from the MD: positions every ps or so, in a periodic cell, from dynamics that are not perturbed.

run()[source]#

Run a Ionic Conductivity step.

property version#

The semantic version of this module.

ionic_conductivity_step.ionic_conductivity.MIN_BLOCK_FRAMES = 20#

The fewest frames in a block of a single run

ionic_conductivity_step.ionic_conductivity.MIN_ION_PAIRS = 10#

The fewest cation-anion pairs for a useful conductivity

ionic_conductivity_step.ionic_conductivity.count_ions(charges, molecules)[source]#

The number of cations and anions, from the charges of the atoms.

Parameters:
  • charges (array_like) – The charge of each atom, e.

  • molecules ([[int]]) – The atoms of each molecule.

Returns:

The numbers of cations and anions.

Return type:

(int, int)

ionic_conductivity_step.ionic_conductivity.hill_formula(symbols)[source]#

The formula of a molecule in Hill order.

ionic_conductivity_step.ionic_conductivity.pairs_note(n_cations, n_anions)[source]#

A warning if there are too few ion pairs for useful statistics, or None.

ionic_conductivity_step.ionic_conductivity_parameters module#

Control parameters for the Ionic Conductivity step in a SEAMM flowchart

class ionic_conductivity_step.ionic_conductivity_parameters.IonicConductivityParameters(defaults={}, data=None)[source]#

Bases: Parameters

The control parameters for Ionic Conductivity.

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 = {'Yeh-Hummer correction': {'default': 'with the viscosity from a Viscosity step', 'default_units': '', 'description': 'Yeh-Hummer correction:', 'enumeration': ('with the viscosity from a Viscosity step', 'no'), 'format_string': 's', 'help_text': 'Correct the self-diffusion coefficients, and so the Nernst-Einstein conductivity, for the size of the cell, using the viscosity from a Viscosity step earlier in the flowchart (skipped, with a note, if there is none).', 'kind': 'enumeration'}, 'fit end': {'default': 0.5, 'default_units': '', 'description': 'Fit to:', 'enumeration': (), 'format_string': '.2f', 'help_text': 'Where the fit ends, as a fraction of the length: the late part has few time origins and is noisy.', 'kind': 'float'}, 'fit start': {'default': 0.1, 'default_units': '', 'description': 'Fit from:', 'enumeration': (), 'format_string': '.2f', 'help_text': 'Where the fit of the mean square displacements starts, as a fraction of their length.', 'kind': 'float'}, 'frame interval': {'default': 1.0, 'default_units': 'ps', 'description': 'Longest interval between frames:', 'enumeration': (), 'format_string': '.2f', 'help_text': 'The positions must be sampled at least this often.', 'kind': 'float'}, '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 ionic conductivity 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

ionic_conductivity_step.ionic_conductivity_step module#

class ionic_conductivity_step.ionic_conductivity_step.IonicConductivityStep(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 Ionic Conductivity 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:

IonicConductivity

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:

TkIonicConductivity

description()[source]#

Return a description of what this step does.

Returns:

description

Return type:

dict(str, str)

my_description = {'description': 'The ionic conductivity of electrolytes from MD: Einstein-Helfand and Nernst-Einstein, and the ionicity', 'group': 'Analysis', 'name': 'Ionic Conductivity'}#

ionic_conductivity_step.metadata module#

This file contains metadata describing the results from IonicConductivity

ionic_conductivity_step.metadata.metadata = {'results': {'D': {'description': 'The self-diffusion coefficient of each ion in the cell', 'dimensionality': '{species: value}', 'type': 'json', 'units': 'm^2/s'}, 'D, corrected': {'description': 'The self-diffusion coefficient of each ion with the Yeh-Hummer correction', 'dimensionality': '{species: value}', 'type': 'json', 'units': 'm^2/s'}, 'D,stderr': {'description': 'The standard error of the self-diffusion coefficients', 'dimensionality': '{species: value}', 'type': 'json', 'units': 'm^2/s'}, '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'}, 'ionicity': {'description': 'The ionicity, the ratio of the Einstein-Helfand and Nernst-Einstein conductivities (the corrected one if there is one)', 'dimensionality': 'scalar', 'property': 'ionicity#Ionic Conductivity#{model}', 'type': 'float', 'units': ''}, 'ionicity,stderr': {'description': 'The standard error of the ionicity', 'dimensionality': 'scalar', 'type': 'float', 'units': ''}, 'n_frames': {'description': 'The number of frames analyzed', 'dimensionality': 'scalar', 'type': 'integer'}, 'nruns': {'description': 'The number of MD runs analyzed', 'dimensionality': 'scalar', 'type': 'integer'}, 'sigma': {'description': 'The ionic conductivity (Einstein-Helfand)', 'dimensionality': 'scalar', 'property': 'ionic conductivity#Einstein-Helfand#{model}', 'type': 'float', 'units': 'S/m'}, 'sigma,stderr': {'description': 'The standard error of the ionic conductivity', 'dimensionality': 'scalar', 'property': 'ionic conductivity,stderr#Einstein-Helfand#{model}', 'type': 'float', 'units': 'S/m'}, 'sigma_NE': {'description': 'The Nernst-Einstein ionic conductivity, from the self-diffusion coefficients in the cell', 'dimensionality': 'scalar', 'property': 'ionic conductivity#Nernst-Einstein#{model}', 'type': 'float', 'units': 'S/m'}, 'sigma_NE, corrected': {'description': 'The Nernst-Einstein ionic conductivity from the self-diffusion coefficients with the Yeh-Hummer correction', 'dimensionality': 'scalar', 'type': 'float', 'units': 'S/m'}, 'sigma_NE,stderr': {'description': 'The standard error of the Nernst-Einstein ionic conductivity', 'dimensionality': 'scalar', 'type': 'float', 'units': 'S/m'}}}#

Description of the computational models for IonicConductivity.

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",
                    },
                },
            },
        },
    },
}

ionic_conductivity_step.tk_ionic_conductivity module#

The graphical part of a IonicConductivity step

class ionic_conductivity_step.tk_ionic_conductivity.TkIonicConductivity(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 IonicConductivity 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 IonicConductivity parameterss.py

Type:

dict

See also

IonicConductivity, TkIonicConductivity, IonicConductivityParameters

create_dialog()[source]#

Create the dialog, with the widgets for the parameters.

reset_dialog(widget=None)[source]#

Lay out the widgets that apply, given the choices made.

Parameters:

widget (Tk Widget = None)

right_click(event)[source]#

Handles the right click event on the node.

Parameters:

event (Tk Event)

Return type:

None

See also

TkIonicConductivity.edit

Module contents#

ionic_conductivity_step A SEAMM plug-in for Ionic Conductivity