********> bugfix.49 Author: Bill Ross Date: 10/21/95 Programs: Leap Severity: Moderate Problem: Improper torsions in 'parm.dat' or 'frcmod' files: if a value is given for IDIVF (which Parm ignores for impropers), Leap will misread the whole line, shifting values to the wrong variables. Thus the throwaway idivf value would be used for PK (energy), the energy term (typically <50) would be used for PHASE instead of the correct phase of 180 degrees for impropers, and the phase would be used for PN (periodicity of the torsional barrier). The effect of this on a simulation is hard to predict, since it depends on the throwaway value used for IDIVF; 0 would be a likely choice, in which case the whole improper term would have no effect. Affects: dat/contrib/heme/frcmod.* and possibly user-supplied force field files. If one is using topology files for which the original parm.dat or frcmod files are unavailable to check, running the .top/.crd files through Anal with the amber41/ templates/anal.in will fail with a cryptic error like this, assuming 180 was used for the PHASE: DIHEDRAL ANGLE ERROR: 132 764 832 829 841 .0175 Cause: The original authors of Parm specified an extraneous number in the improper torsion term to be consistent with the proper torsion term, and the original author of Leap assumed the standard practice of omitting the unused number instead of following the spec exactly. Fix: Make the following change to amber.c: replace subroutine zAmberReadParmSetImpropers() with the following: ---------------------------------------------------------------------- /* * zAmberReadParmSetImpropers * * Read the improper torsion parameter terms. */ FUNC void zAmberReadParmSetImpropers( psParms, fIn ) PARMSET psParms; FILE* fIn; { STRING sLine; int iRead; STRING saStr[10]; double dDivisions, dKp, dP0, dN; int iN; BOOL bPrintLine; BEGIN while (1) { FGETS( sLine, fIn ); NODASHES(sLine); /* * get atoms & values, skipping possible * extraneous idivf value allowed by * the input spec for PARM */ iRead = sscanf( sLine, "%s %s %s %s", saStr[0], saStr[1], saStr[2], saStr[3] ); if ( iRead != 4 ) break; iRead = sscanf( sLine+15, "%lf %lf %lf", &dKp, &dP0, &dN ); if ( iRead != 3 ) break; MESSAGE(( "Read: %s\n", sLine )); dN = (int)floor(dN+0.5); zAmberConvertWildCard( saStr[0] ); zAmberConvertWildCard( saStr[1] ); zAmberConvertWildCard( saStr[2] ); zAmberConvertWildCard( saStr[3] ); iN = (int)dN; /* * check everything in case a format or other user error * led to wrong values, e.g. IDIVF offset */ bPrintLine = FALSE; if ( dKp <= 0.0 ) { VP0((" WARNING: expected Improper Torsion PK>0 (%f)\n", dKp )); bPrintLine = TRUE; } if ( dP0 < 179.999 || dP0 > 180.001 ) { VP0((" WARNING: expected Improper Torsion PHASE=180 (%f)\n", dP0 )); bPrintLine = TRUE; } if ( iN < 1 || iN > 6 ) { VP0((" WARNING: unexpected Improper Torsion PN term (%d)\n", iN )); bPrintLine = TRUE; } if ( bPrintLine ) VP0(( " Here is the Improper Torsion line in question:\n%s", sLine )); iParmSetAddImproperTerm( psParms, saStr[0], saStr[1], saStr[2], saStr[3], iN, dKp, dP0*DEGTORAD, "" ); } if ( iRead > 0 ) VP0(( "WARNING: incomplete Improper Torsion line:\n%s", sLine )); END } ---------------------------------------------------------------------- Temporary workarounds: Replace any numerical values for Improper Torsion IDIVF field with spaces in parm.dat, frcmod files. --