From: John Stone (johns_at_ks.uiuc.edu)
Date: Tue Feb 21 2006 - 09:53:55 CST

Hi Marco,
  It could be that you've got a mistake in your plugin that's
corrupting memory or something like that. Under normal circumstances,
read_next_timestep() is passed a NULL pointer only when VMD wants to
skip a trajectory frame. If you get a NULL pointer for ts, then you should
do whatever is necessary to skip that frame and seek or read past it to the
next one. Here's a tiny example of how your code should deal with this:

static int read_amber_cdf_timestep(void *mydata, int natoms, molfile_timestep_t
*ts) {
  cdfdata *cdf = (cdfdata *)mydata;
  amberdata *amber = &cdf->amber;
  int rc;

  /* Read in the atom coordinates and unit cell information */
  /* only save coords if we're given a valid ts pointer */
  /* otherwise VMD wants us to skip it. */
  if (ts != NULL) {
    /* read in the timestep */
    /* ........ */
  } else {
    /* skip the trajectory frame */
    /* ........ */
  }

  return MOLFILE_SUCCESS;
}

If this example doesn't help solve your problem, I'll be happy to take
a look at your plugin and give you some more specific suggestions.

  John Stone
  vmd_at_ks.uiuc.edu

On Tue, Feb 21, 2006 at 01:08:40PM +0000, Marco Kalweit wrote:
> Hello,
>
> I had written a vmd-molfile-plugin for reading my trajectory files.
> Generally, it is working fine. But now it crashed, because the pointer
> 'ts->coord' that was given to the 'read_next_timestep(...)'-function is
> zero. This happens at a 'random' time step, i e. for one input file, it
> happens on the same time step, but for another input file the time step
> differs.
>
> Even if I handle this case within the function, VMD crashes after the
> return.
>
> I wonder now, if the pointer 'ts->coord' is allowed to be zero, if 'ts'
> is non zero. Can it be that my plugin is responsible for this behaviour?
>
> Many thanks,
> Marco

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078