Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

jsplugin.c File Reference

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

Go to the source code of this file.

Compounds

struct  jshandle

Defines

#define INFOMSGS   1
#define ENABLEJSSHORTREADS   1
#define VMDPLUGIN_STATIC
#define myintptrtype   unsigned long
#define M_PI_2   1.57079632679489661922
#define JSHEADERSTRING   "JS Binary Structure and Trajectory File Format"
#define JSMAGICNUMBER   0x31337
#define JSENDIANISM   0x12345678
#define JSMAJORVERSION   2
#define JSMINORVERSION   19
#define JSNFRAMESOFFSET   (strlen(JSHEADERSTRING) + 20)
#define JSNOERR   0
#define JSBADFILE   1
#define JSBADFORMAT   2
#define JSBLOCKIO_THRESH   50000
#define JSOPT_NOOPTIONS   0x00000000
#define JSOPT_TS_BLOCKIO   0x10000000
#define JSOPT_STRUCTURE   0x00000001
#define JSOPT_BONDS   0x00000002
#define JSOPT_BONDORDERS   0x00000004
#define JSOPT_ANGLES   0x00000008
#define JSOPT_CTERMS   0x00000010
#define JSOPT_OCCUPANCY   0x00000100
#define JSOPT_BFACTOR   0x00000200
#define JSOPT_MASS   0x00000400
#define JSOPT_CHARGE   0x00000800
#define JSOPT_RADIUS   0x00001000
#define JSOPT_ATOMICNUMBER   0x00002000

Functions

void * alloc_aligned_ptr (size_t sz, size_t blocksz, void **unalignedptr)
int read_js_timestep_pagealign_size (void *v, int *pagealignsz)
void js_blockio_check_and_set (jshandle *js)
void * open_js_read (const char *path, const char *filetype, int *natoms)
int js_calc_timestep_blocking_info (void *mydata)
int read_js_structure (void *mydata, int *optflags, molfile_atom_t *atoms)
int read_js_bonds (void *v, int *nbonds, int **fromptr, int **toptr, float **bondorder, int **bondtype, int *nbondtypes, char ***bondtypename)
int read_js_angles (void *v, int *numangles, int **angles, double **angleforces, int *numdihedrals, int **dihedrals, double **dihedralforces, int *numimpropers, int **impropers, double **improperforces, int *numcterms, int **cterms, int *ctermcols, int *ctermrows, double **ctermforces)
int read_js_timestep_index_offsets (void *v, int natoms, ptrdiff_t frameindex, int firstatom, int numatoms, fio_fd *directio_fd, ptrdiff_t *startoffset, ptrdiff_t *fileoffset, ptrdiff_t *readlen)
int read_js_timestep (void *v, int natoms, molfile_timestep_t *ts)
void close_js_read (void *v)
void * open_js_write (const char *path, const char *filetype, int natoms)
int write_js_structure (void *mydata, int optflags, const molfile_atom_t *atoms)
int write_js_bonds (void *mydata, int nbonds, int *fromptr, int *toptr, float *bondorder, int *bondtype, int nbondtypes, char **bondtypename)
int write_js_angles (void *v, int numangles, const int *angles, const double *angleforces, int numdihedrals, const int *dihedrals, const double *dihedralforces, int numimpropers, const int *impropers, const double *improperforces, int numcterms, const int *cterms, int ctermcols, int ctermrows, const double *ctermforces)
int write_js_timestep (void *v, const molfile_timestep_t *ts)
void close_js_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 ENABLEJSSHORTREADS   1
 

Definition at line 80 of file jsplugin.c.

#define INFOMSGS   1
 

Definition at line 77 of file jsplugin.c.

#define JSBADFILE   1
 

Definition at line 137 of file jsplugin.c.

#define JSBADFORMAT   2
 

Definition at line 138 of file jsplugin.c.

#define JSBLOCKIO_THRESH   50000
 

Definition at line 144 of file jsplugin.c.

Referenced by js_blockio_check_and_set.

#define JSENDIANISM   0x12345678
 

Definition at line 129 of file jsplugin.c.

Referenced by open_js_read, and open_js_write.

#define JSHEADERSTRING   "JS Binary Structure and Trajectory File Format"
 

Definition at line 127 of file jsplugin.c.

Referenced by open_js_read, and open_js_write.

#define JSMAGICNUMBER   0x31337
 

Definition at line 128 of file jsplugin.c.

Referenced by open_js_read, and open_js_write.

#define JSMAJORVERSION   2
 

Definition at line 131 of file jsplugin.c.

