What is Molecular Dynamics?
Molecular dynamics deals with simulating the motion of molecules to gain a better understanding of chemical reactions, fluid flow, phase transformations, droplet formation, and other physical phenomena that derive from dynamic molecular interactions. Scientific visualization is used for understanding the result of a molecular dynamics simulation: How is one to understand the mechanism of water molecules diffusing through a complex polymer structure, recognize the formation of a vortex in the mass of data, or the nature of the bending and stretching of a large molecule? How is one to gain new insights? Pictures and animations enable the scientists to literally see the formation of vortices, to view protein folding, and thus to gain new insights into structure <-> property relationships. Computer simulation provides a direct route from the microscopic details of a system (the masses of the atoms, the interactions between them, molecular geometry etc.) to macroscopic properties of experimental interest (the equation of state, transport coefficients, structural order parameter, and so on.) The tutorial below is designed to introduce the student to the basic elements in modeling and visualizing results. More complex theories build on these ideas.


Molecular Dynamics Exercise

Before you begin this exercise you should download, MolecularDynamics.ps from our anonymous file server, ftp.sv.vt.edu, and print a copy of the manusctipt "Molecular Dynamics: An Introduction", Lloyd Fosdick, University of Colorado, January 19, 1995 to a postscript printer. You must READ THIS DOCUMENT FIRST before you can understand how to modify the FORTRAN program in the following exercise. This document was created by the HPSC group at University of Colorado (CU) under NSF Grant CDA-9017953. This file can also be downloaded from CU's ftp server, ftp.cs.colorado.edu/pub/HPSC/MolecularDynamics.ps.Z .

In order to complete this exercise, you will need the following files. You can save these files as plaintext to your own directory for later use. Name these files the same as their hypertext names.


Introduction

There are three different types of models: Hooke's Law (HL), Lennard-Jones (LJ), and Hard Sphere (HS) . Of these three models, the LJ model comes closest to representing real molecular systems. Because the LJ model is also easy to work with in three dimensions (3D), we will work with the LJ model in this tutorial. Even though 3D models are more realistic it may be instructive to start with 1-dimensional and 2-dimensional systems.

Note: If you would like to apply the 1 and 2-dimensional concepts in the LJ model, you will need to modify this FORTRAN Program.

Models of particle systems are characterized by the nature of the interactions between the particles. By going through the following steps, you can create your own LJ model.

When you are ready to experiment with your own input data, click here for description of input file.


Procedure

NOTE: all UNIX commands are denoted with bold-italic letters and we use the viz2% prompt throught out this procedure, although Step I of this procedure will also work on all other UNIX workstations (viz1, viz5, viz6, viz9 and viz10) in the Laboratory for Scientific Visual Analysis (LSVA). We encourage the student to download programs in Step I and run the simulation using FORTRAN compilers on their own personal computers. To visualize their results with AVS we provide access to UNIX workstation in the LSVA. The Makefile used in this procedure will only work with AVS Versions 2.0 (on viz1), 3.0 (on viz2), and 4.0 (on viz10). The Makefile provided in this procedure will not work with AVS Version 5.0 (on viz5 or viz9). A Makefile that will work with AVS Ver 5.0 is under development.

Step I
(i). Obtain the FORTRAN Program with the subroutines for Force and Potential Energy

(ii). Save the FORTRAN program as "molec-dyn.f".

(iii). Create your input data file "md.in". You may use the sample input file given or implement your own.

Note: Remember to change the input and output locations. If you would like to read from "md.in" and store your data to "md.out", make sure the following statements are in your FORTRAN program.

OPEN (UNIT = 2, FILE = 'md.in')
OPEN (UNIT = 3, FILE = 'md.out')

(iv). Open a window on viz2 and compile your program:

viz2% f77 molec-dyn.f -o molec-dyn.x <return>

(v). Execute the FORTRAN program:

viz2% molec-dyn.x <return> This command will create the store results in the file "md.out"

(vi). Make sure your results are stored in "md.out".

At this point you can look at the solutions in tabular format our you can choose to use a graphical postprocessor to view the molecular motion.

NOTE: The remaining procedure will only work on with AVS Ver 2.0, 3.0 or 4.0.

Step II
You will use AVS (Advanced Visual System: Home page) to visualize your data. The output data generated by the FORTRAN program is not in the correct format to be read by AVS. The C shell script anim-ball-color.c will convert your output into the correct format. Next we will create an executable file anim-ball-color.exe with a Makefile. At the command prompt enter:

viz2% make <return>

This command will execute commands in Makefile and will create an anim-ball-color executable file anim-ball-color.exe

NOTE: make sure Makefile is in the same directory with your anim-ball-color.c program.

Step III
Now you are ready to build your AVS program.

(i). Open a window and start AVS:

viz2% avs <return>.

(ii). With the left mouse button select Network Editor from the main menu.

(iii). You will need to access the module anim balls color from the Data Input column of the Network Editor. To do this, select the Module Tools by pressing the left mouse button on Module Tools.

(iv). Next select the Read Module(s) and a Read Module(s) window will appear on the screen showing you files and directories located at your home directory.

(v). You select the file anim-balls-color.exe by clicking the left mouse button on the directory name that contains the file. Directory names are red and filenames are black.

