CASM  1.1.0
A Clusters Approach to Statistical Mechanics
LatticeIO.cc
Go to the documentation of this file.
2 
6 
7 namespace CASM {
8 // write Lattice in json as array of vectors
10  json.put_array();
11  json.push_back(lat[0]);
12  json.push_back(lat[1]);
13  json.push_back(lat[2]);
14  return json;
15 }
16 
17 // read Lattice from a json array of Eigen::Vector3d
18 void from_json(xtal::Lattice &lat, const jsonParser &json, double xtal_tol) {
19  try {
20  lat = xtal::Lattice(json[0].get<Eigen::Vector3d>(),
21  json[1].get<Eigen::Vector3d>(),
22  json[2].get<Eigen::Vector3d>(), xtal_tol);
23  } catch (...) {
25  throw;
26  }
27 }
28 } // namespace CASM
jsonParser & put_array()
Puts new empty JSON array.
Definition: jsonParser.hh:362
jsonParser & push_back(const T &value, Args &&... args)
Definition: jsonParser.hh:684
Main CASM namespace.
Definition: APICommand.hh:8
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
void from_json(ClexDescription &desc, const jsonParser &json)