The CHARMM Water-Box Tutorial


Streaming/Working with Files

    First, we'll want to end our example of working with CHARMM interactively by typing:
STOP
    Now, we can make a command file to be input to CHARMM. First, open up a blank file in a text editor (e.g. xemacs). Enter the following lines into your file. Note that we have inserted comments into the script using the '!' to help us keep the different commands straight. Also notice that you can put blank lines between the sections to help organize your script.
* charmm input script to build a single water molecule
* and energy minimze it
*
BOMLEV -3
READ RTF CARDS
* Here's the water residue
*
   21    1
MASS 1 H 1.    ! Water - Hydrogen Atom
MASS 2 O 16.   ! Water - Oxygen Atom
RESI H2O 0.0   ! Water Model
ATOM OH2 O   -0.82
ATOM H1  H    0.41
ATOM H2  H    0.41
BOND OH2 H1   OH2 H2
THETA  H1 OH2 H2

PATCH FIRST NONE LAST NONE
READ PARAMETERS CARDS
* Bond and Angle constraints for water
*
BOND
H O  450.0 0.9572
THETA
H O H  55.0  104.52
NONBONDED
O  0.0 -0.1521   1.7682
H  0.0 -0.04598  0.2245
READ SEQUENCE CARD
* Here's the water molecule
*
1
H2O
GENERATE WAT
READ COOR CARD FREE
* The coordinates for the water molecule
*
 1
 1 1 H2O OH2 0.0 0.0 0.0
HBUILD
MINIMIZE NRAP NSTEP 1
STOP
    Now we have all the commands that we entered interactively in the previous example in one input script. The advantage of this is that if we made a small mistake we can go back and edit that particular command without having to start from scratch. Notice that we added a new command at the top "BOMLEV -3". This command will tell CHARMM to be somewhat forgiving with us and not abort the program for small errors. It will, however, provide warning messages that you should pay close attention to.
    Save the file as "water.inp" and close the text editor. At the unix command prompt you can now have CHARMM run your input script with the command:
charmm < water.inp > water.out
    CHARMM will read in the file 'water.inp', carry out all the commands,  and print all of the output to the file 'water.out.' which contains all our simulation results as well as any error messages.
    Now that we know some of the basics of working with CHARMM scripts, let's build a system of several molecules and run some molecular dynamics simulations using the command script approach.


Step 2: Parameter Files | Step 4: Dynamics Simulations