MDIO (molecular dynamics input/output) library Need to design a library interface to be used by all MD-related codes for file I/O. Proposal: A three-level C-interface architecture. Level 3 (top) -- routines that allow you to read into or write from MDAPI type arrays; more specifically, this level facilitates data manipulation with the highest level data structures, so there might be several level 3 modules that are plug compatible into the architecture hierarchy, each designed to work with a particular set of high-level data structures; there must also be a file-type structure defined in which the name and type of file is specified. Level 2 (middle) -- routines for reading from or writing to specific types of files using data structures native to that file-type; this level is called by level 3 and uses low-level routines from level 1; this middle layer can be designed as a single module with several sets of functions and data structures, one for each type of supported file. Level 1 (bottom) -- low-level routines for performing the raw data reads and writes to the files; might be best to create a nice file I/O abstraction that can take advantage of the underlying facilities of the particular file system; for example, depending on the size or other qualities of the file, the actual I/O mechanism might be the standard C library, the UNIX I/O library, mmap, or POSIX asynchronous I/O; support could even be provided for other low-level aspects such as file compression or remote file access via FTP. Graceful error handling needs to be built into the design so that any errors would propagate up the hierarchy to the initial call. Appropriate diagnostic messages should be returned, e.g. syntax error in (text) file on line (number). An application should be able to use the library at whatever level best suits its needs. Level 3 modules should be straightforward to create in support of additional high-level data structures. There should also be a method for introducing level 2 support for new file types, and for providing additional low-level reading and writing facilities for level 1. Diagram: +------------+ +------------+ +------------+ Level 3 | MDAPI data | | VMD data | | QM/MM data | ... | interface | | interface | | interface | +------------+ +------------+ +------------+ | | | +---------------+---------------+ | +----------------------+--------------------------+ | | | +----------+ +----------+ +----------+ | Level 2 | | DCD file | | PDB file | | PSF file | ... | | +----------+ +----------+ +----------+ | | | +----------------------+--------------------------+ | +----------------------+--------------------------+ | | | +---------------+ +------+ | Level 1 | | C I/O library | | mmap | ... | | +---------------+ +------+ | | | +-------------------------------------------------+