13 : m_primclex(_primclex), m_report_dir(report_dir) {}
17 "Remove a supercell, including all enumerated configurations and "
18 "calculation results: \n\n"
20 " 'casm remove --type scel' options: \n\n"
22 " - Supercells to be erased can be specified with the --names and \n"
23 " --selection options.\n"
24 " - Use without additional options to remove all enumerated "
26 " that do not have any associated files or data for each specified "
28 " If no data or files, erase supercell.\n"
29 " - Use --data (-d) to remove all configuration data, but not "
31 " configurations, for each specified supercell. \n"
32 " - Use --force (-f) to remove specified supercells including all data "
34 " enumerated configurations. \n"
35 " - Use --dry-run (-n) to do a \"dry-run\". \n\n";
54 for (; it != end; ++it) {
55 selection.
data()[it.name()] =
true;
70 for (; it != end; ++it) {
108 template <
typename T>
113 count_remaining<T>();
124 template <
typename T>
129 count_remaining<T>();
137 bool did_erase =
false;
140 auto it = selection.
selected().begin();
141 auto end = selection.
selected().end();
142 for (; it != end; ++it) {
148 log() <<
"will erase " << it.name() <<
"\n";
154 log() <<
"skipping " << it.name() <<
": has " << f.
remaining
155 <<
" configurations remaining.\n";
169 auto it = selection.
selected().begin();
170 auto end = selection.
selected().end();
171 for (; it != end; ++it) {
182 auto it = selection.
selected().begin();
183 auto end = selection.
selected().end();
184 for (; it != end; ++it) {
190 log() <<
"will erase " << it.name() <<
"\n";
195 log() <<
"unknown error: erase_all called, but " << it.name()
196 <<
" still has " << f.
remaining <<
" configurations.\n";
197 log() <<
"stopping..." << std::endl;
213 std::stringstream msg;
214 msg <<
"Invalid Supercell name: " <<
name;
229 }
else if (opt.
data()) {
const fs::path & selection_path() const
Returns the string corresponding to add_config_suboption()
const std::vector< std::string > & name_strs() const
bool has_existing_data_or_files(const std::string &to_configname) const
const PrimClex & primclex() const
const PrimClex & m_primclex
std::string report_dir() const
void erase_data(const DB::Selection< Supercell > &selection, bool dry_run)
Erase data and files (permanently), but not configs / supercells.
void erase_all(const DB::Selection< Supercell > &selection, bool dry_run)
Removes supercell, including all configurations, data, and files (permanently)
void erase(const DB::Selection< Supercell > &selection, bool dry_run)
Erase all enumerated configs that have no data; if no data, erase supercell.
const PrimClex & primclex() const
static std::string desc()
Remove(const PrimClex &primclex, std::string report_dir)
static int run(const PrimClex &, const Completer::RmOption &opt)
void erase(const DB::Selection< ConfigType > &selection, bool dry_run)
Erase Configurations that have no data.
void erase_data(const DB::Selection< ConfigType > &selection, bool dry_run)
Erase data and files (permanently), but not Configuration.
void erase_all(const DB::Selection< ConfigType > &selection, bool dry_run)
Removes Configurations and data and files (permanently)
boost::iterator_range< iterator > selected()
fs::path root_dir() const
Return casm project directory path.
PrimClex is the top-level data structure for a CASM project.
Represents a supercell of the primitive parent crystal structure.
DB::Database< T > & db() const
const DirectoryStructure & dir() const
Access DirectoryStructure object. Throw if not set.
void commit(ProjectSettings const &set)
std::string create_report_dir(std::string report_dir)
Create a new report directory to avoid overwriting existing results.
void for_each_config_type(F f)
GenericDatumFormatter< std::string, DataObject > name()
INDEX_TYPE Index
For long integer indexing:
EraseAllScelConfigs(Remove< Supercell > &_remover, std::string _scelname, bool _dry_run)
EraseDataScelConfigs(Remove< Supercell > &_remover, std::string _scelname, bool _dry_run)
Helper struct base class.
const PrimClex & primclex
EraseScelConfigsBase(Remove< Supercell > &_remover, std::string _scelname, bool _dry_run)
const Remove< Supercell > & remover
DB::Selection< T > make_selection() const
EraseScelConfigs(Remove< Supercell > &_remover, std::string _scelname, bool _dry_run)