Technical Documentation
Utilities: Force Field Assembler Template

The FFA class is a template for a force field assembler. It provides the constructor function, and two methods.

To create a force field assembler for a new model type first subclass the FFA class. Then, add methods that are specific to the new model type.

The FFA module is located in Yup.Tools. Thus, the required import statement is some variant of: from Yup.Tools.FFA import FFA.

Data Attributes

Some of the data attributes are shared between this class and its subclasses but they are not meant to be manipulated outside the classes. Their names are written entirely in capital letters and are not described here.

Attribute

Description

NumberOfDimensions

Number of dimensions. The preset value is 3. Note that if the module uses the Torsions or Impropers Energy objects, there must be exactly three dimensions, even if those Energy objects are empty.

Methods

__init__()

Initialize this class (private method)

stdcheck()

Determine where to create the atoms and return the parent group

finish()

Assemble the force field and return the model


The initialization function creates several attributes: MOD - the Model object, ENE - a private list of Energy objects and ASM - an empty list that will be used to hold partially built models. Since this is a template, this function is not really useful as a constructor. More likely than not, the constructor function of the subclass will first call this function to initialize the parent class.

Method Name
Number of Arguments
Return Value
__init__
2
None
Argument
Type
Preset Value

POTERMS

List of tuples: (constructor function of an Energy class, the label string for the class)

-

paramdir

string: the pathname of a parameter library

-

The paramdir argument is taken as the pathname to a parameter library. This is usually the path to a standard library supplied by the subclass. However, it is possible to supply the name of any library (e.g. while developing parameters for a new model). The paramdir is used to create the root atom map which is then added to the Model object.

A Potential object is created and registered with the Model object. POTERMS is a list of energy terms that make up the force field for the model. This must be supplied (usually by the subclass). Each item in the list is a tuple with two items: the constructor function of an Energy class and the label for the class. See for example, the constructor for the Bonds object. Each Energy object is created and added to the Potential object. Only the Energy objects that correspond to the potential energy terms of a particular model should be listed.


The stdcheck() method determines where to save new atoms.

Method Name
Number of Arguments
Return Value
stdcheck
2
AtomMap
Argument
Type
Preset Value
modelname
string
None
root
group AtomMap
None

There are three possible outcomes. With the preset value of the arguments (both None), the return value is the root AtomMap. If modelname is a string and root is at the preset value, then a new group is created underneath the root AtomMap. The return value is the new group. If root is not None and modelname is specified, then a new group is created underneath the group referenced by root. The return value is the newly created group. The following examples illustrate all three cases.

modelname
root
Group Created
Return Value
(None)
(None)
(None)
(AtomMap pointing to) :
(string) 'a'
(None)
a: (under :)
(AtomMap pointing to) :a:
(string) 'b'
(AtomMap pointing to) :x:y:
b: (under :x:y:)
(AtomMap pointing to) :x:y:b:


The finish() method returns the finished model.

Method Name
Number of Arguments
Return Value
finish
0
Model object

The Model object contains the Potential object which in turn contains Energy objects. The latter have been filled by other methods. The Model object also contain the Atom Maps and the Coordinates Atom Vector.

The returned Model object is nearly ready for simulation. A force field assembler can assign proper coordinates or leave this up to the user, perhaps to read this from a file. Once the Coordinates Atom Vectors have been assigned proper values, then the Model object can be used for simulation.


Technical
Introduction
Directory
Vectors
Energy
Model
Assembly
Methods
FPF
FFF
AVF
TaroScript
YammpScript
Python
Utilities

Home
Information
News
User
Technical
Programmer
iYup
Download
Showcase
ETC