Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/MapOfActions.cpp

    rb540f3 r986ed3  
    1717#include <boost/optional.hpp>
    1818#include <boost/program_options.hpp>
     19
     20#include <iostream>
    1921
    2022#include "CommandLineParser.hpp"
     
    6567#include "Actions/WorldAction/SetDefaultNameAction.hpp"
    6668#include "Actions/WorldAction/SetGaussianBasisAction.hpp"
    67 #include "Actions/WorldAction/SetOutputFormatsAction.hpp"
    6869#include "Actions/Values.hpp"
    6970
     
    7172{
    7273  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;
    9676    throw boost::program_options::validation_error("Specified vector does not have three components");
    9777  }
    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));
    10181  v = boost::any(VectorValue(VV));
    10282}
     
    10585{
    10686  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;
    13089    throw boost::program_options::validation_error("Specified symmetric box matrix does not have six components");
    13190  }
    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));
    13897  v = boost::any(BoxValue(BV));
    13998}
     
    171130  DescriptionMap["input"] = "specify input files";
    172131  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";
    173133  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";
    177135  DescriptionMap["pair-correlation"] = "pair correlation analysis between two elements, element and point or element and surface";
    178136  DescriptionMap["parse-xyz"] = "parse xyz file into World";
     
    182140  DescriptionMap["repeat-box"] = "create periodic copies of the simulation box per axis";
    183141  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";
    184143  DescriptionMap["save-adjacency"] = "name of the adjacency file to write to";
    185144  DescriptionMap["save-bonds"] = "name of the bonds file to write to";
     
    187146  DescriptionMap["SaveXyz"] = "save world as xyz file";
    188147  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";
    191148  DescriptionMap["subgraph-dissect"] = "dissect the molecular system into molecules representing disconnected subgraphs";
    192149  DescriptionMap["suspend-in-water"] = "suspend the given molecule in water such that in the domain the mean density is as specified";
     
    232189  ShortFormMap["center-in-box"] = "b";
    233190  ShortFormMap["change-element"] = "E";
    234 //  ShortFormMap["convex-envelope"] = "x";
     191  ShortFormMap["convex-envelope"] = "o";
    235192  ShortFormMap["default-molname"] = "X";
    236193  ShortFormMap["depth-first-search"] = "D";
     
    243200  ShortFormMap["linear-interpolate"] = "L";
    244201  ShortFormMap["nonconvex-envelope"] = "N";
    245 //  ShortFormMap["output"] = "o";
    246202  ShortFormMap["pair-correlation"] = "C";
    247203  ShortFormMap["parse-xyz"] = "p";
     
    255211  ShortFormMap["scale-box"] = "s";
    256212  ShortFormMap["set-basis"] = "M";
    257   ShortFormMap["set-output"] = "o";
    258213  ShortFormMap["subgraph-dissect"] = "I";
    259214  ShortFormMap["suspend-in-water"] = "u";
     
    283238  TypeMap["molecular-volume"] = Molecule;
    284239  TypeMap["nonconvex-envelope"] = Molecule;
    285   TypeMap["output"] = None;
     240  TypeMap["output"] = String;
    286241  TypeMap["parse-xyz"] = String;
    287242  TypeMap["pair-correlation"] = String;
     
    296251  TypeMap["scale-box"] = Vector;
    297252  TypeMap["set-basis"] = String;
    298   TypeMap["set-output"] = ListOfString;
    299253  TypeMap["subgraph-dissect"] = None;
    300254  TypeMap["suspend-in-water"] = Double;
     
    395349  MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "default-molname") );
    396350  MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "set-basis") );
    397   MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "set-output") );
    398351
    399352  // put actions into command line category
     
    433386  generic.insert("scale-box");
    434387  generic.insert("set-basis");
    435   generic.insert("set-output");
    436388        generic.insert("subgraph-dissect");
    437389  generic.insert("suspend-in-water");
     
    532484  new WorldSetDefaultNameAction();
    533485  new WorldSetGaussianBasisAction();
    534   new WorldSetOutputFormatsAction();
    535486}
    536487
     
    610561              ;
    611562            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;
    619563          case Axis:
    620564            ListRunner->second->add_options()
     
    629573            ListRunner->second->add_options()
    630574              (getKeyAndShortForm(*OptionRunner).c_str(),
    631                   po::value<VectorValue>(),
     575                  po::value<VectorValue>()->multitoken(),
    632576                  getDescription(*OptionRunner).c_str())
    633577              ;
Note: See TracChangeset for help on using the changeset viewer.