Referenced by open_js_read, open_js_write, and VMDPLUGIN_init.

#define JSMINORVERSION   19
 

Definition at line 132 of file jsplugin.c.

Referenced by open_js_write, and VMDPLUGIN_init.

#define JSNFRAMESOFFSET   (strlen(JSHEADERSTRING) + 20)
 

Definition at line 134 of file jsplugin.c.

Referenced by close_js_write.

#define JSNOERR   0
 

Definition at line 136 of file jsplugin.c.

#define JSOPT_ANGLES   0x00000008
 

Definition at line 162 of file jsplugin.c.

Referenced by read_js_structure, write_js_angles, and write_js_structure.

#define JSOPT_ATOMICNUMBER   0x00002000
 

Definition at line 171 of file jsplugin.c.

Referenced by read_js_structure, and write_js_structure.

#define JSOPT_BFACTOR   0x00000200
 

Definition at line 167 of file jsplugin.c.

Referenced by read_js_structure, and write_js_structure.

#define JSOPT_BONDORDERS   0x00000004
 

Definition at line 161 of file jsplugin.c.

Referenced by read_js_bonds, read_js_structure, write_js_bonds, and write_js_structure.

#define JSOPT_BONDS   0x00000002
 

Definition at line 160 of file jsplugin.c.

Referenced by read_js_bonds, read_js_structure, write_js_bonds, and write_js_structure.

#define JSOPT_CHARGE   0x00000800
 

Definition at line 169 of file jsplugin.c.

Referenced by read_js_structure, and write_js_structure.

#define JSOPT_CTERMS   0x00000010
 

Definition at line 163 of file jsplugin.c.

Referenced by read_js_structure, write_js_angles, and write_js_structure.

#define JSOPT_MASS   0x00000400
 

Definition at line 168 of file jsplugin.c.

Referenced by read_js_structure, and write_js_structure.

#define JSOPT_NOOPTIONS   0x00000000
 

Definition at line 148 of file jsplugin.c.

#define JSOPT_OCCUPANCY   0x00000100
 

Definition at line 166 of file jsplugin.c.

Referenced by read_js_structure, and write_js_structure.

#define JSOPT_RADIUS   0x00001000
 

Definition at line 170 of file jsplugin.c.

Referenced by read_js_structure, and write_js_structure.

#define JSOPT_STRUCTURE   0x00000001
 

Definition at line 159 of file jsplugin.c.

Referenced by read_js_structure, and write_js_structure.

#define JSOPT_TS_BLOCKIO   0x10000000
 

Definition at line 156 of file jsplugin.c.

Referenced by js_blockio_check_and_set, open_js_read, read_js_structure, read_js_timestep_pagealign_size, write_js_structure, and write_js_timestep.

#define M_PI_2   1.57079632679489661922
 

Definition at line 124 of file jsplugin.c.

Referenced by read_js_timestep, and write_js_timestep.

#define myintptrtype   unsigned long
 

Definition at line 106 of file jsplugin.c.

#define VMDPLUGIN_STATIC
 

Definition at line 83 of file jsplugin.c.


Function Documentation

void* alloc_aligned_ptr size_t    sz,
size_t    blocksz,
void **    unalignedptr
[static]
 

Definition at line 114 of file jsplugin.c.

Referenced by js_calc_timestep_blocking_info.

void close_js_read void *    v [static]
 

Definition at line 1464 of file jsplugin.c.

References jshandle::angles, jshandle::bondfrom, jshandle::bondorders, jshandle::bondto, jshandle::cterms, jshandle::dihedrals, jshandle::directio_enabled, jshandle::directio_fd, jshandle::directio_ucell_ptr, jshandle::fd, fio_fclose, jshandle::impropers, and jshandle::path.

Referenced by VMDPLUGIN_init.

void close_js_write void *    v [static]
 

Definition at line 2129 of file jsplugin.c.

References jshandle::angles, jshandle::bondfrom, jshandle::bondorders, jshandle::bondto, jshandle::cterms, jshandle::dihedrals, jshandle::directio_ucell_ptr, jshandle::fd, fio_fclose, fio_fseek, FIO_SEEK_END, FIO_SEEK_SET, fio_write_int32, jshandle::impropers, JSNFRAMESOFFSET, and jshandle::nframes.

Referenced by VMDPLUGIN_init.

void js_blockio_check_and_set jshandle   js [static]
 

Definition at line 248 of file jsplugin.c.

References jshandle::directio_block_size, JSBLOCKIO_THRESH, JSOPT_TS_BLOCKIO, MOLFILE_DIRECTIO_MIN_BLOCK_SIZE, jshandle::natoms, and jshandle::optflags.

