Professional Documents
Culture Documents
Fortran77
!! !!
Several homework assignments are going to be computational, where students will be provided a Fortran77 program to compile, modify, and play with Why Fortran77?
!! !! !! !!
very easy to learn suited for scientific computations compilers freely available for PC/Mac only language I know "
!! !! !!
How to install Fortran77 compilers in PC and Mac How to compile and run Fortran77 programs How to code in Fortran77
!! !! !! !! !!
Insert Mac OS X Installation DVD. Navigate to the Optional Installs: Xcode Tools folder. Double-click XcodeTools.mpkg. Follow the prompts, but at Installation Type, click the Customize button. Uncheck all the components and check only Unix Development Support. In particular, Developer Tools Essentials should be unchecked (saving you 2.5GB of disk space)! Provide your password for the installation to proceed. The latest version of Xcode Tools can be obtained by registering for a free ADC membership and then downloading the latest version of Xcode from Apple (caution: it is > 1GB!).
!! !!
http://prdownloads.sourceforge.net/hpc/g77-intel-bin.tar.gz?download
If your browser did not automatically unzip the file, then > gunzip g77-bin-intel.tar.gz Install the distribution > sudo tar -xvf g77-bin.tar -C / which puts everything in /usr/local
!! !!
G77 documentation is available at http://gcc.gnu.org/onlinedocs/ and another useful site is: http://hpc.sourceforge.net/ Note that the above procedures refer to installation of fortran77 binaries; you dont want to install fortran77 from source code (only for experts).
!! !! !! !! !! !!
Not only a compiler, but also an editor Compatible with Windows XP, 7, Vista Compiles 77, 90, 95, etc
Install Force209GFortranSetup.exe http://force.lepsch.com/2009/05/ downloads.html Begin installation. Use Full installation, with extra examples/documents. Make sure to associate ALL .f like files to FORCE
!! !!
"ENDDO! "EPOT=4.0D0*EPSILON*EPOT! "CALCULATE THE LONG RANGE CORRECTIONS APRIORI! "ELRC = (1.0/3.0)*(SIGMA/LJCUT)**9 - (SIGMA/LJCUT)**3! "ELRC = ELRC*(8.0/3.0)*NATOM*PI*EPSILON*DENS*(SIGMA**3)! "EPOT = EPOT + ELRC!
!! !!
http://www.idris.fr/data/cours/lang/fortran/f90/F77.html
!! !!
http://maeresearch.ucsd.edu/arya/FortranGuide.pdf
Fortran77 tutorial
!! !!
http://www.geo.utexas.edu/courses/387h/Lectures/fortran %2077%20tutorial.pdf
!!
http://www.obliquity.com/computer/fortran/
"Specify pi, triangle side length, sigma, and epsilon ! "PI = 3.14159! "SIDE = 3.5! "SIGMA = 3.405! "EPSILON = 1.65E-21!
Example continued
C "Specify "RX(1) = "RY(1) = "RZ(1) = "Specify "RX(2) = "RY(2) = "RZ(2) = "Specify "RX(3) = "RY(3) = "RZ(3) = the provided coordinates of first Argon atom! 0.0! 0.0! 0.0! the provided coordinates of second Argon atom! SIDE! 0.0! 0.0! the provided coordinates of third Argon atom! SIDE*COS(PI/3)! SIDE*COS(PI/6)! 0.0!
"Calculate total potential energy "! "POTE = 0.0! "DO I = 1, 2! " "DO J = I+1, 3! " " "RXIJ = RX(I) - RX(J)! " " "RYIJ = RY(I) - RY(J)! " " "RZIJ = RZ(I) - RZ(J)! " " "RIJSQ = RXIJ**2 + RYIJ**2 + RZIJ**2!
" " "R6I = SIGMA**6/(RIJSQ*RIJSQ*RIJSQ) ! " " "R12I = R6I*R6I! " "! " " "POTE = POTE + (R12I - R6I) "! " "ENDDO! "ENDDO! "POTE = 4.0*EPSILON*POTE! C "Output the total energy! "WRITE(*,*) 'Total Energy: ', POTE, ' Joules'! "END