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