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