CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
ProjectBuilder.hh
Go to the documentation of this file.
1 #ifndef CASM_ProjectBuilder
2 #define CASM_ProjectBuilder
3 
4 #include <string>
5 #include <vector>
6 
8 
10 #include "casm/app/AppIO.hh"
11 
12 namespace CASM {
13 
19 
20  public:
21 
28  ProjectBuilder(fs::path _root, std::string _name, std::string _property) :
29  m_root(_root),
30  m_name(_name),
31  m_property(_property) {
32 
34  if(!boost::regex_match(m_name, boost::regex(R"([_a-zA-Z]\w*)"))) {
35  throw std::runtime_error(
36  std::string("Error constructing ProjectBuilder.\n") +
37  " Invalid Project name: '" + m_name + "'\n"
38  " Must be a valid C++ identifier: \n"
39  " - only alphanumeric characters and underscores allowed\n"
40  " - cannot start with a number");
41  }
42 
43  }
44 
45 
47  m_crystallography_tol = _tol;
48  return *this;
49  }
50 
52  m_lin_alg_tol = _tol;
53  return *this;
54  }
55 
57  void build() const;
58 
59 
60  private:
61 
62  // require user initialization:
63 
65  std::string m_name;
66  std::string m_property;
67 
68  // allow default initialization:
69 
70  std::vector<std::string> m_properties {"relaxed_energy"};
72  double m_lin_alg_tol = 1e-10;
73 
74  };
75 
76 }
77 
78 #endif
ProjectBuilder & set_crystallography_tol(double _tol)
ProjectBuilder(fs::path _root, std::string _name, std::string _property)
Construct a CASM ProjectBuilder.
Main CASM namespace.
Definition: complete.cpp:8
const double TOL
ProjectBuilder & set_lin_alg_tol(double _tol)
Sets up directories and files for a new CASM project.
void build() const
Builds a new CASM project.