AMBER Archive (2006)Subject: AMBER: proposed patch for ptraj/evec.c (Amber 9.0)
From: Cameron Abrams (cfa22_at_drexel.edu)
Date: Thu Sep 21 2006 - 12:26:35 CDT
Dear Amber Team:
In trying to use ptraj to perform quasi-harmonic analysis, I discovered
a limitation in ptraj/evec.c. When reading in the file of eigenvector
components (as part of a "projection" task, for example), the function
readEvecFile expects that of the two integers on the second line of the
file, the first takes up less than 5 characters. This is a problem if
the eigenvector has more than 9999 elements. A proposed patch for this
appears below.
Cheers,
Cameron
*** 107,126 ****
"WARNING in ptraj(), readEvecFile: error while reading
number of atoms\n");
return 1;
}
- if (sscanf(buffer, "%i", &(modinfo->navgelem)) != 1) {
- fprintf(stderr,
- "WARNING in ptraj(), readEvecFile: sscanf on coords failed\n");
- return 1;
- }
- tmpbuf = buffer + 5;
- if (sscanf(tmpbuf, "%i", &(modinfo->nvectelem)) != 1) {
- /*
- * For compatibility with quasih and nmode output
- */
- fprintf(stderr,
- "FYI: No value for nvectelem found in %s, assuming it is
navgelem\n", modinfo->name);
- modinfo->nvectelem = modinfo->navgelem;
- }
-
/*
* Allocate memory for avg, freq, evec
--- 107,122 ----
"WARNING in ptraj(), readEvecFile: error while reading
number of atoms\n");
return 1;
}
+ switch (sscanf(buffer,"%i %i", &(modinfo->navgelem),
&(modinfo->nvectelem))) {
+ case 0:
+ fprintf(stderr,
+ "WARNING in ptraj(), readEvecFile: sscanf on coords failed\n");
+ return 1;
+ case 1: /* assume the first was read in */
+ fprintf(stderr,
+ "FYI: No value for nvectelem found in %s, assuming it is
navgelem\n", modinfo->name);
+ modinfo->nvectelem = modinfo->navgelem;
+ break;
+ }
/*
* Allocate memory for avg, freq, evec
--
Cameron F Abrams, PhD
Assistant Professor
Department of Chemical and Biological Engineering
Drexel University
Philadelphia, Pennsylvania USA
(v) 215-895-2231 (f) 215-895-5837
-----------------------------------------------------------------------
The AMBER Mail Reflector
To post, send mail to amber_at_scripps.edu
To unsubscribe, send "unsubscribe amber" to majordomo_at_scripps.edu
|