packmol_step package#

Submodules#

packmol_step.installer module#

packmol_step.packmol module#

A step for building fluids with Packmol in a SEAMM flowchart

class packmol_step.packmol.Packmol(flowchart=None, extension=None)[source]#

Bases: Node

create_parser()[source]#

Setup the command-line / config file parser

description_text(P=None)[source]#

Return a short description of this step.

Return a nicely formatted string describing what this step will do.

Keyword Arguments:

P – a dictionary of parameter values, which may be variables or final values. If None, then the parameters values will be used as is.

static get_input(P, system_db, tmp_db, context, ff=None)[source]#

Create the input for Packmol.

property git_revision#

The git version of this module.

run()[source]#

Run a Packmol building step

property version#

The semantic version of this module.

packmol_step.packmol.bounding_box(points)[source]#
packmol_step.packmol.bounding_sphere(points)[source]#

A fast, approximate method for finding the sphere containing a set of points.

See https://www.researchgate.net/publication/242453691_An_Efficient_Bounding_Sphere

This method is approximate. While the sphere is guaranteed to contain all the points it is a few percent larger than necessary on average.

packmol_step.packmol_parameters module#

Control parameters for Packmol, currently for packing fluids

class packmol_step.packmol_parameters.PackmolParameters(defaults={}, data=None)[source]#

Bases: Parameters

The control parameters for Packmol packing fluids

amounts = ('rounding this number of atoms', 'rounding this number of molecules', 'using the density', 'using the Ideal Gas Law')#
amounts_for_density = ('rounding this number of atoms', 'rounding this number of molecules')#
amounts_for_layer = ('using the density', 'using the Ideal Gas Law')#
parameters = {'a': {'default': 20, 'default_units': 'Å', 'description': 'a:', 'enumeration': (), 'format_string': '.1f', 'help_text': 'The length of the first side of the box.', 'kind': 'float'}, 'a_ratio': {'default': 1, 'default_units': '', 'description': 'a ratio:', 'enumeration': (), 'format_string': '.1f', 'help_text': 'The ratio for the first side of the box.', 'kind': 'float'}, 'approximate number of atoms': {'default': 2000, 'default_units': '', 'description': 'Approximate number of atoms:', 'enumeration': (), 'format_string': 'd', 'help_text': 'The approximate number of atoms packed into the cell. This will be rounded to give whole molecules', 'kind': 'integer'}, 'approximate number of molecules': {'default': 100, 'default_units': '', 'description': 'Approximate number of molecules:', 'enumeration': (), 'format_string': 'd', 'help_text': 'The approximate number of molecules to pack in the cell.', 'kind': 'integer'}, 'assign forcefield': {'default': 'If not assigned', 'default_units': '', 'description': 'Assign forcefield:', 'enumeration': ('If not assigned', 'Always', 'No'), 'format_string': 's', 'help_text': 'Whether to assign the forcefield to the molecules.', 'kind': 'enum'}, 'b': {'default': 20, 'default_units': 'Å', 'description': 'b:', 'enumeration': (), 'format_string': '.1f', 'help_text': 'The length of the second side of the box.', 'kind': 'float'}, 'b_ratio': {'default': 1, 'default_units': '', 'description': 'b ratio:', 'enumeration': (), 'format_string': '.1f', 'help_text': 'The ratio for the second side of the box.', 'kind': 'float'}, 'c': {'default': 20, 'default_units': 'Å', 'description': 'c:', 'enumeration': (), 'format_string': '.1f', 'help_text': 'The length of the third side of the box.', 'kind': 'float'}, 'c_ratio': {'default': 1, 'default_units': '', 'description': 'c ratio:', 'enumeration': (), 'format_string': '.1f', 'help_text': 'The ratio for the third side of the box.', 'kind': 'float'}, 'density': {'default': 0.7, 'default_units': 'g/ml', 'description': 'Density:', 'enumeration': (), 'format_string': '.1f', 'help_text': 'The target density of the cell.', 'kind': 'float'}, 'diameter': {'default': 20.0, 'default_units': 'Å', 'description': 'The diameter:', 'enumeration': (), 'format_string': '.1f', 'help_text': 'The diameter of the sphere or cylinder.', 'kind': 'float'}, 'dimensions': {'default': 'calculated from the density', 'default_units': '', 'description': 'The dimensions will be', 'enumeration': ('given explicitly', 'calculated from the volume', 'calculated from the solute dimensions', 'calculated from the density', 'calculated using the Ideal Gas Law'), 'format_string': 's', 'help_text': 'How to get the dimensions of the region', 'kind': 'enumeration'}, 'edge length': {'default': 20, 'default_units': 'Å', 'description': 'Length of the cube edge:', 'enumeration': (), 'format_string': '.1f', 'help_text': 'The length of the cube edge.', 'kind': 'float'}, 'fluid amount': {'default': 'rounding this number of atoms', 'default_units': '', 'description': 'Get number of fluid molecules by', 'enumeration': ('rounding this number of atoms', 'rounding this number of molecules'), 'format_string': 's', 'help_text': 'How to get the number of fluid molecules', 'kind': 'enumeration'}, 'gap': {'default': 2.0, 'default_units': 'Å', 'description': 'Gap around cell:', 'enumeration': (), 'format_string': '.1f', 'help_text': 'Since Packmol does not support periodic systems we will build a box with this gap around the atoms, then make it periodic. The gap ensures that molecules at the boundary do not hit images', 'kind': 'float'}, 'molecules': {'default': [], 'default_units': None, 'description': 'The molecules', 'enumeration': (), 'format_string': '', 'help_text': 'An internal place to put the molecule definitions.', 'kind': 'list'}, 'periodic': {'default': 'No', 'default_units': '', 'description': 'Create periodic system:', 'enumeration': ('Yes', 'No'), 'format_string': 's', 'help_text': 'Whether to create a periodic system or not.', 'kind': 'boolean'}, 'pressure': {'default': 1.0, 'default_units': 'atm', 'description': 'P:', 'enumeration': (), 'format_string': '.2f', 'help_text': 'The pressure using an ideal gas model (PV=nRT).', 'kind': 'float'}, 'shape': {'default': 'spherical', 'default_units': '', 'description': 'Shape of the region:', 'enumeration': ('cubic', 'rectangular', 'spherical'), 'format_string': 's', 'help_text': 'The shape of the desired region.', 'kind': 'enumeration'}, 'solvent thickness': {'default': 10.0, 'default_units': 'Å', 'description': 'Solvent thickness:', 'enumeration': (), 'format_string': '.1f', 'help_text': 'The thickness of the layer of solvent around the solute', 'kind': 'float'}, 'temperature': {'default': 298.15, 'default_units': 'K', 'description': 'T:', 'enumeration': (), 'format_string': '.2f', 'help_text': 'The temperature using an ideal gas model (PV=nRT).', 'kind': 'float'}, 'volume': {'default': 8.0, 'default_units': 'nm^3', 'description': 'The volume of the cell:', 'enumeration': (), 'format_string': '.1f', 'help_text': 'The volume of the target cell.', 'kind': 'float'}}#
periodic_shapes = ('cubic', 'rectangular')#
shapes = ('cubic', 'rectangular', 'spherical')#

