| [97ebf8] | 1 | /*
 | 
|---|
 | 2 |  * MapOfActions.cpp
 | 
|---|
 | 3 |  *
 | 
|---|
 | 4 |  *  Created on: 10.05.2010
 | 
|---|
 | 5 |  *      Author: heber
 | 
|---|
 | 6 |  */
 | 
|---|
 | 7 | 
 | 
|---|
| [112b09] | 8 | #include "Helpers/MemDebug.hpp"
 | 
|---|
 | 9 | 
 | 
|---|
| [97ebf8] | 10 | using namespace std;
 | 
|---|
 | 11 | 
 | 
|---|
 | 12 | #include "Actions/MapOfActions.hpp"
 | 
|---|
| [d02e07] | 13 | #include "Descriptors/AtomIdDescriptor.hpp"
 | 
|---|
 | 14 | #include "Descriptors/MoleculeIdDescriptor.hpp"
 | 
|---|
| [97ebf8] | 15 | #include "Helpers/Assert.hpp"
 | 
|---|
| [4e145c] | 16 | #include "Patterns/Singleton_impl.hpp"
 | 
|---|
| [97ebf8] | 17 | 
 | 
|---|
| [0286bc] | 18 | #include <boost/lexical_cast.hpp>
 | 
|---|
 | 19 | #include <boost/optional.hpp>
 | 
|---|
 | 20 | #include <boost/program_options.hpp>
 | 
|---|
 | 21 | 
 | 
|---|
| [986ed3] | 22 | #include <iostream>
 | 
|---|
 | 23 | 
 | 
|---|
| [ab9a27] | 24 | #include "atom.hpp"
 | 
|---|
| [d02e07] | 25 | #include "Box.hpp"
 | 
|---|
| [97ebf8] | 26 | #include "CommandLineParser.hpp"
 | 
|---|
| [ab9a27] | 27 | #include "element.hpp"
 | 
|---|
| [97ebf8] | 28 | #include "log.hpp"
 | 
|---|
| [d02e07] | 29 | #include "Matrix.hpp"
 | 
|---|
| [ab9a27] | 30 | #include "molecule.hpp"
 | 
|---|
| [d02e07] | 31 | #include "periodentafel.hpp"
 | 
|---|
 | 32 | #include "vector.hpp"
 | 
|---|
| [97ebf8] | 33 | #include "verbose.hpp"
 | 
|---|
 | 34 | 
 | 
|---|
| [326bbe] | 35 | #include "Actions/ActionRegistry.hpp"
 | 
|---|
 | 36 | #include "Actions/AnalysisAction/MolecularVolumeAction.hpp"
 | 
|---|
 | 37 | #include "Actions/AnalysisAction/PairCorrelationAction.hpp"
 | 
|---|
| [d02e07] | 38 | #include "Actions/AnalysisAction/PointCorrelationAction.hpp"
 | 
|---|
| [326bbe] | 39 | #include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp"
 | 
|---|
| [d02e07] | 40 | #include "Actions/AnalysisAction/SurfaceCorrelationAction.hpp"
 | 
|---|
| [326bbe] | 41 | #include "Actions/AtomAction/AddAction.hpp"
 | 
|---|
 | 42 | #include "Actions/AtomAction/ChangeElementAction.hpp"
 | 
|---|
 | 43 | #include "Actions/AtomAction/RemoveAction.hpp"
 | 
|---|
 | 44 | #include "Actions/CmdAction/BondLengthTableAction.hpp"
 | 
|---|
 | 45 | #include "Actions/CmdAction/ElementDbAction.hpp"
 | 
|---|
 | 46 | #include "Actions/CmdAction/FastParsingAction.hpp"
 | 
|---|
 | 47 | #include "Actions/CmdAction/HelpAction.hpp"
 | 
|---|
 | 48 | #include "Actions/CmdAction/VerboseAction.hpp"
 | 
|---|
 | 49 | #include "Actions/CmdAction/VersionAction.hpp"
 | 
|---|
 | 50 | #include "Actions/FragmentationAction/DepthFirstSearchAction.hpp"
 | 
|---|
 | 51 | #include "Actions/FragmentationAction/SubgraphDissectionAction.hpp"
 | 
|---|
 | 52 | #include "Actions/FragmentationAction/FragmentationAction.hpp"
 | 
|---|
 | 53 | #include "Actions/MoleculeAction/BondFileAction.hpp"
 | 
|---|
 | 54 | #include "Actions/MoleculeAction/ChangeNameAction.hpp"
 | 
|---|
 | 55 | #include "Actions/MoleculeAction/FillWithMoleculeAction.hpp"
 | 
|---|
 | 56 | #include "Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp"
 | 
|---|
| [b2531f] | 57 | #include "Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp"
 | 
|---|
| [326bbe] | 58 | #include "Actions/MoleculeAction/SaveAdjacencyAction.hpp"
 | 
|---|
 | 59 | #include "Actions/MoleculeAction/SaveBondsAction.hpp"
 | 
|---|
 | 60 | #include "Actions/MoleculeAction/SaveTemperatureAction.hpp"
 | 
|---|
| [b2531f] | 61 | #include "Actions/MoleculeAction/SuspendInWaterAction.hpp"
 | 
|---|
| [326bbe] | 62 | #include "Actions/MoleculeAction/TranslateAction.hpp"
 | 
|---|
 | 63 | #include "Actions/MoleculeAction/VerletIntegrationAction.hpp"
 | 
|---|
 | 64 | #include "Actions/ParserAction/LoadXyzAction.hpp"
 | 
|---|
 | 65 | #include "Actions/ParserAction/SaveXyzAction.hpp"
 | 
|---|
| [e472eab] | 66 | #include "Actions/SelectionAction/AllAtomsAction.hpp"
 | 
|---|
 | 67 | #include "Actions/SelectionAction/AllMoleculesAction.hpp"
 | 
|---|
| [533838] | 68 | #include "Actions/SelectionAction/AtomByIdAction.hpp"
 | 
|---|
 | 69 | #include "Actions/SelectionAction/MoleculeByIdAction.hpp"
 | 
|---|
| [e472eab] | 70 | #include "Actions/SelectionAction/NotAllAtomsAction.hpp"
 | 
|---|
 | 71 | #include "Actions/SelectionAction/NotAllMoleculesAction.hpp"
 | 
|---|
| [533838] | 72 | #include "Actions/SelectionAction/NotAtomByIdAction.hpp"
 | 
|---|
 | 73 | #include "Actions/SelectionAction/NotMoleculeByIdAction.hpp"
 | 
|---|
| [326bbe] | 74 | #include "Actions/TesselationAction/ConvexEnvelopeAction.hpp"
 | 
|---|
 | 75 | #include "Actions/TesselationAction/NonConvexEnvelopeAction.hpp"
 | 
|---|
 | 76 | #include "Actions/WorldAction/AddEmptyBoundaryAction.hpp"
 | 
|---|
 | 77 | #include "Actions/WorldAction/BoundInBoxAction.hpp"
 | 
|---|
 | 78 | #include "Actions/WorldAction/CenterInBoxAction.hpp"
 | 
|---|
 | 79 | #include "Actions/WorldAction/CenterOnEdgeAction.hpp"
 | 
|---|
 | 80 | #include "Actions/WorldAction/ChangeBoxAction.hpp"
 | 
|---|
 | 81 | #include "Actions/WorldAction/InputAction.hpp"
 | 
|---|
 | 82 | #include "Actions/WorldAction/OutputAction.hpp"
 | 
|---|
 | 83 | #include "Actions/WorldAction/RemoveSphereOfAtomsAction.hpp"
 | 
|---|
 | 84 | #include "Actions/WorldAction/RepeatBoxAction.hpp"
 | 
|---|
 | 85 | #include "Actions/WorldAction/ScaleBoxAction.hpp"
 | 
|---|
 | 86 | #include "Actions/WorldAction/SetDefaultNameAction.hpp"
 | 
|---|
 | 87 | #include "Actions/WorldAction/SetGaussianBasisAction.hpp"
 | 
|---|
| [b9c847] | 88 | #include "Actions/WorldAction/SetOutputFormatsAction.hpp"
 | 
|---|
| [0286bc] | 89 | #include "Actions/Values.hpp"
 | 
|---|
 | 90 | 
 | 
|---|
 | 91 | void validate(boost::any& v, const std::vector<std::string>& values, VectorValue *, int)
 | 
|---|
 | 92 | {
 | 
|---|
 | 93 |   VectorValue VV;
 | 
|---|
| [b540f3] | 94 |   std::vector<std::string> components;
 | 
|---|
 | 95 | 
 | 
|---|
 | 96 |   // split comma-separated values
 | 
|---|
 | 97 |   if (values.size() != 1) {
 | 
|---|
 | 98 |     cerr <<  "Not one vector but " << components.size() << " given " << endl;
 | 
|---|
 | 99 |     throw boost::program_options::validation_error("Unequal to one vector given");
 | 
|---|
 | 100 |   }
 | 
|---|
 | 101 |   std::string argument(values.at(0));
 | 
|---|
 | 102 |   std::string::iterator Aiter = argument.begin();
 | 
|---|
 | 103 |   std::string::iterator Biter = argument.begin();
 | 
|---|
 | 104 |   for (; Aiter != argument.end(); ++Aiter) {
 | 
|---|
 | 105 |     if (*Aiter == ',') {
 | 
|---|
 | 106 |       components.push_back(string(Biter,Aiter));
 | 
|---|
 | 107 |       do {
 | 
|---|
 | 108 |         Aiter++;
 | 
|---|
 | 109 |       } while (*Aiter == ' ' || *Aiter == '\t');
 | 
|---|
 | 110 |       Biter = Aiter;
 | 
|---|
 | 111 |     }
 | 
|---|
 | 112 |   }
 | 
|---|
 | 113 |   components.push_back(string(Biter,argument.end()));
 | 
|---|
 | 114 | 
 | 
|---|
 | 115 |   if (components.size() != 3) {
 | 
|---|
 | 116 |     cerr <<  "Specified vector does not have three components but " << components.size() << endl;
 | 
|---|
| [0286bc] | 117 |     throw boost::program_options::validation_error("Specified vector does not have three components");
 | 
|---|
 | 118 |   }
 | 
|---|
| [b540f3] | 119 |   VV.x = boost::lexical_cast<double>(components.at(0));
 | 
|---|
 | 120 |   VV.y = boost::lexical_cast<double>(components.at(1));
 | 
|---|
 | 121 |   VV.z = boost::lexical_cast<double>(components.at(2));
 | 
|---|
| [0286bc] | 122 |   v = boost::any(VectorValue(VV));
 | 
|---|
 | 123 | }
 | 
|---|
 | 124 | 
 | 
|---|
 | 125 | void validate(boost::any& v, const std::vector<std::string>& values, BoxValue *, int)
 | 
