*******> Suggested Amber24 + AmberTools24 patches

 Apply patch in amber24_src directory as
        patch -p0 -N -r patch_rejects < suggested-amber24.patch


--- src/pmemd/src/mcres.F90
+++ src/pmemd/src/mcres.F90
@@ -948,6 +948,7 @@
     use timers_mod
     use state_info_mod
     use bintraj_mod
+    use, intrinsic :: ieee_arithmetic
 
     implicit none
 
@@ -1200,7 +1201,7 @@
                             pot_ene, nstep, virial, ekcmt, pme_err_est)
 #endif
              new_ene = pot_ene%total
-             if(isnan(new_ene) .or. new_ene > 999999999.0d0 .or. new_ene < -999999999.0d0) then
+             if(ieee_is_nan(new_ene) .or. new_ene > 999999999.0d0 .or. new_ene < -999999999.0d0) then
                  new_ene=999999999.0d0
              end if
              !write(0,*)"Ene:",new_ene-old_ene,acceptance_array(cyc_cnt), pot_ene%vdw_tot,pot_ene%elec_tot
--- AmberTools/src/rism/rism1d_c.F90
+++ AmberTools/src/rism/rism1d_c.F90
@@ -946,9 +946,7 @@
   function  solve3DRISM (this,ksave,progress,maxstep,tolerance) result (converged)
     use rism_util, only : polynomialInterpolation_progressive, freeUnit
     use constants, only : pi
-#ifdef __PGI
     use ieee_arithmetic, only : ieee_is_nan
-#endif
     implicit none
     type(rism1d), intent(inout) :: this
     integer, intent(in) ::  maxstep,ksave,progress
@@ -1040,11 +1038,7 @@
        ! isnan is not standard, but GNU doesn't support Fortran 2003's
        ! ieee_arithmetic until version 5. Intel 15 supports both; use
        ! the PGI define to enable the most support for old compilers.
-#ifdef __PGI
        if (ieee_is_nan(residual)) &
-#else
-       if (isnan(residual)) &
-#endif
           call rism_report_error( 'RXRISM: residual is NaN' )
 
        !................. screen outputting relaxation steps ..................
--- AmberTools/src/rism/rism3d_closure_c.F90
+++ AmberTools/src/rism/rism3d_closure_c.F90
@@ -2975,9 +2975,7 @@
 ! (incomplete & vvv slow) Ewald electrostatic forces 
   subroutine ewaldSumForce(this, ff, guv)
     use constants, only : PI, FOURPI
-#ifdef __PGI
     use ieee_arithmetic, only : ieee_is_nan
-#endif
     implicit none
     type(rism3d_potential), intent(inout) :: this !< potential object.
     _REAL_, intent(inout) :: ff(3, this%solute%numAtoms) !< Force array [kT/A].
@@ -3050,11 +3048,7 @@
                 
                 kforceSum = kforceSum + kforce * totalSolventCharge
                 
-#ifdef __PGI
                 if (ieee_is_nan(this%grid%waveVectors2(ig))) &
-#else
-                if (isnan(this%grid%waveVectors2(ig))) &
-#endif
                      print *, ig, this%grid%totalLocalPointsK, this%grid%waveVectors2(ig)
              end do
           end do
--- AmberTools/src/rism/rism3d_potential_c.F90
+++ AmberTools/src/rism/rism3d_potential_c.F90
@@ -490,9 +490,7 @@
   !! @param[in] boxVolume volume of the solvent box
   subroutine rism3d_potential_setcut_asympktolerance(this, asympKSpaceTolerance, boxVolume)
     use asympk_cut
-#ifdef __PGI
     use ieee_arithmetic, only : ieee_is_nan
-#endif
     implicit none
     type(rism3d_potential), intent(inout) :: this
     _REAL_, intent(in) :: asympKSpaceTolerance
@@ -506,11 +504,7 @@
       ! isnan is not standard, but GNU doesn't support Fortran 2003's
       ! ieee_arithmetic until version 5. Intel 15+ supports both; use
       ! the PGI define to enable the most support for old compilers.
-#ifdef __PGI
       if (ieee_is_nan(this%cut2_chlk)) then
