Fortran (; formerly FORTRAN, derived from Formula Translation) is a general-purpose, compiled imperative programming language that is especially suited to numeric computation and scientific computing.
Originally developed by IBM in the 1950s for scientific and engineering applications, FORTRAN came to subsequently dominate scientific computing. It has been in use for over six decades in computationally intensive areas such as numerical weather prediction, finite element analysis, computational fluid dynamics, geophysics, computational physics, crystallography and computational chemistry. It is a popular language for high-performance computing and is used for programs that benchmark and rank the world's fastest supercomputers.Fortran has had multiple versions, each adding extensions while largely retaining compatibility with prior versions. Successive versions have added support for structured programming
and processing of character-based data (FORTRAN 77), array programming, modular programming and generic programming (Fortran 90), high performance Fortran (Fortran 95), object-oriented programming (Fortran 2003), concurrent programming (Fortran 2008), and native parallel computing capabilities (Coarray Fortran 2008/2018).
Fortran's design was the basis for many other programming languages. Among the better-known is BASIC, which is based on FORTRAN II with a number of syntax cleanups, notably better logical structures, and other changes to work more easily in an interactive environment.As of June 2021, Fortran was ranked 17th in the TIOBE index, a measure of the popularity of programming languages, climbing 17 positions from its ranking of 34th in January 2020.
Hi
I am doing a program using gfortran compiler. I feed angle theta in degrees to the program. Program is supposed to calculate the value of tan(theta) using values of sine and cosine of theta. the program should give warning of division-by-zero if magnitude of cosine theta is less than...
I am a graduate geology student and have been using MATLAB for about a year now. I began learning C a while back to have a broader tool-set to work with but found that it just got in the way of learning material more specific to my major. Besides, MATLAB does everything I need anyway.
That...
Hello everyone, I'm new here and i have a question:
I did this fortran code and isn't work, but i think the problem is my codeblocks
Someone can execute the code and if they presents some errors help me also?
Hello,
I'm trying to run a simulation program, written in Fortran 77 for the g77 compiler ( I use gcc version 3.4.6). I get the following error message when running the program:
invalid number: incomprehensible list input
apparent state: unit 3 named combin.fig
last format: list io...
Hi all !
This is a weird problem. A simple program to read a file and display it works differently when compiled with different versions of the same compiler.
When I compile it as:
garbageij@garbageij:~/NMA$ mpif90 exp4.f90
and run it, it gives the correct output. But when I compile it as...
Hi all !
I am a little new to FORTRAN and I am sorry if the title is confusing but I couldn't come up with anything better.
I have a file of which I am showing a snippet below:
*>>>>>>>>CHARMM22 All-Hydrogen Topology File for Proteins <<<<<<<
*>>>>>>>>>>>>>>>>>>>> and Nucleic Acids...
I have the following code with error- I want this general flow. Errors I get are missing ')' at the do while line,
syntax error on the line started with ****(not part of program added after fact)
and expecting END Program statement at line end do
counter=1
user_reaction =3
do while (counter...
Hello All,
This is my first post on any forum so I will try not to get too fancy. I have been writing in fortran for about two months now and it is my first programming experience. First, I wrote a classical dynamics program for a particle moving toward a potential barrier. Then, I wrote a...
I've recently found myself in a situation where I need to know Fortran at a fairly decent level. A professor has asked me to translate a large amount of his old Fortran code into C++, and knowing no Fortran at all I excepted the task. I do however consider myself a competent C++ programer. So my...
Hi, I am beginning to learn FORTRAN and am a bit confused with the error i am getting. Here is my code:
program main
IMPLICIT NONE
integer :: limit
WRITE(*,*) "Please enter limit: "
READ(*,*) limit
integer :: allnums(limit)
!
! do i=1,limit
!
! allnums(i) = 0
!
! end do...
Hi,
I have been trying to run a linux executable (written in fortran77) into my another code (also in fortran77). In Matlab, I did it with "system('./<filename>')". But I am not able to do it in fortran script as './' is not simply working for me.
I will really appreciate if anyone could...
hi all !
I want to ask about Include Statement in fortran example: Include 'D:\XXX.f'
in my XXX.f have some subroutines and want to call these subroutine in Main program but i show error . someone does like me can share me some experience !
Homework Statement
The Fortran 90 code shown below was written to solve a Crank-Nicholson algorithm that describes the motion of a quantum particle (hence the need for complex numbers). Probably not that crucial to know the details of the math/physics, just the code...
The problem is that...
I was given a CD with fortran files as part of my senior year project
(biology major here), that said in order to compile the code (using
cygwin), to install 'cygwin' and 'g95' Fortran compiler. I think i got
the 'cygwin' succesfully installed (after watching numerous youtube
videos) on my...
Hi everybody,
I need your help guys. I am using FORTRAN 90(or 95) and try to read a text file. The file contains many lines for instance something like this
CS
DIRECT
1.2 2.5 3.6
1.6 -2.3 2.9
....
....
....
I need to put each line inside a string variable for example
A="CS"...
Hi all
I am struggling to work symbolic math calculations with Fotran 95 in the Silverfrost ftn 95 plataform.
Say you want to calculate c=a+b but without initializing "a" or "b" to get a value "c", but rather print out or obtain the actual generic expresion "a+b"
I have tried to solve...
Hi everybody;
I'm not programmer or computer expert, but during working with my thesis got serious problem with my program seemingly about big size of matrices. I'm working with meshes and using Fortran to analyze entire of my mesh including nodes and elements. The biggest size of my matrix has...
Hello all FORTRAN geeks and geekettes,
I was wondering if there is a way to get different colors for each word in a print/write statement?
For example:
WRITE(*,*)'This is my test sentence'
Can I get each word in this write statement to appear as a different color in the terminal...
Hello
I am a beginner in programming with Fortran and I want to use the LAPACK DSYEV in my program.
I am an example to determine the eigenvalues of a matrix (3x3) after I use it in my program but when I compile I get this error
"" "" "** One entry to DSYEV parameter number 5 Had an illegal...
I ran into a kind of strange thing today while coding. I needed Pi in a program, so I used 2*accos(0.0) to pull it out, but my answers were slightly off. I checked the Pi calculated and it was off after a few decimal places.
"Odd", I thought, and just decided to put in Pi as an assigned number...
Hello oeveryone
i've got many txt files each with a different name, such as
filename1.txt
filename2.txt
...
i've got another txt in which I've got the list of the name
of the files
i want to allocate in a vector of characters che name of the files
and use this to open all files...
we have to write a code to solve system of equations by writing them in matricies (tridiagonal matrix) form ...
the first step is to enter the coefficients of the variables (r1,r2,r3,...) and then the answers to the equations (b1,b2,b3,...) by using array , and print the equations in the form...
Dear Sir,
I am using FORTRAN.
I have little experience and i am facing one problem.
I want to store data (i.e. X and Y values) in an array (A(900),B(900)) in such a way that at first I used only 30 elements of each array for storage 30 initial values of X and Y and then I have some...
hi I am just start learning fortran and i have aproblem with my homework:
we have to write a code to solve system of equations by writing them in matricies (tridiagonal matrix) form
the first step is to enter the coefficients of the variables (r1,r2,r3,...) and then the answers to the...
Hello,
I want to write an inner loop which takes values based on the variable values of the outer loop. For outer loop, m=1, Nmax and for inner loop, I want n to take values from 1 to Nmax-m. But I am not sure if I can directly specify n = 1, Nmax-m. Also I want to use Nmax-m value for one of...
Do subroutines return values only?
Sorry for the wrong title!
I currently have a subroutine which should return y like (the actual formula is a bit more complex): y=cos(t)
When i call the subroutine and then make a do-loop to test y for different t, it gives 1 value only. Does the subroutine...
hi all
i try to transfer data between 2 individual program fortran . I've ever tranferred data between 2 subroutine by using common block, but 2 program make so confused. Have you ever done like me can share some experience ?
thank you
Hi,
I have a fortran 77 code, I compiled it on cygwin in windows 7 by using f77 and gfortran, and it has been working correctly.
I should use this code on Ubuntu, so I installed f77, gfortran and gcc compiler. I tried to comile that code by using f77 but it gave me the following error:
> f77...
Hi all.
I am using some Fortran 77 code that was originally written in the early 90s, and some of the subroutines start with DECK or *DECK. I have tried searching the internet but cannot find anything relevant. As an example, say the main program calls two subroutines SUBONE and SUBTWO. One...
I try to write a small program to allocate a variable in small subroutine and I've passed it, now i allocate array in a loop or many loops but i don't have any ideas about it.
Has anyone done like me , can share some experiences ??
Hello
I wondered if in Fortran 90 I can define a variable whose value will be given only while executing the program, in the same line as the execution command, for example like this:
./exe 100
I know one can use the "read" command, but that way you only enter the variable's value once...
There are two functions that I need help with:
http://www.maths.uq.edu.au/expokit/fortran/dgpadm.f
http://www.maths.uq.edu.au/expokit/fortran/dgchbv.f
The problem I'm having is that the arguments on the line DGPADM(...) don't match identically with the explanation. For example, H, ldh...
I'm getting a "Segmentation fault: 11" when running at line 72:
IF (h_temp == blayer) THEN However, the line above it: PRINT *,h_temp==blayer runs just fine. Needless to say, I'm clueless. Here's my entire code.
PROGRAM bunkers
IMPLICIT NONE
REAL, DIMENSION(5) ...
hi all,
i have codes for 1d fdtd maxwell equation. the problem i am facing right now is some error regarding the kind notation.
!1d fdtd Simulation in free space
subroutine fd1d01(f0,miu,delta,S,E0)
implicit none
real :: f0
real :: miu
real :: delta
real...
I'm going to be using Fortran for research this summer (three weeks) and the one problem is I don't know Fortran. Obviously, I know I can't learn everything in three weeks but I assume it is possible to get a strong base. I already have a textbook on Fortran by Etter but possibly there are...
I am new to Fortran. Is there an ultimate best library for FFT for Fortran (95)?
I found this one FFTPACK. I am not sure if this is the best one. Is there anywhere a simple example how to use it?
I have huge time files (260 MB each) that I like to read in Fortran and perform FFT and...
Hi all! I have a question about fortran. So far in my coding, if i wanted to define a function ( say f(x) ) I would manually set a grid for x, and then define f for each x value, so that i would have a vector for f and a vector for x. However, I'd now like to use the 'function' command, so i can...
Hi, I have to program using Fortran 90/95 simultaneous linear equations. My question is, is it possible to program this? First I did the inverse matrix to find the values of the solution of a 4X4 and 3X3 matrix. I set up [A][X] = [X]' and did the inverse matrix to find the values for [X]. So...
Fortran help: high precision intrinsic functions (kind = 16)...
Homework Statement
Dear Everyone,
I am using Fortran G95 compiler in windows 7 with SciTE as text editor. I have successfully compiled many programs (so there is no problem with my installations). I am having problems with...
I've never had this issue before. My code will create the file and also output anything to terminal. But if I change the output from terminal to file, it does nothing. For example, this line
write(*,*) "ist1, ist2 =",ist1,ist2
outputs my two indices in every loop iteration. But...
Homework Statement
The power series
1 + x + (X^2)/2! + (x^3)/3! +...(to infinity)= (x^k)/k!
converges to e^x for all values of x. Write a function subprogram that uses this series to calculate values for e^x to five-decimal-place accuracy (i.e. using terms up to the first one that is less...
Hi everybody,
I have old Fortran code, originally written in the mid 1970's for an Elmer system. The code has been adapted through the years, last run successfully in 2009.
The code has now landed on my lap after having been "retired" due to obsolescence. I am a pure Fortran beginner...
Hi guys having a problem with my code, FORTRAN keeps stating:
lambda(k+1)=(newsum/oldsum)
Error: Incomparable ranks 0 at and 1 in assignment. The code is below:
subroutine powerit(a,b,c,E,n)
implicit none
real, intent(in) :: E
real, intent(inout) ...
I have a an array of type complex. I am trying to assign a value to it in a loop, but I get a strange error "Unclassifiable statement at (1)". I really don't understand why.
do t = 1, count
real(in(t)) = cos(2 * pi * f0 * t)
aimag(in(t))=sin(2 * pi * f0 * t)
end do
thanks.
Given a character variable
character*10 name
write (6,111) name
111 format (?)
what do I put in the format statement to print the hexadecimal contents of name?
hello,
i'm a beginner in programming. i wrote a program to calculate velocity correlation function. i do not get any compilation errors but the lines after line number 42 are not being read. could someone tell me what is it that I'm doing wrong?
thanks a lot!
svartak
!program to...
(The usual format doesn't really fit this question, so I hope you won't mind if I set it up slightly differently)
The task is to make a Fortran program that will read in a given set of data from a file, stopping when it reaches the end, and calculate the gradient and intercept of a best fit...