|---|
 | 126 | {
 | 
|---|
 | 127 |   BoxValue BV;
 | 
|---|
| [b540f3] | 128 |   std::vector<std::string> components;
 | 
|---|
 | 129 | 
 | 
|---|
 | 130 |   // split comma-separated values
 | 
|---|
 | 131 |   if (values.size() != 1) {
 | 
|---|
 | 132 |     cerr <<  "Not one vector but " << components.size() << " given " << endl;
 | 
|---|
 | 133 |     throw boost::program_options::validation_error("Unequal to one vector given");
 | 
|---|
 | 134 |   }
 | 
|---|
 | 135 |   std::string argument(values.at(0));
 | 
|---|
 | 136 |   std::string::iterator Aiter = argument.begin();
 | 
|---|
 | 137 |   std::string::iterator Biter = argument.begin();
 | 
|---|
 | 138 |   for (; Aiter != argument.end(); ++Aiter) {
 | 
|---|
 | 139 |     if (*Aiter == ',') {
 | 
|---|
 | 140 |       components.push_back(string(Biter,Aiter));
 | 
|---|
 | 141 |       do {
 | 
|---|
 | 142 |         Aiter++;
 | 
|---|
 | 143 |       } while (*Aiter == ' ' || *Aiter == '\t');
 | 
|---|
 | 144 |       Biter = Aiter;
 | 
|---|
 | 145 |     }
 | 
|---|
 | 146 |   }
 | 
|---|
 | 147 |   components.push_back(string(Biter,argument.end()));
 | 
|---|
 | 148 | 
 | 
|---|
 | 149 |   if (components.size() != 6) {
 | 
|---|
 | 150 |     cerr <<  "Specified vector does not have three components but " << components.size() << endl;
 | 
|---|
| [0286bc] | 151 |     throw boost::program_options::validation_error("Specified symmetric box matrix does not have six components");
 | 
|---|
 | 152 |   }
 | 
|---|
| [b540f3] | 153 |   BV.xx = boost::lexical_cast<double>(components.at(0));
 | 
|---|
| [8467df] | 154 |   BV.yx = boost::lexical_cast<double>(components.at(1));
 | 
|---|
 | 155 |   BV.yy = boost::lexical_cast<double>(components.at(2));
 | 
|---|
 | 156 |   BV.zx = boost::lexical_cast<double>(components.at(3));
 | 
|---|
 | 157 |   BV.zy = boost::lexical_cast<double>(components.at(4));
 | 
|---|
| [b540f3] | 158 |   BV.zz = boost::lexical_cast<double>(components.at(5));
 | 
|---|
| [0286bc] | 159 |   v = boost::any(BoxValue(BV));
 | 
|---|
 | 160 | }
 | 
|---|
 | 161 | 
 | 
|---|
| [97ebf8] | 162 | /** Constructor of class MapOfActions.
 | 
|---|
 | 163 |  *
 | 
|---|
 | 164 |  */
 | 
|---|
 | 165 | MapOfActions::MapOfActions()
 | 
