make "coords" optional and infer natoms from "types" instead

This commit is contained in:
Axel Kohlmeyer
2025-06-12 21:19:32 -04:00
parent 9b195d2109
commit f9de296ed1
3 changed files with 4 additions and 4 deletions

View File

@ -814,7 +814,7 @@ for the "native" molecule file format.
- overrides the auto-computed moments of inertia - overrides the auto-computed moments of inertia
* - coords * - coords
- a data block - a data block
- yes - no
- contains atom positions with the format "atom-id", "x", "y", "z" (same as Coords) - contains atom positions with the format "atom-id", "x", "y", "z" (same as Coords)
* - types * - types
- a data block - a data block

View File

@ -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, \ error->all(FLERR, Error::NOLASTLINE, "Found {} instead of {} data entries for '{}'", sizevar, \
sizecheck, #field); sizecheck, #field);
JSON_INIT_FIELD(coords, natoms, xflag, true, 0); JSON_INIT_FIELD(types, natoms, typeflag, true, 0);
JSON_INIT_FIELD(types, dummyvar, typeflag, true, natoms); JSON_INIT_FIELD(coords, dummyvar, xflag, false, natoms);
JSON_INIT_FIELD(molecules, dummyvar, moleculeflag, false, natoms); JSON_INIT_FIELD(molecules, dummyvar, moleculeflag, false, natoms);
JSON_INIT_FIELD(fragments, nfragments, fragmentflag, false, 0); JSON_INIT_FIELD(fragments, nfragments, fragmentflag, false, 0);
JSON_INIT_FIELD(charges, dummyvar, qflag, false, natoms); JSON_INIT_FIELD(charges, dummyvar, qflag, false, natoms);

View File

@ -302,5 +302,5 @@
"required": ["format", "data"] "required": ["format", "data"]
} }
}, },
"required": ["application", "format", "revision", "coords", "types"] "required": ["application", "format", "revision", "types"]
} }