-#else
-      if (isnan(this%cut2_chlk)) then
-#endif
          call rism_report_error('Could not converge k-space asymptotics cutoff.  '&
               //'Try using a smaller error tolerance or no cutoff.')
 
--- src/pmemd/src/extra_pnts_nb14.F90
+++ src/pmemd/src/extra_pnts_nb14.F90
@@ -3419,7 +3419,7 @@
                 (lcl_crd(2,1,frame_id)*rja(2) + rm(3)*rt(1))*cfz
         fd(2) = -(lcl_crd(2,1,frame_id)*rja(3) + rm(1)*rt(2))*cfx - rm(2)*rt(2)*cfy + &
                 (lcl_crd(2,1,frame_id)*rja(1) - rm(3)*rt(2))*cfz
-        fd(3) = (lcl_crd(2,1,frame_id)*rja(2) - rm(1)*rt(3))*cfx + &
+        fd(3) = (lcl_crd(2,1,frame_id)*rja(2) - rm(1)*rt(3))*cfx &
                 -(lcl_crd(2,1,frame_id)*rja(1) + rm(2)*rt(3))*cfy - rm(3)*rt(3)*cfz
         do m = 1, 3
           frc(m, j1) = frc(m, j1) + frc(m, j) - fb(m) - fc(m) - fd(m)
--- AmberTools/src/sander/qm2_extern_mrcc_module.F90 
+++ AmberTools/src/sander/qm2_extern_mrcc_module.F90
@@ -285,7 +285,7 @@
     if(mrcc_nml%nprintlog.ne.0) then
        nprintlogstep=nprintlogstep+1
        if(nprintlogstep.eq.mrcc_nml%nprintlog) then
-          write(inttochr,'(i256)') nstep
+          write(inttochr,'(i255)') nstep
           stat=system('cp '//trim(subdir)//logfile//' '&
                      //trim(subdir)//'step.'//trim(adjustl(inttochr))&
                      //'.'//logfile)
--- AmberTools/src/sebomd/se_etimer.F
+++ AmberTools/src/sebomd/se_etimer.F
@@ -18,15 +18,7 @@
 #ifdef MPI 
       tnow = mpi_wtime()
 #else
-#  ifdef __PGI
       call cpu_time(tnow)
-#  else
-#     if (__GNUC__ == 4 && __GNUC_MINOR__ <= 1)
-      tnow = second()
-#     else
-      tnow = 0.01*mclock()
-#     endif
-#  endif
 #endif
       if(first)then
          t0 = tnow
--- AmberTools/src/sander/softcore.F90
+++ AmberTools/src/sander/softcore.F90
@@ -77,6 +77,7 @@
 #ifdef MPI
     subroutine setup_sc(natom,nres,igraph,isymbl,ipres, &
          lbres,crd, ntypes, clambda, nstlim)
+      include 'mpif.h'
 
       integer, intent(in) :: natom, nres, ipres(*),ntypes, nstlim
       character(len=4), intent(in) :: igraph(*), isymbl(*), lbres(*)
@@ -267,6 +268,7 @@
 
 #ifdef MPI
     subroutine sc_change_clambda(clambda)
+      include 'mpif.h'
       
       _REAL_,intent(in) :: clambda
 
@@ -391,6 +393,7 @@
 
 #ifdef MPI
     subroutine sc_check_and_adjust_crd(natom, crd)
+      include 'mpif.h'
 
       ! Input variables
       integer, intent(in) :: natom
@@ -454,6 +457,7 @@
 !===================================================================================================
 
     subroutine sc_check_perturbed_molecules(nummols, molsiz)
+      include 'mpif.h'
 
       integer nummols,molsiz(*)
 
@@ -709,6 +713,7 @@
     subroutine sc_pscale(x,amass,nummols,molsiz,oldrecip,ucell)
       ! This subroutine is copied from ew_pscale, but includes master-to-master
       ! communication to get average center of masses for perturbed molecules
+      include 'mpif.h'
 
       _REAL_ x(3,*),amass(*)
       _REAL_ oldrecip(3,3),ucell(3,3)
@@ -792,6 +797,7 @@
 !===================================================================================================
 
     subroutine mix_temp_scaling(factor, v)
+      include 'mpif.h'
 
       _REAL_ factor, v(*), factor_sc
       _REAL_ factor_partner
@@ -824,6 +830,7 @@
 !===================================================================================================
 
     subroutine sc_mix_sum(sum)
+      include 'mpif.h'
 
       _REAL_ sum, sum_partner
 
@@ -927,6 +934,7 @@
 
 #ifdef MPI
     subroutine sc_mix_position(vcmx,vcmy,vcmz,clambda)
+      include 'mpif.h'
 
       _REAL_ vcmx,vcmy,vcmz,clambda
       _REAL_ vcm(3), vcm_partner(3)
@@ -958,6 +966,7 @@
 
 #ifdef MPI
     subroutine sc_mix_velocities(v, nr3)
+      include 'mpif.h'
 
       _REAL_ v(nr3),vcopy(nr3+3*extra_atoms)
       integer nr3, i
@@ -996,6 +1005,7 @@
 
 #ifdef MPI
     subroutine sc_sync_x(x,nr3)
+      include 'mpif.h'
       
       _REAL_ x(nr3), xpartner(nr3+3*extra_atoms)
       integer nr3, i
@@ -1022,6 +1032,7 @@
 
 #ifdef MPI
     subroutine sc_compare(x,nr3, tag)
+      include 'mpif.h'
       
       _REAL_ x(nr3), xpartner(nr3+3*extra_atoms)
       integer nr3, i
@@ -1198,6 +1209,7 @@
 
 #ifdef MPI
     subroutine calc_softcore_ekin(amass,v,vold,istart,iend)
+      include 'mpif.h'
 
       integer istart,iend
       _REAL_ amass(*), v(*), vold(*), sc_ekin
--- src/pmemd/src/gb_ene.F90
+++ src/pmemd/src/gb_ene.F90
@@ -2610,7 +2610,7 @@
                 end do
               end if
             end if
-          else if (XOR(i_is_sc, j_is_sc)) then !sc-c
+          else if (i_is_sc .OR. j_is_sc) then !sc-c
             eel = qiqj *intdiel_inv * sc_eel_denom_sqrt
             eelt = eelt + eel
             scdvdl = scdvdl + (eel * scbeta * ti_sign * sceeorderinv * &
@@ -2667,7 +2667,7 @@
                   end do
                 end if
               end if
-            else if (XOR(i_is_sc, j_is_sc)) then !sc-c
+            else if (i_is_sc .OR. j_is_sc) then !sc-c
               f6 = 1.0d0/(sc_vdw + r6 * ti_sigma6(ic))
               f12 = f6 * f6
               evdw = evdw + ti_foureps(ic) * ( f12 - f6)