packmol_step.packmol_step module#

Helper class needed for the stevedore integration. Needs to provide a description() method that returns a dict containing a description of this node, and a factory() method for creating the graphical and non-graphical nodes.

class packmol_step.packmol_step.PackmolStep(flowchart=None, gui=None)[source]#

Bases: object

create_node(flowchart=None, **kwargs)[source]#

Return the new node object

create_tk_node(canvas=None, **kwargs)[source]#

Return the graphical Tk node object

description()[source]#

Return a description of what this extension does

my_description = {'description': 'An interface for Packmol', 'group': 'Building', 'name': 'Packmol'}#

packmol_step.tk_packmol module#

The graphical part of a Packmol step

class packmol_step.tk_packmol.TkPackmol(tk_flowchart=None, node=None, canvas=None, x=None, y=None, w=200, h=50)[source]#

Bases: TkNode

Graphical interface for using Packmol for fluid boxes

add_molecule()[source]#

Add a new row to the molecule table.

create_dialog()[source]#

Create the dialog!

handle_dialog(result)[source]#

Do the right thing when the dialog is closed.

remove_molecule(row)[source]#

Remove a molecule entry from the table.

Parameters:

row (int) – The row in the table to remove. Note the first molecule is at row 1.

reset_dialog(widget=None)[source]#

Layout the widgets in the dialog contingent on the parameter values.

reset_molecules()[source]#

Layout the table of molecules to use.

right_click(event)[source]#

Probably need to add our dialog…

Module contents#

packmol_step A step for building fluid boxes using Packmol