Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

dcdplugin.c File Reference

#include "largefiles.h"
#include "fastio.h"
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include "endianswap.h"
#include "molfile_plugin.h"

Go to the source code of this file.

Compounds

struct  dcdhandle

Defines

#define M_PI_2   1.57079632679489661922
#define RECSCALE32BIT   1
#define RECSCALE64BIT   2
#define RECSCALEMAX   2
#define DCD_SUCCESS   0
#define DCD_EOF   -1
#define DCD_DNE   -2
#define DCD_OPENFAILED   -3
#define DCD_BADREAD   -4
#define DCD_BADEOF   -5
#define DCD_BADFORMAT   -6
#define DCD_FILEEXISTS   -7
#define DCD_BADMALLOC   -8
#define DCD_BADWRITE   -9
#define DCD_IS_XPLOR   0x00
#define DCD_IS_CHARMM   0x01
#define DCD_HAS_4DIMS   0x02
#define DCD_HAS_EXTRA_BLOCK   0x04
#define DCD_HAS_64BIT_REC   0x08
#define NFILE_POS   8L
#define NSTEP_POS   20L
#define READ(fd, buf, size)   fio_fread(((void *) buf), (size), 1, (fd))
#define WRITE(fd, buf, size)   fio_fwrite(((void *) buf), (size), 1, (fd))
#define CHECK_FREAD(X, msg)   if (X==-1) { return(DCD_BADREAD); }
#define CHECK_FEOF(X, msg)   if (X==0) { return(DCD_BADEOF); }

Functions

void print_dcderror (const char *func, int errcode)
int read_dcdheader (fio_fd fd, int *N, int *NSET, int *ISTART, int *NSAVC, double *DELTA, int *NAMNF, int **FREEINDEXES, float **fixedcoords, int *reverseEndian, int *charmm)
int read_charmm_extrablock (fio_fd fd, int charmm, int reverseEndian, float *unitcell)
int read_fixed_atoms (fio_fd fd, int N, int num_free, const int *indexes, int reverseEndian, const float *fixedcoords, float *freeatoms, float *pos, int charmm)
int read_charmm_4dim (fio_fd fd, int charmm, int reverseEndian)
int read_dcdstep (fio_fd fd, int N, float *X, float *Y, float *Z, float *unitcell, int num_fixed, int first, int *indexes, float *fixedcoords, int reverseEndian, int charmm)
int skip_dcdstep (fio_fd fd, int natoms, int nfixed, int charmm)
int write_dcdstep (fio_fd fd, int curframe, int curstep, int N, const float *X, const float *Y, const float *Z, const double *unitcell, int charmm)
int write_dcdheader (fio_fd fd, const char *remarks, int N, int ISTART, int NSAVC, double DELTA, int with_unitcell, int charmm)
void close_dcd_read (int *indexes, float *fixedcoords)
void * open_dcd_read (const char *path, const char *filetype, int *natoms)
int read_next_timestep (void *v, int natoms, molfile_timestep_t *ts)
void close_file_read (void *v)
void * open_dcd_write (const char *path, const char *filetype, int natoms)
int write_timestep (void *v, const molfile_timestep_t *ts)
void close_file_write (void *v)
VMDPLUGIN_API int VMDPLUGIN_init ()
VMDPLUGIN_API int VMDPLUGIN_register (void *v, vmdplugin_register_cb cb)
VMDPLUGIN_API int VMDPLUGIN_fini ()

Variables

molfile_plugin_t plugin


Define Documentation

#define CHECK_FEOF X,
msg       if (X==0) { return(DCD_BADEOF); }
 

Definition at line 115 of file dcdplugin.c.

Referenced by read_dcdheader.

#define CHECK_FREAD X,
msg       if (X==-1) { return(DCD_BADREAD); }
 

Definition at line 114 of file dcdplugin.c.

Referenced by read_dcdheader.

#define DCD_BADEOF   -5
 

Definition at line 90 of file dcdplugin.c.

Referenced by print_dcderror, and skip_dcdstep.

#define DCD_BADFORMAT   -6
 

Definition at line 91 of file dcdplugin.c.

Referenced by print_dcderror, read_dcdheader, read_dcdstep, and read_fixed_atoms.

#define DCD_BADMALLOC   -8
 

Definition at line 93 of file dcdplugin.c.

Referenced by print_dcderror, and read_dcdheader.

#define DCD_BADREAD   -4
 

Definition at line 89 of file dcdplugin.c.

Referenced by print_dcderror, read_charmm_4dim, read_charmm_extrablock, read_dcdstep, and read_fixed_atoms.

#define DCD_BADWRITE   -9
 

Definition at line 94 of file dcdplugin.c.

Referenced by print_dcderror, and write_dcdstep.

#define DCD_DNE   -2
 

Definition at line 87 of file dcdplugin.c.

Referenced by print_dcderror.

#define DCD_EOF   -1
 

Definition at line 86 of file dcdplugin.c.

Referenced by print_dcderror.

#define DCD_FILEEXISTS   -7
 

Definition at line 92 of file dcdplugin.c.

Referenced by print_dcderror.

#define DCD_HAS_4DIMS   0x02
 

Definition at line 99 of file dcdplugin.c.

Referenced by open_dcd_read, read_charmm_4dim, read_dcdheader, and skip_dcdstep.

#define DCD_HAS_64BIT_REC   0x08
 

Definition at line 101 of file dcdplugin.c.

Referenced by read_charmm_4dim, read_charmm_extrablock, read_dcdheader, read_dcdstep, read_fixed_atoms, and skip_dcdstep.

#define DCD_HAS_EXTRA_BLOCK   0x04
 

Definition at line 100 of file dcdplugin.c.

Referenced by open_dcd_read, open_dcd_write, read_charmm_extrablock, read_dcdheader, and skip_dcdstep.

#define DCD_IS_CHARMM   0x01
 

Definition at line 98 of file dcdplugin.c.

Referenced by open_dcd_write, read_charmm_4dim, read_charmm_extrablock, read_dcdheader, and skip_dcdstep.

#define DCD_IS_XPLOR   0x00
 

Definition at line 97 of file dcdplugin.c.

Referenced by open_dcd_write, and read_dcdheader.

#define DCD_OPENFAILED   -3
 

Definition at line 88 of file dcdplugin.c.

Referenced by print_dcderror.

#define DCD_SUCCESS   0
 

Definition at line 85 of file dcdplugin.c.

Referenced by print_dcderror, read_charmm_4dim, read_charmm_extrablock, read_dcdheader, read_dcdstep, read_fixed_atoms, skip_dcdstep, write_dcdheader, and write_dcdstep.

#define M_PI_2   1.57079632679489661922
 

Definition at line 59 of file dcdplugin.c.

Referenced by read_next_timestep, and write_timestep.

#define NFILE_POS   8L
 

Definition at line 104 of file dcdplugin.c.

Referenced by write_dcdstep.

#define NSTEP_POS   20L
 

Definition at line 105 of file dcdplugin.c.

Referenced by write_dcdstep.

#define READ fd,
buf,
size       fio_fread(((void *) buf), (size), 1, (fd))
 

Definition at line 108 of file dcdplugin.c.

Referenced by read_dcdheader.

#define RECSCALE32BIT   1
 

Definition at line 62 of file dcdplugin.c.

Referenced by read_charmm_4dim, read_charmm_extrablock, read_dcdheader, read_dcdstep, read_fixed_atoms, and skip_dcdstep.

#define RECSCALE64BIT   2
 

Definition at line 63 of file dcdplugin.c.

Referenced by read_charmm_4dim, read_charmm_extrablock, read_dcdheader, read_dcdstep, read_fixed_atoms, and skip_dcdstep.

#define RECSCALEMAX   2
 

Definition at line 64 of file dcdplugin.c.

Referenced by read_dcdstep.

#define WRITE fd,
buf,
size       fio_fwrite(((void *) buf), (size), 1, (fd))
 

Definition at line 111 of file dcdplugin.c.

Referenced by write_dcdheader, and write_dcdstep.


Function Documentation

void close_dcd_read int *    indexes,
float *    fixedcoords
[static]
 

Definition at line 832 of file dcdplugin.c.

Referenced by close_file_read.

void close_file_read void *    v [static]
 

Definition at line 1031 of file dcdplugin.c.

References close_dcd_read, dcdhandle::fd, fio_fclose, dcdhandle::fixedcoords, dcdhandle::freeind, dcdhandle::x, dcdhandle::y, and dcdhandle::z.

Referenced by VMDPLUGIN_init.

void close_file_write void *    v [static]
 

Definition at line 1136 of file dcdplugin.c.

References dcdhandle::fd, fio_fclose, dcdhandle::x, dcdhandle::y, and dcdhandle::z.

Referenced by VMDPLUGIN_init.

void* open_dcd_read const char *    path,
const char *    filetype,
int *    natoms
[static]
 

Definition at line 841 of file dcdplugin.c.

References dcdhandle::charmm, DCD_HAS_4DIMS, DCD_HAS_EXTRA_BLOCK, dcdhandle::delta, dcdhandle::fd, fio_fclose, fio_fd, fio_fseek, fio_ftell, fio_open, FIO_READ, FIO_SEEK_END, FIO_SEEK_SET, fio_size_t, dcdhandle::first, dcdhandle::fixedcoords, dcdhandle::freeind, dcdhandle::istart, dcdhandle::natoms, dcdhandle::nfixed, dcdhandle::nsavc, dcdhandle::nsets, print_dcderror, printf, read_dcdheader, dcdhandle::reverse, dcdhandle::setsread, dcdhandle::x, dcdhandle::y, and dcdhandle::z.

