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
--
gmx-users mailing list    gmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
* Please search the archive at 
http://www.gromacs.org/Support/Mailing_Lists/Search before posting!
* Please don't post (un)subscribe requests to the list. Use the www interface or send it to gmx-users-requ...@gromacs.org.
* Can't post? Read http://www.gromacs.org/Support/Mailing_Lists

Reply via email to