:78 Function create_function() is deprecated [8192]

Rewrite logical statements to comply with presence or not of optional arguments.

Bruno Mundim [2017-01-02 22:08:35]
Rewrite logical statements to comply with presence or not of optional arguments.
Filename
src/ext/lclist.f90
diff --git a/src/ext/lclist.f90 b/src/ext/lclist.f90
index cfb0a4e..ef54e11 100644
--- a/src/ext/lclist.f90
+++ b/src/ext/lclist.f90
@@ -438,7 +438,21 @@ contains
     ! (2) check distance do the periodic images of the central atom:

     nnb_tot = 0
-    if ( (.not. present(itype)) .or. (atomType(iatom) == itype)) then
+    ! BCM: Replace convoluted and wrong logic below for the following one:
+    if (present(itype)) then
+       if (atomType(iatom) == itype) then
+          aux_logic = .True.
+       else
+          aux_logic = .False.
+       end if
+    else
+       aux_logic = .True.
+    end if
+    if ( aux_logic ) then
+    ! BCM: Fortran is not C! Compiler is free to evaluate statements in any
+    ! order.
+    !if ( (.not. present(itype)) .or. (atomType(iatom) == itype)) then
+    ! BCM: done!
        do iT = 1, nTvecs
           if (TvecLen(iT) > Rc) exit
           nnb_tot = nnb_tot + 2
@@ -542,6 +556,7 @@ contains
     integer                                           :: iat, iT, sgn
     double precision                                  :: Rc, Rc2, dist2
     double precision, dimension(3)                    :: coo1, coo2, cart
+    logical                                           :: aux_logic = .True.

     if (.not. isInit) then
        write(0,*) "Error: module not initialized in `nbdist'."
@@ -575,7 +590,21 @@ contains
     ! (2) check distance do the periodic images of the central atom:

     nnb_tot = 0
-    if ( (.not. present(itype)) .or. (atomType(iatom) == itype)) then
+    ! BCM: Replace convoluted and wrong logic below for the following one:
+    if (present(itype)) then
+       if (atomType(iatom) == itype) then
+          aux_logic = .True.
+       else
+          aux_logic = .False.
+       end if
+    else
+       aux_logic = .True.
+    end if
+    if ( aux_logic ) then
+    ! BCM: Fortran is not C! Compiler is free to evaluate statements in any
+    ! order.
+    !if ( (.not. present(itype)) .or. (atomType(iatom) == itype)) then
+    ! BCM: done!
        do iT = 1, nTvecs
           if (TvecLen(iT) > Rc) exit
           nnb_tot = nnb_tot + 2
ViewGit