Changeset e6317b for src/Actions/MapOfActions.cpp
- Timestamp:
- Jun 16, 2010, 12:24:21 PM (15 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 492279
- Parents:
- f8e486 (diff), 980dd6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/MapOfActions.cpp
rf8e486 re6317b 14 14 #include "Helpers/Assert.hpp" 15 15 16 #include <boost/lexical_cast.hpp> 17 #include <boost/optional.hpp> 18 #include <boost/program_options.hpp> 19 16 20 #include "CommandLineParser.hpp" 17 21 #include "log.hpp" 18 22 #include "verbose.hpp" 23 24 #include "Actions/Values.hpp" 25 26 void validate(boost::any& v, const std::vector<std::string>& values, VectorValue *, int) 27 { 28 VectorValue VV; 29 if (values.size() != 3) { 30 cerr << "Specified vector does not have three components but " << values.size() << endl; 31 throw boost::program_options::validation_error("Specified vector does not have three components"); 32 } 33 VV.x = boost::lexical_cast<double>(values.at(0)); 34 VV.y = boost::lexical_cast<double>(values.at(1)); 35 VV.z = boost::lexical_cast<double>(values.at(2)); 36 v = boost::any(VectorValue(VV)); 37 } 38 39 void validate(boost::any& v, const std::vector<std::string>& values, BoxValue *, int) 40 { 41 BoxValue BV; 42 if (values.size() != 6) { 43 cerr << "Specified vector does not have three components but " << values.size() << endl; 44 throw boost::program_options::validation_error("Specified symmetric box matrix does not have six components"); 45 } 46 BV.xx = boost::lexical_cast<double>(values.at(0)); 47 BV.xy = boost::lexical_cast<double>(values.at(1)); 48 BV.xz = boost::lexical_cast<double>(values.at(2)); 49 BV.yy = boost::lexical_cast<double>(values.at(3)); 50 BV.yz = boost::lexical_cast<double>(values.at(4)); 51 BV.zz = boost::lexical_cast<double>(values.at(5)); 52 v = boost::any(BoxValue(BV)); 53 } 19 54 20 55 /** Constructor of class MapOfActions. … … 51 86 DescriptionMap["nonconvex-envelope"] = "create the non-convex envelope for a molecule"; 52 87 DescriptionMap["molecular-volume"] = "calculate the volume of a given molecule"; 53 DescriptionMap["pair-correlation"] = "pair correlation analysis between two elements"; 54 DescriptionMap["pair-correlation-point"] = "pair correlation analysis between atoms of a element to a given point"; 55 DescriptionMap["pair-correlation-surface"] = "pair correlation analysis between atoms of a given element and a surface"; 88 DescriptionMap["pair-correlation"] = "pair correlation analysis between two elements, element and point or element and surface"; 56 89 DescriptionMap["parse-xyz"] = "parse xyz file into World"; 57 90 DescriptionMap["principal-axis-system"] = "calculate the principal axis system of the specified molecule"; … … 65 98 DescriptionMap["save-temperature"] = "name of the temperature file to write to"; 66 99 DescriptionMap["scale-box"] = "scale box and atomic positions inside"; 67 DescriptionMap["sub space-dissect"] = "dissect the molecular system into molecules representing disconnected subgraphs";100 DescriptionMap["subgraph-dissect"] = "dissect the molecular system into molecules representing disconnected subgraphs"; 68 101 DescriptionMap["suspend-in-water"] = "suspend the given molecule in water such that in the domain the mean density is as specified"; 69 102 DescriptionMap["translate-mol"] = "translate molecule by given vector"; … … 72 105 DescriptionMap["version"] = "show version"; 73 106 // keys for values 107 DescriptionMap["atom-by-id"] = "index of an atom"; 74 108 DescriptionMap["bin-output-file"] = "name of the bin output file"; 75 109 DescriptionMap["bin-end"] = "start of the last bin"; 76 110 DescriptionMap["bin-start"] = "start of the first bin"; 77 111 DescriptionMap["bin-width"] = "width of the bins"; 112 DescriptionMap["convex-file"] = "filename of the non-convex envelope"; 78 113 DescriptionMap["distance"] = "distance in space"; 79 114 DescriptionMap["distances"] = "list of three of distances in space, one for each axis direction"; 80 DescriptionMap["element"] = "set of elements"; 81 DescriptionMap["end-mol"] = "last or end step"; 115 DescriptionMap["DoRotate"] = "whether to rotate or just report angles"; 116 DescriptionMap["element"] = "single element"; 117 DescriptionMap["elements"] = "set of elements"; 118 DescriptionMap["end-step"] = "last or end step"; 119 DescriptionMap["id-mapping"] = "whether the identity shall be used in mapping atoms onto atoms or some closest distance measure shall be used"; 82 120 DescriptionMap["input"] = "name of input file"; 83 121 DescriptionMap["length"] = "length in space"; … … 85 123 DescriptionMap["MaxDistance"] = "maximum distance in space"; 86 124 DescriptionMap["molecule-by-id"] = "index of a molecule"; 125 DescriptionMap["molecule-by-name"] = "name of a molecule"; 126 DescriptionMap["nonconvex-file"] = "filename of the non-convex envelope"; 127 DescriptionMap["order"] = "order of a discretization, dissection, ..."; 87 128 DescriptionMap["output-file"] = "name of the output file"; 88 129 DescriptionMap["periodic"] = "system is constraint to periodic boundary conditions (y/n)"; 89 130 DescriptionMap["position"] = "position in R^3 space"; 90 DescriptionMap["start-mol"] = "first or start step"; 131 DescriptionMap["sphere-radius"] = "radius of tesselation sphere"; 132 DescriptionMap["start-step"] = "first or start step"; 91 133 92 134 // short forms for the actions … … 110 152 ShortFormMap["linear-interpolate"] = "L"; 111 153 ShortFormMap["nonconvex-envelope"] = "N"; 112 ShortFormMap["pair-correlation"] = "CE"; 113 ShortFormMap["pair-correlation-point"] = "CP"; 114 ShortFormMap["pair-correlation-surface"] = "CS"; 154 ShortFormMap["pair-correlation"] = "C"; 115 155 ShortFormMap["parse-xyz"] = "p"; 116 156 ShortFormMap["remove-atom"] = "r"; … … 123 163 ShortFormMap["scale-box"] = "s"; 124 164 ShortFormMap["set-basis"] = "M"; 125 ShortFormMap["sub space-dissect"] = "I";126 ShortFormMap["suspend-in-water"] = " U";165 ShortFormMap["subgraph-dissect"] = "I"; 166 ShortFormMap["suspend-in-water"] = "u"; 127 167 ShortFormMap["translate-mol"] = "t"; 128 168 ShortFormMap["verbose"] = "v"; … … 131 171 132 172 // value types for the actions 133 TypeMap["add-atom"] = Atom;173 TypeMap["add-atom"] = Element; 134 174 TypeMap["bond-file"] = String; 135 175 TypeMap["bond-table"] = String; 136 176 TypeMap["boundary"] = Vector; 137 TypeMap["center-in-box"] = ListOfDoubles;138 TypeMap["change-box"] = ListOfDoubles;139 TypeMap["change-element"] = Element;177 TypeMap["center-in-box"] = Box; 178 TypeMap["change-box"] = Box; 179 TypeMap["change-element"] = Atom; 140 180 TypeMap["change-molname"] = String; 141 181 TypeMap["convex-envelope"] = Molecule; … … 143 183 TypeMap["depth-first-search"] = Double; 144 184 TypeMap["element-db"] = String; 145 TypeMap["end-mol"] = Molecule;146 185 TypeMap["fastparsing"] = Boolean; 147 186 TypeMap["fill-molecule"] = String; … … 152 191 TypeMap["nonconvex-envelope"] = Molecule; 153 192 TypeMap["parse-xyz"] = String; 154 TypeMap["principal-axis-system"] = Axis; 193 TypeMap["pair-correlation"] = String; 194 TypeMap["principal-axis-system"] = Molecule; 155 195 TypeMap["remove-atom"] = Atom; 156 TypeMap["remove-sphere"] = Atom;196 TypeMap["remove-sphere"] = Double; 157 197 TypeMap["repeat-box"] = Vector; 158 198 TypeMap["rotate-to-pas"] = Molecule; … … 162 202 TypeMap["scale-box"] = Vector; 163 203 TypeMap["set-basis"] = String; 164 TypeMap["s tart-mol"] = Molecule;165 TypeMap["suspend-in-water"] = Molecule;204 TypeMap["subgraph-dissect"] = None; 205 TypeMap["suspend-in-water"] = Double; 166 206 TypeMap["translate-mol"] = Vector; 167 207 TypeMap["verlet-integrate"] = String; … … 169 209 170 210 // value types for the values 211 TypeMap["atom-by-id"] = Atom; 171 212 TypeMap["bin-output-file"] = String; 172 213 TypeMap["bin-end"] = Double; 173 214 TypeMap["bin-start"] = Double; 215 TypeMap["bin-width"] = Double; 216 TypeMap["convex-file"] = String; 174 217 TypeMap["distance"] = Double; 175 TypeMap["distances"] = ListOfDoubles; 176 TypeMap["elements"] = Element; 218 TypeMap["distances"] = Vector; 219 TypeMap["DoRotate"] = Boolean; 220 TypeMap["element"] = Element; 177 221 TypeMap["elements"] = ListOfElements; 222 TypeMap["end-step"] = Integer; 223 TypeMap["id-mapping"] = Boolean; 178 224 TypeMap["length"] = Double; 179 TypeMap["lengths"] = ListOfDoubles;225 TypeMap["lengths"] = Vector; 180 226 TypeMap["MaxDistance"] = Double; 181 227 TypeMap["molecule-by-id"] = Molecule; 228 TypeMap["molecule-by-name"] = Molecule; 229 TypeMap["nonconvex-file"] = String; 230 TypeMap["order"] = Integer; 182 231 TypeMap["output-file"] = String; 183 232 TypeMap["periodic"] = Boolean; 184 233 TypeMap["position"] = Vector; 234 TypeMap["sphere-radius"] = Double; 235 TypeMap["start-step"] = Integer; 185 236 186 237 // default values for any action that needs one (always string!) 238 DefaultValue["bin-width"] = "0.5"; 239 DefaultValue["fastparsing"] = "0"; 240 DefaultValue["atom-by-id"] = "-1"; 187 241 DefaultValue["molecule-by-id"] = "-1"; 242 DefaultValue["periodic"] = "0"; 188 243 189 244 190 245 // list of generic actions 191 //generic.insert("add-atom");192 //generic.insert("bond-file");193 //generic.insert("bond-table");246 generic.insert("add-atom"); 247 generic.insert("bond-file"); 248 generic.insert("bond-table"); 194 249 generic.insert("boundary"); 195 250 // generic.insert("bound-in-box"); … … 198 253 generic.insert("change-box"); 199 254 // generic.insert("change-molname"); 200 //generic.insert("change-element");201 //generic.insert("convex-envelope");202 //generic.insert("default-molname");203 //generic.insert("depth-first-search");204 //generic.insert("element-db");205 //generic.insert("fastparsing");206 //generic.insert("fill-molecule");207 //generic.insert("fragment-mol");255 generic.insert("change-element"); 256 generic.insert("convex-envelope"); 257 generic.insert("default-molname"); 258 generic.insert("depth-first-search"); 259 generic.insert("element-db"); 260 generic.insert("fastparsing"); 261 generic.insert("fill-molecule"); 262 generic.insert("fragment-mol"); 208 263 generic.insert("help"); 209 //generic.insert("linear-interpolate");264 generic.insert("linear-interpolate"); 210 265 // generic.insert("molecular-volume"); 211 // generic.insert("nonconvex-envelope"); 212 // generic.insert("pair-correlation"); 213 // generic.insert("pair-correlation-point"); 214 // generic.insert("pair-correlation-surface"); 266 generic.insert("nonconvex-envelope"); 267 generic.insert("pair-correlation"); 215 268 // generic.insert("parse-xyz"); 216 269 // generic.insert("principal-axis-system"); 217 //generic.insert("remove-atom");218 //generic.insert("remove-sphere");219 220 //generic.insert("rotate-to-pas");221 //generic.insert("save-adjacency");222 //generic.insert("save-bonds");223 //generic.insert("save-temperature");270 generic.insert("remove-atom"); 271 generic.insert("remove-sphere"); 272 generic.insert("repeat-box"); 273 generic.insert("rotate-to-pas"); 274 generic.insert("save-adjacency"); 275 generic.insert("save-bonds"); 276 generic.insert("save-temperature"); 224 277 generic.insert("scale-box"); 225 //generic.insert("set-basis");226 // generic.insert("subspace-dissect");227 //generic.insert("suspend-in-water");228 //generic.insert("translate-mol");278 generic.insert("set-basis"); 279 generic.insert("subgraph-dissect"); 280 generic.insert("suspend-in-water"); 281 generic.insert("translate-mol"); 229 282 generic.insert("verbose"); 230 //generic.insert("verlet-integrate");283 generic.insert("verlet-integrate"); 231 284 generic.insert("version"); 232 // // list of generic values233 // generic.insert("bin-output-file");234 // generic.insert("bin-end");235 // generic.insert("bin-start");236 // generic.insert("distance");237 // generic.insert("distances");238 // generic.insert("element");239 // generic.insert("end-mol");240 generic.insert("input");241 // generic.insert("length");242 // generic.insert("lengths");243 // generic.insert("MaxDistance");244 // generic.insert("molecule-by-id");245 // generic.insert("output-file");246 // generic.insert("periodic");247 // generic.insert("position");248 // generic.insert("start-mol");249 285 250 286 // positional arguments 251 inputfile.insert("input"); 287 generic.insert("input"); 288 inputfile.insert("input"); 289 290 // hidden arguments 291 generic.insert("atom-by-id"); 292 generic.insert("bin-end"); 293 generic.insert("bin-output-file"); 294 generic.insert("bin-start"); 295 generic.insert("bin-width"); 296 generic.insert("convex-file"); 297 generic.insert("distance"); 298 generic.insert("DoRotate"); 299 generic.insert("distances"); 300 generic.insert("element"); 301 generic.insert("elements"); 302 generic.insert("end-step"); 303 generic.insert("id-mapping"); 304 generic.insert("lengths"); 305 generic.insert("MaxDistance"); 306 generic.insert("molecule-by-id"); 307 generic.insert("molecule-by-name"); 308 generic.insert("nonconvex-file"); 309 generic.insert("order"); 310 generic.insert("output-file"); 311 generic.insert("periodic"); 312 generic.insert("position"); 313 generic.insert("sphere-radius"); 314 generic.insert("start-step"); 252 315 } 253 316 … … 286 349 ; 287 350 break; 351 case Box: 352 ListRunner->second->add_options() 353 (getKeyAndShortForm(*OptionRunner).c_str(), 354 po::value<BoxValue>()->multitoken(), 355 getDescription(*OptionRunner).c_str()) 356 ; 357 break; 288 358 case Integer: 289 359 ListRunner->second->add_options() … … 339 409 ListRunner->second->add_options() 340 410 (getKeyAndShortForm(*OptionRunner).c_str(), 341 po::value< vector<double> >()->multitoken(), 342 getDescription(*OptionRunner).c_str()) 343 ; 344 break; 345 case Box: 346 ListRunner->second->add_options() 347 (getKeyAndShortForm(*OptionRunner).c_str(), 348 po::value< vector<double> >(), 411 po::value<VectorValue>()->multitoken(), 349 412 getDescription(*OptionRunner).c_str()) 350 413 ; … … 385 448 ListRunner->second->add_options() 386 449 (getKeyAndShortForm(*OptionRunner).c_str(), 387 DefaultValue.find(*OptionRunner) != DefaultValue.end() ? 388 po::value< int >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) : 389 po::value< int >(), 450 po::value< vector<int> >(), 390 451 getDescription(*OptionRunner).c_str()) 391 452 ; … … 497 558 } 498 559 560 /** Returns the inverse to MapOfActions::ShortFormMap, i.e. lookup actionname for its short form. 561 * \return map from short form of action to name of action 562 */ 563 map <std::string, std::string> MapOfActions::getShortFormToActionMap() 564 { 565 map <std::string, std::string> result; 566 567 for (map<std::string, std::string>::iterator iter = ShortFormMap.begin(); iter != ShortFormMap.end(); ++iter) 568 result[iter->second] = iter->first; 569 570 return result; 571 } 499 572 500 573
Note:
See TracChangeset
for help on using the changeset viewer.