thermal_conductivity_step package#

Submodules#

thermal_conductivity_step.analysis module#

Routines to help do Green-Kubo and Helfand moments analysis.

thermal_conductivity_step.analysis.acf_err(acf)[source]#

The standard error of the autocorrelation function.

Copied from statsmodels.tsa.stattools.acf

thermal_conductivity_step.analysis.axb(x, a, b)[source]#
thermal_conductivity_step.analysis.ccf_err(acf1, acf2)[source]#

The standard error of crosscorrelation functions.

Copied from statsmodels.tsa.stattools.acf

thermal_conductivity_step.analysis.create_correlation_functions(J, m=None)[source]#

Create the correlation functions of the heat fluxes.

Parameters:

J (numpy.ndarray(3, n)) – The heat fluxes in x, y, and z

Returns:

The correlation functions

Return type:

numpy.ndarray(6, n)

thermal_conductivity_step.analysis.create_helfand_moments(J, m=None)[source]#

Create the Helfand moments from heat fluxes.

Parameters:
  • J (numpy.ndarray(3, n)) – The heat fluxes in x, y, and z

  • m (int) – The length of the Helfand moments wanted

Returns:

The Helfand moments

Return type:

numpy.ndarray(6, m)

thermal_conductivity_step.analysis.exp_1(t, a, tau)[source]#
thermal_conductivity_step.analysis.exp_1a(t, a2, tau2)[source]#
thermal_conductivity_step.analysis.exp_2(t, a1, tau1, a2, tau2)[source]#
thermal_conductivity_step.analysis.fit_green_kubo_integral(y, xs, sigma=None)[source]#

Find the best a * (1 - exp(-tau/t)) form.

Parameters:
  • y ([float] or numpy.ndarray()) – The integral of the correlation functions

  • xs ([float]) – The time (x) coordinate

  • sigma ([float] or numpy.ndarray()) – Optional standard error of y

Returns:

  • a ([float]) – The list of coefficients

  • tau ([float]) – The time constants

  • a_err ([float]) – The standard error of the coefficients.

  • tau_err ([float]) – The standard error of the time constants

  • n (int) – The point in the x (time) vector that is 3*tau

thermal_conductivity_step.analysis.fit_h(x, a, b, tau)[source]#
thermal_conductivity_step.analysis.fit_helfand_moment(y, xs, sigma=None, start=1, logger=<Logger thermal_conductivity (WARNING)>)[source]#

Find the best linear fit to longest possible segment.

Parameters:
  • y ([float] or numpy.ndarray()) – The Helfand moment

  • xs ([float]) – The time (x) coordinate

  • sigma ([float] or numpy.ndarray()) – Optional standard error of y

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.

thermal_conductivity_step.analysis.frequencies(data)[source]#
thermal_conductivity_step.analysis.get_helfand_slope(y, xs, sigma=None)[source]#

Get the instantaneous slope of the Helfand moments

Parameters:
  • y ([float] or numpy.ndarray()) – The Helfand moment

  • xs ([float]) – The time (x) coordinate

  • sigma ([float] or numpy.ndarray()) – Optional standard error of y

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.

thermal_conductivity_step.analysis.moving_average(a, n)[source]#
thermal_conductivity_step.analysis.plot_GK_integrals(figure, x, ts, err=None, fit=None, labels=[('xx', 'red', 'rgba(255,0,0,0.1)'), ('yy', 'green', 'rgba(0,255,0,0.1)'), ('zz', 'blue', 'rgba(0,0,255,0.1)'), ('xy', 'rgb(127,127,0)', 'rgba(127,127,0,0.1)'), ('xz', 'rgb(255,0,255)', 'rgba(255,0,255,0.1)'), ('yz', 'rgb(0,255,255)', 'rgba(0,255,255,0.1)')], _range=None)[source]#

Create a plot of the Green-Kubo integrals

Parameters:
  • figure (seamm_util.Figure) – The figure that contains the plots.

  • x (numpy.mdarray(6, m)) – The cumulative integrals in W/m/K

  • ts ([float]) – The times associated with the integrals, in ps

  • err (numpy.ndarray(6, m)) – The standard errors of the integrals (optional)

  • fit – The fit parameters for any fit of the CFF (optional)

  • _range ([float]) – The range of the x-axis in terms of units in x.

thermal_conductivity_step.analysis.plot_correlation_functions(figure, CCF, ts, err=None, fit=None, labels=[('xx', 'red', 'rgba(255,0,0,0.1)'), ('yy', 'green', 'rgba(0,255,0,0.1)'), ('zz', 'blue', 'rgba(0,0,255,0.1)'), ('xy', 'rgb(127,127,0)', 'rgba(127,127,0,0.1)'), ('xz', 'rgb(255,0,255)', 'rgba(255,0,255,0.1)'), ('yz', 'rgb(0,255,255)', 'rgba(0,255,255,0.1)')])[source]#

