Release Date: 12-Oct-96 (Version 1.0)
"Java" is a registered trademark of Sun Microsystems, Inc.
The MDModel program has been developed as project
for the "Software Praktikum" at the Computational
Physics Group at the Universität Heidelberg; tutor has been
It offers an experimental environment for simple molecular dynamics simulations. Main intention was to provide fast visual feedback of a single simulated molecule instead of very exact scientific results or simulating larger systems. With MDModel one has the chance to play around with parameters and molecules and get an instant response of the MD model to get an idea how molecular dynamics work.
As this is implemented using the new programming language Java, it runs on every computer with a Java capable browser (as an applet) or Java system (as an application).
This section is about launching MDModel with initial parameters and about the structure of the user interface.
MDModel can be run as both Java applet and Java application. The names of the parameters are the same for both methods except the way of actually setting a parameter. If you are not familiar with applet tags or Java application invokation, please read these sections in the browser or Java system manuals. Since all parameters can also be set through the user interface, you do not need to use any parameters on startup at all.
In the applet case, parameters are provided by parameter/value
pairs like in other applets. Remember that the
tag tells the applet where its classes and its data files are.
[... other applet tags ...]
When running as an application, parameters with their values
are submitted in the command line. As there obviously is nothing
CODEBASE tag here, file names have to be a
full qualified URL.
java MDModel molecule "file:///home/tstoefer/mdmodel/c20.cfg"
Possible parameters are listed below:
|Sets the initial molecule data. If the
suffix of the file name is
|Specifies the desired chain in the molecule file. If omitted, the first chain in the file is read (for "craps" files) or every atom (for PDB files).|
|Sets the initial parameter data file.
The file must be in the
|Enables or disables double buffering.
This feature eliminates the flickering in the animation.
Valid boolean values are:
|Enables or disables depth cueing. This is important for a more realistic depth experience of the rendered molecules (only in line rendering mode).|
|Switches automatic rotation around the y-axis on or off.|
val.: hex rgb color
|Sets the background color for the
rendering screen area. Format of the color is
|Sets a background image. This might look nicer than uni-colored backgrounds but consumes some rendering performance.|
val.: style tag
|Sets the style of rendering. The style
tag is one of
The user interface of MDModel is resembled by a rendering area where the molecule is drawn in a three-dimensional projection, a line of buttons, a line of "card-selectors" and a multi-purpose area. Because of the many options and informations provided by the user interface, the applet (via width and height tags) or the application (by just making the window large enough) should be preferably run at dimensions of 800x600 and up.
While over the rendering area, pressing the left mouse button
and dragging the mouse alters the view of the molecule.
Explanation of the buttons:
|Start||Starts the molecular dynamics simulation.|
|Stop||Stops the molecular dynamics simulation.|
|Center Molecule||Re-centers the molecule if it has diffused away or has become to big or small.|
The "cards" work like the register-like elements
common to many operating systems. Pressing a card-selector
changes the information contents in the multi-purpose area
changes according to the specific selector.
|Forces||Here you can enable/disable force
calculations for each kind of force.
See the "Tech" section for details on how each force affects the molecule.
|Statistics||Displays statistics about the potential energy of each kind of interaction as well as the total kinetic, total potential and total system energy.|
|Mol. Geo.||Displays information about the current
geometry of the molecule. This includes the x,y,z
dimensions and the distance from one end to another (for
unforked chains). The average bond length and bond angle
is also shown.
Last but not least the performance (measured in frames/steps per second) of the renderer and the simulation subsystem is displayed.
|Energy Plot||This is actually the same information as shown under "Statistics", but this time displayed graphically. Watch the energy being exchanged between the different kind of potentials and the kinetic energy. Do not get confused when the plotting area is suddenly cleared, because the current plotter class implementation does not know how to refresh properly if the plotting area has to be rescaled or refreshed. Another problem with this kind of area plots is that negative energies are plotted incorrectly but the total sum of all energies is always shown properly, of course.|
|Parameter||Here you can change the simulation
parameters. Press "Apply" if you want to
really set the altered parameters, press
"Cancel" to abort the changes. If you have
changed the "initial temperature" parameter,
reload the molecule (card "Configs") to
reinitialize it with the new temperature.
See the "Tech" section for details on the meaning of the parameters.
|Configs||If you want to load a new molecule, set
the URL and the desired chain and press
"Open". The current implementation knows
about PDB files and "craps" files. Leave
"chain" empty if you want all the molecule
data (for PDB files) or the first chain (for
"craps" files). Press "Cancel"
to abort. It is not recommended to simulate common PDB
molecules, because the current MD implementation only
works right for monomers. Nevertheless, PDB files can
just be viewed correctly.
With parameter files, it works accordingly. Currently, only the "craps" format is understood.
|Renderer||Switch renderer settings (double buffering, depth cueing) or the automatic rotation (which can be very disturbing). You can also choose between three styles of rendering: Line, Ball and Line+Ball.|
This section covers details of the molecular dynamics simulation and information about how MDModel is actually implemented.
The initial kinetic energy of each atom is drawn from the
Boltzmann curve using the initial temperature settings. Important:
This is only done on reloads of the molecule (pressing
"Open" in the "Configs" card).
The movement of the atoms is calculated by integrating locations and velocities and calculating the forces. If the integration time step is too large, watch the energy conservation principle fail.
Integration step is h, r is the location
vector, v the velocity vector and f the
The MD simulation calculates four different kind of
potentials/forces between the atoms:
Only a brief idea of each kind of force is explained, because the actual exact theory of the underlying physics and mathematics is beyond my knowledge.
This is part of the "Bead-Spring" model, where
atoms are regarded as dimensionless balls connected by little
springs. These springs excert a restoring force on each of the
bonded atoms which is proportional to the displacement from the
balanced position what is also as "Hooke's Law".
This force is calculated on each 2-atom pair.
Potential: U = 1/2 k ( r - r0 )2
quotBend&" forces are also part of the
"Bead-Spring" model. Atoms tend to have their
energetically most favorable orientation to their neighbors, so
e.g. you will usually have monomers in a thedrahedrical
configuration. The magnitude of the restoring force is dependent
on the differences of the cosines of the bond angles to the
This force is calculated on each 3-atom triple.
Potential: U = 1/2 k ( cos theta - cos theta0 )2
This resembles torsion forces, excerted by neighboring atoms
on each side of a bond applying some "torque" on the
This force is calculated on each 4-atom quadruple.
The current implementation of the calculation is obviously flawed in some way, so it is better to leave "Torsion" forces switched off.
Potential: U = SUMn kn
[ 1 + cos ( n*phi - phasen)]
(phase: +1 for phase 0, -1 for phase pi)
Van-der-Waals interaction is caused by slightly inequally
distributed charges (electrons and nucleus) in an atom which
attracts or repells other atoms. To model this situation, the
simulation uses the "Lennard Jones" potential, which
has a distance of no force (sigma) and a maximum attracting
The nearest neighbors are excluded from LJ interaction because forces between them are modeled differently. Besides them, one would have to let each atom interact which each of the other atoms, but as the LJ potential gets very weak at a long distances, lots of calculation time can be saved when using a "cutoff": Atoms beyond this distance are neglected.
If one takes a closer look, e.g. monomers at the end of a chain and in the middle have different epsilon values, what can be taken into account by enabling the "AutoEps" option.
Potential: U = 4 epsilon [ (sigma/r)12 - (sigma/r)6 ]
An important feature of the implementation is that it is done
in Java. This enables the user to run MDModel
independently from the type of computer hardware or the operating
system, as long as some Java capable software exists on it.
Java has some unique superior design features, which are responsible for its more and more wide-spread use in software development. But as Java is quite new and has just emerged, it still has some - say "uncertainties" - which make life for user and programmer harder. The promised stability and security (you might well experience their lacking while using MDModel) is yet to become realized.
Basic Java programming knowledge is precluded in the following explanations of the interior design of MDModel.
As you might have noticed, MDModel can be run via
a Java capable browser or as a standalone Java application.
This is achieved by basing the user interface on the main
class (which is a subclass of
Panel class) rather
than on the
Applet class. Because the
class also implements a
main() method which opens an
AppFrame (the frame handles the
close-window-request), it adds the
to the frame and thus runs as an application exactly the same way
as an applet.
Differentiations between the two execution types are also necessary in the parsing of the parameters (applet parameters versus command line arguments), the display of status messages (applet: status bar, application: window title) and the loading of images (built into
Applet class only).
Disregarding these minor changes, all the rest of MDModel
can stay the same.
It is common implementation behavior in a thread-capable system to let time-consuming tasks execute in their own little environment virtually parallel to other tasks. MDModel takes advantage of this feature by having separate threads for each of the controlling, rendering and simulating subsystems.
To achieve communication between the user interface and the
simulation and renderer thread, all settings and parameters have
been externalized in a
Settings object which
"knows" the configurable features of
as well as of
The actual render or calculation requests are issued asynchronously by
MDControl to the thread of
The reuse of already-written code by OOP is one of the
distinct features in the design of MDModel.
Renderer class, for example,
implements common features of all
subclasses, that is: communication with
objects, handling render requests and implementing things like
double buffering or background images. The
which draws a line-style rendering of the molecule, is placed on
top of this. On top of
LineRenderer there is the
which uses the
LineRenderer to also draw bonding
lines in addition to the atom balls if requested by the user.
Also all forces have a common base class
which implements features every force must have and generalizes
the way of "using" force objects (
is an abstract class).
The interface mechanism of the Java language is used to formalize import filters for the molecule and parameter files.
Importable is the interface every molecule importer
has to implement,
ParamImporter is for parameter
A detailed documentation of each class and its methods and
fields can easily be generated by running
over the source files. Here is just a brief abstract of the
purpose of each class.
||Main class to execute as applet or
application. Its only task is to launch
||This is the main controller in MDModel; it handles all other objects and runs as a separate thread.|
||All rather "static" user
interface handling is done by this class, except for the
"dynamic" mouse dragging, which is handled
||This class incorporates an external settings mechanism for all parameters and settings under user control.|
||This abstract base class for all
molecule renderers implements the communication with
||This class renders the bonds of the molecule as lines (with some sort of depth cueing). It uses centric projection with a vanishing point.|
||This class renders the atoms of the molecule as balls, and/or the bonds as lines if desired. The code for the creation of the graphical ball images is "borrowed" from the "MoleculeViewer" example provided in the JDK.|
||All simulation initialization and integration is done here running in a separate thread.|
||This is the abstract base class for all forces, implementing some general fields (like the potential energy and number of interactions) and some helpful "atom collector" for all n-atom-interactions.|
||Bond length forces are calculated by this class.|
||Bond angle forces are calculated by this class.|
||Torsion forces are calculated by this class. The physical results on the molecule are a bit strange - read: buggy - in the current implementation.|
||Van-der-Waals forces ("Lennard Jones potential") are calculated by this class.|
||This interface defines the common methods all import filters for molecule data files have to implement.|
||Polymers stored in "craps" format are imported by this class.|
||A rudimentary PDB file reader is implemented by this class.|
||This interface defines the common methods all importer filters for parameter files have to implement.|
||Imports MD simulation parameters from "craps" files.|
||This class manages all atoms, bonds and other molecule characteristics.|
||All information of a single atom like
location, velocity, force acting on it, mass and
LJ-epsilon is stored in an
||What atoms are bonded with a base atom is stored here.|
||Basic vector operations for 3-dimensional vectors are implemented by this class.|
||This class draws area, line and dot plots, which is used in the "Energy Plot" card.|
||A ring buffer and the accessing methods
to it are provided by this class. This is needed by the
||This very simple class just displays a framed colored field, which is used for the legend in the "Energy Plot" card.|
||The only extension to the
As MDModel is my project for the obligatory practical training in addition to the computer science lectures, it is finished for me by fixing development at the current state, fulfilling all provided requirements. But there are still lots of ideas and enhancements which could be implemented by others (perhaps future practial training groups) in order to make MDModel even nicer.
Thilo Stöferle, the author of MDModel,
wishes to thank Thorsten Hapke for always having time and
patience for well-understandable explanations of the
physical model and the mathematics.