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