********> bugfix.81 Author: Bill Ross Date: 2/2/97 Programs: Sander Severity: Moderate Problem: Problem: when the product of the number of atoms in the 2 largest residues is greater than 6 * the total atoms in the system, the program is likely to crash if the program was compiled with dynamic memory allocation (the default for non-parallel versions); or, if NOESY volume or chemical shift restraints are being used (NMRMAX > 1), wrong results might be given. Affects: Systems with small numbers of atoms in relation to residue sizes. For residues of ~30 atoms, this would mean approximately less than 150 atoms. Cause: The inter-residue distances scratch area at the end of the basic part of the array of real numbers was not sized large enough; with dynamic memory allocation using NMRMAX<2, the program attempts to write beyond the end of the array, causing either an immediate segementation fault in RESNBA or corruption of other data leading to other forms of crashing. With static dimensioning, the odds are very much in favor of the real array being dimensioned larger than necessary, so the overflow would likely not be detected. Since the area beyond the end of this scratch segment of the real array is used for the (seldom-used) NOESY calculations, if this option is chosen and the relative sizes of the residues to the system is as described above, the NOESY area will be overwritten with erroneous data both with dynamic and static dimensioning. Fix: Make the following change to locmem.f: --------------------------------------------------------------------------- *** OLD locmem.f --- NEW locmem.f *************** *** 209,215 **** L90 = L85 + 3*natom L95 = L90 + natom L100 = L95 + MAX(3*LMXRS,9*natom + MXVAR) ! L105 = L100 + 6 *(natom + MXVAR) if (irmarc.ge.2) then L110 = L105 + MXSUB*ISUBR L115 = L110 + 3*natom + MXVAR --- 209,215 ---- L90 = L85 + 3*natom L95 = L90 + natom L100 = L95 + MAX(3*LMXRS,9*natom + MXVAR) ! L105 = L100 + MAX(LMXRS, 6 *(natom + MXVAR)) if (irmarc.ge.2) then L110 = L105 + MXSUB*ISUBR L115 = L110 + 3*natom + MXVAR --------------------------------------------------------------------------- Temporary workarounds: none --