|
The FFA module provides a class with the most basic of methods for a force field assembler. This module is located in Yup/Models/Null/, where you can find this and other modules that may be used to construct a full-featured force
field assembler. The import statement is some variant of: from
Yup.Models.Null.FFA import FFA. This is the first of several modules that are meant to replace the similarly-named modules in Yup/Tools/.
The FFA Class
The FFA module defines a class FFA and the constructor function is:
|
Name
|
Arguments
|
Return |
|
FFA
|
required: paramdir, optional: dimensions
|
The new FFA object |
| Argument |
Type |
Preset |
|
paramdir
|
Pathname of the directory containing the parameters for this model. The function
Yup.Tools.misc.datasource() provides a convenient way to construct the
path to a standard library.
|
- |
|
dimensions
|
Number of dimensions
|
3 |
Data Attributes
The MOD attribute contains the nascent Model object. Initially, only the Map and Energy attributes are defined and the Energy attribute contains an empty list.
The ENE attribute contains a list of Energy objects that have been added to this force field assembler. Users of this class should strive to keep this list up to date.
The ASM attribute contains a list of tuples. Each tuple represents a disjoint part of the model. See the description of the Finish()
method for the format of the tuples. A force field assembler may
provide methods to build different parts of a model. Each method must
add the part that it is responsible for to this attribute.
The NumberOfDimensions attribute is set to the number of dimensions.
Methods
The AddEnergyTerms() method is used to add the energy terms to the developing model
|
Name
|
Arguments
|
Return |
|
AddEnergyTerms
|
required: poterms
|
- |
| Argument |
Type |
Preset |
|
poterms
|
Tuple of energy constructor function-label pairs
|
- |
The
argument is a list of tuples. Each tuple contains two items: the
constructor function of an Energy term, and a string to be used to
label the function. The constructor function is called to create the
energy object, which is then added to both the Energy attribute of the developing Model object and to the ENE
attribute. Note that only the map and label arguments are supplied to the Energy
constructor function, other arguments recieve the default values. This
means that this method cannot be used to add Energy terms whose
constructor function require more than just the map and label arguments. You also cannot use this method
if you want to specify the optional arguments.
The MakeGroup() method can be used in several ways:
|
Name
|
Arguments
|
Return |
|
MakeGroup
|
optional: modelname, parent
|
A group AtomMap |
| Argument |
Type |
Preset |
|
modelname
|
A string containing the name of the group AtomMap
|
None |
|
parent
|
The parent AtomMap
|
None |
If
both arguments are at their preset values of None, the root AtomMap is
returned. This is also accessible from the Map attribute of the MOD attribute.
If the parent argument is at the preset value, and modelname is a string, a new group AtomMap is created under the root AtomMap using the supplied name.
Finally, if parent is a valid group AtomMap and modelname is a string, a group AtomMap is created with the supplied name under the parent AtomMap.
The found or newly created group AtomMap is returned.
The Finish() method puts the model together from the parts in the ASM attribute.
|
Name
|
Arguments
|
Return |
|
Finish
|
None
|
The finished Model object |
The ASM
attribute is a list of tuples. Each tuple contains two items. The first
item is always a group AtomMap that contains a part of the model; the
AtomMaps in ASM
must not overlap. The second item is either the null value None,
or the coordinates of the atoms belonging to the group AtomMap.
Coordinates can be supplied in one of two forms, a tuple of tuples or
an
AtomVector.
This
method will create an AtomVector for the model and fill it with the
numbers from each part. The AtomVector is then added to the Model
object as the Coordinates attribute.
The force field assembler object is cleared once this method is called. Any further attempt to use this object will fail.
Thus, the FFA class is responsible for creating the three attributes that every Model object must have: Map, Energy and Coordinates.
However, these attributes are mostly "empty". It is up to the derived
classes to fill in the blanks: to populate the model with atoms, to
populate the Energy objects with interactions, and to specify
coordinates. The FFA class provides
only the skeleton of a force field assembler. To create a full-featured
force field assembler, derive a class from this and other relevant
classes in this sub-package, and add methods to "flesh-out" the model.
An example is the Emmental model.
|