[gmx-users] xtcio problem

Oliver Schillinger o.rusche at fz-juelich.de
Wed Sep 11 17:20:03 CEST 2013


Hi,

I have a piece of code in C that is supposed to write atom coordinates 
in xtc format. I want to use the xtcio functions from the gromacs 
library. I use open_xtc() and close_xtc() at the beginning and end of my 
code. Between them I have multiple calls to write_xtc(), one for each 
frame. I wrote a wrapper function to convert my own datatypes (see below).
Now I experience very weird behaviour: When I have up to 9 atoms of 
which I want to write the coordinates everything is fine (VMD can 
visualize the trajectory properly). From the 10th atom on the actual 
length of the xtc file is shorter than the one with less atoms and VMD 
has trouble interpreting its contents, i.e. it sets all coordinates to 
zero for all frames. So obviously something is really wrong here.
Does anyone have an idea what I am doing wrong?

Cheers,
Oliver



void write_frame(t_fileio * XTCfile, // pointer to open xtc file
                  float * r,          // coordinate vector of length
                  int natoms,         // number of atoms
                  float * L,          // cubical box length
                  int step,           // frame number
                  float time) {       // simulation time

     int dim = 3; // space dimensions

     matrix box = {{L[0], 0.0, 0.0},
                   {0.0, L[1], 0.0},
                   {0.0, 0.0, L[2]}}; // box vectors

     real prec  = 0.00001; // I don't get the purpose of this one

     // convert data from simple array to rvec[DIM] vectors used by gromacs
     rvec xrvec[natoms];
     int i, j;
     for (i=0; i < natoms; i++) {
         for (j=0; j < dim; j++)
             xrvec[i][j] = r[i*dim + j];
     }

     write_xtc(XTCfile, natoms, step, time, box, xrvec, prec);

}
-- 
Oliver Schillinger
Master's student

Forschungszentrum Juelich GmbH
52425 Juelich | Germany

Building 5.8v, Room 3010
Phone: 02461-61-9532

Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt



More information about the gromacs.org_gmx-users mailing list