Support new-style archive json files

parent 65a4204f
...@@ -726,6 +726,7 @@ int loadConfigFile(const char * f) ...@@ -726,6 +726,7 @@ int loadConfigFile(const char * f)
menubutton = Infobox; menubutton = Infobox;
else if (!strcmp (s, "Nothing")) else if (!strcmp (s, "Nothing"))
menubutton = Nothing; menubutton = Nothing;
else eprintf ("Unknown menubutton parameter %s\n", s);
} else if (!strcmp (s, "movementspeed")) { } else if (!strcmp (s, "movementspeed")) {
r=fscanf (F, "%f", &movementspeed); r=fscanf (F, "%f", &movementspeed);
if (r<1) if (r<1)
......
...@@ -632,10 +632,11 @@ int readAtomsAnalyticsJson(const char *const f, int **numatoms, int *timesteps, ...@@ -632,10 +632,11 @@ int readAtomsAnalyticsJson(const char *const f, int **numatoms, int *timesteps,
for (rapidjson::SizeType i = 0; i < ss.Size(); i++) { for (rapidjson::SizeType i = 0; i < ss.Size(); i++) {
const rapidjson::GenericValue<rapidjson::UTF8<> > & el=ss[i]; const rapidjson::GenericValue<rapidjson::UTF8<> > & el=ss[i];
if (!el.HasMember("lattice_vectors") || !el.HasMember("atom_positions")) if (!el.HasMember("lattice_vectors") && !el.HasMember("atom_positions"))
continue; continue;
if (currenttime==0) {// take the lattice vectors only once; verify they are real vectors if (currenttime==0 && el.HasMember("lattice_vectors")) {
// take the lattice vectors only once; verify they are real vectors
const rapidjson::GenericValue<rapidjson::UTF8<> > &lv = el["lattice_vectors"]; const rapidjson::GenericValue<rapidjson::UTF8<> > &lv = el["lattice_vectors"];
const rapidjson::GenericValue<rapidjson::UTF8<> > &flatdata = lv["flatData"]; const rapidjson::GenericValue<rapidjson::UTF8<> > &flatdata = lv["flatData"];
bool allzeros=true; bool allzeros=true;
...@@ -649,6 +650,8 @@ int readAtomsAnalyticsJson(const char *const f, int **numatoms, int *timesteps, ...@@ -649,6 +650,8 @@ int readAtomsAnalyticsJson(const char *const f, int **numatoms, int *timesteps,
has_abc=true; has_abc=true;
} }
if (!el.HasMember("atom_positions"))
continue;
const rapidjson::GenericValue<rapidjson::UTF8<> > &result = el["atom_positions"]; const rapidjson::GenericValue<rapidjson::UTF8<> > &result = el["atom_positions"];
if (!result.HasMember("shape")) if (!result.HasMember("shape"))
return (-1); return (-1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment