PHYSICS 3250

Instructions for Running the Codes
__________________________________

These are FORTRAN coded programs. You will need to compile each code to produce an executable so that you can...well...execute the program. To compile and execute the code you will have to be on a computer that has loaded FORTRAN and its libraries. This should be the case for the university unix network computers, for which the following specific instructions apply. Most commands and instructions will also work on Linux platforms as well. Now it is as simple as 0,1,2,3 (usually)...

0) Logon to a Sun unix workstation terminal using your BroncoNet user ID and password. Open up a web browser (netscape, mozilla). You can do this by clicking on the netscape navigator icon on the applications bar at the bottom of your screen, or right click on the background to bring up the windows applications menu, move the mouse to "WWW Browsers" and then click on "Mozilla".

1) click on "fortran code" on the web page; save the file to your disk area; let's say its name is code.f

2) to compile the code under FORTRAN 77, simply type on your unix command line from the Terminal window (you'll need to launch a terminal window if one isn't already set up: right click on the background to bring up the windows applications menu, move the mouse to "Programs" and then click on "Terminal"), followed by a return key:

f77 -o code.exe code.f

fyi: the executable (here named code.exe) can have any name you like. It needn't even have the suffix .exe (or any suffix) attached to it. However, the file name code.f must match exactly the name of the FORTRAN code and it must  have the .f suffix. On a linux platform, the command is probably "g77" instead of "f77", with all else the same.

If there are any bugs in the code, the screen will flash some warning messages. However, this should not happen here. If it does, write down what it says and send me an email (kirk.korista@wmich.edu) or see me. If all goes well you should see that an executable named code.exe was produced in the same directory.

3) to run or execute the code, type :

./code.exe

and hit return. (note: you must include the explicit path ./ of the executable's present directory as shown, when executing an executable)

Once the code is executed, it will prompt you to enter in some data. Hit the carriage return (enter) key as you do so.

When the computations are completed, the program will stop, usually printing to the screen the name of the output file containing the computed data. Note:  if you should see some messages printed to screen upon completion of the execution don't worry unless you see the words floating overflow.  If that happens - the program has crashed; please let me know.

To see that the new data file has appeared in your directory, type:

ls (that's the letter "l" then "s", followed by the return key)

which will "list" the contents of your current directory.  You should be able to see the fortran code file, the executable you created and any data files you've generated. A few other miscellaneous files and folders will be present as well; just leave them alone.

If you need to execute the code more than once, it would be a good idea to rename the output data file - otherwise the data inside that file will be overwritten by the results of the next run. To do this simply type:

mv file.dat file1.dat

on the unix command line (noting spaces where they occur), where mv is the unix command for move, file.dat is the original name, and file1.dat is the new name for this file. You can choose any naming system you like.

Other useful unix commands (see also the unix on-line help), all are to be followed by a {return}:

  • ls    -- to list the contents of the current directory (or folder, if you like)
  • more file1    -- to list the contents of file1 from the top-down (hit spacebar to continue viewing, and 'q' to quit)
  • head file1    -- to list the contents at the top of file1
  • tail file1    -- to list the contents at the bottom of file1
  • textedit file1    -- a simple text editor, allows you to look inside and easily scroll through the file (or edit its contents, though that shouldn't be necessary). Note that a number such as 1.00E+10 means 1.00 x 1010. Type or use backspace/delete key to edit the file. Cut and paste, save file, etc, are also available from pull-down menus. Textedit is also available from the applications bar at the bottom, the x-windows applications menu (right-click on background, go to "Programs", then choose Text Editor), or double click on the file's icon within the file manager window that looks like a file cabinet.
  • rm file    -- to remove (delete) a file
  • mv file1 file2    -- to move contents of file1 to a new file2 (file1 then no longer exists)
  • cp file1 file2    -- to copy contents of file1 to a new file2 (file1 still exists, unchanged)
  • mkdir dirname    -- to make a directory (or folder in pc-talk) named dirname (your choice of name)
  • rmdir dirname    -- to remove a directory (directory must be empty first)
  • cd dirname    -- to change directories to a (sub)directory called dirname
  • cd ../    -- to change to one directory back above
  • cd    -- to go back to your home directory, wherever your present location
  • pwd     -- lists the full path name of the present directory
  • quota  -v    -- to show how much disk space you have left
  • lpr  -Pprint_que_name file1.ps    -- to print file1.ps (a postscript plot file generated by plotting routine xmgr) to a particular printer whose que name follows without space the -P

  • Also, you'll probably see a file manager icon (looks like a file cabinet) in the upper left corner; ust double click to open any of the icons. The file manager acts a bit like "Windows Explorer" on a PC. For example, you can click and drag a file, or you can double-click on a file to open it. If it is a text file (like your .f files and your .dat files) then it will open in a text editor, in which you can both inspect and alter (not recommended) the text file's contents.

    If a process launched from the unix command line should "hang" (become unresponsive) or if for any reason you want to "kill" the process, try "Control c" (press 'Control' then 'c' while continuing to press 'Control') to terminate it.

    Finally, the data may be plotted using any plotting/graphing softeware you like. 'xmgr' is available on the Sun workstations. I would be happy to show you how to use it. A related and improved version called 'xmgrace' is available in most Linux platforms. You can dump the data from the workstation to a floppy disk, and then use PC based graphing software (MS-Excel, Origin, etc).

    If you have any questions about any of this or of the contents of the output files, please ask me.

    Good luck and have fun!
     


    FORTRAN 90 and 95

    FORTRAN 90 and 95 are the latest fancy compilers of FORTRAN code and should usually also work. So I think that

    f90 -o code.exe code.f
    or
    f95 -o code.exe code.f

    should work, should you prefer or need to use either of these versions of FORTRAN. The codes should run slightly faster, but otherwise all else should go as above.