CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
super.cc
Go to the documentation of this file.
3 #include "casm/clex/PrimClex.hh"
7 #include "casm/casm_io/VaspIO.hh"
10 
12 
13 namespace CASM {
14 
15  namespace Completer {
17 
18  const std::vector<fs::path> &SuperOption::transf_mat_paths() const {
19  return m_transf_mat_paths;
20  }
21 
23  return m_struct_path;
24  }
25 
26  const std::string &SuperOption::unit_scel_str() const {
27  return m_unit_scel_str;
28  }
29 
31  return m_min_vol;
32  }
33 
34  double SuperOption::tolerance() const {
35  return m_tolerance;
36  }
37 
44 
45  m_desc.add_options()
46  ("transf-mat",
47  po::value<std::vector<fs::path> >(&m_transf_mat_paths)->multitoken()->value_name(ArgHandler::path()),
48  "1 or more files containing a 3x3 transformation matrix used to create a supercell.")
49 
50  ("get-transf-mat",
51  "If it exists, find the transformation matrix.")
52 
53  ("structure",
54  po::value<fs::path>(&m_struct_path)->value_name(ArgHandler::path()),
55  "File with structure (POSCAR type) to use.")
56 
57  ("unitcell",
58  po::value<std::string>(&m_unit_scel_str)->value_name(ArgHandler::supercell()),
59  "Name of supercell to use as unit cell. For ex. 'SCEL2_2_1_1_0_0_0'.")
60 
61  ("duper",
62  "Construct the superdupercell, the minimum supercell of all input supercells "
63  "and configurations.")
64 
65  ("fixed-orientation",
66  "When constructing the superdupercell, do not consider other symmetrically "
67  "equivalent orientations.")
68 
69  ("min-volume",
70  po::value<Index>(&m_min_vol),
71  "Transforms the transformation matrix, T -> T', where T' = T*M, such that "
72  "(T').determininant() >= V. This has the effect that a supercell has a "
73  "particular volume.")
74 
75  ("fixed-shape",
76  "Used with --min-volume to enforce that T' = T*m*I, where I is the identity "
77  "matrix, and m is a scalar. This has the effect of preserving the shape "
78  "of the resulting supercell, but increasing the volume.")
79 
80  ("verbose",
81  "When used with --duper, show how the input lattices are transformed "
82  "to tile the superdupercell.")
83 
84  ("add-canonical,a", "Will add the generated super configuration in it's "
85  "canonical form in the equivalent niggli supercell.")
86 
87  ("vasp5",
88  "Print using VASP5 style (include atom name line)")
89 
90  ("tol",
91  po::value<double>(&m_tolerance)->default_value(CASM::TOL),
92  "Tolerance used for checking symmetry");
93 
94  return;
95  }
96  }
97 
98 
99  // ///////////////////////////////////////
100  // 'super' function for casm
101  // (add an 'if-else' statement in casm.cpp to call this)
102 
103  int super_command(const CommandArgs &args) {
104 
105  //casm enum [—supercell min max] [—config supercell ] [—hopconfigs hop.background]
106  //- enumerate supercells and configs and hop local configurations
107 
108  std::vector<std::string> scelname, configname;
109  std::string unitscelname;
110  fs::path structfile;
111  std::vector<fs::path> tmatfile, abs_tmatfile, config_path;
112  fs::path abs_structfile;
113  Index min_vol;
114  double tol;
115  COORD_TYPE coordtype;
116  po::variables_map vm;
117 
119  Completer::SuperOption super_opt;
120 
121  try {
122  po::store(po::parse_command_line(args.argc, args.argv, super_opt.desc()), vm); // can throw
123 
124  if(!vm.count("help") && !vm.count("desc")) {
125  if(!vm.count("duper")) {
126  if(vm.count("transf-mat") + vm.count("get-transf-mat") != 1) {
127  args.err_log << "Error in 'casm super'. Only one of --transf-mat or --get-transf-mat may be chosen." << std::endl;
128  return ERR_INVALID_ARG;
129  }
130  if(configname.size() > 1 || scelname.size() > 1 || tmatfile.size() > 1) {
131  args.err_log << "ERROR: more than one --confignames, --scelnames, or --transf-mat argument "
132  "is only allowed for option --duper" << std::endl;
133  return ERR_INVALID_ARG;
134  }
135  if(config_path.size() > 0) {
136  args.err_log << "ERROR: the --configs option is only allowed with option --duper" << std::endl;
137  return ERR_INVALID_ARG;
138  }
139  }
140  }
141 
144  if(vm.count("help")) {
145  args.log << "\n";
146  args.log << super_opt.desc() << std::endl;
147 
148  return 0;
149  }
150 
151  if(vm.count("desc")) {
152  args.log << "\n";
153  args.log << super_opt.desc() << std::endl;
154  args.log << "DESCRIPTION" << std::endl;
155  args.log << " \n" <<
156  " casm super --transf-mat T \n" <<
157  " - Print super lattice of the PRIM lattice \n" <<
158  " \n" <<
159  " casm super --structure POSCAR --transf-mat T \n" <<
160  " - Print superstructure of a POSCAR \n" <<
161  " \n" <<
162  " casm super --confignames configname --transf-mat T \n" <<
163  " - Print superstructure of a configuration \n" <<
164  " \n" <<
165  " casm super --structure POSCAR --unitcell scelname --get-transf-mat \n" <<
166  " - Check if POSCAR lattice is a supercell of unit cell lattice and \n" <<
167  " if so print the transformation matrix \n" <<
168  " - Uses primitive cell for unitcell if none given \n" <<
169  " \n" <<
170  " casm super --scelnames scelname --unitcell scelname --get-transf-mat\n" <<
171  " - Check if configuration lattice is a supercell of unit cell lattice.\n" <<
172  " and print the transformation matrix \n" <<
173  " - Uses primitive cell for unitcell if none given \n\n" <<
174 
175  " casm super --duper --scelnames scel1 [scel2 ...] --confignames con1 [con2 ...]\n"
176  " --configs [mylist ...] --transf-mat M1 [M2 ...] \n" <<
177  " - Makes the superdupercell of the lattices of all inputs \n" <<
178  " - Using '--configs' with no arguments is equivalent to '--configs MASTER',\n" <<
179  " which uses the master config list \n" <<
180  " - Default applies prim point group ops to try to find minimum volume\n" <<
181  " superdupercell, disable with '--fixed-orientation' \n\n";
182 
183  return 0;
184  }
185 
186  po::notify(vm); // throws on error, so do after help in case
187  // there are any problems
188 
189  scelname = super_opt.supercell_strs();
190  configname = super_opt.config_strs();
191  unitscelname = super_opt.unit_scel_str();
192  structfile = super_opt.struct_path();
193  tmatfile = super_opt.transf_mat_paths();
194  config_path = super_opt.selection_paths();
195  min_vol = super_opt.min_vol();
196  tol = super_opt.tolerance();
197  coordtype = super_opt.coordtype_enum();
198  }
199  catch(po::error &e) {
200  args.err_log << "ERROR: " << e.what() << std::endl << std::endl;
201  args.err_log << super_opt.desc() << std::endl;
202  return 1;
203  }
204  catch(std::exception &e) {
205  args.err_log << "Unhandled Exception reached the top of main: "
206  << e.what() << ", application will now exit" << std::endl;
207  return 1;
208 
209  }
210 
211  COORD_MODE C(coordtype);
212 
213  // lambda for printing
214  auto print = [&](const BasicStructure<Site> &struc) {
215  VaspIO::PrintPOSCAR printer(struc);
216 
217  if(vm.count("vasp5")) {
218  printer.set_atom_names_on();
219  }
220  else {
221  printer.set_atom_names_off();
222  }
223  printer.set_coord_mode(coordtype);
224  printer.print(args.log);
225  };
226 
227 
228 
229  // -- no casm project necessary for super cell of a POSCAR -------
230 
231  // want absolute paths
232  for(auto && file : tmatfile) {
233  abs_tmatfile.push_back(fs::absolute(file));
234  }
235  abs_structfile = fs::absolute(structfile);
236 
237  if(vm.count("structure") && vm.count("transf-mat")) {
238 
239  if(!fs::exists(abs_structfile)) {
240  args.log << "ERROR: " << abs_tmatfile[0] << " not found." << std::endl;
241  return 1;
242  }
243  BasicStructure<Site> unitcell(abs_structfile);
244 
245  // -- read transf matrix ---
246  if(!fs::exists(abs_tmatfile[0])) {
247  args.log << "ERROR: " << abs_tmatfile[0] << " not found." << std::endl;
248  return 1;
249  }
250  Eigen::Matrix3i Tm;
251  fs::ifstream file(abs_tmatfile[0]);
252  file >> Tm;
253  file.close();
254 
255  auto super = unitcell.create_superstruc(make_supercell(unitcell.lattice(), Tm));
256  super.title = std::string("Supercell of ") + unitcell.title;
257 
258  print(super);
259 
260  return 0;
261  }
262 
263 
264  const fs::path &root = args.root;
265  if(root.empty()) {
266  args.err_log.error("No casm project found");
267  args.err_log << std::endl;
268  return ERR_NO_PROJ;
269  }
270 
271  // If 'args.primclex', use that, else construct PrimClex in 'uniq_primclex'
272  // Then whichever exists, store reference in 'primclex'
273  std::unique_ptr<PrimClex> uniq_primclex;
274  PrimClex &primclex = make_primclex_if_not(args, uniq_primclex);
275 
276  if(vm.count("duper")) {
277 
278  // collect all the Lattice to make the superdupercell of
279  std::map<std::string, Lattice> lat;
280  std::map<std::string, Lattice> config_lat;
281 
282  // collect lattices by constructing from transformation matrices
283  if(vm.count("transf-mat")) {
284  for(auto it = abs_tmatfile.begin(); it != abs_tmatfile.end(); ++it) {
285  Eigen::Matrix<int, 3, 3, Eigen::RowMajor> T;
286  fs::ifstream file(*it);
287  for(int i = 0; i < 9; i++) {
288  file >> T.data()[i];
289  }
290  file.close();
291  lat[it->string()] = make_supercell(primclex.get_prim().lattice(), T);
292  }
293  }
294 
295  // collect supercells from --scelnames
296  if(vm.count("scelnames")) {
297  for(auto it = scelname.begin(); it != scelname.end(); ++it) {
298  lat[*it] = primclex.get_supercell(*it).get_real_super_lattice();
299  }
300  }
301 
302  // collect configs from --confignames
303  if(vm.count("confignames")) {
304  for(auto it = configname.begin(); it != configname.end(); ++it) {
305  config_lat[*it] = lat[*it] = primclex.configuration(*it).get_supercell().get_real_super_lattice();
306  }
307  }
308 
309  // collect configs from lists via --configs
310  if(vm.count("configs")) {
311 
312  // MASTER config list if '--configs' only
313  if(config_path.size() == 0) {
314  ConstConfigSelection selection(primclex);
315  for(auto it = selection.selected_config_begin(); it != selection.selected_config_end(); ++it) {
316  config_lat[it.name()] = lat[it.name()] = it->get_supercell().get_real_super_lattice();
317  }
318  }
319  // all input config list if '--configs X Y ...'
320  else {
321  for(auto c_it = config_path.begin(); c_it != config_path.end(); ++c_it) {
322  if(c_it->string() == "MASTER") {
323  ConstConfigSelection selection(primclex);
324  for(auto it = selection.selected_config_begin(); it != selection.selected_config_end(); ++it) {
325  config_lat[it.name()] = lat[it.name()] = it->get_supercell().get_real_super_lattice();
326  }
327  }
328  else {
329  ConstConfigSelection selection(primclex, fs::absolute(*c_it));
330  for(auto it = selection.selected_config_begin(); it != selection.selected_config_end(); ++it) {
331  config_lat[it.name()] = lat[it.name()] = it->get_supercell().get_real_super_lattice();
332  }
333  }
334  }
335  }
336 
337  }
338 
339  std::vector<Lattice> lat_only;
340  for(auto it = lat.begin(); it != lat.end(); ++it) {
341  lat_only.push_back(it->second);
342  }
343 
344  // create superdupercell
345  auto begin = primclex.get_prim().point_group().begin();
346  auto end = primclex.get_prim().point_group().end();
347  if(vm.count("fixed-orientation")) {
348  end = begin;
349  }
350  Lattice superduper = superdupercell(lat_only.begin(), lat_only.end(), begin, end);
351 
353  if(vm.count("min-volume")) {
354 
355  args.log << " Enforcing minimum volume: " << min_vol;
356  if(vm.count("fixed-shape")) {
357  args.log << " (with fixed shape)";
358  }
359  args.log << "\n\n";
360 
361  auto prim_lat = primclex.get_prim().lattice();
362  const SymGroup &pg = primclex.get_prim().point_group();
363  auto T = is_supercell(superduper, prim_lat, TOL).second;
364 
365  args.log << " Superdupercell lattice: \n" << superduper.lat_column_mat() << "\n\n";
366 
367  args.log << " Initial transformation matrix:\n" << T
368  << "\n (volume = " << T.cast<double>().determinant() << ")\n\n";
369 
370  auto M = enforce_min_volume(prim_lat, T, pg, min_vol, vm.count("fixed-shape"));
371 
372  superduper = canonical_equivalent_lattice(make_supercell(superduper, M), pg, TOL);
373 
374  auto S = is_supercell(superduper, prim_lat, TOL).second;
375 
376  args.log << " Superdupercell lattice: \n" << superduper.lat_column_mat() << "\n\n";
377 
378  args.log << " Transformation matrix, after enforcing mininum volume:\n"
379  << S << "\n (volume = " << S.cast<double>().determinant() << ")\n\n";
380 
381  }
382 
383  Index index = primclex.add_supercell(superduper);
384  Supercell &superduper_scel = primclex.get_supercell(index);
385 
386  args.log << "--- Lattices as column vector matrices ---\n\n";
387 
388  args.log << " Superdupercell: " << primclex.get_supercell(index).get_name() << "\n\n";
389 
390  args.log << " Superdupercell lattice: \n" << superduper.lat_column_mat() << "\n\n";
391 
392  args.log << " Transformation matrix, relative the primitive cell:\n";
393  args.log << is_supercell(superduper, primclex.get_prim().lattice(), TOL).second << "\n\n";
394 
395  if(vm.count("verbose")) {
396  args.log << "Transformation matrices: \n";
397  for(auto it = lat.begin(); it != lat.end(); ++it) {
398  args.log << "--- \n";
399  args.log << " Unit: " << it->first << ":\n"
400  << it->second.lat_column_mat() << "\n\n";
401 
402  auto res = is_supercell(superduper, it->second, begin, end, TOL);
403  args.log << " Superduper = (op*unit) * T\n\nop:\n";
404  args.log << res.first->matrix() << "\n\n";
405  args.log << " T:\n";
406  args.log << res.second << "\n\n";
407 
408  }
409  args.log << "--- \n";
410  }
411 
412  args.log << " Writing SCEL..." << std::endl;
413  primclex.print_supercells();
414  args.log << " DONE\n";
415 
416 
417  if(vm.count("add-canonical")) {
418  args.log << "Add super configurations:\n";
419  for(auto it = config_lat.begin(); it != config_lat.end(); ++it) {
420  auto res = is_supercell(superduper, it->second, begin, end, TOL);
421  FillSupercell f(superduper_scel, *res.first);
422  Index config_index;
424  bool result = superduper_scel.add_config(
425  f(primclex.configuration(it->first)),
426  config_index,
427  permute_it);
428  if(result) {
429  args.log << " " << it->first << " -> " << superduper_scel.get_config(config_index).name() << "\n";
430  }
431  }
432  args.log << "\n";
433  args.log << " Writing config_list..." << std::endl << std::endl;
434  primclex.write_config_list();
435  args.log << " DONE\n";
436  }
437 
438  return 0;
439 
440  }
441  else if(vm.count("transf-mat")) {
442 
443  Eigen::Matrix3i T;
444  if(!fs::exists(abs_tmatfile[0])) {
445  args.log << "ERROR: " << abs_tmatfile[0] << " not found." << std::endl;
446  return 1;
447  }
448  fs::ifstream file(abs_tmatfile[0]);
449  file >> T;
450  file.close();
451 
452  args.log << "Read transformation matrix, T: \n" << T << "\n\n";
453 
455  if(vm.count("min-volume")) {
456 
457  if(!vm.count("fixed-shape")) {
458  args.log << " Enforcing minimum volume: \n";
459  args.log << " Finding T' = T*M, such that (T').determinant() >= " << min_vol;
460  }
461  else {
462  args.log << " Enforcing minimum volume (with fixed shape): \n";
463  args.log << " Finding T' = T*m*I, such that (T').determinant() >= " << min_vol;
464  }
465  args.log << "\n\n";
466 
467  auto prim_lat = primclex.get_prim().lattice();
468  const SymGroup &pg = primclex.get_prim().point_group();
469 
470  args.log << " Initial transformation matrix:\n" << T
471  << "\n (volume = " << T.cast<double>().determinant() << ")\n\n";
472 
473  auto M = enforce_min_volume(
474  primclex.get_prim().lattice(),
475  T,
476  pg,
477  min_vol,
478  vm.count("fixed-shape"));
479 
480  Lattice niggli_lat = canonical_equivalent_lattice(make_supercell(prim_lat, T * M), pg, TOL);
481  T = is_supercell(niggli_lat, prim_lat, TOL).second;
482 
483  args.log << " Transformation matrix, after enforcing mininum volume:\n"
484  << T << "\n (volume = " << T.cast<double>().determinant() << ")\n\n";
485  }
486 
487 
488  // super lattice
489  if(vm.count("scelnames")) {
490 
491  Supercell &scel = primclex.get_supercell(scelname[0]);
492 
493  args.log << " Unit cell: " << scelname[0] << "\n\n";
494 
495  args.log << " Unit cell lattice: \n" << scel.get_real_super_lattice().lat_column_mat() << "\n\n";
496 
497  Lattice super_lat = make_supercell(scel.get_real_super_lattice(), T);
498  Index index = primclex.add_supercell(super_lat);
499  Supercell &super_scel = primclex.get_supercell(index);
500 
501  args.log << " Add supercell: " << super_scel.get_name() << "\n\n";
502 
503  args.log << " Supercell lattice: \n" << super_scel.get_real_super_lattice().lat_column_mat() << "\n\n";
504 
505  args.log << " Transformation matrix: \n" << super_scel.get_transf_mat() << "\n\n";
506 
507  args.log << " Writing SCEL..." << std::endl;
508  primclex.print_supercells();
509  args.log << " DONE\n";
510 
511  }
512  // super structure
513  else if(vm.count("confignames")) {
514 
515  std::stringstream ss;
516  const Configuration &con = primclex.configuration(configname[0]);
517 
518  VaspIO::PrintPOSCAR p(con);
519  p.sort();
520  p.print(ss);
521 
522  std::istringstream iss(ss.str());
524  unit.read(iss);
525 
526  args.log << "Unit structure:";
527  args.log << "\n------\n";
528  print(unit);
529  args.log << "\n------\n";
530  args.log << "\n\n";
531 
532 
533  BasicStructure<Site> super = unit.create_superstruc(make_supercell(unit.lattice(), T));
534  super.title = std::string("Supercell of ") + con.name();
535 
536  args.log << "Super structure:";
537  args.log << "\n------\n";
538  print(super);
539  args.log << "\n------\n";
540 
541  if(vm.count("add-canonical")) {
542 
543  int map_opt = ConfigMapper::none;
544  double tol = TOL;
545  double vol_tol = 0.25;
546  double lattice_weight = 0.5;
547  ConfigMapper configmapper(primclex, lattice_weight, vol_tol, map_opt, tol);
548 
549  std::string imported_name;
550  Eigen::Matrix3d cart_op;
551  std::vector<Index> best_assignment;
552  jsonParser fullrelax_data;
553  if(configmapper.import_structure_occupation(super,
554  imported_name,
555  fullrelax_data,
556  best_assignment,
557  cart_op,
558  true)) {
559  args.log << " The configuration was imported successfully as "
560  << imported_name << std::endl << std::endl;
561 
562  }
563  else {
564  args.log << " The configuration was mapped onto pre-existing equivalent structure "
565  << imported_name << std::endl << std::endl;
566  }
567 
568  jsonParser json_src;
569  json_src["supercell_of"] = configname[0];
570  primclex.configuration(imported_name).push_back_source(json_src);
571 
572  //Update directories
573  args.log << " Writing SCEL..." << std::endl;
574  primclex.print_supercells();
575  args.log << " Writing config_list..." << std::endl << std::endl;
576  primclex.write_config_list();
577  args.log << " DONE" << std::endl << std::endl;
578 
579  }
580 
581  return 0;
582 
583  }
584  // super lattice of prim lattice
585  else {
586 
587  BasicStructure<Site> unit = primclex.get_prim();
588  SymGroup pg = Structure(unit).point_group();
589 
591  Eigen::Matrix3d S = U * T.cast<double>();
592  Eigen::Matrix3i H_canon;
593  Eigen::Matrix3d op_canon;
594 
596  Eigen::Matrix3i T_niggli = iround(U.inverse() * S_niggli);
597  Eigen::Matrix3i H_niggli = hermite_normal_form(T_niggli).first;
598 
599  std::stringstream s_name;
600  s_name << "SCEL" << H_niggli(0, 0)*H_niggli(1, 1)*H_niggli(2, 2) << "_"
601  << H_niggli(0, 0) << "_" << H_niggli(1, 1) << "_" << H_niggli(2, 2) << "_"
602  << H_niggli(1, 2) << "_" << H_niggli(0, 2) << "_" << H_niggli(0, 1);
603 
604  // S = U*T;
605  // S_canon = op_canon*S = U*T', where H_canon*V = U.inv*op_canon*U*T = T'
606 
607  args.log << "--- Lattices as column vector matrices ---\n\n";
608 
609  args.log << "Prim lattice, U:\n" << U << "\n\n";
610 
611  args.log << "Super lattice, S = U*T:\n" << S << "\n\n";
612 
613  args.log << "This is equivalent to '" << s_name.str() << "', the equivalent super lattice \n" <<
614  "in the standard orientation niggli cell, S_niggli:\n" << S_niggli << "\n\n";
615 
616  args.log << "The transformation matrix (S_niggli = U*T) for '" << s_name.str() << "' is:\n" << T_niggli << "\n\n";
617 
618 
619  args.log << "--- Lattices as row vector matrices ---\n\n";
620 
621  args.log << "Prim lattice:\n" << U.transpose() << "\n\n";
622 
623  args.log << "Super lattice:\n" << S.transpose() << "\n\n";
624 
625  args.log << "This is equivalent to '" << s_name.str() << "', the equivalent super lattice \n" <<
626  "in the standard orientation niggli cell:\n" << S_niggli.transpose() << "\n\n";
627 
628  return 0;
629  }
630 
631  }
632 
633  if(vm.count("get-transf-mat")) {
634 
635  Lattice unit_lat = primclex.get_prim().lattice();
636 
637  if(vm.count("unitcell")) {
638  unit_lat = primclex.get_supercell(unitscelname).get_real_super_lattice();
639  }
640 
641  Lattice super_lat;
642 
643  if(vm.count("structure")) {
644  super_lat = BasicStructure<Site>(abs_structfile).lattice();
645  }
646  else if(vm.count("scelnames")) {
647  super_lat = primclex.get_supercell(scelname[0]).get_real_super_lattice();
648  }
649  else {
650  args.log << "Error in 'casm super --get-transf-mat'. No --structure or --scelnames given." << std::endl << std::endl;
651  return 1;
652  }
653 
654  args.log << "--- Lattices as column vector matrices ---\n\n";
655 
656  args.log << "Unit lattice, U:\n" << unit_lat.lat_column_mat() << "\n\n";
657 
658  args.log << "Super lattice, S:\n" << super_lat.lat_column_mat() << "\n\n";
659 
660  // see if super_lat is a supercell of unitlat
661  // S == U*T
662  Eigen::Matrix3d T = unit_lat.lat_column_mat().inverse() * super_lat.lat_column_mat();
663 
664  if(is_integer(T, TOL) && !almost_zero(T, TOL)) {
665  args.log << "The super lattice is a supercell of the unit lattice.\n\n";
666 
667  args.log << "The transformation matrix, T, where S = U*T, is: \n" << iround(T) << "\n\n";
668  }
669  else {
670  args.log << "The super lattice is NOT a supercell of the unit lattice.\n\n";
671 
672  args.log << "The transformation matrix, T, where S = U*T, is: \n" << T << "\n\n";
673  }
674 
675  return 0;
676  }
677 
678  return 0;
679  };
680 
681 }
682 
683 
const Configuration & get_config(Index i) const
Definition: Supercell.hh:287
Data structure holding basic CASM command info.
COORD_TYPE coordtype_enum() const
Return the coordinate type recasted as the CASM defined enum.
Definition: Handlers.cc:220
bool almost_zero(const T &val, double tol=TOL)
If T is not integral, use std::abs(val) < tol;.
Definition: CASM_math.hh:41
std::string get_name() const
Return supercell name.
Definition: Supercell.cc:123
const fs::path & struct_path() const
Definition: super.cc:22
void write_config_list(std::set< std::string > scel_to_delete={})
Definition: PrimClex.cc:450
Lattice superdupercell(const Lattice &lat1, const Lattice &lat2)
returns Lattice that is smallest possible supercell of both input Lattice
Definition: Lattice.cc:1161
void add_scelnames_suboption()
Add a –scelnames suboption.
Definition: Handlers.cc:346
#define ERR_INVALID_ARG
const SymGroup & point_group() const
Definition: Structure.cc:101
Structure specifies the lattice and atomic basis of a crystal.
Definition: Structure.hh:29
void set_atom_names_off()
Do not print atom names line.
Definition: VaspIO.hh:163
PrimClex * primclex
Definition: settings.cc:101
void set_atom_names_on()
Print atom names line.
Definition: VaspIO.hh:168
void add_help_suboption()
Add a plain –help suboption.
Definition: Handlers.cc:276
iterator selected_config_begin()
double tolerance() const
Definition: super.cc:34
BasicStructure create_superstruc(const Lattice &scel_lat, double map_tol=TOL) const
Shortcut routine to create a supercell structure and fill it with sites.
void push_back_source(const jsonParser &source)
Eigen::Matrix3i enforce_min_volume(const UnitType &unit, const Eigen::Matrix3i &T, const SymGroup &point_grp, Index volume, bool fix_shape=false)
Return a transformation matrix that ensures a supercell of at least some volume.
const Lattice & get_real_super_lattice() const
Definition: Supercell.hh:267
void add_configlists_nodefault_suboption()
Add –configs suboption (no default)
Definition: Handlers.cc:267
Lattice make_supercell(const Lattice &lat, const Eigen::Matrix3i &transf_mat)
Returns a super Lattice.
Definition: Lattice.hh:377
Main CASM namespace.
Definition: complete.cpp:8
const Lattice & lattice() const
const double TOL
Represents a supercell of the primitive parent crystal structure.
Definition: Supercell.hh:37
const Eigen::Matrix3d & lat_column_mat() const
3x3 matrix with lattice vectors as its columne
Definition: Lattice.hh:104
static std::string path()
Get value_type string for path completion.
Definition: Handlers.cc:39
static std::string supercell()
Get value_type string for supercell completion.
Definition: Handlers.cc:47
int super_command(const CommandArgs &args)
Definition: super.cc:103
void print(std::ostream &sout)
Print POSCAR to stream.
Definition: VaspIO.hh:509
SymGroup is a collection of symmetry operations that satisfy the group property The symmetry operatio...
Definition: SymGroup.hh:33
double tol
const po::options_description & desc()
Get the program options, filled with the initialized values.
Definition: Handlers.cc:160
COORD_MODE specifies the current coordinate mode (Fractional or Cartesian)
EigenIndex Index
For long integer indexing:
void sort()
Default sort is by atom name.
Definition: VaspIO.hh:500
std::vector< fs::path > m_transf_mat_paths
Definition: Handlers.hh:689
Lattice canonical_equivalent_lattice(const Lattice &in_lat, const SymGroup &point_grp, double compare_tol)
Find the niggli, most standard oriented version of the given orbit (defined by the given SymGroup) of...
Definition: Niggli.cc:276
const std::string & unit_scel_str() const
Definition: super.cc:26
po::options_description m_desc
Boost program options. All the derived classes have them, but will fill them up themselves.
Definition: Handlers.hh:126
bool add_config(const Configuration &config)
Definition: Supercell.cc:568
const std::vector< std::string > & config_strs() const
Returns the names of the supercells for add_configname_suboption(), for when multiple=false.
Definition: Handlers.cc:204
PrimClex is the top-level data structure for a CASM project.
Definition: PrimClex.hh:52
std::string title
User-specified name of this Structure.
std::string name() const
SCELV_A_B_C_D_E_F/i.
virtual void read(std::istream &stream)
Print intpolated images in seperate directries.
const Configuration & configuration(const std::string &configname) const
access configuration by name (of the form "scellname/[NUMBER]", e.g., ("SCEL1_1_1_1_0_0_0/0") ...
Definition: PrimClex.cc:347
void add_confignames_suboption()
Add a –confignames suboption.
Definition: Handlers.cc:365
std::pair< Eigen::MatrixXi, Eigen::MatrixXi > hermite_normal_form(const Eigen::MatrixXi &M)
Return the hermite normal form, M == H*V.
void print_supercells(std::set< std::string > scel_to_delete={}) const
Definition: PrimClex.cc:557
void set_coord_mode(COORD_TYPE mode)
Set coordinate mode.
Definition: VaspIO.hh:148
T const * end() const
Definition: Array.hh:197
Index add_supercell(const Lattice &superlat)
Definition: PrimClex.cc:550
const std::vector< std::string > & supercell_strs() const
Returns the list of the supercells for add_scelnames_suboption()
Definition: Handlers.cc:212
bool is_integer(const Eigen::MatrixBase< Derived > &M, double tol)
Check if Eigen::Matrix is integer.
ConfigIO::GenericConfigFormatter< std::string > configname()
Constructs DataFormmaterDictionary containing all Configuration DatumFormatters.
Definition: ConfigIO.cc:340
void add_coordtype_suboption()
Add a –coord suboption to specify FRAC or CART.
Definition: Handlers.cc:377
Eigen::Matrix3d Matrix3d
PrimClex & make_primclex_if_not(const CommandArgs &args, std::unique_ptr< PrimClex > &uniq_primclex)
If !_primclex, construct new PrimClex stored in uniq_primclex, then return reference to existing or c...
Print POSCAR with formating options.
Definition: VaspIO.hh:232
const Supercell & get_supercell(Index i) const
const Access supercell by index
Definition: PrimClex.cc:311
std::pair< bool, Eigen::MatrixXi > is_supercell(const Lattice &scel, const Lattice &unit, double tol)
Check if scel is a supercell of unitcell unit and some integer transformation matrix T...
Definition: Lattice.cc:1196
void error(const std::string &what)
Definition: Log.hh:86
T const * begin() const
Definition: Array.hh:185
Supercell & get_supercell() const
Get the Supercell for this Configuration.
Eigen::CwiseUnaryOp< decltype(std::ptr_fun(boost::math::iround< typename Derived::Scalar >)), const Derived > iround(const Eigen::MatrixBase< Derived > &val)
Round Eigen::MatrixXd to Eigen::MatrixXi.
const Eigen::Matrix3i & get_transf_mat() const
Definition: Supercell.hh:263
ConfigIO::GenericConfigFormatter< std::string > scelname()
Definition: ConfigIO.cc:348
void initialize() override
Fill in the options descriptions accordingly.
Definition: super.cc:38
const std::vector< fs::path > & transf_mat_paths() const
Definition: super.cc:18
const std::vector< fs::path > & selection_paths() const
Returns the string corresponding to add_config_suboption()
Definition: Handlers.cc:172
A Configuration represents the values of all degrees of freedom in a Supercell.
const Structure & get_prim() const
const Access to primitive Structure
Definition: PrimClex.cc:260
Index min_vol() const
Definition: super.cc:30
bool import_structure_occupation(const fs::path &pos_path, std::string &imported_name, jsonParser &relaxation_properties, std::vector< Index > &best_assignment, Eigen::Matrix3d &cart_op) const
imports structure specified by 'pos_path' into primclex() by finding optimal mapping and then setting...
#define ERR_NO_PROJ