|
There
is no standard method of assembling a force field
in Yammp. In these pages, we present the
implementations of two force field assemblers. As
illustration, we will be using a force field, and
an assembler for a force field called
TestTube which creates nonsensical models
that were used in the development of the force
field terms. The parameter library and assembler
for TestTube are shipped with every copy of
Yammp and you can view the source code as you read
these pages. The files are installed as part of the
Yup package whose location varies depending on your
installation. To find the files on your system,
type the following commands in your Python
interpreter:
>>> from Yup.Tools.misc import datasource >>> print datasource( 'TestTube' )
|
The
output looks like this:
/home/robtan/Develop/Yup/Data/TestTube,
where the part of the pathname shown here in red is
fixed while the part in gray depends on your
system. This is the path to the TestTube
parameter library and you can read the file named
source-of-constants
(the other files in this directory are
unformatted). The code for the TestTube
force field assembler will be in:
/home/robtan/Develop/Yup/Models/TestTube.
(The files named *.py contain the source code while
the *.pyc or *.pyo files contain the non-text
outputs of the Python compiler.)
Normally,
a force field is associated with only one
assembler. The assembler may assemble the force
field for many different families of molecular
models but each family uses the data from the same
parameter library. TestTube is unusual in
having two separate assemblers. This is necessary
because TestTube is used in the development
of the force field terms but it is not possible to
place all the terms into a single force
field.
The
following pages start with an overview of the force
field assembly process: with the functions of an
assembler. The discussion then moves on to the
issues involved in implementing an assembler;
whether the implementation should be
objected-oriented or procedural. We have found it
is easier to implement the assembler as a class so
the discussion continues with the constructor
function of the class, then on to the methods of
the class. The two most important families of
models are discussed next: these are the all-atom
and reduced representation models. These two
families are very different and so the
implementations are also different. Coordinates are
discussed on the following page. The models have
been accumulating in the class instance and the
finished model is returned only when the class is
closed out, by calling the special method named
finish. Although we have decided on an
object-orientated implementation of the force field
assemblers, a procedural implementation would have
been more familiar to the user. However, it is
possible to define end-user procedures that make
use of the class implementation. Finally, this
discussion closes with a few miscellaneous items
and some practical information that may be useful
to the developer.
|