abinit/doc/developers/debug_make_abiauty

150 lines
4.5 KiB
Plaintext

## How to make the abiauty script happy
After executing
make abiauty
in the src directory, one can get several types of messages.
However, they are not always very indicative of what should be corrected.
Here follows a set of hints to fix the problem identified by abiauty.
### SOME INFORMATION
The goal of abiauty is to indent correctly the lines inside the F90 source files of ABINIT.
In order to do this, the F90 source files must respect some rules.
It will be quite long to explain them. You can get a feeling by simply looking at existing files!
The script abiauty relies heavily on the structuration of the source file.
In particular, after a section where variables are declared, abiauty expects the following line:
! *************************************************************************
namely, a '!', then a blank, then 73 stars - copy it from here, it is the simplest.
In the above mentioned case, such a line was missing at the line 138 of the file *32_util/interpol3d.F90*,
preventing abiauty to understand the structure of the file.
More explicitly, here is the old section (that does not follow the abirules):
real(dp) :: d1,d2,d3
d1=one/nr1
And here is the new section (that follows the abirules):
real(dp) :: d1,d2,d3
! *************************************************************************
d1=one/nr1
### Questions
Q1: **How to debug ABINIT when he following diagnostic is obtained**
ERROR(66_paw/qijb_bk.F90):
found end statement at line 183 for '' subroutine '' instead of '' subroutine qijb_bk ''
Answer:
Simply, you have not mentioned the name of the routine at the "end subroutine statement".
So, in the routine name_of_routine.F90, replace:
end subroutine
by
end subroutine name_of_routine
Q2: **How to debug ABINIT when the following diagnostics are obtained**
ERROR(72_response/nstpaw3.F90):
found end statement at line 652 for '' if '' instead of '' do construct ''
ERROR(42_parser/instrng.F90):
found end statement at line 316 for '' subroutine instrng '' instead of '' do construct ''
Answer:
There are some fundamental limitations of the abiauty script, moreover accompanied
with a diagnostic that is of no help.
(1) abiauty cannot treat an "if" statement, followed by a conditional that is split on two lines,
with moreover, a comment at the end of the first line. E.g. it cannot treat:
if( conditional1 .and. & ! Here is a comment, that cannot be treated correctly by abiauty
& conditional2 ) then
You can choose between different possibilities avoid this problem:
! Here is a comment BEFORE the if
if( conditional1 .and. &
& conditional2 ) then
or
if( conditional1 .and. conditional2 ) then ! Here is a comment for the whole line
or
if( conditional1 .and. &
& conditional2 ) then ! Here is a comment for the split line
(2) in certain cases, abiauty cannot treat a "call" that appears immediately after a "if". E.g it cannot treat:
if (condition) call name_of_subroutine
You have to replace it by
if (condition) then
call name_of_subroutine
endif
(3) abiauty cannot treat a "enddo" that appears on the same line than another command thanks to a ";".
E.g. it cannot treate:
do ii=1,nn ; mm=mm+ii ; enddo
You have to replace it by
do ii=1,nn
mm=mm+ii
enddo
The indication of the line where the script realizes that there is a problem, is not the indication
of the line at which the problem occurs.
However, the abiauty script identifies also, earlier, that there is a problem with this line.
Typically, the two error messages appear:
ERROR(42_parser/instrng.F90):
semicolon found at line 102 with do statement
ERROR(42_parser/instrng.F90):
found end statement at line 103 for '' if '' instead of '' do construct ''
or
ERROR(42_parser/instrng.F90):
semicolon found at line 101 with do statement
ERROR(42_parser/instrng.F90):
found end statement at line 316 for '' subroutine instrng '' instead of '' do construct ''
Suggestion: examine first the 'semicolon found at line 102 with do statement' error message.
Q3: **How to debug ABINIT when the following diagnostic is obtained:**
ERROR(95_drive/timana.F90):
semicolon found at line 853 with case(1) statement
Answer:
Following the abirules, one should not have the following syntax:
case(xx) ; instruction
The instruction should instead appear in the line following the case condition:
case(xx)
instruction