Thanks for the answer, but I've given up all hope to call python from fortran. I remade my fortran program to be used with python. Took me the whole afternoon, far less than I expected, and the result was quite nice.
Python is quite a cool language to use with fortran. I wouldn't even think...
I have been trying to merge some python with fortran, to build a nice interface but still be fast. I spent the last two days learning how to use f2py, buy everything would be so much easier if I could call a Python function from Fortran instead of doing the other way around.
Anyone know how...
Taken from this site: http://elsa.berkeley.edu/sst/fmttop.html
Try also this site, for more details: http://www.cs.mtu.edu/~shene/COURSES/cs201/NOTES/chap05/format.html
Sorry, I did not understand how you could not simply put some code like
Open (Unit=1, File='File.dat')
Read(1,*)var1
Read(1,*)var2
.
.
.
Read(1,*)varn
Close (Unit=1)
Mainly because you already use some Write\Reads, if I'm guessing right. Maybe some allocatable array? Could you...
I fail to see where I was trying to open twice using the same unit. Could you show me more detailed? On the subject of the array of 20, I've put a few Ifs on Inserter to deal with that, but I'll make some research on Allocatables Arrays, it seems quite interesting.
.
.
.
200 Write (*,*)...
I have solved many issues on this program already, but new ones keep rising.
On this 'subprogram', when it goes into the third loop it can't get out. But it does open all files it should open
Program Lennard2
Implicit None
Double Precision...
When I use
i=1
Do While (i .LE. n)
Write (500,*) i,'.dat'
Write (501,*) 'mov',i,'.dat'
i=i+1
End
I'll have a file like this
1.dat
2.dat
3.dat
.
.
.
n.dat
When I read it with
i=1
Do While (i .LE. n)
Read (500,*) files(i)
Open (Unit=i,File=files)
i=i+1
EndDo
Will I get a array...
I've been thinking about this program (many thanks to emes) and tought thet I could do something like this
Subroutine Opener (n,i)
Implicit None
Integer n,i
Character (LEN=15) :: files
Open (unit=500,File='Files1.dat')
Open (unit=501,File='Files2.dat')
i=1
Do While (i .LE. n)
Write (500,*)...
Hello there. I've doing a program that I do not know how many files will be needed, because it'll depend on user's choice. So, how to name them?
I tought that a command like, where n is a user-input number
Do While (i .LE. n)
Open (Unit=i, File=i'.dat')
i=i+1
EndDo
Would be enough, but I...
No, I didn't know of this command. It seems quite interesting. And you right. Segfault is as scary as hell.
I most certainly did! But I whispered some of my codes to some IBM guy and he stole from me. At least he spent three years trying to understand them. :approve:
I could compile on both, Windows and Linux. I think gfortran didn't return errors because they are declared on the subroutine, but are not called. That's why the segfault. The subroutine was trying to access variables which it was not entitled to.
Indeed, it is a great idea. In this case, windows' version should not have worked. If I hadn't the linux problem, I would have never noticed my mistake. I'm not using libraries yet. But I guess it would that idea even better.
When I run a program on Ubuntu (10.04 x64) I receive a warning of segmentation fault. But when on windows (seven, x64), I do not receive this error. This program was compiled with gfortran on both systems. Any ideas why?
Program Lennard
Implicit None
Double Precision...
I've made a program that uses more than 72 characters per line. When I try to compile it on gfortran, using -ffixed-line-length-n, it returns several errors, all of them derived from a line truncated at the very beggining. How can I compile it or untruncate the line?
The code is as follows...