fix minor issues
This commit is contained in:
@ -2169,6 +2169,7 @@ void Atom::add_molecule(const std::string &id, const json &moldata)
|
||||
molecules[nmolecule] = new Molecule(lmp);
|
||||
molecules[nmolecule]->from_json(id, moldata);
|
||||
molecules[nmolecule]->nset = 1;
|
||||
molecules[nmolecule]->last = 1;
|
||||
nmolecule++;
|
||||
}
|
||||
|
||||
|
||||
@ -180,6 +180,7 @@ void Molecule::command(int narg, char **arg, int &index)
|
||||
|
||||
if (json_format) {
|
||||
// broadcast binary JSON data to all processes and deserialize again
|
||||
MPI_Bcast(jsondata_size, 1, MPI_INT, 0, world);
|
||||
if (comm->me != 0) jsondata.resize(jsondata_size);
|
||||
MPI_Bcast(jsondata.data(), jsondata_size, MPI_CHAR, 0, world);
|
||||
// convert back to json class on all processors
|
||||
@ -316,6 +317,22 @@ void Molecule::from_json(const std::string &molid, const json &moldata)
|
||||
error->all(FLERR, Error::NOLASTLINE,
|
||||
"Molecule data z center-of-mass must be 0.0 for 2d systems");
|
||||
|
||||
if ((typeflag) && moldata["types"].contains("data")) {
|
||||
if (moldata["types"]["data"].size() != natoms)
|
||||
error->all(FLERR, Error::NOLASTLINE, "Found {} instead of {} data entries for 'types'",
|
||||
moldata["types"]["data"].size(), natoms);
|
||||
}
|
||||
if ((radiusflag) && moldata["diameters"].contains("data")) {
|
||||
if (moldata["diameters"]["data"].size() != natoms)
|
||||
error->all(FLERR, Error::NOLASTLINE, "Found {} instead of {} data entries for 'diameters'",
|
||||
moldata["diameters"]["data"].size(), natoms);
|
||||
}
|
||||
if ((rmassflag) && moldata["masses"].contains("data")) {
|
||||
if (moldata["masses"]["data"].size() != natoms)
|
||||
error->all(FLERR, Error::NOLASTLINE, "Found {} instead of {} data entries for 'masses'",
|
||||
moldata["masses"]["data"].size(), natoms);
|
||||
}
|
||||
|
||||
// allocate required storage
|
||||
|
||||
Molecule::allocate();
|
||||
|
||||
@ -26,7 +26,7 @@ for how to use a tool called `check-jsonschema` which is available via
|
||||
# Installation into a virtual environment.
|
||||
# Once installed only the activation should be needed
|
||||
python3 -m venv validate-json
|
||||
source validata-json/bin/activate
|
||||
source validate-json/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip install check-jsonschema
|
||||
|
||||
@ -42,4 +42,4 @@ Otherwise details about the non-conforming fields are given.
|
||||
|
||||
-------
|
||||
|
||||
updated by Axel Kohlmeyer, 2025-05-22
|
||||
updated by Axel Kohlmeyer, 2025-05-23
|
||||
|
||||
Reference in New Issue
Block a user