Referenced by VMDPLUGIN_init.

void* open_dcd_write const char *    path,
const char *    filetype,
int    natoms
[static]
 

Definition at line 1042 of file dcdplugin.c.

References dcdhandle::charmm, DCD_HAS_EXTRA_BLOCK, DCD_IS_CHARMM, DCD_IS_XPLOR, dcdhandle::fd, fio_fclose, fio_fd, fio_open, FIO_WRITE, dcdhandle::istart, dcdhandle::natoms, dcdhandle::nsavc, dcdhandle::nsets, print_dcderror, printf, dcdhandle::with_unitcell, write_dcdheader, dcdhandle::x, dcdhandle::y, and dcdhandle::z.

Referenced by VMDPLUGIN_init.

void print_dcderror const char *    func,
int    errcode
[static]
 

Definition at line 119 of file dcdplugin.c.

References DCD_BADEOF, DCD_BADFORMAT, DCD_BADMALLOC, DCD_BADREAD, DCD_BADWRITE, DCD_DNE, DCD_EOF, DCD_FILEEXISTS, DCD_OPENFAILED, DCD_SUCCESS, and printf.

Referenced by open_dcd_read, open_dcd_write, read_next_timestep, and write_timestep.

int read_charmm_4dim fio_fd    fd,
int    charmm,
int    reverseEndian
[static]
 

Definition at line 487 of file dcdplugin.c.

References DCD_BADREAD, DCD_HAS_4DIMS, DCD_HAS_64BIT_REC, DCD_IS_CHARMM, DCD_SUCCESS, fio_fd, fio_fread, fio_fseek, FIO_SEEK_CUR, RECSCALE32BIT, RECSCALE64BIT, and swap4_aligned.

Referenced by read_dcdstep.

int read_charmm_extrablock fio_fd    fd,
int    charmm,
int    reverseEndian,
float *    unitcell
[static]
 

Definition at line 419 of file dcdplugin.c.

References DCD_BADREAD, DCD_HAS_64BIT_REC, DCD_HAS_EXTRA_BLOCK, DCD_IS_CHARMM, DCD_SUCCESS, fio_fd, fio_fread, fio_fseek, FIO_SEEK_CUR, i, RECSCALE32BIT, RECSCALE64BIT, swap4_aligned, and swap8_aligned.

Referenced by read_dcdstep.

int read_dcdheader fio_fd    fd,
int *    N,
int *    NSET,
int *    ISTART,
int *    NSAVC,
double *    DELTA,
int *    NAMNF,
int **    FREEINDEXES,
float **    fixedcoords,
int *    reverseEndian,
int *    charmm
[static]
 

Definition at line 155 of file dcdplugin.c.

References CHECK_FEOF, CHECK_FREAD, DCD_BADFORMAT, DCD_BADMALLOC, DCD_HAS_4DIMS, DCD_HAS_64BIT_REC, DCD_HAS_EXTRA_BLOCK, DCD_IS_CHARMM, DCD_IS_XPLOR, DCD_SUCCESS, fio_fd, fio_fseek, FIO_SEEK_CUR, i, printf, READ, RECSCALE32BIT, RECSCALE64BIT, swap4_aligned, swap4_unaligned, and swap8_unaligned.

Referenced by open_dcd_read.

int read_dcdstep fio_fd    fd,
int    N,
float *    X,
float *    Y,
float *    Z,
float *    unitcell,
int    num_fixed,
int    first,
int *    indexes,
float *    fixedcoords,
int    reverseEndian,
int    charmm
[static]
 

Definition at line 523 of file dcdplugin.c.

References DCD_BADFORMAT, DCD_BADREAD, DCD_HAS_64BIT_REC, DCD_SUCCESS, fio_fd, fio_fread, fio_readv, fio_size_t, i, fio_iovec::iov_base, fio_iovec::iov_len, read_charmm_4dim, read_charmm_extrablock, read_fixed_atoms, RECSCALE32BIT, RECSCALE64BIT, RECSCALEMAX, and swap4_aligned.

Referenced by read_next_timestep.

int read_fixed_atoms fio_fd    fd,
int    N,
int    num_free,
const int *    indexes,
int    reverseEndian,
const float *    fixedcoords,
float *    freeatoms,
float *    pos,
int    charmm
[static]
 

Definition at line 451 of file dcdplugin.c.

