#include "largefiles.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <math.h>
#include <errno.h>
#include "molfile_plugin.h"
#include "periodic_table.h"
#include "vmdconio.h"
#include <expat.h>
Go to the source code of this file.
Compounds | |
struct | hoomd_data_t |
Defines | |
#define | THISPLUGIN plugin |
#define | HOOMD_FORMAT_MAJV 1 |
#define | HOOMD_FORMAT_MINV 4 |
#define | SMALL 1.0e-7f /*! arbitrary small number. "almost zero" */ |
#define | HOOMD_NONE 0 /**< undefined */ |
#define | HOOMD_XML 1 /**< toplevel tag */ |
#define | HOOMD_CONFIG 2 /**< timestep tag */ |
#define | HOOMD_BOX 3 /**< box dimensions tag */ |
#define | HOOMD_POS 4 /**< coordinates tag */ |
#define | HOOMD_IMAGE 5 /**< image counter tag */ |
#define | HOOMD_VEL 6 /**< velocities tag */ |
#define | HOOMD_TYPE 7 /**< atom type tag */ |
#define | HOOMD_BODY 8 /**< body number tag */ |
#define | HOOMD_MASS 9 /**< atom mass tag */ |
#define | HOOMD_CHARGE 10 /**< atom diameter tag */ |
#define | HOOMD_DIAMETER 11 /**< atom diameter tag */ |
#define | HOOMD_BOND 12 /**< bond section tag */ |
#define | HOOMD_ANGLE 13 /**< angle section tag */ |
#define | HOOMD_DIHEDRAL 14 /**< dihedral section tag */ |
#define | HOOMD_IMPROPER 15 /**< improper section tag */ |
#define | HOOMD_WALL 16 /**< wall description */ |
#define | HOOMD_COORD 17 /**< wall coordinate tag */ |
#define | HOOMD_ACCEL 18 /**< accelerations tag */ |
#define | HOOMD_ORIENT 19 /**< orientation tag */ |
#define | HOOMD_UNKNOWN 20 /**< unknown tag */ |
#define | HOOMD_NUMTAGS 21 /**< number of known tags */ |
#define | HOOMD_MAXDEPTH 5 |
#define | HOOMD_DEBUG 0 |
#define | PRINTERR (void)(0) |
#define | SAFE_FREE(ptr) free(ptr); ptr=NULL |
#define | SAFE_CALLOC(ptr, type, count) |
#define | XML_ATTR_COPY(a, n, k, v) |
#define | XML_UNK_ATTR(e, k, v) |
#define | SECTION_OPEN(tag, num) fprintf(data->fp, "<%s num=\"%d\">\n", hoomd_tag_name[tag], num) |
#define | SECTION_CLOSE(tag) fprintf(data->fp, "</%s>\n", hoomd_tag_name[tag]) |
#define | SECTION_WRITE_ATOMIC(tag, fmt, val) |
#define | HOOMD_CONV_POS(crd, box, p, i) |
Functions | |
void | make_lower (char *s) |
int | addstring (char ***list, const char *key) |
void | xml_new_tag (void *data, const XML_Char *elmt, const XML_Char **attr) |
void | xml_end_tag (void *data, const XML_Char *elmt) |
void | xml_data_block (void *data, const XML_Char *s, int len) |
void | xml_comment (void *data, const XML_Char *s) |
int | hoomd_parse_line (hoomd_data_t *data) |
void * | open_hoomd_read (const char *filename, const char *filetype, int *natoms) |
int | read_hoomd_structure (void *mydata, int *optflags, molfile_atom_t *atoms) |
int | read_hoomd_bonds (void *v, int *nbonds, int **fromptr, int **toptr, float **bondorder) |
int | read_hoomd_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_hoomd_timestep (void *mydata, int natoms, molfile_timestep_t *ts) |
void | close_hoomd_read (void *mydata) |
void * | open_hoomd_write (const char *filename, const char *filetype, int natoms) |
int | write_hoomd_structure (void *mydata, int optflags, const molfile_atom_t *atoms) |
int | write_hoomd_bonds (void *v, int nbonds, int *fromptr, int *toptr, float *bondorder) |
int | write_hoomd_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_hoomd_timestep (void *mydata, const molfile_timestep_t *ts) |
void | close_hoomd_write (void *mydata) |
VMDPLUGIN_API int | VMDPLUGIN_init () |
VMDPLUGIN_API int | VMDPLUGIN_register (void *v, vmdplugin_register_cb cb) |
VMDPLUGIN_API int | VMDPLUGIN_fini () |
Variables | |
const char * | hoomd_tag_name [HOOMD_NUMTAGS] |
molfile_plugin_t | plugin |
return | MOLFILE_SUCCESS |
|
Definition at line 162 of file hoomdplugin.c. Referenced by xml_end_tag, and xml_new_tag. |
|
Definition at line 157 of file hoomdplugin.c. Referenced by write_hoomd_structure, xml_data_block, xml_end_tag, and xml_new_tag. |
|
Definition at line 152 of file hoomdplugin.c. Referenced by write_hoomd_structure, xml_data_block, xml_end_tag, and xml_new_tag. |
|
Definition at line 156 of file hoomdplugin.c. Referenced by write_hoomd_structure, xml_data_block, xml_end_tag, and xml_new_tag. |
|
Definition at line 147 of file hoomdplugin.c. Referenced by write_hoomd_timestep, xml_end_tag, and xml_new_tag. |
|
Definition at line 154 of file hoomdplugin.c. Referenced by write_hoomd_structure, xml_data_block, xml_end_tag, and xml_new_tag. |
|
Definition at line 146 of file hoomdplugin.c. Referenced by close_hoomd_write, open_hoomd_write, write_hoomd_timestep, xml_end_tag, and xml_new_tag. |
|
Value: if (fabsf(box) > SMALL) { \ float tmp; \ tmp = floorf(crd / box + 0.5f); \ p = crd - tmp*box; \ i = (int) tmp; \ } else { \ p = crd; \ i = 0.0f; \ } |
|
Definition at line 161 of file hoomdplugin.c. Referenced by xml_end_tag, and xml_new_tag. |
|
Definition at line 233 of file hoomdplugin.c. |
|
Definition at line 155 of file hoomdplugin.c. Referenced by write_hoomd_structure, xml_data_block, xml_end_tag, and xml_new_tag. |
|
Definition at line 158 of file hoomdplugin.c. Referenced by write_hoomd_structure, xml_data_block, xml_end_tag, and xml_new_tag. |
|
hoomd file format version that this plugin supports. it will refuse to load file formats with higher major version and print a warning on higher minor version. written files will be in exactly this version. Definition at line 138 of file hoomdplugin.c. Referenced by open_hoomd_read, and open_hoomd_write. |
|
Definition at line 139 of file hoomdplugin.c. Referenced by open_hoomd_read, and open_hoomd_write. |
|
Definition at line 149 of file hoomdplugin.c. Referenced by write_hoomd_timestep, xml_data_block, xml_end_tag, and xml_new_tag. |
|
Definition at line 159 of file hoomdplugin.c. Referenced by write_hoomd_structure, xml_data_block, xml_end_tag, and xml_new_tag. |
|
Definition at line 153 of file hoomdplugin.c. Referenced by write_hoomd_structure, xml_data_block, xml_end_tag, and xml_new_tag. |
|
maximum XML element nesting level supported Definition at line 178 of file hoomdplugin.c. Referenced by xml_data_block. |
|
Definition at line 144 of file hoomdplugin.c. Referenced by xml_end_tag. |
|
Definition at line 165 of file hoomdplugin.c. Referenced by xml_end_tag, and xml_new_tag. |
|
Definition at line 163 of file hoomdplugin.c. Referenced by xml_end_tag, and xml_new_tag. |
|
Definition at line 148 of file hoomdplugin.c. Referenced by write_hoomd_timestep, xml_data_block, xml_end_tag, and xml_new_tag. |
|
Definition at line 151 of file hoomdplugin.c. Referenced by write_hoomd_structure, xml_data_block, xml_end_tag, and xml_new_tag. |
|
Definition at line 164 of file hoomdplugin.c. Referenced by xml_new_tag. |
|
Definition at line 150 of file hoomdplugin.c. Referenced by write_hoomd_timestep, xml_data_block, xml_end_tag, and xml_new_tag. |
|
Definition at line 160 of file hoomdplugin.c. Referenced by xml_end_tag, and xml_new_tag. |
|
Definition at line 145 of file hoomdplugin.c. Referenced by close_hoomd_write, open_hoomd_write, xml_end_tag, and xml_new_tag. |
|
Definition at line 240 of file hoomdplugin.c. |
|
Value: ptr = (type *)calloc(count,sizeof(type)); \ if (ptr == NULL) { \ \ PRINTERR; \ return MOLFILE_ERROR; \ } Definition at line 246 of file hoomdplugin.c. |
|
Definition at line 244 of file hoomdplugin.c. |
|
Definition at line 1781 of file hoomdplugin.c. Referenced by close_hoomd_write, write_hoomd_structure, and write_hoomd_timestep. |
|
Definition at line 1778 of file hoomdplugin.c. Referenced by write_hoomd_structure, and write_hoomd_timestep. |
|
Value: SECTION_OPEN(tag,numatoms); \ for (i=0; i < numatoms; ++i) \ fprintf(data->fp,fmt, val); \ SECTION_CLOSE(tag) Definition at line 1784 of file hoomdplugin.c. Referenced by write_hoomd_structure. |
|
Definition at line 141 of file hoomdplugin.c. Referenced by write_hoomd_timestep. |
|
Definition at line 123 of file hoomdplugin.c. |
|
Value: strncpy(k, a[n], sizeof(k)-1); make_lower(k); \ strncpy(v, a[n+1], sizeof(v)-1); make_lower(value) Definition at line 285 of file hoomdplugin.c. Referenced by xml_new_tag. |
|
Value: vmdcon_printf(VMDCON_WARN, "hoomdplugin) ignoring unknown " \ " attribute %s='%s' for element %s\n", k, v, e); Definition at line 290 of file hoomdplugin.c. Referenced by xml_new_tag. |
|
find string in a NULL terminated list of strings. grow storage and append if needed. return the index. Definition at line 265 of file hoomdplugin.c. Referenced by xml_data_block. |
|
|
|
run the XML parser to read the next line Definition at line 1174 of file hoomdplugin.c. References hoomd_data_t::buffer, hoomd_data_t::filename, hoomd_data_t::fp, MOLFILE_BIGBUFSIZ, MOLFILE_ERROR, MOLFILE_SUCCESS, hoomd_data_t::p, and hoomd_data_t::parse_error. Referenced by open_hoomd_read, read_hoomd_structure, and read_hoomd_timestep. |
|
convert string to upper case Definition at line 255 of file hoomdplugin.c. Referenced by xml_new_tag. |
|
|
|
Definition at line 1570 of file hoomdplugin.c. References hoomd_data_t::angle, hoomd_data_t::dihedral, hoomd_data_t::improper, MOLFILE_SUCCESS, hoomd_data_t::numangles, hoomd_data_t::numdihedrals, hoomd_data_t::numimpropers, and VMDCON_INFO. Referenced by VMDPLUGIN_init. |
|
Definition at line 1484 of file hoomdplugin.c. References hoomd_data_t::from, MOLFILE_SUCCESS, hoomd_data_t::numbonds, and hoomd_data_t::to. Referenced by VMDPLUGIN_init. |
|
|
|
Definition at line 2348 of file hoomdplugin.c. References VMDPLUGIN_API, and VMDPLUGIN_SUCCESS. |
|
|
Definition at line 2343 of file hoomdplugin.c. References VMDPLUGIN_API, vmdplugin_register_cb, and VMDPLUGIN_SUCCESS. |
|
Definition at line 2104 of file hoomdplugin.c. References hoomd_data_t::angle, hoomd_data_t::numangles, hoomd_data_t::numdihedrals, and hoomd_data_t::numimpropers. Referenced by VMDPLUGIN_init. |
|
Definition at line 1999 of file hoomdplugin.c. References hoomd_data_t::bondtype, hoomd_data_t::from, MOLFILE_SUCCESS, hoomd_data_t::numbonds, hoomd_data_t::numbondtypes, SAFE_CALLOC, and hoomd_data_t::to. Referenced by VMDPLUGIN_init. |
|
write topology data to hoomd data file. Definition at line 1792 of file hoomdplugin.c. References hoomd_data_t::angle, hoomd_data_t::angletype, hoomd_data_t::angletypename, hoomd_data_t::bondtype, hoomd_data_t::bondtypename, hoomd_data_t::dihedral, hoomd_data_t::dihedraltype, hoomd_data_t::dihedraltypename, hoomd_data_t::fp, hoomd_data_t::from, HOOMD_ANGLE, HOOMD_BODY, HOOMD_BOND, HOOMD_CHARGE, HOOMD_DIAMETER, HOOMD_DIHEDRAL, HOOMD_IMPROPER, HOOMD_MASS, HOOMD_TYPE, hoomd_data_t::improper, hoomd_data_t::impropertype, hoomd_data_t::impropertypename, MOLFILE_CHARGE, MOLFILE_MASS, MOLFILE_RADIUS, MOLFILE_SUCCESS, hoomd_data_t::numangles, hoomd_data_t::numatoms, hoomd_data_t::numbonds, hoomd_data_t::numdihedrals, hoomd_data_t::numimpropers, SECTION_CLOSE, SECTION_OPEN, SECTION_WRITE_ATOMIC, and hoomd_data_t::to. Referenced by VMDPLUGIN_init. |
|
Definition at line 2143 of file hoomdplugin.c. References molfile_timestep_t::A, molfile_timestep_t::B, molfile_timestep_t::C, molfile_timestep_t::coords, hoomd_data_t::fp, HOOMD_BOX, HOOMD_CONFIG, HOOMD_IMAGE, HOOMD_POS, hoomd_tag_name, HOOMD_VEL, hoomd_data_t::imagecounts, MOLFILE_SUCCESS, hoomd_data_t::numatoms, hoomd_data_t::numframe, molfile_timestep_t::physical_time, SECTION_CLOSE, SECTION_OPEN, SMALL, molfile_timestep_t::velocities, and vmdplugin_ABIVERSION. Referenced by VMDPLUGIN_init. |
|
comment handler Definition at line 1164 of file hoomdplugin.c. References hoomd_data_t::parsedepth. Referenced by open_hoomd_read, and read_hoomd_structure. |
|
|
end of element handler for xml document. Definition at line 629 of file hoomdplugin.c. References hoomd_data_t::counter, hoomd_data_t::currtag, hoomd_data_t::doneframe, HOOMD_ACCEL, HOOMD_ANGLE, HOOMD_BODY, HOOMD_BOND, HOOMD_BOX, HOOMD_CHARGE, HOOMD_CONFIG, HOOMD_COORD, HOOMD_DIAMETER, HOOMD_DIHEDRAL, HOOMD_IMAGE, HOOMD_IMPROPER, HOOMD_MASS, HOOMD_NONE, HOOMD_NUMTAGS, HOOMD_ORIENT, HOOMD_POS, hoomd_tag_name, HOOMD_TYPE, HOOMD_VEL, HOOMD_WALL, HOOMD_XML, hoomd_data_t::majv, hoomd_data_t::minv, hoomd_data_t::numangles, hoomd_data_t::numatoms, hoomd_data_t::numbonds, hoomd_data_t::numdihedrals, hoomd_data_t::numimpropers, hoomd_data_t::parse_error, and hoomd_data_t::parsedepth. Referenced by open_hoomd_read, and read_hoomd_structure. |
|
|
Initial value: { "(none)", "hoomd_xml", "configuration", "box", "position", "image", "velocity", "type", "body", "mass", "charge", "diameter", "bond", "angle", "dihedral", "improper", "wall", "coord", "acceleration", "orientation", "(error)" } Definition at line 168 of file hoomdplugin.c. Referenced by open_hoomd_write, write_hoomd_timestep, xml_end_tag, and xml_new_tag. |
|
Definition at line 2138 of file hoomdplugin.c. Referenced by hoomd_parse_line, read_hoomd_angles, read_hoomd_bonds, read_hoomd_structure, read_hoomd_timestep, write_hoomd_bonds, write_hoomd_structure, and write_hoomd_timestep. |
|
Definition at line 227 of file hoomdplugin.c. |