Create a plot for the heat flux cross-correlation functions.

Parameters:
  • figure (seamm_util.Figure) – The figure that contains the plots.

  • CCF (numpy.mdarray(6, m)) – The cross-correlation functions in W^2/m^4

  • ts ([float]) – The times associated with the CCF, in ps

  • err (numpy.ndarray(6, m)) – The standard errors of the CCF (optional)

  • fit – The fit parameters for any fit of the CFF (optional)

thermal_conductivity_step.analysis.plot_helfand_moments(figure, M, ts, err=None, fit=None, labels=[('xx', 'red', 'rgba(255,0,0,0.1)'), ('yy', 'green', 'rgba(0,255,0,0.1)'), ('zz', 'blue', 'rgba(0,0,255,0.1)'), ('xy', 'rgb(127,127,0)', 'rgba(127,127,0,0.1)'), ('xz', 'rgb(255,0,255)', 'rgba(255,0,255,0.1)'), ('yz', 'rgb(0,255,255)', 'rgba(0,255,255,0.1)')])[source]#

Create a plot for the Helfand moments.

Parameters:
  • figure (seamm_util.Figure) – The figure that contains the plots.

  • M (numpy.mdarray(6, m)) – The Helfand moments, in W/m/K*ps

  • ts ([float]) – The times associated with the moments, in ps

thermal_conductivity_step.analysis.plot_helfand_slopes(figure, x, ts, err=None, fit=None, labels=[('xx', 'red', 'rgba(255,0,0,0.1)'), ('yy', 'green', 'rgba(0,255,0,0.1)'), ('zz', 'blue', 'rgba(0,0,255,0.1)'), ('xy', 'rgb(127,127,0)', 'rgba(127,127,0,0.1)'), ('xz', 'rgb(255,0,255)', 'rgba(255,0,255,0.1)'), ('yz', 'rgb(0,255,255)', 'rgba(0,255,255,0.1)')], _range=None)[source]#

Create a plot of the slope of the Helfand moments

Parameters:
  • figure (seamm_util.Figure) – The figure that contains the plots.

  • x (numpy.mdarray(6, m)) – The slope in W/m/K

  • ts ([float]) – The times associated with the points, in ps

  • err (numpy.ndarray(6, m)) – The standard errors of the points (optional)

  • fit – The fit parameters for any fit of the slope (optional)

  • _range ([float]) – The range of the x-axis in terms of units in x.

thermal_conductivity_step.metadata module#

This file contains metadata describing the results from ThermalConductivity

thermal_conductivity_step.metadata.metadata = {}#

Description of the computational models for ThermalConductivity.

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

thermal_conductivity_step.thermal_conductivity module#

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

class thermal_conductivity_step.thermal_conductivity.ThermalConductivity(flowchart=None, title='Thermal Conductivity', namespace='org.molssi.seamm', extension=None, logger=<Logger thermal_conductivity_step.thermal_conductivity (WARNING)>)[source]#

Bases: Node

The non-graphical part of a Thermal Conductivity 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 Thermal Conductivity.

Type:

ThermalConductivityParameters

See also

TkThermalConductivity, ThermalConductivity, ThermalConductivityParameters

