********>Bugfix 21: Author: Dave Case, (originally from Ilyas) Date: June 2, 2009 Programs: molsurf Description: A buried atom assertion can be triggered by numerical noise; this patch avoids that Use this patch to update amber10/src/mm_pbsa/molsurf.c ------------------------------------------------------------------------------ *** molsurf.c 2 Jun 2008 22:15:47 -0000 10.1 --- molsurf.c 17 Sep 2008 10:47:50 -0000 10.2 *************** *** 1030,1036 **** POINT t_ij, t_ik, t_diff; REAL_T b_factor, h_ijk, xtest; REAL_T w_ijk, w_sin, r_pk2; ! REAL_T sarg1, sarg2; POINT b_ijk, r_ib; void cross (); int i; --- 1030,1036 ---- POINT t_ij, t_ik, t_diff; REAL_T b_factor, h_ijk, xtest; REAL_T w_ijk, w_sin, r_pk2; ! REAL_T sarg1, sarg2, check1, check2, check3, check4; POINT b_ijk, r_ib; void cross (); int i; *************** *** 1050,1056 **** } sarg1 = (ai->rad + aj->rad + probe_diam) * (ai->rad + aj->rad + ! probe_diam) - d_ij * d_ij; sarg2 = d_ij * d_ij - (ai->rad - aj->rad) * (ai->rad - aj->rad); assert( sarg1 >= 0.0 ); assert( sarg2 >= 0.0 ); --- 1050,1065 ---- } sarg1 = (ai->rad + aj->rad + probe_diam) * (ai->rad + aj->rad + ! probe_diam) - d_ij * d_ij; ! /* For rounding to 6 decimal points in case sarg1 < 0 */ ! if(sarg1 < 0){ ! check1 = sarg1; ! check2 = 0; ! check3 = fabs(modf( check1 * 1000000, &check2)); ! check4 = (floor(check1 * 1000000) + (check3 < 0.5 ? 1 : 0 ))/1000000; ! sarg1 = check4; ! } ! sarg2 = d_ij * d_ij - (ai->rad - aj->rad) * (ai->rad - aj->rad); assert( sarg1 >= 0.0 ); assert( sarg2 >= 0.0 ); ------------------------------------------------------------------------------ Temporary Workarounds: None