From: John Stone (johns_at_ks.uiuc.edu)
Date: Tue Oct 07 2008 - 11:46:41 CDT

Alexander,

On Sat, Oct 04, 2008 at 08:55:52AM +0500, Alexander A. Vakhrushev wrote:
[...]
> I have the following question: Windows version of VMD does not allow
> to load DCD trajectory file while it is being downloaded from remote
> host (in other words when file is of incomplete size). When I stop
> download even it was not finished everything goes OK. Linux version
> does not has such behaviour. Would you suggest any solutions?

The Windows version of the DCD plugin uses the Win32 binary file I/O
APIs, which have different limitations and semantics than the
read/write/seek calls on Unix. I believe the likely source of problems
is the code we're forced to use on Windows to determine the size of
large files (files larger than 4GB) since the Windows implementation of
the normal libc calls is not capable of dealing with such large files:

#if defined(_MSC_VER) && defined(FASTIO_NATIVEWIN32)
    /* the stat() call is not 64-bit savvy on Windows */
    /* so we have to use the fastio fseek/ftell routines for this */
    /* until we add a portable filesize routine for this purpose */
    fio_fseek(dcd->fd, 0, FIO_SEEK_END); /* seek to end of file */
    filesize = fio_ftell(dcd->fd);
    fio_fseek(dcd->fd, curpos, FIO_SEEK_SET); /* return to end of header */
#else
    filesize = stbuf.st_size; /* this works ok on Unix machines */
#endif

You could try writing another piece of code to query the file size
that behaves better with files that are in the process of being
appended to, but it's really somewhat of a questionable scenario to
attempt to load files that are in the process of being updated since
OSes handle these things a bit differently.

Cheers,
  John Stone
  vmd_at_ks.uiuc.edu

-- 
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