21 (
"relaxed,r",
"Attempt to display corresponding relaxed structures to the given configurations.");
31 std::vector<std::string> confignames;
39 po::positional_options_description p;
40 p.add(
"confignames", -1);
43 po::store(po::command_line_parser(args.
argc - 1, args.
argv + 1).options(view_opt.
desc()).positional(p).run(), vm);
48 if(vm.count(
"help")) {
50 args.
log << view_opt.
desc() << std::endl;
55 if(vm.count(
"desc")) {
57 args.
log << view_opt.
desc() << std::endl;
58 args.
log <<
"This allows opening visualization programs directly from \n"
59 "CASM. It iterates over all selected configurations and \n"
60 "one by one writes a POSCAR and executes \n"
61 " '$VIEW_COMMAND /path/to/POSCAR' \n"
62 "where $VIEW_COMMAND is set via 'casm settings --set-view-command'.\n"
63 "A script 'casm.view' is included with can be used to run \n"
64 "a command and then pause 1s, which is useful for opening \n"
65 "POSCARs with VESTA. An example on Mac might look like: \n"
66 " casm settings --set-view-command 'casm.view \"open -a /Applications/VESTA/VESTA.app\"' \n\n";
78 args.
err_log <<
"ERROR: " << e.what() << std::endl << std::endl;
82 catch(std::exception &e) {
83 args.
err_log <<
"Unhandled Exception reached the top of main: "
84 << e.what() <<
", application will now exit" << std::endl;
99 args.
err_log <<
"Error in 'casm view': No command set. Use 'casm settings "
100 "--set-view-command' to set the command to open visualization "
101 "software. It should take one argument, the path to a POSCAR "
102 "to be visualized. For example, to use VESTA on Mac: casm settings --set-view-command 'casm.view \"open -a /Applications/VESTA/VESTA.app\"'.\n";
108 std::unique_ptr<PrimClex> uniq_primclex;
112 if(!vm.count(
"config")) {
115 else if(selection ==
"MASTER") {
123 for(
int i = 0; i < confignames.size(); i++) {
127 fs::path tmp_dir = root /
".casm" /
"tmp";
128 fs::create_directory(tmp_dir);
135 fs::path POSCARpath = tmp_dir /
"POSCAR";
138 fs::path pos_path = it->calc_properties_path();
139 args.
log <<
"Obtaining relaxed structure from:\n";
140 args.
log << pos_path.string() << std::endl;
145 file.open(POSCARpath);
151 args.
log << it->name() <<
" relaxed" <<
":\n";
154 popen.
print(std::cout);
160 fs::path POSCARpath = tmp_dir /
"POSCAR";
161 file.open(POSCARpath);
166 if(vm.count(
"relaxed")) {
167 args.
log <<
"No relaxed structure found." <<
"\n";
169 args.
log << it->name() <<
":\n";
Data structure holding basic CASM command info.
void from_json(ClexDescription &desc, const jsonParser &json)
const_iterator selected_config_cbegin() const
Specification of CASM project directory structure.
void add_help_suboption()
Add a plain –help suboption.
int view_command(const CommandArgs &args)
void popen(std::string _command)
Execute popen for a given command.
void print(std::ostream &sout) const
Print the last command executed and the resulting stdout.
const fs::path & selection_path() const
Returns the string corresponding to add_config_suboption()
Remember how to use popen.
void print(std::ostream &sout)
Print POSCAR to stream.
void set_selected(const std::string &configname, bool is_selected)
void add_configlist_nodefault_suboption()
Add –config suboption (no default)
const po::options_description & desc()
Get the program options, filled with the initialized values.
Read/modify settings of an already existing CASM project.
void sort()
Default sort is by atom name.
bool is_calculated(const Configuration &config)
Return true if all current properties have been been calculated for the configuration.
po::options_description m_desc
Boost program options. All the derived classes have them, but will fill them up themselves.
const std::vector< std::string > & config_strs() const
Returns the names of the supercells for add_configname_suboption(), for when multiple=false.
PrimClex is the top-level data structure for a CASM project.
const_iterator selected_config_cend() const
SimpleJSonSiteStructure< true > simple_json(const BasicStructure< Site > &struc, const std::string &prefix)
void add_confignames_suboption()
Add a –confignames suboption.
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.
void error(const std::string &what)
void initialize() override
Fill in the options descriptions accordingly.
std::string view_command() const
Get current command used by 'casm view'.
#define ERR_MISSING_DEPENDS