References DCD_BADFORMAT, DCD_BADREAD, DCD_HAS_64BIT_REC, DCD_SUCCESS, fio_fd, fio_fread, i, RECSCALE32BIT, RECSCALE64BIT, and swap4_aligned.

Referenced by read_dcdstep.

int read_next_timestep void *    v,
int    natoms,
molfile_timestep_t   ts
[static]
 

Definition at line 950 of file dcdplugin.c.

References molfile_timestep_t::A, molfile_timestep_t::alpha, molfile_timestep_t::B, molfile_timestep_t::beta, molfile_timestep_t::C, dcdhandle::charmm, molfile_timestep_t::coords, dcdhandle::fd, dcdhandle::first, dcdhandle::fixedcoords, dcdhandle::freeind, molfile_timestep_t::gamma, i, j, M_PI_2, MOLFILE_EOF, MOLFILE_ERROR, dcdhandle::natoms, dcdhandle::nfixed, dcdhandle::nsets, print_dcderror, read_dcdstep, dcdhandle::reverse, dcdhandle::setsread, skip_dcdstep, dcdhandle::x, dcdhandle::y, and dcdhandle::z.

Referenced by VMDPLUGIN_init.

int skip_dcdstep fio_fd    fd,
int    natoms,
int    nfixed,
int    charmm
[static]
 

Definition at line 672 of file dcdplugin.c.

References DCD_BADEOF, DCD_HAS_4DIMS, DCD_HAS_64BIT_REC, DCD_HAS_EXTRA_BLOCK, DCD_IS_CHARMM, DCD_SUCCESS, fio_fd, fio_fseek, FIO_SEEK_CUR, RECSCALE32BIT, and RECSCALE64BIT.

Referenced by read_next_timestep.

VMDPLUGIN_API int VMDPLUGIN_fini void   
 

Definition at line 1176 of file dcdplugin.c.

References VMDPLUGIN_API, and VMDPLUGIN_SUCCESS.

VMDPLUGIN_API int VMDPLUGIN_init void   
 

Definition at line 1151 of file dcdplugin.c.

References close_file_read, molfile_plugin_t::close_file_read, close_file_write, molfile_plugin_t::close_file_write, molfile_plugin_t::filename_extension, MOLFILE_PLUGIN_TYPE, open_dcd_read, open_dcd_write, molfile_plugin_t::open_file_read, molfile_plugin_t::open_file_write, read_next_timestep, molfile_plugin_t::read_next_timestep, vmdplugin_ABIVERSION, VMDPLUGIN_API, VMDPLUGIN_SUCCESS, VMDPLUGIN_THREADSAFE, write_timestep, and molfile_plugin_t::write_timestep.

VMDPLUGIN_API int VMDPLUGIN_register void *    v,
vmdplugin_register_cb    cb
 

Definition at line 1171 of file dcdplugin.c.

References VMDPLUGIN_API, vmdplugin_register_cb, and VMDPLUGIN_SUCCESS.

int write_dcdheader fio_fd    fd,
const char *    remarks,
int    N,
int    ISTART,
int    NSAVC,
double    DELTA,
int    with_unitcell,
int    charmm
[static]
 

Definition at line 757 of file dcdplugin.c.

References DCD_SUCCESS, fio_fd, fio_write_int32, strncpy, and WRITE.

Referenced by open_dcd_write.

int write_dcdstep fio_fd    fd,
int    curframe,
int    curstep,
int    N,
const float *    X,
const float *    Y,
const float *    Z,
const double *    unitcell,
int    charmm
[static]
 

Definition at line 711 of file dcdplugin.c.

References DCD_BADWRITE, DCD_SUCCESS, fio_fd, fio_fseek, fio_fwrite, FIO_SEEK_END, FIO_SEEK_SET, fio_write_int32, NFILE_POS, NSTEP_POS, and WRITE.

Referenced by write_timestep.

int write_timestep void *    v,
const molfile_timestep_t   ts
[static]
 

Definition at line 1100 of file dcdplugin.c.

References molfile_timestep_t::A, molfile_timestep_t::alpha, molfile_timestep_t::B, molfile_timestep_t::beta, molfile_timestep_t::C, dcdhandle::charmm, molfile_timestep_t::coords, dcdhandle::fd, molfile_timestep_t::gamma, i, dcdhandle::istart, M_PI_2, MOLFILE_ERROR, dcdhandle::natoms, dcdhandle::nsavc, dcdhandle::nsets, print_dcderror, dcdhandle::with_unitcell, write_dcdstep, dcdhandle::x, dcdhandle::y, and dcdhandle::z.

Referenced by VMDPLUGIN_init.


Variable Documentation

molfile_plugin_t plugin [static]
 

Definition at line 1149 of file dcdplugin.c.


Generated on Tue Aug 21 02:53:02 2018 for VMD Plugins (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002