|---|
 | 166 | {
 | 
|---|
 | 167 |   // initialise lookup map
 | 
|---|
 | 168 |   CmdParserLookup[&generic] = &(CommandLineParser::getInstance().generic);
 | 
|---|
 | 169 |   CmdParserLookup[&config] = &(CommandLineParser::getInstance().config);
 | 
|---|
 | 170 |   CmdParserLookup[&hidden] = &(CommandLineParser::getInstance().hidden);
 | 
|---|
 | 171 |   CmdParserLookup[&visible] = &(CommandLineParser::getInstance().visible);
 | 
|---|
 | 172 | 
 | 
|---|
 | 173 |   // keys for actions
 | 
|---|
 | 174 |   DescriptionMap["add-atom"] = "add atom of specified element";
 | 
|---|
 | 175 |   DescriptionMap["bond-table"] = "setting name of the bond length table file";
 | 
|---|
 | 176 |   DescriptionMap["bond-file"] = "name of the bond file";
 | 
|---|
 | 177 |   DescriptionMap["boundary"] = "change box to add an empty boundary around all atoms";
 | 
|---|
 | 178 |   DescriptionMap["bound-in-box"] = "bound all atoms in the domain";
 | 
|---|
 | 179 |   DescriptionMap["center-edge"] = "center edge of all atoms on (0,0,0)";
 | 
|---|
 | 180 |   DescriptionMap["center-in-box"] = "center all atoms in the domain";
 | 
|---|
 | 181 |   DescriptionMap["change-box"] = "change the symmetrc matrix of the simulation domain";
 | 
|---|
 | 182 |   DescriptionMap["change-element"] = "change the element of an atom";
 | 
|---|
 | 183 |   DescriptionMap["change-molname"] = "change the name of a molecule";
 | 
|---|
 | 184 |   DescriptionMap["convex-envelope"] = "create the convex envelope for a molecule";
 | 
|---|
 | 185 |   DescriptionMap["default-molname"] = "set the default name of new molecules";
 | 
|---|
 | 186 |   DescriptionMap["depth-first-search"] = "Depth-First Search analysis of the molecular system";
 | 
|---|
 | 187 |   DescriptionMap["element-db"] = "setting the path where the element databases can be found";
 | 
|---|
 | 188 |   DescriptionMap["fastparsing"] = "setting whether trajectories shall be parsed completely (n) or just first step (y)";
 | 
|---|
 | 189 |   DescriptionMap["fill-molecule"] = "fill empty space of box with a filler molecule";
 | 
|---|
 | 190 |   DescriptionMap["fragment-mol"] = "create for a given molecule into fragments up to given order";
 | 
|---|
| [a77976] | 191 |   DescriptionMap["help"] = "Give this help screen";
 | 
|---|
| [4f7f34e] | 192 |   DescriptionMap["input"] = "specify input files";
 | 
|---|
| [97ebf8] | 193 |   DescriptionMap["linear-interpolate"] = "linear interpolation in discrete steps between start and end position of a molecule";
 | 
|---|
 | 194 |   DescriptionMap["molecular-volume"] = "calculate the volume of a given molecule";
 | 
|---|
| [b9c847] | 195 |   DescriptionMap["nonconvex-envelope"] = "create the non-convex envelope for a molecule";
 | 
|---|
 | 196 |   DescriptionMap["output"] = "write output files";
 | 
|---|
 | 197 |   DescriptionMap["set-output"] = "specify output formats";
 | 
|---|
| [e65de8] | 198 |   DescriptionMap["pair-correlation"] = "pair correlation analysis between two elements";
 | 
|---|
| [97ebf8] | 199 |   DescriptionMap["parse-xyz"] = "parse xyz file into World";
 | 
|---|
| [e65de8] | 200 |   DescriptionMap["point-correlation"] = "pair correlation analysis between element and point";
 | 
|---|
| [97ebf8] | 201 |   DescriptionMap["principal-axis-system"] = "calculate the principal axis system of the specified molecule";
 | 
|---|
 | 202 |   DescriptionMap["remove-atom"] = "remove a specified atom";
 | 
|---|
 | 203 |   DescriptionMap["remove-sphere"] = "remove sphere of atoms of around a specified atom";
 | 
|---|
 | 204 |   DescriptionMap["repeat-box"] = "create periodic copies of the simulation box per axis";
 | 
|---|
 | 205 |   DescriptionMap["rotate-to-pas"] = "calculate the principal axis system of the specified molecule and rotate specified axis to align with main axis";
 | 
|---|
 | 206 |   DescriptionMap["save-adjacency"] = "name of the adjacency file to write to";
 | 
|---|
 | 207 |   DescriptionMap["save-bonds"] = "name of the bonds file to write to";
 | 
|---|
 | 208 |   DescriptionMap["save-temperature"] = "name of the temperature file to write to";
 | 
|---|
| [326bbe] | 209 |   DescriptionMap["SaveXyz"] = "save world as xyz file";
 | 
|---|
| [2a92ff] | 210 |   DescriptionMap["scale-box"] = "scale box and atomic positions inside";
 | 
|---|
| [4e4c4d] | 211 |   DescriptionMap["select-all-atoms"] = "select all atoms";
 | 
|---|
 | 212 |   DescriptionMap["select-all-molecules"] = "select all molecules";
 | 
|---|
 | 213 |   DescriptionMap["select-atom-by-id"] = "select an atom by index";
 | 
|---|
 | 214 |   DescriptionMap["select-molecule-by-id"] = "select a molecule by index";
 | 
|---|
| [b9c847] | 215 |   DescriptionMap["set-basis"] = "set the name of the gaussian basis set for MPQC";
 | 
|---|
 | 216 |   DescriptionMap["set-output"] = "specify output formats";
 | 
|---|
| [6866aa] | 217 |   DescriptionMap["subgraph-dissect"] = "dissect the molecular system into molecules representing disconnected subgraphs";
 | 
|---|
| [e65de8] | 218 |   DescriptionMap["surface-correlation"] = "pair correlation analysis between element and surface";
 | 
|---|
| [97ebf8] | 219 |   DescriptionMap["suspend-in-water"] = "suspend the given molecule in water such that in the domain the mean density is as specified";
 | 
|---|
 | 220 |   DescriptionMap["translate-mol"] = "translate molecule by given vector";
 | 
|---|
| [4e4c4d] | 221 |   DescriptionMap["unselect-all-atoms"] = "unselect all atoms";
 | 
|---|
 | 222 |   DescriptionMap["unselect-all-molecules"] = "unselect all molecules";
 | 
|---|
 | 223 |   DescriptionMap["unselect-atom-by-id"] = "unselect an atom by index";
 | 
|---|
 | 224 |   DescriptionMap["unselect-molecule-by-id"] = "unselect a molecule by index";
 | 
|---|
| [97ebf8] | 225 |   DescriptionMap["verbose"] = "set verbosity level";
 | 
|---|
 | 226 |   DescriptionMap["verlet-integrate"] = "perform verlet integration of a given force file";
 | 
|---|
 | 227 |   DescriptionMap["version"] = "show version";
 | 
|---|
 | 228 |   // keys for values
 | 
|---|
 | 229 |   DescriptionMap["bin-output-file"] = "name of the bin output file";
 | 
|---|
 | 230 |   DescriptionMap["bin-end"] = "start of the last bin";
 | 
|---|
 | 231 |   DescriptionMap["bin-start"] = "start of the first bin";
 | 
|---|
 | 232 |   DescriptionMap["bin-width"] = "width of the bins";
 | 
|---|
| [f6bd32] | 233 |   DescriptionMap["convex-file"] = "filename of the non-convex envelope";
 | 
|---|
| [97ebf8] | 234 |   DescriptionMap["distance"] = "distance in space";
 | 
|---|
 | 235 |   DescriptionMap["distances"] = "list of three of distances in space, one for each axis direction";
 | 
|---|
| [0286bc] | 236 |   DescriptionMap["DoRotate"] = "whether to rotate or just report angles";
 | 
|---|
| [58bbd3] | 237 |   DescriptionMap["element"] = "single element";
 | 
|---|
 | 238 |   DescriptionMap["elements"] = "set of elements";
 | 
|---|
| [a02462] | 239 |   DescriptionMap["end-step"] = "last or end step";
 | 
|---|
 | 240 |   DescriptionMap["id-mapping"] = "whether the identity shall be used in mapping atoms onto atoms or some closest distance measure shall be used";
 | 
|---|
| [97ebf8] | 241 |   DescriptionMap["input"] = "name of input file";
 | 
|---|
 | 242 |   DescriptionMap["length"] = "length in space";
 | 
|---|
 | 243 |   DescriptionMap["lengths"] = "list of three of lengths in space, one for each axis direction";
 | 
|---|
 | 244 |   DescriptionMap["MaxDistance"] = "maximum distance in space";
 | 
|---|
 | 245 |   DescriptionMap["molecule-by-id"] = "index of a molecule";
 | 
|---|
| [f6bd32] | 246 |   DescriptionMap["nonconvex-file"] = "filename of the non-convex envelope";
 | 
|---|
| [e4b5de] | 247 |   DescriptionMap["order"] = "order of a discretization, dissection, ...";
 | 
|---|
| [97ebf8] | 248 |   DescriptionMap["output-file"] = "name of the output file";
 | 
|---|
 | 249 |   DescriptionMap["periodic"] = "system is constraint to periodic boundary conditions (y/n)";
 | 
|---|
 | 250 |   DescriptionMap["position"] = "position in R^3 space";
 | 
|---|
| [a02462] | 251 |   DescriptionMap["start-step"] = "first or start step";
 | 
|---|
| [97ebf8] | 252 | 
 | 
|---|
 | 253 |   // short forms for the actions
 | 
|---|
 | 254 |   ShortFormMap["add-atom"] = "a";
 | 
|---|
 | 255 |   ShortFormMap["bond-table"] = "g";
 | 
|---|
 | 256 |   ShortFormMap["bond-file"] = "A";
 | 
|---|
 | 257 |   ShortFormMap["boundary"] = "c";
 | 
|---|
| [6ca1f7] | 258 |   ShortFormMap["change-box"] = "B";
 | 
|---|
| [97ebf8] | 259 |   ShortFormMap["center-edge"] = "O";
 | 
|---|
 | 260 |   ShortFormMap["center-in-box"] = "b";
 | 
|---|
 | 261 |   ShortFormMap["change-element"] = "E";
 | 
|---|
| [b9c847] | 262 | //  ShortFormMap["convex-envelope"] = "x";
 | 
|---|
| [97ebf8] | 263 |   ShortFormMap["default-molname"] = "X";
 | 
|---|
 | 264 |   ShortFormMap["depth-first-search"] = "D";
 | 
|---|
 | 265 |   ShortFormMap["element-db"] = "e";
 | 
|---|
 | 266 |   ShortFormMap["fastparsing"] = "n";
 | 
|---|
 | 267 |   ShortFormMap["fill-molecule"] = "F";
 | 
|---|
 | 268 |   ShortFormMap["fragment-mol"] = "f";
 | 
|---|
 | 269 |   ShortFormMap["help"] = "h";
 | 
|---|
 | 270 |   ShortFormMap["input"] = "i";
 | 
|---|
 | 271 |   ShortFormMap["linear-interpolate"] = "L";
 | 
|---|
 | 272 |   ShortFormMap["nonconvex-envelope"] = "N";
 | 
|---|
| [cd8e55] | 273 | //  ShortFormMap["output"] = "o";
 | 
|---|
| [e65de8] | 274 | //  ShortFormMap["pair-correlation"] = "C";
 | 
|---|
| [97ebf8] | 275 |   ShortFormMap["parse-xyz"] = "p";
 | 
|---|
 | 276 |   ShortFormMap["remove-atom"] = "r";
 | 
|---|
 | 277 |   ShortFormMap["remove-sphere"] = "R";
 | 
|---|
 | 278 |   ShortFormMap["repeat-box"] = "d";
 | 
|---|
 | 279 |   ShortFormMap["rotate-to-pas"] = "m";
 | 
|---|
 | 280 |   ShortFormMap["save-adjacency"] = "J";
 | 
|---|
 | 281 |   ShortFormMap["save-bonds"] = "j";
 | 
|---|
 | 282 |   ShortFormMap["save-temperature"] = "S";
 | 
|---|
 | 283 |   ShortFormMap["scale-box"] = "s";
 | 
|---|
 | 284 |   ShortFormMap["set-basis"] = "M";
 | 
|---|
| [b9c847] | 285 |   ShortFormMap["set-output"] = "o";
 | 
|---|
| [6866aa] | 286 |   ShortFormMap["subgraph-dissect"] = "I";
 | 
|---|
| [48ab70a] | 287 |   ShortFormMap["suspend-in-water"] = "u";
 | 
|---|
| [97ebf8] | 288 |   ShortFormMap["translate-mol"] = "t";
 | 
|---|
| [6670a97] | 289 |   ShortFormMap["verbose"] = "v";
 | 
|---|
| [97ebf8] | 290 |   ShortFormMap["verlet-integrate"] = "P";
 | 
|---|
| [6670a97] | 291 |   ShortFormMap["version"] = "V";
 | 
|---|
| [97ebf8] | 292 | 
 | 
|---|
 | 293 |   // value types for the actions
 | 
|---|
| [ab9a27] | 294 |   TypeMap["add-atom"] = &typeid(element);
 | 
|---|
 | 295 |   TypeMap["bond-file"] = &typeid(std::string);
 | 
|---|
 | 296 |   TypeMap["bond-table"] = &typeid(std::string);
 | 
|---|
 | 297 |   TypeMap["boundary"] = &typeid(VectorValue);
 | 
|---|
 | 298 |   TypeMap["center-in-box"] = &typeid(BoxValue);
 | 
|---|
 | 299 |   TypeMap["change-box"] = &typeid(BoxValue);
 | 
|---|
 | 300 |   TypeMap["change-element"] = &typeid(element);
 | 
|---|
 | 301 |   TypeMap["change-molname"] = &typeid(std::string);
 | 
|---|
| [1d9b7d2] | 302 |   TypeMap["convex-envelope"] = &typeid(void);
 | 
|---|
| [ab9a27] | 303 |   TypeMap["default-molname"] = &typeid(std::string);
 | 
|---|
 | 304 |   TypeMap["depth-first-search"] = &typeid(double);
 | 
|---|
 | 305 |   TypeMap["element-db"] = &typeid(std::string);
 | 
|---|
 | 306 |   TypeMap["fastparsing"] = &typeid(bool);
 | 
|---|
 | 307 |   TypeMap["fill-molecule"] = &typeid(std::string);
 | 
|---|
 | 308 |   TypeMap["fragment-mol"] = &typeid(std::string);
 | 
|---|
 | 309 |   TypeMap["input"] = &typeid(std::string);
 | 
|---|
 | 310 |   TypeMap["linear-interpolate"] = &typeid(std::string);
 | 
|---|
 | 311 |   TypeMap["molecular-volume"] = &typeid(molecule);
 | 
|---|
| [1d9b7d2] | 312 |   TypeMap["nonconvex-envelope"] = &typeid(double);
 | 
|---|
| [ab9a27] | 313 |   TypeMap["output"] = &typeid(void);
 | 
|---|
 | 314 |   TypeMap["parse-xyz"] = &typeid(std::string);
 | 
|---|
| [e65de8] | 315 |   TypeMap["pair-correlation"] = &typeid(void);
 | 
|---|
 | 316 |   TypeMap["point-correlation"] = &typeid(void);
 | 
|---|
| [b76394] | 317 |   TypeMap["principal-axis-system"] = &typeid(void);
 | 
|---|
| [120088] | 318 |   TypeMap["remove-atom"] = &typeid(void);
 | 
|---|
| [ab9a27] | 319 |   TypeMap["remove-sphere"] = &typeid(double);
 | 
|---|
 | 320 |   TypeMap["repeat-box"] = &typeid(VectorValue);
 | 
|---|
 | 321 |   TypeMap["rotate-to-pas"] = &typeid(molecule);
 | 
|---|
 | 322 |   TypeMap["save-adjacency"] = &typeid(std::string);
 | 
|---|
 | 323 |   TypeMap["save-bonds"] = &typeid(std::string);
 | 
|---|
 | 324 |   TypeMap["save-temperature"] = &typeid(std::string);
 | 
|---|
 | 325 |   TypeMap["scale-box"] = &typeid(VectorValue);
 | 
|---|
 | 326 |   TypeMap["set-basis"] = &typeid(std::string);
 | 
|---|
 | 327 |   TypeMap["set-output"] = &typeid(std::vector<std::string>);
 | 
|---|
 | 328 |   TypeMap["subgraph-dissect"] = &typeid(void);
 | 
|---|
| [e65de8] | 329 |   TypeMap["surface-correlation"] = &typeid(void);
 | 
|---|
| [ab9a27] | 330 |   TypeMap["suspend-in-water"] = &typeid(double);
 | 
|---|
 | 331 |   TypeMap["translate-mol"] = &typeid(VectorValue);
 | 
|---|
 | 332 |   TypeMap["verlet-integrate"] = &typeid(std::string);
 | 
|---|
 | 333 |   TypeMap["verbose"] = &typeid(int);
 | 
|---|
| [e30ce8] | 334 | 
 | 
|---|
| [97ebf8] | 335 |   // value types for the values
 | 
|---|
| [ab9a27] | 336 |   TypeMap["bin-output-file"] = &typeid(std::string);
 | 
|---|
 | 337 |   TypeMap["bin-end"] = &typeid(double);
 | 
|---|
 | 338 |   TypeMap["bin-start"] = &typeid(double);
 | 
|---|
 | 339 |   TypeMap["bin-width"] = &typeid(double);
 | 
|---|
 | 340 |   TypeMap["convex-file"] = &typeid(std::string);
 | 
|---|
 | 341 |   TypeMap["distance"] = &typeid(double);
 | 
|---|
 | 342 |   TypeMap["distances"] = &typeid(VectorValue);
 | 
|---|
 | 343 |   TypeMap["DoRotate"] = &typeid(bool);
 | 
|---|
 | 344 |   TypeMap["element"] = &typeid(element);
 | 
|---|
 | 345 |   TypeMap["elements"] = &typeid(std::vector<element *>);
 | 
|---|
 | 346 |   TypeMap["end-step"] = &typeid(int);
 | 
|---|
 | 347 |   TypeMap["id-mapping"] = &typeid(bool);
 | 
|---|
 | 348 |   TypeMap["length"] = &typeid(double);
 | 
|---|
 | 349 |   TypeMap["lengths"] = &typeid(VectorValue);
 | 
|---|
 | 350 |   TypeMap["MaxDistance"] = &typeid(double);
 | 
|---|
| [e65de8] | 351 |   TypeMap["molecule-by-id"] = &typeid(molecule);
 | 
|---|
| [ab9a27] | 352 |   TypeMap["nonconvex-file"] = &typeid(std::string);
 | 
|---|
 | 353 |   TypeMap["order"] = &typeid(int);
 | 
|---|
 | 354 |   TypeMap["output-file"] = &typeid(std::string);
 | 
|---|
 | 355 |   TypeMap["periodic"] = &typeid(bool);
 | 
|---|
 | 356 |   TypeMap["position"] = &typeid(VectorValue);
 | 
|---|
| [e472eab] | 357 |   TypeMap["select-all-atoms"] = &typeid(void);
 | 
|---|
 | 358 |   TypeMap["select-all-molecules"] = &typeid(void);
 | 
|---|
| [533838] | 359 |   TypeMap["select-atom-by-id"] = &typeid(atom);
 | 
|---|
 | 360 |   TypeMap["select-molecule-by-id"] = &typeid(molecule);
 | 
|---|
| [ab9a27] | 361 |   TypeMap["start-step"] = &typeid(int);
 | 
|---|
| [e472eab] | 362 |   TypeMap["unselect-all-atoms"] = &typeid(void);
 | 
|---|
 | 363 |   TypeMap["unselect-all-molecules"] = &typeid(void);
 | 
|---|
| [533838] | 364 |   TypeMap["unselect-atom-by-id"] = &typeid(atom);
 | 
|---|
 | 365 |   TypeMap["unselect-molecule-by-id"] = &typeid(molecule);
 | 
|---|
| [ab9a27] | 366 | 
 | 
|---|
| [0b0a20] | 367 |   TypeEnumMap[&typeid(void)] = None;
 | 
|---|
 | 368 |   TypeEnumMap[&typeid(bool)] = Boolean;
 | 
|---|
| [ab9a27] | 369 |   TypeEnumMap[&typeid(int)] = Integer;
 | 
|---|
| [0b0a20] | 370 |   TypeEnumMap[&typeid(std::vector<int>)] = ListOfIntegers;
 | 
|---|
| [ab9a27] | 371 |   TypeEnumMap[&typeid(double)] = Double;
 | 
|---|
| [0b0a20] | 372 |   TypeEnumMap[&typeid(std::vector<double>)] = ListOfDoubles;
 | 
|---|
| [ab9a27] | 373 |   TypeEnumMap[&typeid(std::string)] = String;
 | 
|---|
| [0b0a20] | 374 |   TypeEnumMap[&typeid(std::vector<std::string>)] = ListOfStrings;
 | 
|---|
 | 375 |   TypeEnumMap[&typeid(VectorValue)] = Vector;
 | 
|---|
| [39b639] | 376 |   TypeEnumMap[&typeid(std::vector<VectorValue>)] = ListOfVectors;
 | 
|---|
| [0b0a20] | 377 |   TypeEnumMap[&typeid(BoxValue)] = Box;
 | 
|---|
 | 378 |   TypeEnumMap[&typeid(molecule)] = Molecule;
 | 
|---|
 | 379 |   TypeEnumMap[&typeid(std::vector<molecule *>)] = ListOfMolecules;
 | 
|---|
| [ab9a27] | 380 |   TypeEnumMap[&typeid(atom)] = Atom;
 | 
|---|
| [0b0a20] | 381 |   TypeEnumMap[&typeid(std::vector<atom *>)] = ListOfAtoms;
 | 
|---|
| [ab9a27] | 382 |   TypeEnumMap[&typeid(element)] = Element;
 | 
|---|
 | 383 |   TypeEnumMap[&typeid(std::vector<element *>)] = ListOfElements;
 | 
|---|
| [97ebf8] | 384 | 
 | 
|---|
| [e30ce8] | 385 |   // default values for any action that needs one (always string!)
 | 
|---|
| [ab9a27] | 386 |   CurrentValue["bin-width"] = "0.5";
 | 
|---|
 | 387 |   CurrentValue["fastparsing"] = "0";
 | 
|---|
 | 388 |   CurrentValue["periodic"] = "0";
 | 
|---|
| [e30ce8] | 389 | 
 | 
|---|
| [326bbe] | 390 |   // put action into each menu category
 | 
|---|
| [b2531f] | 391 |   MenuDescription["analysis"] = pair<std::string,std::string>("Analysis (pair correlation, volume)", "Analysis");
 | 
|---|
| [5b5c4d] | 392 |   MenuDescription["atom"] = pair<std::string,std::string>("Edit atoms", "Atoms");
 | 
|---|
 | 393 |   MenuDescription["command"] = pair<std::string,std::string>("Configuration", "configuration options");
 | 
|---|
| [b2531f] | 394 |   MenuDescription["fragmentation"] = pair<std::string,std::string>("Fragmentation", "Fragmentation");
 | 
|---|
| [5b5c4d] | 395 |   MenuDescription["molecule"] = pair<std::string,std::string>("Parse files into system", "Molecules");
 | 
|---|
 | 396 |   MenuDescription["parser"] = pair<std::string,std::string>("Edit molecules (load, parse, save)", "Input/Output");
 | 
|---|
 | 397 |   MenuDescription["selection"] = pair<std::string,std::string>("Select atoms/molecules", "Selection");
 | 
|---|
 | 398 |   MenuDescription["tesselation"] = pair<std::string,std::string>("Tesselate molecules", "Tesselation");
 | 
|---|
 | 399 |   MenuDescription["world"] = pair<std::string,std::string>("Edit world", "Globals");
 | 
|---|
| [b2531f] | 400 | 
 | 
|---|
| [326bbe] | 401 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "molecular-volume") );
 | 
