********>Bugfix 12:
Author: Scott Brozell
Date: 08/17/06
Programs: Antechamber
Description: Files of type prepi or prepc with a length greater than 139
lines cause antechamber programs to fail. The -o output
file contains garbage. The standard output usually contains:
Info: the atom number exceeds the MAXATOM, reallocate memory automatically
Unrecognized atomic name , exit
Fix: apply the following patch to amber9/src/antechamber/prep.c *and* to
amber9/src/antechamber/parmchk.c
------------------------------------------------------------------------------
*** prep.c 3 Apr 2006 23:34:26 -0000 9.0
--- prep.c 18 Aug 2006 05:02:19 -0000
***************
*** 38,48 ****
if (fgets(line, 150, fpin) == NULL)
break;
i++;
- if (i > (*cinfo).maxatom + 11) {
- printf
- ("\nInfo: the atom number exceeds the MAXATOM, reallocate memory automatically");
- overflow_flag = 1;
- }
if (i == 5) {
sscanf(line, "%s", tmpchar);
(*minfo).resname[0] = tmpchar[0];
--- 38,43 ----
***************
*** 61,70 ****
if (strlen(line) == 1 && readindex == 3)
readindex = 4;
if (readindex == 1) {
sscanf(line, "%d%s%s%s%d%d%d%lf%lf%lf%lf", &tmpint1, tmpchar1,
tmpchar2, tmpchar3, &tmpint2, &tmpint3, &tmpint4,
! &tmpfloat1, &tmpfloat2, &tmpfloat3, &atm[i - 8].charge);
! number++;
if (i == 8) {
atm[0].x = 0.0;
atm[0].y = 0.0;
--- 56,74 ----
if (strlen(line) == 1 && readindex == 3)
readindex = 4;
if (readindex == 1) {
+ number++;
+ if (number - 3 > (*cinfo).maxatom ) {
+ printf("\nInfo: the atom number exceeds the MAXATOM,"
+ " reallocate memory automatically");
+ overflow_flag = 1;
+ }
+ double tmpcharge;
sscanf(line, "%d%s%s%s%d%d%d%lf%lf%lf%lf", &tmpint1, tmpchar1,
tmpchar2, tmpchar3, &tmpint2, &tmpint3, &tmpint4,
! &tmpfloat1, &tmpfloat2, &tmpfloat3, &tmpcharge);
! if (overflow_flag == 0) {
! atm[i - 8].charge = tmpcharge;
! }
if (i == 8) {
atm[0].x = 0.0;
atm[0].y = 0.0;
***************
*** 165,175 ****
if (fgets(line, 150, fpin) == NULL)
break;
i++;
- if (i > (*cinfo).maxatom + 11) {
- printf
- ("\nInfo: the atom number exceeds the MAXATOM, reallocate memory automatically");
- overflow_flag = 1;
- }
if (i == 5) {
sscanf(line, "%s", tmpchar);
(*minfo).resname[0] = tmpchar[0];
--- 169,174 ----
***************
*** 189,194 ****
--- 188,198 ----
readindex = 4;
if (readindex == 1) {
number++;
+ if (number - 3 > (*cinfo).maxatom) {
+ printf("\nInfo: the atom number exceeds the MAXATOM,"
+ " reallocate memory automatically");
+ overflow_flag = 1;
+ }
if (overflow_flag == 0) {
sscanf(line, "%d%s%s%s%lf%lf%lf%lf", &tmpint1, tmpchar1,
tmpchar2, tmpchar3, &tmpfloat1, &tmpfloat2,
*** parmchk.c 3 Apr 2006 23:34:26 -0000 9.0
--- parmchk.c 18 Aug 2006 05:17:59 -0000
***************
*** 3773,3780 ****
rmol2(ifilename, &atomnum, atom, &bondnum, bond_array, &cinfo,
&minfo, 1);
if (overflow_flag) {
! cinfo.maxatom = atomnum + 10;
! cinfo.maxbond = bondnum + 10;
free(atom);
free(bond_array);
atom = (ATOM *) malloc(sizeof(ATOM) * cinfo.maxatom);
--- 3773,3782 ----
rmol2(ifilename, &atomnum, atom, &bondnum, bond_array, &cinfo,
&minfo, 1);
if (overflow_flag) {
! cinfo.maxatom = (atomnum > cinfo.maxatom) ? atomnum : cinfo.maxatom;
! cinfo.maxbond = (bondnum > cinfo.maxbond) ? bondnum : cinfo.maxbond;
! cinfo.maxatom += 10; /* add some fudge */
! cinfo.maxbond += 10; /* add some fudge */
free(atom);
free(bond_array);
atom = (ATOM *) malloc(sizeof(ATOM) * cinfo.maxatom);
------------------------------------------------------------------------------
Temporary workarounds: use antechamber programs from Amber 8.