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