3 #include <boost/filesystem/fstream.hpp>
19 class DirectoryStructure;
43 bool print_lattice_point_group,
44 bool print_factor_group,
45 bool print_crystal_point_group) {
51 if (!print_lattice_point_group && !print_factor_group &&
52 !print_crystal_point_group) {
53 log <<
" Lattice point group size: " << lattice_pg.size() << std::endl;
54 log <<
" Lattice point group is: " << lattice_pg.get_name() << std::endl
57 log <<
" Factor group size: " << prim.
factor_group().size() << std::endl;
62 auto print_group = [&](std::string
name,
SymGroup const &group) {
65 <<
" representation)" << std::endl;
69 log <<
name <<
":" << std::endl;
70 group.print(
log, coordtype);
74 if (print_lattice_point_group) {
75 print_group(
"Lattice point group", lattice_pg);
78 if (print_factor_group) {
82 if (print_crystal_point_group) {
83 print_group(
"Crystal point group", prim.
point_group());
89 auto write_group = [&](fs::path path,
SymGroup const &group) {
107 "Write / print prim symmetry information (default behavior): "
110 " The default `casm sym` action writes the following symmetry files: "
112 " - Lattice point group: <root>/symmetry/lattice_point_group.json "
114 " - Crystal factor group: <root>/symmetry/factor_group.json "
116 " - Crystal point group: <root>/symmetry/crystal_point_group.json "
119 " Optionally, it also prints symmetry information: "
121 " - Print lattice point group with --lattice-point-group "
123 " - Print crystal factor group with --print-factor-group "
125 " - Print crystal point group with --print-crystal-point-group "
127 " - Print brief symmetry operation descriptions with --brief "
129 " - Control coordinate printing mode (FRAC vs CART) with --coord "
134 " - Use this method to print symmetry info to screen "
136 " - Use this method to write symmetry files if they have been deleted "
138 " - Use this method to write symmetry files if the crystallography "
140 " tolerance in project settings is modified "
150 std::map<std::string, std::string> cli_to_combined_keys{
151 {
"print_lattice_point_group",
152 "print_lattice_point_group"},
153 {
"print_factor_group",
"print_factor_group"},
154 {
"print_crystal_point_group",
155 "print_crystal_point_group"},
156 {
"coordinate_mode",
"coordinate_mode"},
164 bool print_lattice_point_group;
165 bool print_factor_group;
166 bool print_crystal_point_group;
170 parser.
optional_else(print_lattice_point_group,
"print_lattice_point_group",
172 parser.optional_else(print_factor_group,
"print_factor_group",
false);
173 parser.optional_else(print_crystal_point_group,
"print_crystal_point_group",
175 parser.optional_else(coordtype,
"coordinate_mode",
FRAC);
176 std::runtime_error error_if_invalid{
"Error reading `casm sym` input"};
179 parser.optional_else(brief,
"brief",
false);
182 log(), print_lattice_point_group, print_factor_group,
183 print_crystal_point_group);
Specification of CASM project directory structure.
fs::path crystal_point_group() const
Return crystal_point_group.json path.
fs::path lattice_point_group() const
Return lattice_point_group.json path.
bool new_symmetry_dir() const
Create new symmetry directory.
fs::path factor_group() const
Return factor_group.json path.
PrimClex is the top-level data structure for a CASM project.
Structure specifies the lattice and atomic basis of a crystal.
const SymGroup & point_group() const
const Lattice & lattice() const
const MasterSymGroup & factor_group() const
SymGroup is a collection of symmetry operations that satisfy the group property The symmetry operatio...
const std::string & get_name() const
static SymGroup lattice_point_group(Lattice const &_lat)
void print(std::ostream &stream, unsigned int indent=2, unsigned int prec=12) const
Print json to stream.
COORD_MODE specifies the current coordinate mode (Fractional or Cartesian)
static std::string NAME()
get a string with the name of the active mode
const DirectoryStructure & dir() const
Access DirectoryStructure object. Throw if not set.
const PrimType & prim() const
const Access to primitive Structure
std::string write_prim_symmetry_desc()
Describe the default casm sym option.
std::string description(const SymOp &op, const xtal::Lattice &lat, SymInfoOptions opt=SymInfoOptions())
Print SymInfo to string.
void write_prim_symmetry_impl(Structure const &prim, DirectoryStructure const &dir, COORD_TYPE coordtype, bool brief, Log &log, bool print_lattice_point_group, bool print_factor_group, bool print_crystal_point_group)
std::string brief_description(const SymOp &op, const xtal::Lattice &lat, SymInfoOptions opt=SymInfoOptions())
Print SymInfo to brief string.
GenericDatumFormatter< std::string, DataObject > name()
void write_symgroup(SymGroup const &grp, jsonParser &json)
jsonParser & combine_json_options(std::map< std::string, std::string > const &source_to_combined_keys, jsonParser const &json_source, jsonParser &json_combined)
Copy from json_source to json_combined
void write_prim_symmetry(PrimClex &primclex, jsonParser const &json_options, jsonParser const &cli_options_as_json)
Write/print prim symmetry.
void report_and_throw_if_invalid(KwargsParser const &parser, Log &log, ErrorType error)
DirectoryStructure const & dir
Options for printing SymInfo.