seamm_ff_util package#

Submodules#

seamm_ff_util.ff_assigner module#

Main class for handling forcefields

class seamm_ff_util.ff_assigner.FFAssigner(forcefield)[source]#

Bases: object

assign(configuration)[source]#

Assign the atom types to the structure using SMARTS templates

seamm_ff_util.forcefield module#

Main class for handling forcefields

class seamm_ff_util.forcefield.Forcefield(filename=None, fftype=None)[source]#

Bases: object

static a_b_to_sigma_eps(A, B, factor1, factor2)[source]#

Transform nonbond parameters from A-B to sigma-eps and apply the unit conversion factors

angle_angle_parameters(i, j, k, l, zero=False)[source]#

Return the angle_angle parameters given four atoms types

Handles equivalences and wildcards

angle_angle_torsion_1_parameters(i, j, k, l, zero=False)[source]#

Return the angle - angle - torsion_1 parameters given four atom types

Handle equivalences

angle_parameters(i, j, k)[source]#

Return the angle parameters given three atom types

Handle equivalences and automatic equivalences.

angle_torsion_3_parameters(i, j, k, l, zero=False)[source]#

Return the angle - torsion_3 parameters given four atom types

Handle equivalences

static ar_br_to_sigma_eps(A, B, factor1, factor2)[source]#

Transform nonbond parameters from A/r-B/r to sigma-eps and apply the unit conversion factors

assign_forcefield(configuration)[source]#

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

Parameters:

configuration (Configuration) – The configuration to assign.

Return type:

None

bond_angle_parameters(i, j, k, zero=False)[source]#

Return the bond-angle parameters given three atoms types

Handle equivalences, and if zero=True, return zero valued parameters rather than raise an error

bond_bond_1_3_parameters(i, j, k, l, zero=False)[source]#

Return the bond-bond_1_3 parameters given four atoms types

Handles equivalences wildcards

bond_bond_parameters(i, j, k, zero=False)[source]#

Return the bond-bond parameters given three atoms types

Handle equivalences, and if zero=True, return zero valued parameters rather than raise an error

bond_increments(i, j)[source]#

Return the bond increments given two atoms types i and j

Handle automatic equivalences.

bond_parameters(i, j)[source]#

Return the bond parameters given two atoms types i and j

Handle equivalences and automatic equivalences.

charges(i)[source]#

Return the charge given an atom type i

Handle equivalences.

clear()[source]#

Reset the object to its initial, empty, state

property current_forcefield#

The forcefield currently set up for use.

eex_1_3_bond_bond(eex, configuration)[source]#

Create the 1,3 bond-bond portion of the energy expression

eex_angle(eex, configuration)[source]#

Create the angle portion of the energy expression

eex_angle_angle(eex, configuration)[source]#

Create the angle-angle portion of the energy expression

j is the vertex atom of the angles. For the angle-angle parameters the bond j-k is the common bond, i.e. the angles are i-j-k and j-k l

eex_angle_torsion_angle(eex, configuration)[source]#

Create the angle-angle-torsion portion of the energy expression

eex_atomic_charge(eex, configuration)[source]#

Handle charges.

eex_atoms(eex, configuration)[source]#

List the atoms into the energy expression.

Note that if using the shell model, an extra “atom” is added for the shell. At the moment the mass is split 90:10 between core and shell. The shells are appended at the end of the atoms so bonds, etc. work using the atom indices.

eex_bond(eex, configuration)[source]#

Create the bond portion of the energy expression

eex_bond_angle(eex, configuration)[source]#

Create the bond-angle portion of the energy expression

eex_bond_bond(eex, configuration)[source]#

Create the bond-bond portion of the energy expression

eex_bond_charge_increment(eex, configuration)[source]#

Get the charges for the structure

If they do not exists on the structure, they are created using the bond increments and saved on the structure

eex_charge(eex, configuration)[source]#

Do nothing routine since charges are handled by the increments.

eex_out_of_plane(eex, configuration)[source]#

Create the out-of-plane portion of the energy expression

eex_pair(eex, configuration)[source]#

Create the pair (non-bond) portion of the energy expression

eex_shell_model(eex, configuration)[source]#

Create the shell model portion of the energy expression

eex_torsion(eex, configuration)[source]#

Create the torsion portion of the energy expression

eex_torsion_angle(eex, configuration)[source]#

Create the angle-torsion portion of the energy expression

eex_torsion_end_bond(eex, configuration)[source]#

Create the end_bond-torsion portion of the energy expression

eex_torsion_middle_bond(eex, configuration)[source]#

Create the middle_bond-torsion portion of the energy expression

end_bond_torsion_3_parameters(i, j, k, l, zero=False)[source]#

Return the end bond - torsion_3 parameters given four atom types

Handle equivalences

energy_expression(configuration, style='')[source]#

Create the energy expression for the given structure

Parameters:
  • configuration (_Configuration) – Which configuration of the system.

  • style (str = '') – The style of energy expression. Currently only ‘LAMMPS’ is supported.

