Re: AMBER: ptraj and netcdf with AmberTools1.2 ?

From: Dave Rogers <wantye.gmail.com>
Date: Wed, 5 Nov 2008 16:34:21 -0500

> Hi there,
>
> When updating from AmberTools 1.0 to 1.2 I discovered I could no
> longer read my binary trajectory files. Double checking this shows
> that compiling AT-1.0 ptraj works fine with respect to this, but
> AT-1.2 results in "could not open file".
>
> I use "./configure_at gcc" in both cases. I've tried this on two
> separate machines, with the same result on both. It seems to me that
> NetCDF compiles in both cases, and "make check" in
> $AMBERHOME/src/netcdf/src works fine as well in both cases (for AT-1.0
> and AT-1.2). Writing a binary trajectory file works on the other hand
> just fine (with AT1.2).

> Any clues ? Is it just me (or my settings), or is this a common problem?

> Thanks,
>
> Lars Skjaerven
> University of Bergen, Norway

I recently discivered this problem too. Output looked like so:
vvvvvvvvvvvvv output vvvvvvvvvvvvv
PTRAJ: Processing input from "STDIN" ...
trajin mdcrd

PTRAJ: trajin mdcrd
  Checking coordinates: mdcrd
trajin mdcrd ignored; could not open file (mdcrd)
^^^^^^^^^^^^^ output ^^^^^^^^^^^^^

grepping for "could not open file" in the ptraj directory showed
ptraj.c as the culprit:

------- ptraj.c lines 2067-2093 (GNU GPL >=2) --------
  /*
   * Check to see if the file specified by "filename" is a NetCDF file;
   * if it is NOT open the file in the regular manner...
   */

#ifdef BINTRAJ
  err = nc_open(filename, NC_NOWRITE, &ncid);
  if (err == NC_NOERR) {
    /*
     * this appears to be a NetCDF file so initialize necessary data
     */
    type = COORD_AMBER_NETCDF;
    NCInfo = (netcdfTrajectoryInfo *)
safe_malloc(sizeof(netcdfTrajectoryInfo));
INITIALIZE_netcdfTrajectoryInfo( NCInfo );
    NCInfo->ncid = ncid;
  } else
#endif

    err = openFile(&fp, filename, "r");
    if ( err == 0 ) {

      fprintf(stdout, "trajin %s ignored; could not open file (%s)\n",
filename, filename);
      safe_free(trajInfo->filename);
      safe_free(trajInfo);
      return NULL;

  }
--------------------------

This bit of code fails if NC_NOERR is zero!
So I added a block around the whole section after the #endif
patch (apply with)
patch ptraj.c <<EOF
--- old/ptraj.c 2008-07-16 19:40:29.000000000 -0400
+++ ptraj.c 2008-11-05 16:14:08.000000000 -0500
.. -2082,5 +2082,5 ..
   } else
 #endif
-
+ {
     err = openFile(&fp, filename, "r");
     if ( err == 0 ) {
.. -2090,5 +2090,5 ..
       safe_free(trajInfo);
       return NULL;
-
+ }
   }

EOF

~ David Rogers
PhD Candidate
Dr. Thomas L. Beck Lab
University of Cincinnati
-----------------------------------------------------------------------
The AMBER Mail Reflector
To post, send mail to amber.scripps.edu
To unsubscribe, send "unsubscribe amber" (in the *body* of the email)
      to majordomo.scripps.edu
Received on Fri Dec 05 2008 - 10:55:03 PST
Custom Search