Skip to content

Commit

Permalink
Update {fmt} to 10.1.1, fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sgsaenger committed Dec 25, 2023
1 parent 330fb4e commit 535323e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions util/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ FetchContent_Declare(
FetchContent_Declare(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt
GIT_TAG 10.0.0
GIT_TAG 10.1.1
GIT_SHALLOW TRUE
FIND_PACKAGE_ARGS 10.0.0
FIND_PACKAGE_ARGS 10.1.1
)

# library: pybind11
Expand Down
10 changes: 5 additions & 5 deletions vipster/plugins/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void parseStep(const json &j, Molecule &m)
}
auto coord = at.find("coord");
if(coord == at.end() || !coord->is_array() || !(coord->size() == 3)){
throw IOError(fmt::format("JSON-Parser: Invalid atom (missing or invalid \"coord\"): {}", at));
throw IOError(fmt::format("JSON-Parser: Invalid atom (missing or invalid \"coord\"): {}", at.dump()));
}
s.newAtom(name->get<std::string>(), {(*coord)[0].get<double>(), (*coord)[1].get<double>(), (*coord)[2].get<double>()});
}
Expand All @@ -78,13 +78,13 @@ void parseStep(const json &j, Molecule &m)
// check if atoms are valid
auto at_pos = bond.find("atoms");
if(at_pos == bond.end()){
throw IOError(fmt::format("JSON-Parser: Missing atom ids in bond {}", bond));
throw IOError(fmt::format("JSON-Parser: Missing atom ids in bond {}", bond.dump()));
}
const auto &atoms = at_pos.value();
if(!(atoms.is_array() && (atoms.size() == 2) &&
atoms[0].is_number_unsigned() && atoms[1].is_number_unsigned() &&
(atoms[0].get<size_t>() < s.getNat()) && (atoms[1].get<size_t>() < s.getNat()))){
throw IOError(fmt::format("JSON-Parser: Invalid atom ids in bond {}", bond));
throw IOError(fmt::format("JSON-Parser: Invalid atom ids in bond {}", bond.dump()));
}
// parse optional pbc information
DiffVec diff{};
Expand All @@ -93,7 +93,7 @@ void parseStep(const json &j, Molecule &m)
const auto &pbc = pbc_pos.value();
if(!(pbc.is_array() && pbc.size() == 3 &&
pbc[0].is_number() && pbc[1].is_number() && pbc[2].is_number())){
throw IOError(fmt::format("JSON-Parser: Invalid periodic bond {}", bond));
throw IOError(fmt::format("JSON-Parser: Invalid periodic bond {}", bond.dump()));
}
diff = {pbc[0].get<int>(), pbc[1].get<int>(), pbc[2].get<int>()};
}
Expand Down Expand Up @@ -133,7 +133,7 @@ IOTuple JSONParser(const std::string& name, std::istream &file)
parseStep(j, m);
}
}else{
throw IOError(fmt::format("JSON-Parser: invalid molecule data {}", mol.value()));
throw IOError(fmt::format("JSON-Parser: invalid molecule data {}", mol->dump()));
}
}catch(nlohmann::detail::exception& e){
throw IOError(e.what());
Expand Down

0 comments on commit 535323e

Please sign in to comment.