|---|
 | 402 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "pair-correlation") );
 | 
|---|
| [e65de8] | 403 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "point-correlation") );
 | 
|---|
 | 404 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "surface-correlation") );
 | 
|---|
| [326bbe] | 405 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "principal-axis-system") );
 | 
|---|
| [e30ce8] | 406 | 
 | 
|---|
| [326bbe] | 407 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("atom", "add-atom") );
 | 
|---|
 | 408 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("atom", "change-element") );
 | 
|---|
 | 409 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("atom", "remove-atom") );
 | 
|---|
 | 410 | 
 | 
|---|
 | 411 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("command", "bond-table") );
 | 
|---|
 | 412 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("command", "element-db") );
 | 
|---|
 | 413 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("command", "fastparsing") );
 | 
|---|
 | 414 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("command", "verbose") );
 | 
|---|
 | 415 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("command", "version") );
 | 
|---|
 | 416 | 
 | 
|---|
 | 417 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("fragmentation", "depth-first-search") );
 | 
|---|
 | 418 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("fragmentation", "fragment-mol") );
 | 
|---|
 | 419 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("fragmentation", "subgraph-dissect") );
 | 
|---|
 | 420 | 
 | 
|---|
 | 421 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "bond-file") );
 | 
|---|
 | 422 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "change-molname") );
 | 
|---|
 | 423 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "fill-molecule") );
 | 
|---|
 | 424 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "linear-interpolate") );
 | 
|---|
 | 425 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "rotate-to-pas") );
 | 
|---|
 | 426 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "save-adjacency") );
 | 
|---|
 | 427 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "save-bonds") );
 | 
|---|
 | 428 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "save-temperature") );
 | 
|---|
 | 429 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "suspend-in-water") );
 | 
|---|
 | 430 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "translate-mol") );
 | 
|---|
 | 431 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "verlet-integrate") );
 | 
|---|
 | 432 | 
 | 
|---|
 | 433 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("parser", "parse-xyz") );
 | 
|---|
 | 434 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("parser", "SaveXyz") );
 | 
|---|
 | 435 | 
 | 
|---|
| [5b5c4d] | 436 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-atom-by-id") );
 | 
|---|
 | 437 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-molecule-by-id") );
 | 
|---|
 | 438 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-atom-by-id") );
 | 
|---|
 | 439 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-molecule-by-id") );
 | 
|---|
 | 440 | 
 | 
|---|
| [326bbe] | 441 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("tesselation", "convex-envelope") );
 | 
|---|
 | 442 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("tesselation", "nonconvex-envelope") );
 | 
|---|
 | 443 | 
 | 
|---|
 | 444 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "boundary") );
 | 
|---|
 | 445 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "bound-in-box") );
 | 
|---|
 | 446 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "center-in-box") );
 | 
|---|
 | 447 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "center-edge") );
 | 
|---|
 | 448 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "change-box") );
 | 
|---|
 | 449 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "input") );
 | 
|---|
 | 450 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "output") );
 | 
|---|
 | 451 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "remove-sphere") );
 | 
|---|
 | 452 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "repeat-box") );
 | 
|---|
 | 453 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "scale-box") );
 | 
|---|
 | 454 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "default-molname") );
 | 
|---|
 | 455 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "set-basis") );
 | 
|---|
| [b9c847] | 456 |   MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "set-output") );
 | 
|---|
| [326bbe] | 457 | 
 | 
|---|
 | 458 |   // put actions into command line category
 | 
|---|
| [f0a3ec] | 459 |         generic.insert("add-atom");
 | 
|---|
| [f4bd01] | 460 |   generic.insert("bond-file");
 | 
|---|
| [39af9f] | 461 |         generic.insert("bond-table");
 | 
|---|
| [116f37] | 462 |   generic.insert("boundary");
 | 
|---|
| [97ebf8] | 463 | //  generic.insert("bound-in-box");
 | 
|---|
| [584a2a] | 464 |   generic.insert("center-edge");
 | 
|---|
| [158c594] | 465 |   generic.insert("center-in-box");
 | 
|---|
| [6ca1f7] | 466 |         generic.insert("change-box");
 | 
|---|
| [97ebf8] | 467 | //  generic.insert("change-molname");
 | 
|---|
| [54b953] | 468 |         generic.insert("change-element");
 | 
|---|
| [f6bd32] | 469 |   generic.insert("convex-envelope");
 | 
|---|
| [387b36] | 470 |         generic.insert("default-molname");
 | 
|---|
| [8540f0] | 471 |         generic.insert("depth-first-search");
 | 
|---|
| [198494] | 472 |         generic.insert("element-db");
 | 
|---|
| [f821d6] | 473 |         generic.insert("fastparsing");
 | 
|---|
| [0286bc] | 474 |   generic.insert("fill-molecule");
 | 
|---|
| [e4b5de] | 475 |   generic.insert("fragment-mol");
 | 
|---|
| [97ebf8] | 476 |   generic.insert("help");
 | 
|---|
| [4f7f34e] | 477 |   generic.insert("input");
 | 
|---|
 | 478 |   generic.insert("linear-interpolate");
 | 
|---|
| [97ebf8] | 479 | //  generic.insert("molecular-volume");
 | 
|---|
| [980dd6] | 480 |   generic.insert("nonconvex-envelope");
 | 
|---|
| [4f7f34e] | 481 |   generic.insert("output");
 | 
|---|
| [58bbd3] | 482 |         generic.insert("pair-correlation");
 | 
|---|
| [a1e929] | 483 |         generic.insert("parse-xyz");
 | 
|---|
| [e65de8] | 484 |   generic.insert("point-correlation");
 | 
|---|
| [97ebf8] | 485 | //  generic.insert("principal-axis-system");
 | 
|---|
| [d55743e] | 486 |   generic.insert("remove-atom");
 | 
|---|
| [e2b47c] | 487 |   generic.insert("remove-sphere");
 | 
|---|
| [0286bc] | 488 |   generic.insert("repeat-box");
 | 
|---|
| [2b5574] | 489 |   generic.insert("rotate-to-pas");
 | 
|---|
| [77de81] | 490 |         generic.insert("save-adjacency");
 | 
|---|
 | 491 |   generic.insert("save-bonds");
 | 
|---|
| [a307af] | 492 |   generic.insert("save-temperature");
 | 
|---|
| [2a92ff] | 493 |   generic.insert("scale-box");
 | 
|---|
| [e472eab] | 494 |   generic.insert("select-all-atoms");
 | 
|---|
 | 495 |   generic.insert("select-all-molecules");
 | 
|---|
 | 496 |   generic.insert("select-atom-by-id");
 | 
|---|
 | 497 |   generic.insert("select-molecule-by-id");
 | 
|---|
| [bdaacd] | 498 |   generic.insert("set-basis");
 | 
|---|
| [b9c847] | 499 |   generic.insert("set-output");
 | 
|---|
| [6866aa] | 500 |         generic.insert("subgraph-dissect");
 | 
|---|
| [e65de8] | 501 |   generic.insert("surface-correlation");
 | 
|---|
| [48ab70a] | 502 |   generic.insert("suspend-in-water");
 | 
|---|
| [77b2d7] | 503 |   generic.insert("translate-mol");
 | 
|---|
| [e472eab] | 504 |   generic.insert("unselect-all-atoms");
 | 
|---|
 | 505 |   generic.insert("unselect-all-molecules");
 | 
|---|
 | 506 |   generic.insert("unselect-atom-by-id");
 | 
|---|
 | 507 |   generic.insert("unselect-molecule-by-id");
 | 
|---|
| [97ebf8] | 508 |         generic.insert("verbose");
 | 
|---|
| [aacce8] | 509 |   generic.insert("verlet-integrate");
 | 
|---|
| [97ebf8] | 510 |         generic.insert("version");
 | 
|---|
 | 511 | 
 | 
|---|
 | 512 |     // positional arguments
 | 
|---|
| [f6bd32] | 513 |   generic.insert("input");
 | 
|---|
| [0286bc] | 514 | 
 | 
|---|
 | 515 |     // hidden arguments
 | 
|---|
| [533838] | 516 |   hidden.insert("bin-end");
 | 
|---|
 | 517 |   hidden.insert("bin-output-file");
 | 
|---|
 | 518 |   hidden.insert("bin-start");
 | 
|---|
 | 519 |   hidden.insert("bin-width");
 | 
|---|
 | 520 |   hidden.insert("convex-file");
 | 
|---|
 | 521 |   hidden.insert("distance");
 | 
|---|
 | 522 |   hidden.insert("DoRotate");
 | 
|---|
 | 523 |   hidden.insert("distances");
 | 
|---|
 | 524 |   hidden.insert("element");
 | 
|---|
 | 525 |   hidden.insert("elements");
 | 
|---|
 | 526 |   hidden.insert("end-step");
 | 
|---|
 | 527 |   hidden.insert("id-mapping");
 | 
|---|
 | 528 |   hidden.insert("lengths");
 | 
|---|
 | 529 |   hidden.insert("MaxDistance");
 | 
|---|
| [e65de8] | 530 |   hidden.insert("molecule-by-id");
 | 
|---|
| [533838] | 531 |   hidden.insert("nonconvex-file");
 | 
|---|
 | 532 |   hidden.insert("order");
 | 
|---|
 | 533 |   hidden.insert("output-file");
 | 
|---|
 | 534 |   hidden.insert("periodic");
 | 
|---|
 | 535 |   hidden.insert("position");
 | 
|---|
 | 536 |   hidden.insert("start-step");
 | 
|---|
| [97ebf8] | 537 | }
 | 
|---|
 | 538 | 
 | 
|---|
 | 539 | /** Destructor of class MapOfActions.
 | 
|---|
 | 540 |  *
 | 
|---|
 | 541 |  */
 | 
|---|
 | 542 | MapOfActions::~MapOfActions()
 | 
|---|
 | 543 | {
 | 
|---|
 | 544 |   DescriptionMap.clear();
 | 
|---|
 | 545 | }
 | 
|---|
 | 546 | 
 | 
|---|
| [d02e07] | 547 | void MapOfActions::queryCurrentValue(const char * name, class atom * &_T)
 | 
|---|
 | 548 | {
 | 
|---|
 | 549 |   int atomID = -1;
 | 
|---|
| [4e145c] | 550 |   if (typeid( atom ) == *TypeMap[name]) {
 | 
|---|
 | 551 |     if (CurrentValue.find(name) == CurrentValue.end())
 | 
|---|
 | 552 |       throw MissingValueException(__FILE__, __LINE__);
 | 
|---|
| [d02e07] | 553 |     atomID = lexical_cast<int>(CurrentValue[name].c_str());
 | 
|---|
| [4e145c] | 554 |     CurrentValue.erase(name);
 | 
|---|
 | 555 |   } else
 | 
|---|
| [d02e07] | 556 |     throw IllegalTypeException(__FILE__,__LINE__);
 | 
|---|
 | 557 |   _T = World::getInstance().getAtom(AtomById(atomID));
 | 
|---|
 | 558 | }
 | 
|---|
 | 559 | 
 | 
|---|
 | 560 | void MapOfActions::queryCurrentValue(const char * name, class element * &_T)  {
 | 
|---|
 | 561 |   int Z = -1;
 | 
|---|
| [4e145c] | 562 |   if (typeid( element ) == *TypeMap[name]) {
 | 
|---|
 | 563 |     if (CurrentValue.find(name) == CurrentValue.end())
 | 
|---|
 | 564 |       throw MissingValueException(__FILE__, __LINE__);
 | 
|---|
| [d02e07] | 565 |     Z = lexical_cast<int>(CurrentValue[name].c_str());
 | 
|---|
| [4e145c] | 566 |     CurrentValue.erase(name);
 | 
|---|
 | 567 |   } else
 | 
|---|
| [d02e07] | 568 |     throw IllegalTypeException(__FILE__,__LINE__);
 | 
|---|
 | 569 |   _T = World::getInstance().getPeriode()->FindElement(Z);
 | 
|---|
 | 570 | }
 | 
|---|
 | 571 | 
 | 
|---|
 | 572 | void MapOfActions::queryCurrentValue(const char * name, class molecule * &_T) {
 | 
|---|
 | 573 |   int molID = -1;
 | 
|---|
| [4e145c] | 574 |   if (typeid( molecule ) == *TypeMap[name]) {
 | 
|---|
 | 575 |     if (CurrentValue.find(name) == CurrentValue.end())
 | 
|---|
 | 576 |       throw MissingValueException(__FILE__, __LINE__);
 | 
|---|
| [d02e07] | 577 |     molID = lexical_cast<int>(CurrentValue[name].c_str());
 | 
|---|
| [4e145c] | 578 |     CurrentValue.erase(name);
 | 
|---|
 | 579 |   } else
 | 
|---|
| [d02e07] | 580 |     throw IllegalTypeException(__FILE__,__LINE__);
 | 
|---|
 | 581 |   _T = World::getInstance().getMolecule(MoleculeById(molID));
 | 
|---|
 | 582 | }
 | 
|---|
 | 583 | 
 | 
|---|
 | 584 | void MapOfActions::queryCurrentValue(const char * name, class Box &_T) {
 | 
|---|
 | 585 |   Matrix M;
 | 
|---|
 | 586 |   double tmp;
 | 
|---|
 | 587 |   if (typeid( BoxValue ) == *TypeMap[name]) {
 | 
|---|
| [4e145c] | 588 |     if (CurrentValue.find(name) == CurrentValue.end())
 | 
|---|
 | 589 |       throw MissingValueException(__FILE__, __LINE__);
 | 
|---|
| [d02e07] | 590 |     std::istringstream stream(CurrentValue[name]);
 | 
|---|
 | 591 |     stream >> tmp;
 | 
|---|
 | 592 |     M.set(0,0,tmp);
 | 
|---|
 | 593 |     stream >> tmp;
 | 
|---|
 | 594 |     M.set(0,1,tmp);
 | 
|---|
 | 595 |     M.set(1,0,tmp);
 | 
|---|
 | 596 |     stream >> tmp;
 | 
|---|
 | 597 |     M.set(0,2,tmp);
 | 
|---|
 | 598 |     M.set(2,0,tmp);
 | 
|---|
 | 599 |     stream >> tmp;
 | 
|---|
 | 600 |     M.set(1,1,tmp);
 | 
|---|
 | 601 |     stream >> tmp;
 | 
|---|
 | 602 |     M.set(1,2,tmp);
 | 
|---|
 | 603 |     M.set(2,1,tmp);
 | 
|---|
 | 604 |     stream >> tmp;
 | 
|---|
 | 605 |     M.set(2,2,tmp);
 | 
|---|
| [39b639] | 606 |     _T = M;
 | 
|---|
 | 607 |     CurrentValue.erase(name);
 | 
|---|
| [d02e07] | 608 |   } else
 | 
|---|
 | 609 |     throw IllegalTypeException(__FILE__,__LINE__);
 | 
|---|
 | 610 | }
 | 
|---|
 | 611 | 
 | 
|---|
 | 612 | void MapOfActions::queryCurrentValue(const char * name, class Vector &_T) {
 | 
|---|
 | 613 |   if (typeid( VectorValue ) == *TypeMap[name]) {
 | 
|---|
 | 614 |     std::istringstream stream(CurrentValue[name]);
 | 
|---|
| [4e145c] | 615 |     CurrentValue.erase(name);
 | 
|---|
| [d02e07] | 616 |     stream >> _T[0];
 | 
|---|
 | 617 |     stream >> _T[1];
 | 
|---|
 | 618 |     stream >> _T[2];
 | 
|---|
 | 619 |   } else
 | 
|---|
 | 620 |     throw IllegalTypeException(__FILE__,__LINE__);
 | 
|---|
 | 621 | }
 | 
|---|
 | 622 | 
 | 
|---|
| [0b0a20] | 623 | void MapOfActions::queryCurrentValue(const char * name, std::vector<atom *>&_T)
 | 
|---|
 | 624 | {
 | 
|---|
 | 625 |   int atomID = -1;
 | 
|---|
 | 626 |   atom *Walker = NULL;
 | 
|---|
 | 627 |   if (typeid( std::vector<atom *> ) == *TypeMap[name]) {
 | 
|---|
 | 628 |     if (CurrentValue.find(name) == CurrentValue.end())
 | 
|---|
 | 629 |       throw MissingValueException(__FILE__, __LINE__);
 | 
|---|
 | 630 |     std::istringstream stream(CurrentValue[name]);
 | 
|---|
 | 631 |     CurrentValue.erase(name);
 | 
|---|
 | 632 |     while (!stream.fail()) {
 | 
|---|
| [e65de8] | 633 |       stream >> atomID >> ws;
 | 
|---|
| [0b0a20] | 634 |       Walker = World::getInstance().getAtom(AtomById(atomID));
 | 
|---|
 | 635 |       if (Walker != NULL)
 | 
|---|
 | 636 |         _T.push_back(Walker);
 | 
|---|
| [e65de8] | 637 |       atomID = -1;
 | 
|---|
 | 638 |       Walker = NULL;
 | 
|---|
| [0b0a20] | 639 |     }
 | 
|---|
 | 640 |   } else
 | 
|---|
 | 641 |     throw IllegalTypeException(__FILE__,__LINE__);
 | 
|---|
 | 642 | }
 | 
|---|
 | 643 | 
 | 
|---|
| [d02e07] | 644 | void MapOfActions::queryCurrentValue(const char * name, std::vector<element *>&_T)
 | 
|---|
 | 645 | {
 | 
|---|
 | 646 |   int Z = -1;
 | 
|---|
 | 647 |   element *elemental = NULL;
 | 
|---|
 | 648 |   if (typeid( std::vector<element *> ) == *TypeMap[name]) {
 | 
|---|
| [4e145c] | 649 |     if (CurrentValue.find(name) == CurrentValue.end())
 | 
|---|
 | 650 |       throw MissingValueException(__FILE__, __LINE__);
 | 
|---|
| [d02e07] | 651 |     std::istringstream stream(CurrentValue[name]);
 | 
|---|
| [4e145c] | 652 |     CurrentValue.erase(name);
 | 
|---|
| [d02e07] | 653 |     while (!stream.fail()) {
 | 
|---|
| [e65de8] | 654 |       stream >> Z >> ws;
 | 
|---|
| [d02e07] | 655 |       elemental = World::getInstance().getPeriode()->FindElement(Z);
 | 
|---|
 | 656 |       if (elemental != NULL)
 | 
|---|
 | 657 |         _T.push_back(elemental);
 | 
|---|
| [e65de8] | 658 |       Z = -1;
 | 
|---|
| [d02e07] | 659 |     }
 | 
|---|
 | 660 |   } else
 | 
|---|
 | 661 |     throw IllegalTypeException(__FILE__,__LINE__);
 | 
|---|
 | 662 | }
 | 
|---|
 | 663 | 
 | 
|---|
| [0b0a20] | 664 | void MapOfActions::queryCurrentValue(const char * name, std::vector<molecule *>&_T)
 | 
|---|
| [3e54d0] | 665 | {
 | 
|---|
| [0b0a20] | 666 |   int molID = -1;
 | 
|---|
 | 667 |   molecule *mol = NULL;
 | 
|---|
 | 668 |   if (typeid( std::vector<molecule *> ) == *TypeMap[name]) {
 | 
|---|
| [4e145c] | 669 |     if (CurrentValue.find(name) == CurrentValue.end())
 | 
|---|
 | 670 |       throw MissingValueException(__FILE__, __LINE__);
 | 
|---|
| [3e54d0] | 671 |     std::istringstream stream(CurrentValue[name]);
 | 
|---|
| [4e145c] | 672 |     CurrentValue.erase(name);
 | 
|---|
| [3e54d0] | 673 |     while (!stream.fail()) {
 | 
|---|
| [e65de8] | 674 |       stream >> molID >> ws;
 | 
|---|
| [0b0a20] | 675 |       mol = World::getInstance().getMolecule(MoleculeById(molID));
 | 
|---|
 | 676 |       if (mol != NULL)
 | 
|---|
 | 677 |         _T.push_back(mol);
 | 
|---|
| [e65de8] | 678 |       molID = -1;
 | 
|---|
 | 679 |       mol = NULL;
 | 
|---|
| [3e54d0] | 680 |     }
 | 
|---|
 | 681 |   } else
 | 
|---|
 | 682 |     throw IllegalTypeException(__FILE__,__LINE__);
 | 
|---|
 | 683 | }
 | 
|---|
 | 684 | 
 | 
|---|
| [d02e07] | 685 | 
 | 
|---|
 | 686 | void MapOfActions::setCurrentValue(const char * name, class atom * &_T)
 | 
|---|
 | 687 | {
 | 
|---|
 | 688 |   if (typeid( atom ) == *TypeMap[name]) {
 | 
|---|
 | 689 |     std::ostringstream stream;
 | 
|---|
 | 690 |     stream << _T->getId();
 | 
|---|
 | 691 |     CurrentValue[name] = stream.str();
 | 
|---|
 | 692 |   } else
 | 
|---|
 | 693 |     throw IllegalTypeException(__FILE__,__LINE__);
 | 
|---|
 | 694 | }
 | 
|---|
 | 695 | 
 | 
|---|
 | 696 | void MapOfActions::setCurrentValue(const char * name, class element * &_T)
 | 
|---|
 | 697 | {
 | 
|---|
 | 698 |   if (typeid( element ) == *TypeMap[name]) {
 | 
|---|
 | 699 |     std::ostringstream stream;
 | 
|---|
 | 700 |     stream << _T->Z;
 | 
|---|
 | 701 |     CurrentValue[name] = stream.str();
 | 
|---|
 | 702 |   } else
 | 
|---|
 | 703 |     throw IllegalTypeException(__FILE__,__LINE__);
 | 
|---|
 | 704 | }
 | 
|---|
 | 705 | 
 | 
|---|
 | 706 | void MapOfActions::setCurrentValue(const char * name, class molecule * &_T)
 | 
|---|
 | 707 | {
 | 
|---|
 | 708 |   if (typeid( molecule ) == *TypeMap[name]) {
 | 
|---|
 | 709 |     std::ostringstream stream;
 | 
|---|
 | 710 |     stream << _T->getId();
 | 
|---|
 | 711 |     CurrentValue[name] = stream.str();
 | 
|---|
 | 712 |   } else
 | 
|---|
 | 713 |     throw IllegalTypeException(__FILE__,__LINE__);
 | 
|---|
 | 714 | }
 | 
|---|
 | 715 | 
 | 
|---|
 | 716 | void MapOfActions::setCurrentValue(const char * name, class Box &_T)
 | 
|---|
 | 717 | {
 | 
|---|
 | 718 |   const Matrix &M = _T.getM();
 | 
|---|
| [39b639] | 719 |   if (typeid( BoxValue ) == *TypeMap[name]) {
 | 
|---|
| [d02e07] | 720 |     std::ostringstream stream;
 | 
|---|
 | 721 |     stream << M.at(0,0) << " ";
 | 
|---|
 | 722 |     stream << M.at(0,1) << " ";
 | 
|---|
 | 723 |     stream << M.at(0,2) << " ";
 | 
|---|
 | 724 |     stream << M.at(1,1) << " ";
 | 
|---|
 | 725 |     stream << M.at(1,2) << " ";
 | 
|---|
 | 726 |     stream << M.at(2,2) << " ";
 | 
|---|
 | 727 |     CurrentValue[name] = stream.str();
 | 
|---|
 | 728 |   } else
 | 
|---|
 | 729 |     throw IllegalTypeException(__FILE__,__LINE__);
 | 
|---|
 | 730 | }
 | 
|---|
 | 731 | 
 | 
|---|
 | 732 | void MapOfActions::setCurrentValue(const char * name, class Vector &_T)
 | 
|---|
 | 733 | {
 | 
|---|
| [39b639] | 734 |   if (typeid( VectorValue ) == *TypeMap[name]){
 | 
|---|
| [d02e07] | 735 |     std::ostringstream stream;
 | 
|---|
 | 736 |     stream << _T[0] << " ";
 | 
|---|
 | 737 |     stream << _T[1] << " ";
 | 
|---|
 | 738 |     stream << _T[2] << " ";
 | 
|---|
 | 739 |     CurrentValue[name] = stream.str();
 | 
|---|
 | 740 |   } else
 | 
|---|
 | 741 |     throw IllegalTypeException(__FILE__,__LINE__);
 | 
|---|
 | 742 | }
 | 
|---|
 | 743 | 
 | 
|---|
| [0b0a20] | 744 | void MapOfActions::setCurrentValue(const char * name, std::vector<atom *>&_T)
 | 
|---|
 | 745 | {
 | 
|---|
 | 746 |   if (typeid( std::vector<atom *> ) == *TypeMap[name]) {
 | 
|---|
 | 747 |     std::ostringstream stream;
 | 
|---|
 | 748 |     for (std::vector<atom *>::iterator iter = _T.begin(); iter != _T.end(); ++iter) {
 | 
|---|
 | 749 |       stream << (*iter)->getId() << " ";
 | 
|---|
 | 750 |     }
 | 
|---|
 | 751 |     CurrentValue[name] = stream.str();
 | 
|---|
 | 752 |   } else
 | 
|---|
 | 753 |     throw IllegalTypeException(__FILE__,__LINE__);
 | 
|---|
 | 754 | }
 | 
|---|
 | 755 | 
 | 
|---|
| [d02e07] | 756 | void MapOfActions::setCurrentValue(const char * name, std::vector<element *>&_T)
 | 
|---|
 | 757 | {
 | 
|---|
 | 758 |   if (typeid( std::vector<element *> ) == *TypeMap[name]) {
 | 
|---|
 | 759 |     std::ostringstream stream;
 | 
|---|
 | 760 |     for (std::vector<element *>::iterator iter = _T.begin(); iter != _T.end(); ++iter) {
 | 
|---|
| [0b0a20] | 761 |       stream << (*iter)->Z << " ";
 | 
|---|
| [d02e07] | 762 |     }
 | 
|---|
 | 763 |     CurrentValue[name] = stream.str();
 | 
|---|
 | 764 |   } else
 | 
|---|
 | 765 |     throw IllegalTypeException(__FILE__,__LINE__);
 | 
|---|
 | 766 | }
 | 
|---|
 | 767 | 
 | 
|---|
| [0b0a20] | 768 | void MapOfActions::setCurrentValue(const char * name, std::vector<molecule *>&_T)
 | 
|---|
| [3e54d0] | 769 | {
 | 
|---|
| [0b0a20] | 770 |   if (typeid( std::vector<molecule *> ) == *TypeMap[name]) {
 | 
|---|
| [3e54d0] | 771 |     std::ostringstream stream;
 | 
|---|
| [0b0a20] | 772 |     for (std::vector<molecule *>::iterator iter = _T.begin(); iter != _T.end(); ++iter) {
 | 
|---|
 | 773 |       stream << (*iter)->getId() << " ";
 | 
|---|
| [3e54d0] | 774 |     }
 | 
|---|
 | 775 |     CurrentValue[name] = stream.str();
 | 
|---|
 | 776 |   } else
 | 
|---|
 | 777 |     throw IllegalTypeException(__FILE__,__LINE__);
 | 
|---|
 | 778 | }
 | 
|---|
 | 779 | 
 | 
|---|
| [d02e07] | 780 | 
 | 
|---|
| [326bbe] | 781 | 
 | 
|---|
 | 782 | void MapOfActions::populateActions()
 | 
|---|
 | 783 | {
 | 
|---|
 | 784 |   new AnalysisMolecularVolumeAction();
 | 
|---|
 | 785 |   new AnalysisPairCorrelationAction();
 | 
|---|
| [d02e07] | 786 |   new AnalysisPointCorrelationAction();
 | 
|---|
| [326bbe] | 787 |   new AnalysisPrincipalAxisSystemAction();
 | 
|---|
| [d02e07] | 788 |   new AnalysisSurfaceCorrelationAction();
 | 
|---|
| [326bbe] | 789 | 
 | 
|---|
 | 790 |   new AtomAddAction();
 | 
|---|
 | 791 |   new AtomChangeElementAction();
 | 
|---|
 | 792 |   new AtomRemoveAction();
 | 
|---|
 | 793 | 
 | 
|---|
 | 794 |   new CommandLineBondLengthTableAction();
 | 
|---|
 | 795 |   new CommandLineElementDbAction();
 | 
|---|
 | 796 |   new CommandLineFastParsingAction();
 | 
|---|
 | 797 |   new CommandLineHelpAction();
 | 
|---|
 | 798 |   new CommandLineVerboseAction();
 | 
|---|
 | 799 |   new CommandLineVersionAction();
 | 
|---|
 | 800 | 
 | 
|---|
 | 801 |   new FragmentationDepthFirstSearchAction();
 | 
|---|
 | 802 |   new FragmentationFragmentationAction();
 | 
|---|
 | 803 |   new FragmentationSubgraphDissectionAction();
 | 
|---|
 | 804 | 
 | 
|---|
 | 805 |   new MoleculeBondFileAction();
 | 
|---|
 | 806 |   new MoleculeChangeNameAction();
 | 
|---|
 | 807 |   new MoleculeFillWithMoleculeAction();
 | 
|---|
 | 808 |   new MoleculeLinearInterpolationofTrajectoriesAction();
 | 
|---|
| [b2531f] | 809 |   new MoleculeRotateToPrincipalAxisSystemAction();
 | 
|---|
| [326bbe] | 810 |   new MoleculeSaveAdjacencyAction();
 | 
|---|
 | 811 |   new MoleculeSaveBondsAction();
 | 
|---|
 | 812 |   new MoleculeSaveTemperatureAction();
 | 
|---|
| [b2531f] | 813 |   new MoleculeSuspendInWaterAction();
 | 
|---|
| [326bbe] | 814 |   new MoleculeTranslateAction();
 | 
|---|
 | 815 |   new MoleculeVerletIntegrationAction();
 | 
|---|
 | 816 | 
 | 
|---|
 | 817 |   new ParserLoadXyzAction();
 | 
|---|
 | 818 |   new ParserSaveXyzAction();
 | 
|---|
 | 819 | 
 | 
|---|
| [e472eab] | 820 |   new SelectionAllAtomsAction();
 | 
|---|
 | 821 |   new SelectionAllMoleculesAction();
 | 
|---|
| [533838] | 822 |   new SelectionAtomByIdAction();
 | 
|---|
 | 823 |   new SelectionMoleculeByIdAction();
 | 
|---|
| [e472eab] | 824 |   new SelectionNotAllAtomsAction();
 | 
|---|
 | 825 |   new SelectionNotAllMoleculesAction();
 | 
|---|
| [533838] | 826 |   new SelectionNotAtomByIdAction();
 | 
|---|
 | 827 |   new SelectionNotMoleculeByIdAction();
 | 
|---|
 | 828 | 
 | 
|---|
| [326bbe] | 829 |   new TesselationConvexEnvelopeAction();
 | 
|---|
 | 830 |   new TesselationNonConvexEnvelopeAction();
 | 
|---|
 | 831 | 
 | 
|---|
 | 832 |   new WorldAddEmptyBoundaryAction();
 | 
|---|
 | 833 |   new WorldBoundInBoxAction();
 | 
|---|
 | 834 |   new WorldCenterInBoxAction();
 | 
|---|
 | 835 |   new WorldCenterOnEdgeAction();
 | 
|---|
 | 836 |   new WorldChangeBoxAction();
 | 
|---|
 | 837 |   new WorldInputAction();
 | 
|---|
 | 838 |   new WorldOutputAction();
 | 
|---|
 | 839 |   new WorldRemoveSphereOfAtomsAction();
 | 
|---|
 | 840 |   new WorldRepeatBoxAction();
 | 
|---|
 | 841 |   new WorldScaleBoxAction();
 | 
|---|
 | 842 |   new WorldSetDefaultNameAction();
 | 
|---|
 | 843 |   new WorldSetGaussianBasisAction();
 | 
|---|
| [b9c847] | 844 |   new WorldSetOutputFormatsAction();
 | 
|---|
| [326bbe] | 845 | }
 | 
|---|
 | 846 | 
 | 
|---|
| [97ebf8] | 847 | /** Adds all options to the CommandLineParser.
 | 
|---|
 | 848 |  *
 | 
|---|
 | 849 |  */
 | 
|---|
 | 850 | void MapOfActions::AddOptionsToParser()
 | 
|---|
 | 851 | {
 | 
|---|
 | 852 |   // add other options
 | 
|---|
 | 853 |   for (map< set<string>*, po::options_description* >::iterator ListRunner = CmdParserLookup.begin(); ListRunner != CmdParserLookup.end(); ++ListRunner) {
 | 
|---|
 | 854 |     for (set<string>::iterator OptionRunner = ListRunner->first->begin(); OptionRunner != ListRunner->first->end(); ++OptionRunner) {
 | 
|---|
 | 855 |       if (hasValue(*OptionRunner)) {
 | 
|---|
| [e65de8] | 856 |         DoLog(1) && (Log() << Verbose(1) << "Adding option " << *OptionRunner << " with type " << TypeMap[*OptionRunner]->name() << " to CommandLineParser." << endl);
 | 
|---|
| [ab9a27] | 857 |            switch(TypeEnumMap[TypeMap[*OptionRunner]]) {
 | 
|---|
| [97ebf8] | 858 |           default:
 | 
|---|
 | 859 |           case None:
 | 
|---|
 | 860 |             ListRunner->second->add_options()
 | 
|---|
 | 861 |               (getKeyAndShortForm(*OptionRunner).c_str(), getDescription(*OptionRunner).c_str())
 | 
|---|
 | 862 |               ;
 | 
|---|
 | 863 |             break;
 | 
|---|
 | 864 |           case Boolean:
 | 
|---|
 | 865 |             ListRunner->second->add_options()
 | 
|---|
| [e30ce8] | 866 |               (getKeyAndShortForm(*OptionRunner).c_str(),
 | 
|---|
| [ab9a27] | 867 |                   CurrentValue.find(*OptionRunner) != CurrentValue.end() ?
 | 
|---|
| [39b639] | 868 |                         po::value< bool >()->default_value(lexical_cast<int>(CurrentValue[*OptionRunner].c_str())) :
 | 
|---|
| [e30ce8] | 869 |                         po::value< bool >(),
 | 
|---|
 | 870 |                   getDescription(*OptionRunner).c_str())
 | 
|---|
| [97ebf8] | 871 |               ;
 | 
|---|
 | 872 |             break;
 | 
|---|
| [0286bc] | 873 |           case Box:
 | 
|---|
 | 874 |             ListRunner->second->add_options()
 | 
|---|
 | 875 |               (getKeyAndShortForm(*OptionRunner).c_str(),
 | 
|---|
| [39b639] | 876 |                   po::value<BoxValue>(),
 | 
|---|
| [0286bc] | 877 |                   getDescription(*OptionRunner).c_str())
 | 
|---|
 | 878 |               ;
 | 
|---|
 | 879 |             break;
 | 
|---|
| [97ebf8] | 880 |           case Integer:
 | 
|---|
 | 881 |             ListRunner->second->add_options()
 | 
|---|
| [e30ce8] | 882 |               (getKeyAndShortForm(*OptionRunner).c_str(),
 | 
|---|
| [ab9a27] | 883 |                   CurrentValue.find(*OptionRunner) != CurrentValue.end() ?
 | 
|---|
| [39b639] | 884 |                         po::value< int >()->default_value(lexical_cast<int>(CurrentValue[*OptionRunner].c_str())) :
 | 
|---|
| [e30ce8] | 885 |                         po::value< int >(),
 | 
|---|
 | 886 |                   getDescription(*OptionRunner).c_str())
 | 
|---|
| [97ebf8] | 887 |               ;
 | 
|---|
 | 888 |             break;
 | 
|---|
| [0b0a20] | 889 |           case ListOfIntegers:
 | 
|---|
| [97ebf8] | 890 |             ListRunner->second->add_options()
 | 
|---|
| [e30ce8] | 891 |               (getKeyAndShortForm(*OptionRunner).c_str(),
 | 
|---|
 | 892 |                   po::value< vector<int> >()->multitoken(),
 | 
|---|
 | 893 |                   getDescription(*OptionRunner).c_str())
 | 
|---|
| [97ebf8] | 894 |               ;
 | 
|---|
 | 895 |             break;
 | 
|---|
 | 896 |           case Double:
 | 
|---|
 | 897 |             ListRunner->second->add_options()
 | 
|---|
| [e30ce8] | 898 |               (getKeyAndShortForm(*OptionRunner).c_str(),
 | 
|---|
| [ab9a27] | 899 |                   CurrentValue.find(*OptionRunner) != CurrentValue.end() ?
 | 
|---|
| [39b639] | 900 |                         po::value< double >()->default_value(lexical_cast<double>(CurrentValue[*OptionRunner].c_str())) :
 | 
|---|
| [e30ce8] | 901 |                         po::value< double >(),
 | 
|---|
 | 902 |                   getDescription(*OptionRunner).c_str())
 | 
|---|
| [97ebf8] | 903 |               ;
 | 
|---|
 | 904 |             break;
 | 
|---|
 | 905 |           case ListOfDoubles:
 | 
|---|
 | 906 |             ListRunner->second->add_options()
 | 
|---|
| [e30ce8] | 907 |               (getKeyAndShortForm(*OptionRunner).c_str(),
 | 
|---|
 | 908 |                   po::value< vector<double> >()->multitoken(),
 | 
|---|
 | 909 |                   getDescription(*OptionRunner).c_str())
 | 
|---|
| [97ebf8] | 910 |               ;
 | 
|---|
 | 911 |             break;
 | 
|---|
 | 912 |           case String:
 | 
|---|
 | 913 |             ListRunner->second->add_options()
 | 
|---|
| [e30ce8] | 914 |               (getKeyAndShortForm(*OptionRunner).c_str(),
 | 
|---|
| [ab9a27] | 915 |                   CurrentValue.find(*OptionRunner) != CurrentValue.end() ?
 | 
|---|
 | 916 |                         po::value< std::string >()->default_value(CurrentValue[*OptionRunner]) :
 | 
|---|
| [e30ce8] | 917 |                         po::value< std::string >(),
 | 
|---|
 | 918 |                   getDescription(*OptionRunner).c_str())
 | 
|---|
| [97ebf8] | 919 |               ;
 | 
|---|
 | 920 |             break;
 | 
|---|
| [0b0a20] | 921 |           case ListOfStrings:
 | 
|---|
| [cd8e55] | 922 |             ListRunner->second->add_options()
 | 
|---|
 | 923 |               (getKeyAndShortForm(*OptionRunner).c_str(),
 | 
|---|
 | 924 |                   po::value< vector<std::string> >()->multitoken(),
 | 
|---|
 | 925 |                   getDescription(*OptionRunner).c_str())
 | 
|---|
 | 926 |               ;
 | 
|---|
 | 927 |             break;
 | 
|---|
| [0b0a20] | 928 |           case Vector:
 | 
|---|
| [97ebf8] | 929 |             ListRunner->second->add_options()
 | 
|---|
| [e30ce8] | 930 |               (getKeyAndShortForm(*OptionRunner).c_str(),
 | 
|---|
| [0b0a20] | 931 |                   po::value<VectorValue>(),
 | 
|---|
| [e30ce8] | 932 |                   getDescription(*OptionRunner).c_str())
 | 
|---|
| [97ebf8] | 933 |               ;
 | 
|---|
 | 934 |             break;
 | 
|---|
| [0b0a20] | 935 |           case ListOfVectors:
 | 
|---|
| [97ebf8] | 936 |             ListRunner->second->add_options()
 | 
|---|
| [e30ce8] | 937 |               (getKeyAndShortForm(*OptionRunner).c_str(),
 | 
|---|
| [0b0a20] | 938 |                   po::value< vector<VectorValue> >()->multitoken(),
 | 
|---|
| [e30ce8] | 939 |                   getDescription(*OptionRunner).c_str())
 | 
|---|
| [97ebf8] | 940 |               ;
 | 
|---|
 | 941 |             break;
 | 
|---|
 | 942 |           case Molecule:
 | 
|---|
 | 943 |             ListRunner->second->add_options()
 | 
|---|
| [e30ce8] | 944 |               (getKeyAndShortForm(*OptionRunner).c_str(),
 | 
|---|
| [ab9a27] | 945 |                   CurrentValue.find(*OptionRunner) != CurrentValue.end() ?
 | 
|---|
| [39b639] | 946 |                         po::value< int >()->default_value(lexical_cast<int>(CurrentValue[*OptionRunner].c_str())) :
 | 
|---|
| [e30ce8] | 947 |                         po::value< int >(),
 | 
|---|
 | 948 |                   getDescription(*OptionRunner).c_str())
 | 
|---|
| [97ebf8] | 949 |               ;
 | 
|---|
 | 950 |             break;
 | 
|---|
 | 951 |           case ListOfMolecules:
 | 
|---|
 | 952 |             ListRunner->second->add_options()
 | 
|---|
| [e30ce8] | 953 |               (getKeyAndShortForm(*OptionRunner).c_str(),
 | 
|---|
 | 954 |                   po::value< vector<int> >()->multitoken(),
 | 
|---|
 | 955 |                   getDescription(*OptionRunner).c_str())
 | 
|---|
| [97ebf8] | 956 |               ;
 | 
|---|
 | 957 |             break;
 | 
|---|
 | 958 |           case Atom:
 | 
|---|
 | 959 |             ListRunner->second->add_options()
 | 
|---|
| [e30ce8] | 960 |               (getKeyAndShortForm(*OptionRunner).c_str(),
 | 
|---|
| [ab9a27] | 961 |                   CurrentValue.find(*OptionRunner) != CurrentValue.end() ?
 | 
|---|
| [39b639] | 962 |                         po::value< int >()->default_value(lexical_cast<int>(CurrentValue[*OptionRunner].c_str())) :
 | 
|---|
| [e30ce8] | 963 |                         po::value< int >(),
 | 
|---|
 | 964 |                   getDescription(*OptionRunner).c_str())
 | 
|---|
| [97ebf8] | 965 |               ;
 | 
|---|
 | 966 |             break;
 | 
|---|
 | 967 |           case ListOfAtoms:
 | 
|---|
 | 968 |             ListRunner->second->add_options()
 | 
|---|
| [e30ce8] | 969 |               (getKeyAndShortForm(*OptionRunner).c_str(),
 | 
|---|
 | 970 |                   po::value< vector<int> >()->multitoken(),
 | 
|---|
 | 971 |                   getDescription(*OptionRunner).c_str())
 | 
|---|
| [97ebf8] | 972 |               ;
 | 
|---|
 | 973 |             break;
 | 
|---|
 | 974 |           case Element:
 | 
|---|
 | 975 |             ListRunner->second->add_options()
 | 
|---|
| [e30ce8] | 976 |               (getKeyAndShortForm(*OptionRunner).c_str(),
 | 
|---|
| [39b639] | 977 |                   po::value< int >(),
 | 
|---|
| [e30ce8] | 978 |                   getDescription(*OptionRunner).c_str())
 | 
|---|
| [97ebf8] | 979 |               ;
 | 
|---|
 | 980 |             break;
 | 
|---|
 | 981 |           case ListOfElements:
 | 
|---|
 | 982 |             ListRunner->second->add_options()
 | 
|---|
| [e30ce8] | 983 |               (getKeyAndShortForm(*OptionRunner).c_str(),
 | 
|---|
 | 984 |                   po::value< vector<int> >()->multitoken(),
 | 
|---|
 | 985 |                   getDescription(*OptionRunner).c_str())
 | 
|---|
| [97ebf8] | 986 |               ;
 | 
|---|
 | 987 |             break;
 | 
|---|
 | 988 |         }
 | 
|---|
 | 989 |       } else {
 | 
|---|
| [0b0a20] | 990 |         DoLog(3) && (Log() << Verbose(3) << "Adding option " << *OptionRunner << " to CommandLineParser." << endl);
 | 
|---|
| [97ebf8] | 991 |         ListRunner->second->add_options()
 | 
|---|
 | 992 |           (getKeyAndShortForm(*OptionRunner).c_str(), getDescription(*OptionRunner).c_str())
 | 
|---|
 | 993 |           ;
 | 
|---|
 | 994 |       }
 | 
|---|
 | 995 |     }
 | 
|---|
 | 996 |   }
 | 
|---|
 | 997 | }
 | 
|---|
 | 998 | 
 | 
|---|
 | 999 | /** Getter for MapOfActions:DescriptionMap.
 | 
|---|
 | 1000 |  * Note that we assert when action does not exist in CommandLineParser::DescriptionMap.
 | 
|---|
 | 1001 |  * \param actionname name of the action to lookup
 | 
|---|
 | 1002 |  * \return Description of the action
 | 
|---|
 | 1003 |  */
 | 
|---|
 | 1004 | std::string MapOfActions::getDescription(string actionname)
 | 
|---|
 | 1005 | {
 | 
|---|
 | 1006 |   ASSERT(DescriptionMap.find(actionname) != DescriptionMap.end(), "Unknown action name passed to MapOfActions::getDescription");
 | 
|---|
 | 1007 |   return DescriptionMap[actionname];
 | 
|---|
 | 1008 | }
 | 
|---|
 | 1009 | 
 | 
|---|
 | 1010 | /** Specific Getter for a MapOfActions:ShortFormMap.
 | 
|---|
 | 1011 |  * If action has a short for, then combination is as "actionname,ShortForm" (this is
 | 
|---|
 | 1012 |  * the desired format for boost::program_options). If no short form exists in the map,
 | 
|---|
 | 1013 |  * just actionname will be returned
 | 
|---|
 | 1014 |  * Note that we assert when action does not exist in CommandLineParser::DescriptionMap.
 | 
|---|
 | 1015 |  * \param actionname name of the action to lookup
 | 
|---|
 | 1016 |  * \return actionname,ShortForm or Description of the action
 | 
|---|
 | 1017 |  */
 | 
|---|
 | 1018 | std::string MapOfActions::getKeyAndShortForm(string actionname)
 | 
|---|
 | 1019 | {
 | 
|---|
 | 1020 |   stringstream output;
 | 
|---|
 | 1021 |   ASSERT(DescriptionMap.find(actionname) != DescriptionMap.end(), "Unknown action name passed to MapOfActions::getDescriptionAndShortForm");
 | 
|---|
 | 1022 |   output << actionname;
 | 
|---|
 | 1023 |   if (ShortFormMap.find(actionname) != DescriptionMap.end())
 | 
|---|
 | 1024 |     output << "," << ShortFormMap[actionname];
 | 
|---|
 | 1025 |   return output.str();
 | 
|---|
 | 1026 | }
 | 
|---|
 | 1027 | 
 | 
|---|
 | 1028 | /** Getter for MapOfActions:ShortFormMap.
 | 
|---|
 | 1029 |  * Note that we assert when action does not exist CommandLineParser::ShortFormMap.
 | 
|---|
 | 1030 |  * \param actionname name of the action to lookup
 | 
|---|
 | 1031 |  * \return ShortForm of the action
 | 
|---|
 | 1032 |  */
 | 
|---|
 | 1033 | std::string MapOfActions::getShortForm(string actionname)
 | 
|---|
 | 1034 | {
 | 
|---|
 | 1035 |   ASSERT(ShortFormMap.find(actionname) != ShortFormMap.end(), "Unknown action name passed to MapOfActions::getShortForm");
 | 
|---|
 | 1036 |   return ShortFormMap[actionname];
 | 
|---|
 | 1037 | }
 | 
|---|
 | 1038 | 
 | 
|---|
 | 1039 | /** Returns whether the given action needs a value or not.
 | 
|---|
 | 1040 |  * \param actionname name of the action to look up
 | 
|---|
 | 1041 |  * \return true - value is needed, false - no value is stored in MapOfActions::TypeMap
 | 
|---|
 | 1042 |  */
 | 
|---|
 | 1043 | bool MapOfActions::hasValue(string actionname)
 | 
|---|
 | 1044 | {
 | 
|---|
 | 1045 |   return (TypeMap.find(actionname) != TypeMap.end());
 | 
|---|
 | 1046 | }
 | 
|---|
 | 1047 | 
 | 
|---|
 | 1048 | /** Getter for MapOfActions::TypeMap.
 | 
|---|
 | 1049 |  * \param actionname name of the action to look up
 | 
|---|
 | 1050 |  * \return type of the action
 | 
|---|
 | 1051 |  */
 | 
|---|
| [ab9a27] | 1052 | std::string MapOfActions::getValueType(string actionname)
 | 
|---|
| [97ebf8] | 1053 | {
 | 
|---|
| [ab9a27] | 1054 |   return TypeMap[actionname]->name();
 | 
|---|
| [97ebf8] | 1055 | }
 | 
|---|
 | 1056 | 
 | 
|---|
 | 1057 | /** Searches whether action is registered with CommandLineParser.
 | 
|---|
 | 1058 |  * Note that this method is only meant transitionally for ParseCommandLineOptions' removal.
 | 
|---|
 | 1059 |  * I.e. All actions that are already handled by the new CommandLineUIFactory can be checked
 | 
|---|
 | 1060 |  * by this function.
 | 
|---|
 | 1061 |  * \param shortform command short form to look for
 | 
|---|
 | 1062 |  * \return true - action has been registered, false - action has not been registered.
 | 
|---|
 | 1063 |  */
 | 
|---|
 | 1064 | bool MapOfActions::isShortFormPresent(string shortform)
 | 
|---|
 | 1065 | {
 | 
|---|
 | 1066 |   bool result = false;
 | 
|---|
 | 1067 |   string actionname;
 | 
|---|
 | 1068 |   for (map<std::string, std::string>::iterator ShortFormRunner = ShortFormMap.begin(); ShortFormRunner != ShortFormMap.end(); ++ShortFormRunner)
 | 
|---|
 | 1069 |     if (ShortFormRunner->second == shortform) {
 | 
|---|
 | 1070 |       actionname = ShortFormRunner->first;
 | 
|---|
 | 1071 |       break;
 | 
|---|
 | 1072 |     }
 | 
|---|
 | 1073 |   result = result || (generic.find(actionname) != generic.end());
 | 
|---|
 | 1074 |   result = result || (config.find(actionname) != config.end());
 | 
|---|
 | 1075 |   result = result || (hidden.find(actionname) != hidden.end());
 | 
|---|
 | 1076 |   result = result || (visible.find(actionname) != visible.end());
 | 
|---|
 | 1077 |   result = result || (inputfile.find(actionname) != inputfile.end());
 | 
|---|
 | 1078 |   return result;
 | 
|---|
 | 1079 | }
 | 
|---|
 | 1080 | 
 | 
|---|
| [7e6b00] | 1081 | /** Returns the inverse to MapOfActions::ShortFormMap, i.e. lookup actionname for its short form.
 | 
|---|
 | 1082 |  * \return map from short form of action to name of action
 | 
|---|
 | 1083 |  */
 | 
|---|
 | 1084 | map <std::string, std::string> MapOfActions::getShortFormToActionMap()
 | 
|---|
 | 1085 | {
 | 
|---|
 | 1086 |   map <std::string, std::string> result;
 | 
|---|
 | 1087 | 
 | 
|---|
 | 1088 |   for (map<std::string, std::string>::iterator iter = ShortFormMap.begin(); iter != ShortFormMap.end();  ++iter)
 | 
|---|
 | 1089 |     result[iter->second] = iter->first;
 | 
|---|
 | 1090 | 
 | 
|---|
 | 1091 |   return result;
 | 
|---|
 | 1092 | }
 | 
|---|
| [97ebf8] | 1093 | 
 | 
|---|
 | 1094 | 
 | 
|---|
 | 1095 | CONSTRUCT_SINGLETON(MapOfActions)
 | 
|---|