forcefield_step package#

Submodules#

forcefield_step.forcefield module#

A node or step for the forcefield in a flowchart

class forcefield_step.forcefield.Forcefield(flowchart=None, extension=None, logger=<Logger forcefield_step.forcefield (WARNING)>)[source]#

Bases: Node

assign_forcefield(P=None, configuration=None)[source]#

Assign the forcefield to the structure, i.e. find the atom types and charges.

Parameters:

P ({str: Any}) – The final values of the parameters.

Return type:

None

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.

property files#

The files in the forcefield … (short name & full path)

property git_revision#

The git version of this module.

list_data_files(local_only=True)[source]#

Returns the forcefield files needed by this step.

run()[source]#

Setup the forcefield

setup_forcefield(P=None)[source]#

Setup the forcefield for later use.

Parameters:

P ({str: Any}) – The final values of the parameters.

Return type:

None

uri_handler(path)[source]#

Return the actual file given a path that may have a uri.

Parameters:

path (str or pathlib.Path) – The filename or uri for the file.

Returns:

path – The full path to the file

Return type:

pathlib.Path

Note

Forcefields can be in one of 3 locations:

  1. In the data directory of this Python package. This is where the standard forcefields are stored.

  2. In the local installation, under ~/SEAMM/data/Forcefields. This allows a site to add or customize forcefields for all users. The user for the SEAMM installation may not be the same as the user running the code! So ‘~/’ may reference a different directory than the next item.

  3. In the users directory at ~/seamm.d/data/Forcefields. This allows the user to add or override any existing forcefield.

When a forcefield is referenced, if it has no URI it is assumed to be in (1), the default location for forcefields shipped with the release.

If it has a URI, i.e. the path starts with ‘local:’, the code searches for it first in the users local data (3). If it is not found, the search continues in site location (2).

Jobs executed by the JobServer are handled a bit differently, because the site and home directories may not exist or may be different on the machine that the JobServer is running on. When a job is submitted to the Dashboard, the code locates the forcefields on the local machine, as outlined above. It then sends copies to the data/Forcefields directory of the job. The path for the job’s data/ driectory is changed to its local data/ directory, so the copies sent with the job are used.

property version#

The semantic version of this module.

forcefield_step.forcefield_parameters module#

Control parameters for using forcefields

class forcefield_step.forcefield_parameters.ForcefieldParameters(defaults={}, data=None)[source]#

Bases: Parameters

The control parameters for forcefields

parameters = {'elements': {'default': '', 'default_units': None, 'description': 'Elements:', 'enumeration': None, 'format_string': '', 'help_text': 'The elements to include.', 'kind': 'periodic table'}, 'forcefield': {'default': 'default', 'default_units': '', 'description': 'Forcefield:', 'enumeration': ('default',), 'format_string': 's', 'help_text': 'The forcefield with the file.', 'kind': 'enumeration'}, 'forcefield_file': {'default': 'oplsaa.frc', 'default_units': '', 'description': 'Forcefield Repository:', 'enumeration': ('OpenKIM', 'lithium_battery.frc', 'nacl_water.frc', 'oplsaa.frc', 'pcff2018.frc'), 'format_string': 's', 'help_text': 'The forcefield repository or file to use.', 'kind': 'enumeration'}, 'potentials': {'default': '', 'default_units': '', 'description': 'Interatomic Potentials:', 'enumeration': ('will be replaced',), 'format_string': 's', 'help_text': 'The interatomic potentials to use.', 'kind': 'enumeration'}, 'task': {'default': 'setup forcefield', 'default_units': '', 'description': 'What to do:', 'enumeration': ('setup forcefield', 'assign forcefield to structure'), 'format_string': 's', 'help_text': 'What to do with the forcefield.', 'kind': 'enumeration'}}#

forcefield_step.forcefield_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 forcefield_step.forcefield_step.ForcefieldStep(flowchart=None, gui=None)[source]#

Bases: object

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

Return a 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 the setup and control of the forcefield', 'group': 'Simulations', 'name': 'Forcefield'}#

forcefield_step.ligpargen module#

forcefield_step.ligpargen.add_to_ff(ff, configuration, data)[source]#

Adds the data to the forcefield file

This method adds the data from the .key file to the forcefield file.

Parameters:
  • ff (list) – The list of strings that make up the forcefield file

  • configuration (Configuration) – The configuration object

  • data (dict) – The data read from the .key file

Returns:

The updated forcefield file

Return type:

str

forcefield_step.ligpargen.reader(path)[source]#

Reads the .key file and returns the data

This method reads the .key file output by LigParGen and adds the parameters to the local SEAMM forcefield ligpargen.frc file.

Parameters:

path (str or pathlib.Path) – The path to the .key or .xyz files

Note

The .key file is a text file that contains the forcefield parameters for Tinker. It looks like this:

      ##############################
      ##                          ##
      ##  Force Field Definition  ##
      ##                          ##
      ##############################


forcefield              OPLS-AA

vdwindex                TYPE
vdwtype                 LENNARD-JONES
radiusrule              GEOMETRIC
radiustype              SIGMA
radiussize              DIAMETER
epsilonrule             GEOMETRIC
torsionunit             1.0
imptorunit              1.0
vdw-14-scale            2.0
chg-14-scale            2.0
electric                332.06
dielectric              1.0


      #############################
      ##                         ##
      ##  Atom Type Definitions  ##
      ##                         ##
      #############################


atom        800  800    CT    "C00"          6     12.011     4
atom        801  801    CZ    "C01"          6     12.011     2
atom        802  802    NZ    "N02"          7     14.007     1
atom        803  803     F    "F03"          9     18.998     1
atom        804  804    HC    "H04"          1      1.008     1
atom        805  805    HC    "H05"          1      1.008     1



      ################################
      ##                            ##
      ##  Van der Waals Parameters  ##
      ##                            ##
      ################################


vdw         800           3.5000   0.0660
vdw         801           3.3000   0.0660
vdw         802           3.2000   0.1700
...
The interesting keys are:
  • atom: defines the atom types

  • vdw: defines the van der Waals parameters

  • bond: defines the bond parameters

  • angle: defines the angle parameters

  • torsion: defines the torsion parameters

  • imptors: defines the improper torsion parameters

  • charge: defines the charge parameters

forcefield_step.ligpargen.run()[source]#

forcefield_step.tk_forcefield module#

The graphical part of a Forcefield step

class forcefield_step.tk_forcefield.TkForcefield(tk_flowchart=None, node=None, canvas=None, x=None, y=None, w=200, h=50)[source]#

Bases: TkNode

The graphical part of a forcefield step

create_dialog()[source]#

Create the dialog for editing the Forcefield flowchart

edit()[source]#

Present a dialog for editing this step’s parameters. We need to recreate the PeriodicTable for some reason

reset_dialog(widget=None)[source]#

Layout the widgets as needed for the current state

right_click(event)[source]#

Probably need to add our dialog…

update_potentials(elements)[source]#

Update the list of possible OpenKIM potentials as the element selection changes.

Module contents#

forcefield_step A step for choosing the default forcefield.