From f9de296ed1f839b033e8882995411bb2b3976bd0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 12 Jun 2025 21:19:32 -0400 Subject: [PATCH] make "coords" optional and infer natoms from "types" instead --- doc/src/molecule.rst | 2 +- src/molecule.cpp | 4 ++-- tools/json/molecule-schema.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/src/molecule.rst b/doc/src/molecule.rst index abedc96752..1dcae66f1a 100644 --- a/doc/src/molecule.rst +++ b/doc/src/molecule.rst @@ -814,7 +814,7 @@ for the "native" molecule file format. - overrides the auto-computed moments of inertia * - coords - a data block - - yes + - no - contains atom positions with the format "atom-id", "x", "y", "z" (same as Coords) * - types - a data block diff --git a/src/molecule.cpp b/src/molecule.cpp index aa64662237..8eaa44ee49 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -280,8 +280,8 @@ void Molecule::from_json(const std::string &molid, const json &moldata) error->all(FLERR, Error::NOLASTLINE, "Found {} instead of {} data entries for '{}'", sizevar, \ sizecheck, #field); - JSON_INIT_FIELD(coords, natoms, xflag, true, 0); - JSON_INIT_FIELD(types, dummyvar, typeflag, true, natoms); + JSON_INIT_FIELD(types, natoms, typeflag, true, 0); + JSON_INIT_FIELD(coords, dummyvar, xflag, false, natoms); JSON_INIT_FIELD(molecules, dummyvar, moleculeflag, false, natoms); JSON_INIT_FIELD(fragments, nfragments, fragmentflag, false, 0); JSON_INIT_FIELD(charges, dummyvar, qflag, false, natoms); diff --git a/tools/json/molecule-schema.json b/tools/json/molecule-schema.json index 856bd4ccdc..de212942b6 100644 --- a/tools/json/molecule-schema.json +++ b/tools/json/molecule-schema.json @@ -302,5 +302,5 @@ "required": ["format", "data"] } }, - "required": ["application", "format", "revision", "coords", "types"] + "required": ["application", "format", "revision", "types"] }