Referenced by write_js_structure, and write_js_timestep.

int js_calc_timestep_blocking_info void *    mydata [static]
 

Definition at line 432 of file jsplugin.c.

References alloc_aligned_ptr, jshandle::directio_block_size, jshandle::directio_enabled, jshandle::directio_fd, jshandle::directio_ucell_blkbuf, jshandle::directio_ucell_ptr, jshandle::fd, fio_fseek, fio_ftell, FIO_SEEK_SET, fio_size_t, jshandle::natoms, jshandle::ts_crd_padsz, jshandle::ts_crd_sz, jshandle::ts_file_offset, jshandle::ts_ucell_padsz, jshandle::ts_ucell_sz, and jshandle::verbose.

Referenced by read_js_structure, write_js_structure, and write_js_timestep.

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

Definition at line 257 of file jsplugin.c.

References jshandle::directio_block_size, jshandle::directio_enabled, jshandle::directio_fd, jshandle::directio_pgsize_queried, jshandle::directio_ucell_blkbuf, jshandle::directio_ucell_ptr, jshandle::fd, FIO_DIRECT, fio_fclose, fio_fread, fio_open, FIO_READ, fio_read_int32, JSENDIANISM, JSHEADERSTRING, JSMAGICNUMBER, JSMAJORVERSION, JSOPT_TS_BLOCKIO, MOLFILE_DIRECTIO_MAX_BLOCK_SIZE, jshandle::natoms, jshandle::nframes, jshandle::optflags, jshandle::parsed_structure, jshandle::path, jshandle::reverseendian, swap4_aligned, jshandle::ts_crd_padsz, jshandle::ts_crd_sz, jshandle::ts_file_offset, jshandle::ts_ucell_padsz, jshandle::ts_ucell_sz, and jshandle::verbose.

Referenced by VMDPLUGIN_init.

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

Definition at line 1500 of file jsplugin.c.

References jshandle::directio_block_size, jshandle::directio_enabled, jshandle::directio_ucell_blkbuf, jshandle::directio_ucell_ptr, jshandle::fd, fio_open, FIO_WRITE, fio_write_int32, fio_write_str, JSENDIANISM, JSHEADERSTRING, JSMAGICNUMBER, JSMAJORVERSION, JSMINORVERSION, jshandle::natoms, jshandle::nframes, jshandle::parsed_structure, jshandle::ts_crd_padsz, jshandle::ts_crd_sz, jshandle::ts_file_offset, jshandle::ts_ucell_padsz, jshandle::ts_ucell_sz, and jshandle::with_unitcell.

Referenced by VMDPLUGIN_init.

int read_js_angles void *    v,
int *    numangles,
int **    angles,
double **    angleforces,
int *    numdihedrals,
int **    dihedrals,
double **    dihedralforces,
int *    numimpropers,
int **    impropers,
double **    improperforces,
int *    numcterms,
int **    cterms,
int *    ctermcols,
int *    ctermrows,
double **    ctermforces
[static]
 

Definition at line 1193 of file jsplugin.c.

References jshandle::angles, jshandle::cterms, jshandle::dihedrals, jshandle::impropers, jshandle::numangles, jshandle::numcterms, jshandle::numdihedrals, and jshandle::numimpropers.

Referenced by VMDPLUGIN_init.

int read_js_bonds void *    v,
int *    nbonds,
int **    fromptr,
int **    toptr,
float **    bondorder,
int **    bondtype,
int *    nbondtypes,
char ***    bondtypename
[static]
 

Definition at line 1117 of file jsplugin.c.

References jshandle::bondfrom, jshandle::bondorders, jshandle::bondto, JSOPT_BONDORDERS, JSOPT_BONDS, jshandle::nbonds, and jshandle::optflags.

Referenced by VMDPLUGIN_init.

int read_js_structure void *    mydata,
int *    optflags,
molfile_atom_t   atoms
[static]
 

Definition at line 501 of file jsplugin.c.

