********>Bugfix 14:
Author: Ross Walker & Thomas Steinbrecher
Date: 07/01/2004

Programs: LEaP

Description: When checking a unit that has both initial and perturbed charges
             LEaP will incorrectly print a warning message implying that
             the perturbed charge is not zero when in fact it is.
             This is due to the checking routine not being updated to the
             new method of entering the perturbed charge in the form of the
             difference between the initial charge and the perturbed charge.

             This error simply involves the printing of perturbed charges.
             Although the warning is incorrect Leap still writes a correct
             prmtop file.

Fix:         save this file to bugfix.14
             cd $AMBERHOME
             patch -N -p0 -r rejects < bugfix.14

------------------------------------------------------------------------------
*** src/leap/src/leap/unit.c	2004-07-01 14:53:24.000000000 -0700
--- src/leap/src/leap/unit.c	2004-07-01 15:32:23.000000000 -0700
***************
*** 1803,1821 ****
  	(*iPWarnings)++;
      }
      if ( bPert == TRUE ) {
!     	dAbs = fabs(dPertCharge);
      	dFrac = fabs( dAbs - (double)(int)(dAbs+0.5) );
      	if ( dFrac > 0.01 ) {
  	    VP0(( 
  		"ERROR: The perturbed charge: %lf is not integral.\n",
! 		dPertCharge ));
  	    (*iPErrors)++;
      	}
  
!     	if ( fabs(dPertCharge) > 0.01 ) {
  	    VP0(( 
  		"WARNING: The perturbed charge: %lf is not zero.\n",
! 		dPertCharge ));
  	    (*iPWarnings)++;
      	}
      }
--- 1803,1825 ----
  	(*iPWarnings)++;
      }
      if ( bPert == TRUE ) {
!          /*Note dPertCharge now contains the delta perturbed charge rather than
!            the actual perturbed charge. In other words the perturbed charge is now
!            dCharge+dPertCharge
!          */
!     	dAbs = fabs(dCharge+dPertCharge);
      	dFrac = fabs( dAbs - (double)(int)(dAbs+0.5) );
      	if ( dFrac > 0.01 ) {
  	    VP0(( 
  		"ERROR: The perturbed charge: %lf is not integral.\n",
! 		(dCharge+dPertCharge) ));
  	    (*iPErrors)++;
      	}
  
!     	if ( fabs(dCharge+dPertCharge) > 0.01 ) {
  	    VP0(( 
  		"WARNING: The perturbed charge: %lf is not zero.\n",
! 		(dCharge+dPertCharge) ));
  	    (*iPWarnings)++;
      	}
      }
*** src/leap/src/leap/container.c	2004-07-01 15:44:27.000000000 -0700
--- src/leap/src/leap/container.c	2004-07-01 16:20:27.000000000 -0700
***************
*** 1149,1159 ****
      lAtoms = lLoop( (OBJEKT)cCont, ATOMS );
      while ( aAtom = (ATOM)oNext(&lAtoms) ) {
          (*dPCharge) += dAtomCharge(aAtom);
!         if ( bAtomPerturbed(aAtom) ) {
!             (*dPPertCharge) += dAtomPertCharge(aAtom);
!         } else {
!             (*dPPertCharge) += dAtomCharge(aAtom);
!         }
      }
  }
  
--- 1149,1155 ----
      lAtoms = lLoop( (OBJEKT)cCont, ATOMS );
      while ( aAtom = (ATOM)oNext(&lAtoms) ) {
          (*dPCharge) += dAtomCharge(aAtom);
!         (*dPPertCharge) += dAtomPertCharge(aAtom);
      }
  }
  
*** src/leap/src/leap/commands.c	2004-07-01 15:29:11.000000000 -0700
--- src/leap/src/leap/commands.c	2004-07-01 15:31:39.000000000 -0700
***************
*** 2872,2878 ****
  
      ContainerTotalCharge( cCont, &dCharge, &dPertCharge );
      VP0(( "Total unperturbed charge: %6.4lf\n", dCharge ));
!     VP0(( "Total perturbed charge:   %6.4lf\n", dPertCharge ));
  
      return(NULL);
  }
--- 2872,2879 ----
  
      ContainerTotalCharge( cCont, &dCharge, &dPertCharge );
      VP0(( "Total unperturbed charge: %6.4lf\n", dCharge ));
!     /*dPertCharge is now the delta of the charge and not the actual perturbed charge*/
!     VP0(( "Total perturbed charge:   %6.4lf\n", (dCharge+dPertCharge) ));
  
      return(NULL);
  }
------------------------------------------------------------------------------

Temporary workarounds: Ignore the warnings and manually check the perturbed
charge yourself.