[gmx-users] open_xtc() returns zero

chris.neale at utoronto.ca chris.neale at utoronto.ca
Mon Mar 27 23:32:21 CEST 2006


I am trying to manipulate my XTC trajectory using a C program. I am having
difficulty getting open_xtc() to work. Specifically, fxtc=open_xtc(args[1],"r")
returns 0 (mentioned as an error in the online manual).

I am using gromacs-3.3 on intel linux.

I have attached my code.
I compile with:
gcc -o xtc_getmaxd xtc_getmaxd.c -I/home/cneale/gromacs-3.3/exec/include/gromacs
-L/home/cneale/gromacs-3.3/exec/lib -lgmx -lm

#include <stdio.h>
#include <stdlib.h>
#include "/home/cneale/gromacs-3.3/include/xtcio.h"

int main(int argn, char *args[]){
  int natoms,step,k,fxtc;
  real time,prec;
  matrix box;
  rvec **x;
  bool bOK;
  int k;
  if (argn!=2){
    exit(1);
  }

  if((fxtc=open_xtc(args[1],"r"))!=1){
    printf("error (main): unable to open xtc file %s for reading\n",args[1]);
    printf("              open_xtc() returned %d\n",fxtc);
    exit(1);
  }
  k=read_first_xtc(fxtc,&natoms,&step,&time,box,x,&prec,&bOK);
  if(k!=1){
    printf("error (main): read_first_xtc() returned error value (%d)\n",k);
    close_xtc(fxtc);
    exit(1);
  }

  close_xtc(fxtc);
} 

************************

I have also tried with the following includes:
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "typedefs.h"
#include "xdrf.h"
#include "gmxfio.h"
#include "xtcio.h"
#include "smalloc.h"
#include "vec.h"
#include "futil.h"
#include "fatal.h"

Thanks,
Chris Neale.




More information about the gromacs.org_gmx-users mailing list