References jshandle::angles, molfile_atom_t::atomicnumber, molfile_atom_t::bfactor, jshandle::bondfrom, jshandle::bondorders, jshandle::bondto, molfile_atom_t::charge, jshandle::cterms, jshandle::dihedrals, jshandle::directio_block_size, jshandle::directio_enabled, jshandle::directio_fd, jshandle::directio_pgsize_queried, jshandle::fd, FIO_DIRECT, fio_fread, fio_fseek, fio_open, FIO_READ, fio_read_int32, FIO_SEEK_CUR, jshandle::impropers, js_calc_timestep_blocking_info, JSOPT_ANGLES, JSOPT_ATOMICNUMBER, JSOPT_BFACTOR, JSOPT_BONDORDERS, JSOPT_BONDS, JSOPT_CHARGE, JSOPT_CTERMS, JSOPT_MASS, JSOPT_OCCUPANCY, JSOPT_RADIUS, JSOPT_STRUCTURE, JSOPT_TS_BLOCKIO, molfile_atom_t::mass, MOLFILE_ATOMICNUMBER, MOLFILE_BFACTOR, MOLFILE_CHARGE, MOLFILE_DIRECTIO_MAX_BLOCK_SIZE, MOLFILE_MASS, MOLFILE_NOOPTIONS, MOLFILE_NOSTRUCTUREDATA, MOLFILE_OCCUPANCY, MOLFILE_RADIUS, name, jshandle::natoms, jshandle::nbonds, jshandle::numangles, jshandle::numcterms, jshandle::numdihedrals, jshandle::numimpropers, molfile_atom_t::occupancy, jshandle::optflags, jshandle::parsed_structure, jshandle::path, molfile_atom_t::radius, molfile_atom_t::resid, jshandle::reverseendian, swap2_aligned, swap4_aligned, and jshandle::verbose.

Referenced by read_js_timestep, read_js_timestep_index_offsets, and VMDPLUGIN_init.

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

Definition at line 1281 of file jsplugin.c.

References molfile_timestep_t::A, molfile_timestep_t::alpha, molfile_timestep_t::B, molfile_timestep_t::beta, molfile_timestep_t::C, molfile_timestep_t::coords, jshandle::directio_block_size, jshandle::directio_enabled, jshandle::directio_fd, jshandle::directio_ucell_blkbuf, jshandle::fd, fio_fread, fio_fseek, fio_readv, FIO_SEEK_CUR, fio_size_t, molfile_timestep_t::gamma, fio_iovec::iov_base, fio_iovec::iov_len, M_PI_2, MOLFILE_EOF, jshandle::natoms, jshandle::parsed_structure, read_js_structure, jshandle::reverseendian, swap4_aligned, swap8_aligned, jshandle::ts_crd_padsz, jshandle::ts_crd_sz, jshandle::ts_ucell_padsz, and jshandle::ts_ucell_sz.

Referenced by VMDPLUGIN_init.

int read_js_timestep_index_offsets void *    v,
int    natoms,
ptrdiff_t    frameindex,
int    firstatom,
int    numatoms,
fio_fd   directio_fd,
ptrdiff_t *    startoffset,
ptrdiff_t *    fileoffset,
ptrdiff_t *    readlen
[static]
 

Definition at line 1228 of file jsplugin.c.

References jshandle::directio_fd, fio_fd, fio_size_t, jshandle::parsed_structure, read_js_structure, jshandle::ts_crd_padsz, jshandle::ts_file_offset, and jshandle::ts_ucell_padsz.

int read_js_timestep_pagealign_size void *    v,
int *    pagealignsz
[static]
 

Definition at line 229 of file jsplugin.c.

References jshandle::directio_block_size, jshandle::directio_pgsize_queried, JSOPT_TS_BLOCKIO, and jshandle::optflags.

Referenced by VMDPLUGIN_init.

VMDPLUGIN_API int VMDPLUGIN_fini void   
 

Definition at line 2209 of file jsplugin.c.

References VMDPLUGIN_API, and VMDPLUGIN_SUCCESS.

VMDPLUGIN_API int VMDPLUGIN_init void   
 

Definition at line 2171 of file jsplugin.c.

References molfile_plugin_t::close_file_read, molfile_plugin_t::close_file_write, close_js_read, close_js_write, molfile_plugin_t::filename_extension, JSMAJORVERSION, JSMINORVERSION, MOLFILE_PLUGIN_TYPE, molfile_plugin_t::open_file_read, molfile_plugin_t::open_file_write, open_js_read, open_js_write, molfile_plugin_t::read_angles, molfile_plugin_t::read_bonds, read_js_angles, read_js_bonds, read_js_structure, read_js_timestep, read_js_timestep_pagealign_size, molfile_plugin_t::read_next_timestep, molfile_plugin_t::read_structure, molfile_plugin_t::read_timestep_pagealign_size, vmdplugin_ABIVERSION, VMDPLUGIN_API, VMDPLUGIN_SUCCESS, VMDPLUGIN_THREADSAFE, molfile_plugin_t::write_angles, molfile_plugin_t::write_bonds, write_js_angles, write_js_bonds, write_js_structure, write_js_timestep, molfile_plugin_t::write_structure, and molfile_plugin_t::write_timestep.

