From b40bcd0cfb106c3ead1c2572ede99ee94c7a225e Mon Sep 17 00:00:00 2001 From: jeremiah Date: Mon, 24 Jul 2023 17:45:46 -0700 Subject: [PATCH 1/3] return the correct transformation matrix --- src/casm/app/super.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/casm/app/super.cc b/src/casm/app/super.cc index b662f16a0..3cc08b0f4 100644 --- a/src/casm/app/super.cc +++ b/src/casm/app/super.cc @@ -699,7 +699,7 @@ int super_command(const CommandArgs &args) { super_lat = BasicStructure::from_poscar_stream(abs_structfile_stream).lattice(); } else if (vm.count("scelnames")) { - super_lat = primclex.db().find(unitscelname)->lattice(); + super_lat = primclex.db().find(scelname[0])->lattice(); } else { log() << "Error in 'casm super --get-transf-mat'. No --structure or " "--scelnames given." From 4cbd73d25132a285d3ceb7fd6fd47a3b59790d50 Mon Sep 17 00:00:00 2001 From: jeremiah Date: Mon, 24 Jul 2023 18:19:28 -0700 Subject: [PATCH 2/3] fix check for multiple --scelnames, --confignames, etc. without --duper --- src/casm/app/super.cc | 76 +++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src/casm/app/super.cc b/src/casm/app/super.cc index 3cc08b0f4..3030ae1a3 100644 --- a/src/casm/app/super.cc +++ b/src/casm/app/super.cc @@ -150,31 +150,6 @@ int super_command(const CommandArgs &args) { po::parse_command_line(args.argc(), args.argv(), super_opt.desc()), vm); // can throw - if (!vm.count("help") && !vm.count("desc")) { - if (!vm.count("duper")) { - if (vm.count("transf-mat") + vm.count("get-transf-mat") != 1) { - err_log() << "Error in 'casm super'. Only one of --transf-mat or " - "--get-transf-mat may be chosen." - << std::endl; - return ERR_INVALID_ARG; - } - if (configname.size() > 1 || scelname.size() > 1 || - tmatfile.size() > 1) { - err_log() << "ERROR: more than one --confignames, --scelnames, or " - "--transf-mat argument " - "is only allowed for option --duper" - << std::endl; - return ERR_INVALID_ARG; - } - if (config_path.size() > 0) { - err_log() << "ERROR: the --configs option is only allowed with " - "option --duper" - << std::endl; - return ERR_INVALID_ARG; - } - } - } - /** --help option */ if (vm.count("help")) { @@ -184,7 +159,7 @@ int super_command(const CommandArgs &args) { return 0; } - if (vm.count("desc")) { + else if (vm.count("desc")) { log() << "\n"; log() << super_opt.desc() << std::endl; log() << "DESCRIPTION" << std::endl; @@ -246,18 +221,43 @@ int super_command(const CommandArgs &args) { return 0; } - po::notify(vm); // throws on error, so do after help in case - // there are any problems - - scelname = super_opt.supercell_strs(); - configname = super_opt.config_strs(); - unitscelname = super_opt.unit_scel_str(); - structfile = super_opt.struct_path(); - tmatfile = super_opt.transf_mat_paths(); - config_path = super_opt.selection_paths(); - min_vol = super_opt.min_vol(); - tol = super_opt.tolerance(); - coordtype = super_opt.coordtype_enum(); + else { + po::notify(vm); // throws on error, so do after help in case + // there are any problems + + scelname = super_opt.supercell_strs(); + configname = super_opt.config_strs(); + unitscelname = super_opt.unit_scel_str(); + structfile = super_opt.struct_path(); + tmatfile = super_opt.transf_mat_paths(); + config_path = super_opt.selection_paths(); + min_vol = super_opt.min_vol(); + tol = super_opt.tolerance(); + coordtype = super_opt.coordtype_enum(); + if (!vm.count("duper")) { + if (vm.count("transf-mat") + vm.count("get-transf-mat") != 1) { + err_log() << "Error in 'casm super'. Only one of --transf-mat or " + "--get-transf-mat may be chosen." + << std::endl; + return ERR_INVALID_ARG; + } + if (configname.size() > 1 || scelname.size() > 1 || + tmatfile.size() > 1) { + err_log() << "ERROR: more than one --confignames, --scelnames, or " + "--transf-mat argument " + "is only allowed for option --duper" + << std::endl; + return ERR_INVALID_ARG; + } + if (config_path.size() > 0) { + err_log() << "ERROR: the --configs option is only allowed with " + "option --duper" + << std::endl; + return ERR_INVALID_ARG; + } + } + } + } catch (po::error &e) { err_log() << "ERROR: " << e.what() << std::endl << std::endl; err_log() << super_opt.desc() << std::endl; From 0e1921b96612b34b904e58d9c3bc1b3b9d2665e7 Mon Sep 17 00:00:00 2001 From: jeremiah Date: Mon, 24 Jul 2023 18:56:24 -0700 Subject: [PATCH 3/3] reformat --- src/casm/app/super.cc | 149 +++++++++++++++++++----------------------- 1 file changed, 69 insertions(+), 80 deletions(-) diff --git a/src/casm/app/super.cc b/src/casm/app/super.cc index 3030ae1a3..1c3565e0a 100644 --- a/src/casm/app/super.cc +++ b/src/casm/app/super.cc @@ -54,70 +54,59 @@ void SuperOption::initialize() { add_configlists_nodefault_suboption(); add_coordtype_suboption(); - m_desc.add_options()("transf-mat", - po::value >(&m_transf_mat_paths) - ->multitoken() - ->value_name(ArgHandler::path()), - "1 or more files containing a 3x3 transformation matrix " - "used to create a supercell.") - - ("get-transf-mat", "If it exists, find the transformation matrix.") - - ("structure", - po::value(&m_struct_path)->value_name(ArgHandler::path()), - "File with structure (POSCAR type) to use.") - - ("unitcell", - po::value(&m_unit_scel_str) - ->value_name(ArgHandler::supercell()), - "Name of supercell to use as unit cell. For ex. " - "'SCEL2_2_1_1_0_0_0'.") - - ("duper", - "Construct the superduperlattice, the minimum supercell of " - "all input supercells " - "and configurations.") - - ("fixed-orientation", - "When constructing the superduperlattice, do not " - "consider other symmetrically " - "equivalent orientations.") - - ("min-volume", po::value(&m_min_vol), - "Transforms the transformation matrix, T -> T', " - "where T' = T*M, such that " - "(T').determininant() >= V. This has the effect " - "that a supercell has a " - "particular volume.") - - ("fixed-shape", - "Used with --min-volume to enforce that T' = " - "T*m*I, where I is the identity " - "matrix, and m is a scalar. This has the effect " - "of preserving the shape " - "of the resulting supercell, but increasing the " - "volume.") - - ("verbose", - "When used with --duper, show how the input " - "lattices are transformed " - "to tile the superduperlattice.") - - ("add-canonical,a", - "Will add the generated super " - "configuration in it's " - "canonical form in the equivalent " - "niggli supercell.") - - ("vasp5", - "Print using VASP5 style (include " - "atom name line)") - - ("tol", - po::value(&m_tolerance) - ->default_value(CASM::TOL), - "Tolerance used for checking " - "symmetry"); + m_desc.add_options()( + "transf-mat", + po::value >(&m_transf_mat_paths) + ->multitoken() + ->value_name(ArgHandler::path()), + "One or more files containing a 3x3 transformation matrix used to create " + "a supercell.")( + + "get-transf-mat", + "If it exists, find the transformation matrix.")( + + "structure", + po::value(&m_struct_path)->value_name(ArgHandler::path()), + "File with structure (POSCAR type) to use.")( + + "unitcell", + po::value(&m_unit_scel_str) + ->value_name(ArgHandler::supercell()), + "Name of supercell to use as unit cell. For ex. 'SCEL2_2_1_1_0_0_0'.")( + + "duper", + "Construct the superduperlattice, the minimum supercell of all input " + "supercells and configurations.")( + + "fixed-orientation", + "When constructing the superduperlattice, do not consider other " + "symmetrically equivalent orientations.")( + + "min-volume", po::value(&m_min_vol), + "Transforms the transformation matrix, T -> T', where T' = T*M, " + "such that (T').determininant() >= V. This has the effect " + "that a supercell has a particular volume.")( + + "fixed-shape", + "Used with --min-volume to enforce that T' = T*m*I, where I is the " + "identity matrix, and m is a scalar. This has the effect of preserving " + "the shape of the resulting supercell, but increasing the volume.")( + + "verbose", + "When used with --duper, show how the input lattices are transformed to " + "tile the superduperlattice.")( + + "add-canonical,a", + "Will add the generated super configuration in its canonical form in the " + "equivalent niggli supercell.")( + + "vasp5", + "Print using VASP5 style (include atom name line).")( + + "tol", + po::value(&m_tolerance) + ->default_value(CASM::TOL), + "Tolerance used for checking symmetry"); return; } @@ -222,36 +211,36 @@ int super_command(const CommandArgs &args) { } else { - po::notify(vm); // throws on error, so do after help in case - // there are any problems - - scelname = super_opt.supercell_strs(); - configname = super_opt.config_strs(); - unitscelname = super_opt.unit_scel_str(); - structfile = super_opt.struct_path(); - tmatfile = super_opt.transf_mat_paths(); - config_path = super_opt.selection_paths(); - min_vol = super_opt.min_vol(); - tol = super_opt.tolerance(); - coordtype = super_opt.coordtype_enum(); + po::notify(vm); // throws on error, so do after help in case + // there are any problems + + scelname = super_opt.supercell_strs(); + configname = super_opt.config_strs(); + unitscelname = super_opt.unit_scel_str(); + structfile = super_opt.struct_path(); + tmatfile = super_opt.transf_mat_paths(); + config_path = super_opt.selection_paths(); + min_vol = super_opt.min_vol(); + tol = super_opt.tolerance(); + coordtype = super_opt.coordtype_enum(); if (!vm.count("duper")) { if (vm.count("transf-mat") + vm.count("get-transf-mat") != 1) { err_log() << "Error in 'casm super'. Only one of --transf-mat or " - "--get-transf-mat may be chosen." + "--get-transf-mat may be chosen." << std::endl; return ERR_INVALID_ARG; } if (configname.size() > 1 || scelname.size() > 1 || tmatfile.size() > 1) { err_log() << "ERROR: more than one --confignames, --scelnames, or " - "--transf-mat argument " - "is only allowed for option --duper" + "--transf-mat argument " + "is only allowed for option --duper" << std::endl; return ERR_INVALID_ARG; } if (config_path.size() > 0) { err_log() << "ERROR: the --configs option is only allowed with " - "option --duper" + "option --duper" << std::endl; return ERR_INVALID_ARG; }