For some reason this window can start in a directory that is not your home directory, therefore you may need to go all the way back to the root directory ( / ) by clicking on the symbol ( .. / ) at the top of the column. Notice that each time you click on ( .. / ) you go backwards in the directory structure. From the root directory ( / ) you can than go forward to your home directory and locate the file anim-ball-color.exe by selecting the appropriate directory names: for viz2, for example, this path would be /home/viz2/class/ etc.

When you find the file anim-balls-color.exe select it by pressing on the left mouse button and you will notice that this module in added, in alphabetic order, at the top of the Data Input column of modules in the Network Editor.

The module anim-balls-color has an additional feature to change the color of each atom. Click here for an explanation of the changes you will need to make on your output file. Different colors are used here to differentiate different types of modal vibrations.

(vi). Find the anim balls color module will appear in the Data Input column of the Network Editor. "Drag" this module and the geometry viewer module into the network layout area. Network Editor modules are "dragged" into the network editor work area by selecting and holding down the left mouse button as you drag the module into place.

(vii). Arrange the modules on the layout area. Connect the modules together by pressing and holding down the middle mouse button on the red color port: you should see a thin red line connecting the two modules. A permanent connection is selected by moving the mouse while holding down the middle mouse button until the selected line changes color to white and then let go of the middle mouse button: this line then becomes a thick red line indicating that the connect is completed. You can disconnect modules by use the right mouse button. Once you connect the modules, you are ready to read the output file "md.out". You may choose your output file from the file browser shown below. Find the file "md.out" in the appropriate directory, select it with the left mouse button, and the colored balls should appear in the geometry viewer window.

Notice that here Mike Yilma, the author of this execise, has created a directory named "yilma" off of the "class" home directory and has stored the file "md.out" in the directory named "Modules". If you use viz2.sv.vt.edu for this exercise you should create your own directory but remember that when you finish your files may be erased by the next user that logs onto viz2.sv.vt.edu. Therefore if you want to continue to work on your FORTRAN and AVS programs you should work on the mountable optical disk located somewhere near viz2's optical disk drive.



Make sure to unset the pause button to start the animation. With this module you can increase of decrease the size ("Radius") of the particles as well as the animation speed.

Step IV
(viii). Bounding Box: This section is optional. If you add a bounding box to your animation, you will need the filed file box.fld. After you create this file, drag the read field and volume bounds modules into the network layout area and connect them using the middle mouse button. You will also need to connect the volume bounds module to the geometry viewer module again using the middle mouse button.


To read the dimensions of this Bounding Box into this AVS program, click on the small square inside and to the right of the read field module: The Read Field Browser should appear on the left side of the screen.

This window always starts in a directory /usr/avs/data because this is where the example data sets are located, therefore you need to go all the way back to the root directory ( / ) by clicking on the symbol ( .. / ) at the top of the column. Notice that each time you click on ( .. / ) you go backwards in the directory structure. From the root directory ( / ) you can than go forward to your home directory and locate the file "box.fld" by selecting the appropriate directory names: for viz2, for example, this path would be /home/viz2/class/ etc.

Once the "box.fld" file is selected the bounding box should appear in the geometry viewer window as show below. With this box you can now rotate and change the view angle of the box by using the middle and left mouse buttons without affecting your animation.

What should I expect from this exercise?

This molecular dynamic exercise deals with the LJ model. As we mentioned earlier, the main characteristics of LJ are strong repulsive forces at very short distances between atoms, attractive forces at larger distances, and extremely weak attractive forces at very large distances. We can witness these three types of forces in the eight atom example shown below: 1. The initial vibration of this 8 atom configuration shows that attractive and repulsive forces result in a stable vibration (NOTE: because the governing equations are nonlinear, the vibration is chaotic and exhibits three different stable vibration configurations), 2. The vibrations continue to evolve into a unstable configuration where all the atoms scatter alway from each other and leave the bounding box which is a result of weak attractive forces at very large distances. Use this example input file to create your own 8 atom movie (1.9 Mbyte) and see if you can reproduce these results with your own FORTRAN program.


Periodic Boundary Conditions

When we use periodic boundaries the motion of atoms/molecules in our Bounding Box is reproduced in each of the neighboring boxes. This creates a periodic image. The cubic Bounding Box is replicate throughout space to form a boundless lattice. Consequently, as a atom/molecule leaves the central Bounding Box it will then re-enter the same box but from the opposite side. There are no walls at the boundary of the central box, and no exterior atoms/molecules. Periodic boundaries therefore assume that the behavior of the total systems reduces to the behavior in our Bounding Box This box also creates a convenient axis system for measuring the coordinates of each of the atoms/molecules. It was not appropriate to apply the periodic boundary concept to our 8 atom example. It would be beneficial to apply this concept to other models that could benefit from this type of symmetry.
References

Acknowledgments


This tutorial was constructed by Michael Yilma and modified by Dr. R.D. Kriz (advisor) as a 1995 summer project for the NSF-STC Summer Undergraduate Research Program at Virginia Tech, Blacksburg, Virginia. If you have any questions or comments, please contact Dr. Kriz first at myilma@www.jwave.vt.edu.

Last Modified: August 5, 1995

End of Tutorial: http://www.sv.vt.edu/class/surp/Yilma/MolecDyn/Molec.html