torchani_step package

Submodules

torchani_step.energy module

Non-graphical part of the Energy step in a TorchANI flowchart

class torchani_step.energy.Energy(flowchart=None, title='Energy', extension=None, logger=<Logger torchani_step.energy (WARNING)>)[source]

Bases: Node

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

Type:

EnergyParameters

See also

TkEnergy, Energy, EnergyParameters

analyze(indent='', **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

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:

A description of the current step.

Return type:

str

get_input(schema)[source]

Get the input for the energy in TorchANI.

Parameters:

None

Returns:

The next node object in the flowchart.

Return type:

seamm.Node

property git_revision

The git version of this module.

property header

A printable header for this section of output

property version

The semantic version of this module.

torchani_step.energy_parameters module

Control parameters for the Energy step in a SEAMM flowchart

class torchani_step.energy_parameters.EnergyParameters(defaults={}, data=None)[source]

Bases: Parameters

The control parameters for Energy.

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

Energy, TkEnergy, Energy, EnergyStep

parameters = {'gradients': {'default': 'yes', 'default_units': '', 'description': 'Calculate gradients:', 'enumeration': ('yes', 'no'), 'format_string': '', 'help_text': 'Whether to calculate and return the gradients', 'kind': 'boolean'}, 'model': {'default': 'ANI-2x', 'default_units': '', 'description': 'ANI Model:', 'enumeration': ('ANI-1x', 'ANI-1ccx', 'ANI-2x'), 'format_string': '', 'help_text': 'Which of the ANI machine-learning models to use.', 'kind': 'enum'}, 'results': {'default': {}, 'default_units': '', 'description': 'results', 'enumeration': (), 'format_string': '', 'help_text': 'The results to save to variables or in tables.', 'kind': 'dictionary'}, 'submodel': {'default': 'all', 'default_units': '', 'description': 'Submodels:', 'enumeration': ('all',), 'format_string': '', 'help_text': "Which of the submodels to use, averaging over the set.\n May be 'all', a single integer 1-8, or a list with ranges, e.g. '1, 3, 5-8'.", 'kind': 'string'}}

torchani_step.energy_step module

class torchani_step.energy_step.EnergyStep(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 Energy 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:

Energy

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:

TkEnergy

description()[source]

Return a description of what this step does.

Returns:

description

Return type:

dict(str, str)

my_description = {'description': 'An interface for Energy', 'group': 'Calculations', 'name': 'Energy'}

torchani_step.installer module

Installer for the TorchANI plug-in.

This handles any further installation needed after installing the Python package torchani-step.

class torchani_step.installer.Installer(logger=<Logger torchani_step.installer (WARNING)>)[source]

Bases: InstallerBase

Handle further installation needed after installing torchani-step.

The Python package torchani-step should already be installed, using pip, conda, or similar. This plug-in-specific installer then checks for the TorchANI script, installing it if needed, and registers its location in seamm.ini.

  1. The correct executables are already available.
    1. If they are already registered in seamm.ini there is nothing else to do.

    2. They may be in the current path, in which case they need to be added to seamm.ini.

    3. If a module system is in use, a module may need to be loaded to give access to Dftbplus.

    4. They cannot be found automatically, so the user needs to locate the executables for the installer.

  2. TorchANI is not installed on the machine. In this case they can be installed in a Conda environment. There is one choice:

    1. They can be installed in a separate environment, seamm-torchani by default.

exe_version(path)[source]

Get the version of the TorchANI executable.

Parameters:

path (pathlib.Path) – Path to the executable.

Returns:

The version reported by the executable, or ‘unknown’.

Return type:

str

install()[source]

Install then conda environment and the Python executable.

torchani_step.metadata module

This file contains metadata describing the results from TorchANI

torchani_step.metadata.metadata = {'computational models': {'ML': {'models': {'ANI': {'parameterizations': {'ANI-1ccx': {'code': 'torchani', 'elements': '1,6-8', 'optimization': True, 'periodic': True, 'reactions': True}, 'ANI-1x': {'code': 'torchani', 'elements': '1,6-8', 'optimization': True, 'periodic': True, 'reactions': True}, 'ANI-2x': {'code': 'torchani', 'elements': '1,6-9,16-17', 'optimization': True, 'periodic': True, 'reactions': True}}}}}}, 'results': {'energy': {'calculation': ['energy', 'optimization'], 'description': 'The total energy', 'dimensionality': 'scalar', 'property': 'energy#TorchANI#{model}', 'type': 'float', 'units': 'E_h'}, 'gradients': {'calculation': ['energy', 'optimization'], 'description': 'gradients', 'dimensionality': [3, 'natoms'], 'format': '.6f', 'type': 'float', 'units': 'E_h/a0'}, 'model': {'description': 'The model string', 'dimensionality': 'scalar', 'type': 'string'}}}

Description of the computational models for TorchANI.

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

torchani_step.optimization module

Non-graphical part of the Optimization step in a TorchANI flowchart

class torchani_step.optimization.Optimization(flowchart=None, title='Optimization', extension=None, logger=<Logger torchani_step.optimization (WARNING)>)[source]

Bases: Energy

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

Type:

OptimizationParameters

See also

TkOptimization, Optimization, OptimizationParameters

analyze(indent='', schema=None, table=None, step_no=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

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:

A description of the current step.

Return type:

str

get_input(schema)[source]

Get the input for the optimization in TorchANI.

Parameters:

None

Returns:

The next node object in the flowchart.

Return type:

seamm.Node

property git_revision

The git version of this module.

property header

A printable header for this section of output

property version

The semantic version of this module.

torchani_step.optimization_parameters module

Control parameters for the Optimization step in a SEAMM flowchart

class torchani_step.optimization_parameters.OptimizationParameters(defaults={}, data=None)[source]

Bases: EnergyParameters

The control parameters for Optimization.

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

Optimization, TkOptimization, Optimization, OptimizationStep

parameters = {'convergence': {'default': 0.01, 'default_units': 'eV/Å', 'description': 'Convergence:', 'enumeration': (), 'format_string': '', 'help_text': 'The convergence criteria. Maximum force on any atom.', 'kind': 'float'}, 'max steps': {'default': 1000, 'default_units': '', 'description': 'Max steps:', 'enumeration': (), 'format_string': '', 'help_text': 'The maximum number of steps to take.', 'kind': 'integer'}, 'minimizer': {'default': 'BFGS using linesearch', 'default_units': '', 'description': 'Minimizer:', 'enumeration': ('BFGS', 'LBFGS', 'BFGS using linesearch', 'LBFGS using linesearch', 'Gaussian Process minimizer', 'FIRE', 'MD minimizer'), 'format_string': '', 'help_text': 'The minimization algorithm.', 'kind': 'enum'}}

torchani_step.optimization_step module

class torchani_step.optimization_step.OptimizationStep(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 Optimization 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:

Optimization

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:

TkOptimization

description()[source]

Return a description of what this step does.

Returns:

description

Return type:

dict(str, str)

my_description = {'description': 'An interface for Optimization', 'group': 'Calculations', 'name': 'Optimization'}

torchani_step.tk_energy module

The graphical part of a Energy step

class torchani_step.tk_energy.TkEnergy(tk_flowchart=None, node=None, canvas=None, x=None, y=None, w=200, h=50)[source]

Bases: TkNode

The graphical part of a Energy 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 Energy_parameters.py

Type:

dict

See also

Energy, TkEnergy, EnergyParameters

create_dialog(title='TorchANI Energy')[source]

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

Parameters:

None

Return type:

None

See also

TkEnergy.reset_dialog

right_click(event)[source]

Handles the right click event on the node.

Parameters:

event (Tk Event)

Return type:

None

See also

TkEnergy.edit

torchani_step.tk_optimization module

The graphical part of a Optimization step

class torchani_step.tk_optimization.TkOptimization(tk_flowchart=None, node=None, canvas=None, x=None, y=None, w=200, h=50)[source]

Bases: TkEnergy

The graphical part of a Optimization 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 Optimization_parameters.py

Type:

dict

See also

Optimization, TkOptimization, OptimizationParameters

create_dialog(title='TorchANI Optimization')[source]

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

Parameters:

None

Return type:

None

reset_dialog(widget=None)[source]

Reset the layout of the dialog as needed for the parameters.

In this base class this does nothing. Override as needed in the subclasses derived from this class.

reset_optimization_frame()[source]

Layout the optimization frame according to the current values.

right_click(event)[source]

Handles the right click event on the node.

Parameters:

event (Tk Event)

Return type:

None

See also

TkOptimization.edit

torchani_step.tk_torchani module

The graphical part of a TorchANI step

class torchani_step.tk_torchani.TkTorchANI(tk_flowchart=None, node=None, namespace='org.molssi.seamm.torchani.tk', canvas=None, x=None, y=None, w=200, h=50)[source]

Bases: TkNode

The graphical part of a TorchANI 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 TorchANI_parameters.py

Type:

dict

See also

TorchANI, TkTorchANI, TorchANIParameters

create_dialog()[source]

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

Parameters:

None

Return type:

None

See also

TkTorchANI.reset_dialog

right_click(event)[source]

Handles the right click event on the node.

Parameters:

event (Tk Event)

Return type:

None

See also

TkTorchANI.edit

torchani_step.torchani module

Non-graphical part of the TorchANI step in a SEAMM flowchart

class torchani_step.torchani.TorchANI(flowchart=None, title='TorchANI', namespace='org.molssi.seamm.torchani', extension=None, logger=<Logger torchani_step.torchani (WARNING)>)[source]

Bases: Node

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

Type:

TorchANIParameters

See also

TkTorchANI, TorchANI, TorchANIParameters

create_parser()[source]

Setup the command-line / config file parser

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:

A description of the current step.

Return type:

str

property git_revision

The git version of this module.

run()[source]

Run a TorchANI step.

Parameters:

None

Returns:

The next node object in the flowchart.

Return type:

seamm.Node

set_id(node_id)[source]

Set the id for node to a given tuple

property version

The semantic version of this module.

torchani_step.torchani_parameters module

Control parameters for the TorchANI step in a SEAMM flowchart

class torchani_step.torchani_parameters.TorchANIParameters(defaults={}, data=None)[source]

Bases: Parameters

The control parameters for TorchANI.

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:
  • parameters ({"kind", "default", "default_units", "enumeration",)

  • "format_string" – 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.

  • description" – 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.

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

  • parameters["kind"] (custom) – 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.

  • parameters["default"] ("integer" or "float" or "string" or "boolean" or) – “enum” The default value of the parameter, used to reset it.

  • 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"] (tuple) – A longer string to display as help for the user.

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

See also

TorchANI, TkTorchANI, TorchANI, TorchANIParameters, TorchANIStep

parameters = {'time': {'default': 100.0, 'default_units': 'ps', 'description': 'Simulation time:', 'enumeration': (), 'format_string': '.1f', 'help_text': 'The time to simulate in the dynamics run.', 'kind': 'float'}}

torchani_step.torchani_step module

class torchani_step.torchani_step.TorchANIStep(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 TorchANI 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:

TorchANI

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:

TkTorchANI

description()[source]

Return a description of what this step does.

Returns:

description

Return type:

dict(str, str)

my_description = {'description': 'An interface for TorchANI', 'group': 'Simulations', 'name': 'TorchANI'}

Module contents

torchani_step A SEAMM plug-in for TorchANI