VMDPLUGIN_API int VMDPLUGIN_register void *    v,
vmdplugin_register_cb    cb
 

Definition at line 2204 of file jsplugin.c.

References VMDPLUGIN_API, vmdplugin_register_cb, and VMDPLUGIN_SUCCESS.

int write_js_angles void *    v,
int    numangles,
const int *    angles,
const double *    angleforces,
int    numdihedrals,
const int *    dihedrals,
const double *    dihedralforces,
int    numimpropers,
const int *    impropers,
const double *    improperforces,
int    numcterms,
const int *    cterms,
int    ctermcols,
int    ctermrows,
const double *    ctermforces
[static]
 

Definition at line 2010 of file jsplugin.c.

References jshandle::angles, jshandle::cterms, jshandle::dihedrals, jshandle::impropers, JSOPT_ANGLES, JSOPT_CTERMS, jshandle::numangles, jshandle::numcterms, jshandle::numdihedrals, jshandle::numimpropers, and jshandle::optflags.

Referenced by VMDPLUGIN_init.

int write_js_bonds void *    mydata,
int    nbonds,
int *    fromptr,
int *    toptr,
float *    bondorder,
int *    bondtype,
int    nbondtypes,
char **    bondtypename
[static]
 

Definition at line 1930 of file jsplugin.c.

References jshandle::bondfrom, jshandle::bondorders, jshandle::bondto, JSOPT_BONDORDERS, JSOPT_BONDS, jshandle::nbonds, jshandle::optflags, and jshandle::verbose.

Referenced by VMDPLUGIN_init.

int write_js_structure void *    mydata,
int    optflags,
const molfile_atom_t   atoms
[static]
 

Definition at line 1548 of file jsplugin.c.

References jshandle::angles, molfile_atom_t::atomicnumber, molfile_atom_t::bfactor, jshandle::bondfrom, jshandle::bondorders, jshandle::bondto, molfile_atom_t::charge, jshandle::cterms, jshandle::dihedrals, jshandle::directio_block_size, jshandle::fd, fio_fwrite, fio_write_int32, hash_destroy, hash_entries, hash_init, hash_insert, hash_lookup, jshandle::impropers, js_blockio_check_and_set, js_calc_timestep_blocking_info, JSOPT_ANGLES, JSOPT_ATOMICNUMBER, JSOPT_BFACTOR, JSOPT_BONDORDERS, JSOPT_BONDS, JSOPT_CHARGE, JSOPT_CTERMS, JSOPT_MASS, JSOPT_OCCUPANCY, JSOPT_RADIUS, JSOPT_STRUCTURE, JSOPT_TS_BLOCKIO, molfile_atom_t::mass, MOLFILE_ATOMICNUMBER, MOLFILE_BFACTOR, MOLFILE_CHARGE, MOLFILE_MASS, MOLFILE_NOSTRUCTUREDATA, MOLFILE_OCCUPANCY, MOLFILE_RADIUS, name, jshandle::natoms, jshandle::nbonds, jshandle::numangles, jshandle::numcterms, jshandle::numdihedrals, jshandle::numimpropers, molfile_atom_t::occupancy, jshandle::optflags, molfile_atom_t::radius, and molfile_atom_t::resid.

Referenced by VMDPLUGIN_init.

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

Definition at line 2047 of file jsplugin.c.

References molfile_timestep_t::A, molfile_timestep_t::alpha, molfile_timestep_t::B, molfile_timestep_t::beta, jshandle::blockpad, molfile_timestep_t::C, molfile_timestep_t::coords, jshandle::directio_block_size, jshandle::directio_ucell_blkbuf, jshandle::fd, fio_fwrite, fio_write_int32, molfile_timestep_t::gamma, js_blockio_check_and_set, js_calc_timestep_blocking_info, JSOPT_TS_BLOCKIO, M_PI_2, MOLFILE_DIRECTIO_MAX_BLOCK_SIZE, MOLFILE_ERROR, jshandle::nframes, jshandle::optflags, jshandle::ts_crd_padsz, jshandle::ts_crd_sz, jshandle::ts_ucell_padsz, and jshandle::ts_ucell_sz.

Referenced by VMDPLUGIN_init.


Variable Documentation

molfile_plugin_t plugin [static]
 

Definition at line 2167 of file jsplugin.c.


Generated on Thu Mar 28 03:08:26 2024 for VMD Plugins (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002