Returns:

eex – The energy expression as a dictionary of terms

Return type:

{str: []}

property fftype#

‘str’ the type of forcefield to handle

When set, the type is checked to make sure it can be handled. If not a RunTimeError is raised.

property filename#

‘str’ name of file for this forcefield.

When the filename is set, if the file exists it is read. If it does not exist, it is created and initialized as a forcefield file. The type of the file may be given by self.fftype; if not, the code tries the divine the type of the forcefield. The default type for new forcefields is the Biosym .frc format.

If the filename is changed the object is reset.

property forcefields#

The list of current forcefields. The first is the default one

get_templates()[source]#

Return the templates dict

initialize_biosym_forcefield(forcefield=None, version=None)[source]#

Initialize the given version of the Biosym-style forcefield

If not given, the default forcefield is used, and if the version is not specified then the default is the latest version.

make_canonical(symmetry, atom_types)[source]#

Using the symmetry, order the atom_types canonically

mass(i)[source]#

Return the atomic mass for an atom type i

middle_bond_torsion_3_parameters(i, j, k, l, zero=False)[source]#

Return the middle bond - torsion_3 parameters given four atom types

Handle equivalences

static no_transform(in1, in2, factor1, factor2)[source]#

No transformation of nonbond parameters, just units.

nonbond_parameters(i, j=None, form='nonbond(12-6)')[source]#

Return the nondbond parameters given one or two atoms types i and j

Handle equivalences

static nonbond_transformation(in_form=NonbondForms.SIGMA_EPS, in1_units=None, in2_units=None, out_form=NonbondForms.SIGMA_EPS, out1_units='Å', out2_units='kcal/mol')[source]#

Return the transform method and unit conversions for the nonbonds.

Parameters:
  • in_form (enum (NonbondForms)) – The form of the parameters input (‘sigma-eps’, ‘rmin-eps’, ‘A-B’ or ‘A/r-B/r’)

  • in1_units (string) – The units for the first input parameter

  • in2_units (string) – The units for the second input parameter

  • out_form (enum (NonbondForms)) – The form of the parameters output.

  • out1_units (string) – The units for the first output parameter

  • out2_units (string) – The units for the second output parameter

Returns:

  • function (function object) – Python function to transform the parameters

  • factor1 (float) – Conversion factor to apply to first transformed parameter

  • factor2 (float) – Conversion factor to apply to the second transformed parameter

oop_parameters(i, j, k, l, zero=False)[source]#

Return the oop parameters given four atoms types

Handles equivalences and automatic equivalences and wildcards, with numerical precedences

static rmin_eps_to_sigma_eps(rmin, eps, factor1, factor2)[source]#

Transform nonbond parameters from rmin-eps to sigma-eps and apply the unit conversion factors

static rmin_to_sigma(rmin)[source]#

Convert rmin to sigma for LJ potential.

setup_topology(configuration, style='')[source]#

Create the list of bonds, angle, torsion, etc. for the configuration

This topology information is held in self.topology.

Parameters:
  • configuration (int = None) – Which configuration. Defaults to the current_configuration.

  • style (str = '') – The style of energy expression. Currently only ‘LAMMPS’ is supported.

Return type:

None

shell_model(i)[source]#

Return the shell model parameters given an atom type i

Handle equivalences.

static sigma_to_rmin(sigma)[source]#

Convert sigma to rmin for LJ potential.

property terms#

The terms in the current forcefield.

Returns a dictionary whose keys are the terms in the forcefield and values are lists of the functional forms for the term.

Return type:

dict(str, [str])

torsion_parameters(i, j, k, l)[source]#

Return the torsion parameters given four atoms types

Handles equivalences and automatic equivalences and wildcards, with numerical precedences

class seamm_ff_util.forcefield.NonbondForms(value)[source]#

Bases: Enum

An enumeration.

AR_BR = 'A/r-B/r'#
A_B = 'A-B'#
RMIN_EPS = 'rmin-eps'#
SIGMA_EPS = 'sigma-eps'#

seamm_ff_util.metadata module#

Metadata for describing terms in focefields.

seamm_ff_util.tabulate module#

Functions for creating the input for LAMMPS tabulated potentials.

seamm_ff_util.tabulate.tabulate_angle(equation, values, derivative=None, step=0.2)[source]#

Return the angle, energy and force on a grid of points.

Some angle terms might go to inifinity at precisely 0.0 degrees, so if the values include ‘zero-shift’ the first angle is set to that value during the calculation, but reset to 0.0 in the returned angles.

Parameters:
  • equation (str) – The symbolic equation as a string.

  • values ({str: int or float}) – The values of the constants in the equation, indexex by the name

  • derivative (str = None) – The equation for the derivative. If None, it will be derived if possible

  • step (float = 0.2) – The step to us for the angle grid, in degrees.

Module contents#

Top-level package for SEAMM_FF_Util.