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