The Case Study are written for the UNIX operating system. The programs are written in standard FORTRAN77 (using the generally accepted DO WHILE, ENDDO extensions) and can be used on other operating systems as well. However, the user should make some modifications. Here some explanations are given about those aspects that are specific to UNIX.
For UNIX systems a "makefile" is used in this file one can find the name of the program after compilation. One can find this name at the line (in the file called Makefile or makefile which is located in the directory Source):
PROGRAM = mc_nvtIn this example the name of the executable is: mc_nvt
On non-UNIX systems one should compile the program using the appropriate FORTRAN77 compiler and give the executable the name .
Here a UNIX macro is used to run the program. For those not familiar with UNIX a short explanation is given below of a typical example (Case Study 1). The macro is the contents of the file run:
#! /bin/csh -f cp lj.model fort.25 foreach rho (0.70) echo " --- rho ${rho} " >> out echo " --- rho ${rho} " cat > fort.15 <>& out cp fort.21 lj.res cp fort.66 lj.prt #perform block analysis cp lj.prth fort.31 mv lj.prt fort.32 ../../Appendix/block >>& out rm fort.* end exit
Below each a short explanation of the UNIX commands is given.
#! /bin/csh -f
Define an appropriate UNIX shell (specific for UNIX)
cp lj.model fort.25
Copy the file lj.model to fort.25. The latter is used in the FORTRAN program in statements like WRITE(25,*) or READ(25,*). The name fort.25 depends on the machine (this works on IBM and Silicon Graphics workstations, but HP uses different names)
foreach rho (0.70)
The command "foreach ... end" makes a loop. In this case it gives rho the value 0.70 and runs the loop only once. If one wants to simulate several densities, one can use: "foreach rho (0.70 0.60 0.50)"
echo " --- rho ${rho} " >> out
The command echo echoes (prints) the string " --- rho 0.70 " to file named out. The command >> ensures that this is appended to the fille out. ${rho} indicates that it should take the value of rho (as defined in foreach) rho without the ${ } are the letters r h o.
echo " --- rho ${rho} "
This time the string is echoed to the screen (note that the command ">> out" is omitted).
cat > fort.15 << endofdata ibeg , nequil , lmax nsamp iseed 0 00 200 1 368675 dr 0.09 ndispl 50 npart temp rho 100 2.0 ${rho} endofdata
The cat command prints to the file named fort.15 the contents of the lines till it finds the string endofdata. This is used to create the file fort.15 which contains the input parameters for the simulations. In this way the program can run for several values of rho since in each time ${rho} is replace by the value of rho as defined in the foreach loop.
cp lj.res fort.11 cp lj.model fort.25
Copy the files to their appropriate FORTRAN file number: lj.res to 11 and lj.model to fort.25
time ../Source/mc_nvt >>& out
The command time measures how long the program ../Source/mc_nvt has run. Since this is a system command one has to add the & to print this to the file out. To run a program in UNIX one simply has to type the name of the program, which is the program that has been compiled previously. Since the program is run in the directory /CaseStudy_1/Run/ and the program is located in /CaseStudy_1/Source/, we have to type ../Source/mc_nvt where ../ indicates we have to move up one directory.
cp fort.21 lj.res cp fort.66 lj.prt
Copy the results which have been written to unit 21 and 66 to the appropriate file names.
#perform block analysisAfter # one can put comments in UNIX
cp lj.prth fort.31 mv lj.prt fort.32
To determine the standard deviations the program "block" is used. This program uses the FORTRAN units 31 and 32. Since the file connected to 32 can be come very large this file is moved (mv) instead of copied.
../../Appendix/block >>& out
Run the program block and append the results to the file named out. This program is located in the directory: /Appendix/, which means two directories up (../../).
rm fort.*
Remove all the fort.* files
end
The end corresponding to foreach
exit
Leave the UNIX program
In some other Case Studies the following additional commands are used:
set gives the parameter npart the value 100. Similar to rho/${rho} as in the example above.
The UNIX command nice runs the program at a lower priority.