Changes in src/Actions/MapOfActions.cpp [b540f3:986ed3]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/MapOfActions.cpp
rb540f3 r986ed3 17 17 #include <boost/optional.hpp> 18 18 #include <boost/program_options.hpp> 19 20 #include <iostream> 19 21 20 22 #include "CommandLineParser.hpp" … … 65 67 #include "Actions/WorldAction/SetDefaultNameAction.hpp" 66 68 #include "Actions/WorldAction/SetGaussianBasisAction.hpp" 67 #include "Actions/WorldAction/SetOutputFormatsAction.hpp"68 69 #include "Actions/Values.hpp" 69 70 … … 71 72 { 72 73 VectorValue VV; 73 std::vector<std::string> components; 74 75 // split comma-separated values 76 if (values.size() != 1) { 77 cerr << "Not one vector but " << components.size() << " given " << endl; 78 throw boost::program_options::validation_error("Unequal to one vector given"); 79 } 80 std::string argument(values.at(0)); 81 std::string::iterator Aiter = argument.begin(); 82 std::string::iterator Biter = argument.begin(); 83 for (; Aiter != argument.end(); ++Aiter) { 84 if (*Aiter == ',') { 85 components.push_back(string(Biter,Aiter)); 86 do { 87 Aiter++; 88 } while (*Aiter == ' ' || *Aiter == '\t'); 89 Biter = Aiter; 90 } 91 } 92 components.push_back(string(Biter,argument.end())); 93 94 if (components.size() != 3) { 95 cerr << "Specified vector does not have three components but " << components.size() << endl; 74 if (values.size() != 3) { 75 cerr << "Specified vector does not have three components but " << values.size() << endl; 96 76 throw boost::program_options::validation_error("Specified vector does not have three components"); 97 77 } 98 VV.x = boost::lexical_cast<double>( components.at(0));99 VV.y = boost::lexical_cast<double>( components.at(1));100 VV.z = boost::lexical_cast<double>( components.at(2));78 VV.x = boost::lexical_cast<double>(values.at(0)); 79 VV.y = boost::lexical_cast<double>(values.at(1)); 80 VV.z = boost::lexical_cast<double>(values.at(2)); 101 81 v = boost::any(VectorValue(VV)); 102 82 } … … 105 85 { 106 86 BoxValue BV; 107 std::vector<std::string> components; 108 109 // split comma-separated values 110 if (values.size() != 1) { 111 cerr << "Not one vector but " << components.size() << " given " << endl; 112 throw boost::program_options::validation_error("Unequal to one vector given"); 113 } 114 std::string argument(values.at(0)); 115 std::string::iterator Aiter = argument.begin(); 116 std::string::iterator Biter = argument.begin(); 117 for (; Aiter != argument.end(); ++Aiter) { 118 if (*Aiter == ',') { 119 components.push_back(string(Biter,Aiter)); 120 do { 121 Aiter++; 122 } while (*Aiter == ' ' || *Aiter == '\t'); 123 Biter = Aiter; 124 } 125 } 126 components.push_back(string(Biter,argument.end())); 127 128 if (components.size() != 6) { 129 cerr << "Specified vector does not have three components but " << components.size() << endl; 87 if (values.size() != 6) { 88 cerr << "Specified vector does not have three components but " << values.size() << endl; 130 89 throw boost::program_options::validation_error("Specified symmetric box matrix does not have six components"); 131 90 } 132 BV.xx = boost::lexical_cast<double>( components.at(0));133 BV.xy = boost::lexical_cast<double>( components.at(1));134 BV.xz = boost::lexical_cast<double>( components.at(2));135 BV.yy = boost::lexical_cast<double>( components.at(3));136 BV.yz = boost::lexical_cast<double>( components.at(4));137 BV.zz = boost::lexical_cast<double>( components.at(5));91 BV.xx = boost::lexical_cast<double>(values.at(0)); 92 BV.xy = boost::lexical_cast<double>(values.at(1)); 93 BV.xz = boost::lexical_cast<double>(values.at(2)); 94 BV.yy = boost::lexical_cast<double>(values.at(3)); 95 BV.yz = boost::lexical_cast<double>(values.at(4)); 96 BV.zz = boost::lexical_cast<double>(values.at(5)); 138 97 v = boost::any(BoxValue(BV)); 139 98 } … … 171 130 DescriptionMap["input"] = "specify input files"; 172 131 DescriptionMap["linear-interpolate"] = "linear interpolation in discrete steps between start and end position of a molecule"; 132 DescriptionMap["nonconvex-envelope"] = "create the non-convex envelope for a molecule"; 173 133 DescriptionMap["molecular-volume"] = "calculate the volume of a given molecule"; 174 DescriptionMap["nonconvex-envelope"] = "create the non-convex envelope for a molecule"; 175 DescriptionMap["output"] = "write output files"; 176 DescriptionMap["set-output"] = "specify output formats"; 134 DescriptionMap["output"] = "specify output formats"; 177 135 DescriptionMap["pair-correlation"] = "pair correlation analysis between two elements, element and point or element and surface"; 178 136 DescriptionMap["parse-xyz"] = "parse xyz file into World"; … … 182 140 DescriptionMap["repeat-box"] = "create periodic copies of the simulation box per axis"; 183 141 DescriptionMap["rotate-to-pas"] = "calculate the principal axis system of the specified molecule and rotate specified axis to align with main axis"; 142 DescriptionMap["set-basis"] = "set the name of the gaussian basis set for MPQC"; 184 143 DescriptionMap["save-adjacency"] = "name of the adjacency file to write to"; 185 144 DescriptionMap["save-bonds"] = "name of the bonds file to write to"; … … 187 146 DescriptionMap["SaveXyz"] = "save world as xyz file"; 188 147 DescriptionMap["scale-box"] = "scale box and atomic positions inside"; 189 DescriptionMap["set-basis"] = "set the name of the gaussian basis set for MPQC";190 DescriptionMap["set-output"] = "specify output formats";191 148 DescriptionMap["subgraph-dissect"] = "dissect the molecular system into molecules representing disconnected subgraphs"; 192 149 DescriptionMap["suspend-in-water"] = "suspend the given molecule in water such that in the domain the mean density is as specified"; … … 232 189 ShortFormMap["center-in-box"] = "b"; 233 190 ShortFormMap["change-element"] = "E"; 234 // ShortFormMap["convex-envelope"] = "x";191 ShortFormMap["convex-envelope"] = "o"; 235 192 ShortFormMap["default-molname"] = "X"; 236 193 ShortFormMap["depth-first-search"] = "D"; … … 243 200 ShortFormMap["linear-interpolate"] = "L"; 244 201 ShortFormMap["nonconvex-envelope"] = "N"; 245 // ShortFormMap["output"] = "o";246 202 ShortFormMap["pair-correlation"] = "C"; 247 203 ShortFormMap["parse-xyz"] = "p"; … … 255 211 ShortFormMap["scale-box"] = "s"; 256 212 ShortFormMap["set-basis"] = "M"; 257 ShortFormMap["set-output"] = "o";258 213 ShortFormMap["subgraph-dissect"] = "I"; 259 214 ShortFormMap["suspend-in-water"] = "u"; … … 283 238 TypeMap["molecular-volume"] = Molecule; 284 239 TypeMap["nonconvex-envelope"] = Molecule; 285 TypeMap["output"] = None;240 TypeMap["output"] = String; 286 241 TypeMap["parse-xyz"] = String; 287 242 TypeMap["pair-correlation"] = String; … … 296 251 TypeMap["scale-box"] = Vector; 297 252 TypeMap["set-basis"] = String; 298 TypeMap["set-output"] = ListOfString;299 253 TypeMap["subgraph-dissect"] = None; 300 254 TypeMap["suspend-in-water"] = Double; … … 395 349 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "default-molname") ); 396 350 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "set-basis") ); 397 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "set-output") );398 351 399 352 // put actions into command line category … … 433 386 generic.insert("scale-box"); 434 387 generic.insert("set-basis"); 435 generic.insert("set-output");436 388 generic.insert("subgraph-dissect"); 437 389 generic.insert("suspend-in-water"); … … 532 484 new WorldSetDefaultNameAction(); 533 485 new WorldSetGaussianBasisAction(); 534 new WorldSetOutputFormatsAction();535 486 } 536 487 … … 610 561 ; 611 562 break; 612 case ListOfString:613 ListRunner->second->add_options()614 (getKeyAndShortForm(*OptionRunner).c_str(),615 po::value< vector<std::string> >()->multitoken(),616 getDescription(*OptionRunner).c_str())617 ;618 break;619 563 case Axis: 620 564 ListRunner->second->add_options() … … 629 573 ListRunner->second->add_options() 630 574 (getKeyAndShortForm(*OptionRunner).c_str(), 631 po::value<VectorValue>() ,575 po::value<VectorValue>()->multitoken(), 632 576 getDescription(*OptionRunner).c_str()) 633 577 ;
Note:
See TracChangeset
for help on using the changeset viewer.