[gmx-developers] libxml2 versus JSON
David van der Spoel
spoel at xray.bmc.uu.se
Wed May 25 14:58:10 CEST 2016
On 23/05/16 16:43, Erik Lindahl wrote:
>> On 23 May 2016, at 16:13, Mark Abraham <mark.j.abraham at gmail.com> wrote:
>> The external parsing library that we wrap for use by GROMACS will need good support for schema handling, but I haven't identified a candidate for that for JSON (David or Erik, did you?).
> RapidJSON even includes preliminary schema support; I think I found a couple of rough edges when I played around with it last week, but I’m not sure whether those edges were in me or the library. They are targeting full schema support for release 1.1, so even if there are some bugs I would suspect they are small enough that we might be able to fix those ourselves.
> I thought about a couple of other things when playing around:
> 1) We should not code for any specific library or file format in most GROMACS code, but rather define a module that handles settings/data in a hierarchical manner, and then the calls to any specific library only happens inside this module. This module needs a bit of design and implementation work.
> 2) The actual implementations are trivial, but we should spend efforts on explicit nomenclature and a good hierarchical structure for the mdp file. As Mark mentioned, one idea is to make it possible to extend the format by simply adding an extra node with data for module X, and then all parsing for that is delegated to module X.
> 3) We need a similar choice of structure for data (e.g. scattering factors) and force fields, but only on the highest level. The lower-level stuff we can wait with until we actually implement a specific file.
Maybe I misunderstand you completely, but if we assume we fill a data
structure, the intermediate routine (doing the JSON I/O) can do what it
likes right? A structure like
std::string name, value;
struct GmxTree branch;
struct GmxTree next;
can be mapped to most anything, right?
> 4) We need schemas to validate the files.
David van der Spoel, Ph.D., Professor of Biology
Dept. of Cell & Molec. Biol., Uppsala University.
Box 596, 75124 Uppsala, Sweden. Phone: +46184714205.
spoel at xray.bmc.uu.se http://folding.bmc.uu.se
More information about the gromacs.org_gmx-developers