analyze(indent='', P=None, style='full', run=None, **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

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. 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.

plot_GK_integral(x, ts, err=None, fit=None, filename='GK_integral.graph')[source]#

Create a plot of the GK integrals and any fit to them.

Parameters:
  • x (numpy.ndarray(6, m)) – The cumulative integrals

  • ts ([float]) – List of times for the points, in ps

  • err (numpy.ndarray(6, m)) – The standard errors of the integrals (optional)

  • fit – The fit parameters for the integrals (optional)

  • filename (str) – The filename to write

plot_JJ_correlation(CCF, ts, err=None, fit=None, filename='JJ.graph')[source]#

Create a plot of the orrelation functions and any fit to them.

Parameters:
  • CCF (numpy.ndarray(6, m)) – The cross-correlation functions.

  • ts ([float]) – List of times for the points, in ps

  • err (numpy.ndarray(6, m)) – The standard errors of the CCF (optional)

  • fit – The fit parameters for any fit of the CFF (optional)

  • filename (str) – The filename to write

plot_helfand_moment(M, ts, M_err=None, fit=None, filename='HelfandMoments.graph')[source]#

Create a plot of the Helfand moments and any fit to them.

Parameters:
  • M (numpy.ndarray(6, m)) – The Helfand moments.

  • ts ([float]) – List of times for the points, in ps

process_run(run, run_dir)[source]#

Get the heat fluxes from the run and do initial processing.

Parameters:
  • run (int) – The run number

  • run_dir (pathlib.Path) – The toplevel directory of the run.

run()[source]#

Run a Thermal Conductivity step.

Parameters:

None

Returns:

The next node object in the flowchart.

Return type:

seamm.Node

set_id(node_id=())[source]#

Sequentially number the subnodes

set_subids(node_id=())[source]#

Set the ids of the nodes in the subflowchart

property version#

The semantic version of this module.

thermal_conductivity_step.thermal_conductivity.fmt_err(value, err, precision=2)[source]#

thermal_conductivity_step.thermal_conductivity_parameters module#

Control parameters for the Thermal Conductivity step in a SEAMM flowchart

class thermal_conductivity_step.thermal_conductivity_parameters.ThermalConductivityParameters(defaults={}, data=None)[source]#

Bases: Parameters

The control parameters for Thermal Conductivity.

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

ThermalConductivity, TkThermalConductivity, ThermalConductivityParameters, ThermalConductivityStep

parameters = {'T': {'default': 298.15, 'default_units': 'K', 'description': 'Temperature:', 'format_string': '.2f', 'help_text': 'The temperature for the thermal conductivity calculation.', 'kind': 'float'}, 'approach': {'default': 'Green-Kubo', 'default_units': '', 'description': 'Approach:', 'enumeration': ('Green-Kubo', 'Reverse Non-Equilibrium MD (RNEMD)', 'Thermostatted Temperature Difference', 'Heat Removal / Addition'), 'format_string': '', 'help_text': 'The approach or method for determining the thermal conductivity.', 'kind': 'enum'}, 'deltaT': {'default': '20', 'default_units': 'K', 'description': 'Target temperature difference:', 'enumeration': (), 'format_string': '.1f', 'help_text': 'The target difference in temperatures between the hot and cold zones.', 'kind': 'float'}, 'ehex': {'default': 'yes', 'default_units': '', 'description': 'Use enhanced heat exchange algorithm:', 'enumeration': ('yes', 'no'), 'format_string': '', 'help_text': 'Whether to use the enhanced algorithm, which conserves energy  noticeably better than the original algorithm at little extra cost.', 'kind': 'boolean'}, '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'}, 'n to swap': {'default': '1', 'default_units': '', 'description': 'Number of momenta to swap:', 'enumeration': (), 'format_string': '', 'help_text': 'The number of momenta to swap in the RNEMD approach.', 'kind': 'integer'}, 'nlayers': {'default': '50', 'default_units': '', 'description': 'Number of layers:', 'enumeration': (), 'format_string': '', 'help_text': 'How many layers to slice the system into for determining the temperature profile.', 'kind': 'integer'}, 'nruns': {'default': '20', 'default_units': '', 'description': 'Number of runs to average:', 'enumeration': (), 'format_string': '', 'help_text': 'The number for separate runs to average.', 'kind': 'integer'}, 'swap frequency': {'default': '100', 'default_units': 'fs', 'description': 'Momenta swap frequency:', 'enumeration': (), 'format_string': '', 'help_text': 'The frequency to swap momenta in the RNEMD approach.', 'kind': 'float'}}#

thermal_conductivity_step.thermal_conductivity_step module#

class thermal_conductivity_step.thermal_conductivity_step.ThermalConductivityStep(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 Thermal 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:

ThermalConductivity

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:

TkThermalConductivity

description()[source]#

Return a description of what this step does.

Returns:

description

Return type:

dict(str, str)

my_description = {'description': 'An interface for Thermal Conductivity', 'group': 'Properties', 'name': 'Thermal Conductivity'}#

thermal_conductivity_step.tk_thermal_conductivity module#

The graphical part of a Thermal Conductivity step

class thermal_conductivity_step.tk_thermal_conductivity.TkThermalConductivity(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 Thermal Conductivity 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 Thermal Conductivity_parameters.py

Type:

dict

See also

ThermalConductivity, TkThermalConductivity, ThermalConductivityParameters

create_dialog()[source]#

Create the dialog. A set of widgets will be chosen by default based on what is specified in the Thermal Conductivity_parameters module.

Parameters:

None

Return type:

None

reset_conductivity_frame(widget=None)[source]#

Layout the widgets in the conductivity frame as needed for the current state

reset_dialog(widget=None)[source]#

Layout the widgets in the dialog.

The widgets are chosen by default from the information in Thermal Conductivity_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. If so, edit or override this method

Parameters:

widget (Tk Widget = None)

Return type:

None

right_click(event)[source]#

Handles the right click event on the node.

Parameters:

event (Tk Event)

Return type:

None

See also

TkThermalConductivity.edit

Module contents#

thermal_conductivity_step A SEAMM plug-in for Thermal Conductivity