gfortran

gfortran debugging with gdb: w_powf.c: No such file or directory

风格不统一 提交于 2019-12-02 21:26:28
问题 I have a Fortran program I am debuging. I have a list of varables and one of the expected variables is almost double its expected value. So I compiled the program, with debug flags, and commenced debugging: the program name is hfock $gdb hfock (gdb) break hfock (gdb) run Starting program: /home/e/Desktop/hfock hfock Breakpoint 1, hfock () at hfock.f:16 16 ZETA1 = 2.173171 (gdb) s 17 ZETA2 = 1.188530 (gdb) s 18 WRITE (*, '( "Zeta1:", F7.4 / "Zeta2:", F7.4 )' ) ZETA1, ZETA2 (gdb) s Zeta1: 2

Type * error in gfortran

对着背影说爱祢 提交于 2019-12-02 17:58:00
问题 When I run my code I get the following error for all the statements that have the following format. Is there any problem with the type statement? If yes kindly provide me with a solution. I running my code on a Ubuntu 14.10 system. The program is very long hence I am not posting it now however if required I can surely send it. recfunk_ascii.f:622.12: type *,'enter back-azimuth limits ib1,ib2 (integers!)' 1 Error: Invalid character in name at (1) 回答1: Type is an obsolete and completely non

Why does using command PRINT in Fortran overwrite the input file?

元气小坏坏 提交于 2019-12-02 17:15:57
问题 I'm writing my code and using input and output feature in Fortran. The code looks like this ( only for simplification ): PROGRAM TEST REAL, DIMENSION(1000):: A REAL:: B INTEGER::T !Defining input and output OPEN(UNIT=1, FILE='input.dat', STATUS='OLD') OPEN(UNIT=2, FILE='output.dat', STATUS='NEW') !Reading from file "input.dat" READ(1,*) (A(I),I=1,1000) !Just for initial condition B=0.0 DO T=1, 10 PRINT *, 'Step =', T DO I=1, 1000 B=B+1.0 A(I)=A(I)/B END DO END DO !Writing results into file

Understanding the backtrace error in fortran

时间秒杀一切 提交于 2019-12-02 16:13:21
问题 I get the following error when I execute a fortran code compiled with gfortran . The error is followed by a backtrace for this error pointing to memory locations. Program received signal SIGSEGV: Segmentation fault - invalid memory reference. Backtrace for this error: #0 0x2b2f8e39da2d in ??? #1 0x2b2f8e39cc63 in ??? #2 0x311823256f in ??? #3 0x311827a7be in ??? #4 0x2b2f8e39cff2 in ??? #5 0x2b2f8e4adde6 in ??? #6 0x2b2f8e4ae047 in ??? #7 0x2b2f8e4a62d7 in ??? #8 0x40482a in instrument_ at

How to create functions in Fortran?

心已入冬 提交于 2019-12-02 13:53:10
问题 I'm sure the solution to this is extremely basic, but I'm having a hard time figuring out how to use functions in Fortran. I have the following simple program: PROGRAM main IMPLICIT NONE INTEGER :: a,b a = 3 b = 5 PRINT *,funct(a,b) END PROGRAM FUNCTION funct(a,b) IMPLICIT NONE INTEGER :: funct INTEGER :: a,b funct = a + b END FUNCTION I've tried several variations of this, including assigning a data type before FUNCTION, assigning the result of funct to another variable in the main program

fortran 95 rounding up on it's own

房东的猫 提交于 2019-12-02 12:31:33
问题 I decided to learn the fortran95 language (reason why is not important). However being a beginner I ran into a weird problem I really can't explain, therefor I need help. I have the insertion sort algorithm: subroutine insertion_sort_REAL4(array, array_len) implicit none !parameners integer :: array_len real (kind=4), dimension(array_len) :: array !variables integer :: i,key,hole_pos do i = 0,array_len key = array(i) hole_pos = i; do while ((hole_pos > 0.0) .and. (key < array(hole_pos - 1)))

Fortran non advancing reading of a text file

只谈情不闲聊 提交于 2019-12-02 12:29:50
I have a text file with a header of information followed by lines with just numbers, which are the data to be read. I don't know how many lines are there in the header, and it is a variable number. Here is an example: filehandle: 65536 total # scientific data sets: 1 file description: This file contains a Northern Hemisphere polar stereographic map of snow and ice coverage at 1024x1024 resolution. The map was produced using the NOAA/NESDIS Interactive MultisensorSnow and Ice Mapping System (IMS) developed under the directionof the Interactive Processing Branch (IPB) of the Satellite Services

Problems with parametrized derived types in Fortran 2003

吃可爱长大的小学妹 提交于 2019-12-02 12:27:48
问题 I'm teaching myself Fortran 2003 to use for a research project I'm currently working on. I'm used to Fortran 90, but this project requires the use of parametrized types, and so I'm moving on to 2003. I was following this site's description of how to define a parametrized type, and wrote a very simple example program based on the site's example to test it out: module example implicit none type :: param_matrix(k,a,b) integer, kind :: k integer, len :: a integer, len :: b real(kind=k), dimension

FORTRAN compiler warning: obsolete arithmetic IF statement

醉酒当歌 提交于 2019-12-02 11:44:26
I have a gfortran error: Warning: Obsolete: arithmetic IF statement at (1) What does this mean? In the source (old source): 66 s12 = max(epsilon, s1 + s2) c Then execution will go to label 13. Will this stop any further problems? if (s12 - 1.0) 13, 13, 12 13 z = s1 / s12 Arithmetic if is a peculiar feature of FORTRAN it works as follows. IF (expr) label1, label2, label3 If the value of the expression is less than 0, jump to label1 equal to 0, jump to label2 greater than 0, jump to label3 In newer FORTRAN standards this feature is obsolete In your code you can replace it with IF (s12 - 1.0 .gt.

`Allocatable array must have deferred shape` when moving from g95 to gfortran

℡╲_俬逩灬. 提交于 2019-12-02 11:02:34
问题 When transitioning from using the g95 compiler to gfortran I get the following error when I try to compile what previously had been a working code Error: Allocatable array ' ' at (1) must have a deferred shape This happens in all of my subroutines for all of my allocatable arrays. An example is below. SUBROUTINE TEST(name,ndimn,ntype,nelem,npoin,nface,inpoel,coord,face) IMPLICIT NONE integer:: i, j,testing integer, INTENT(OUT)::ndimn,ntype,nelem,npoin,nface integer, allocatable, dimension(1: