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