Changeset ec4b04 for src/bin/mpqc
- Timestamp:
- Jul 10, 2012, 1:15:51 PM (13 years ago)
- Children:
- 52aacc
- Parents:
- e9a571
- git-author:
- Frederik Heber <heber@…> (07/08/12 19:12:09)
- git-committer:
- Frederik Heber <heber@…> (07/10/12 13:15:51)
- File:
- 
      - 1 edited
 
 - 
          
  src/bin/mpqc/mpqc.cc (modified) (13 diffs)
 
Legend:
- Unmodified
- Added
- Removed
- 
      src/bin/mpqc/mpqc.ccre9a571 rec4b04 305 305 } 306 306 307 /** Temporary structure for storing information from command-line 308 * 309 * This structure has been introduced to gather the various calls to GetLongOpts 310 * at one (initial) place and to abstract it from the source of command-lines. 311 * This temporary object can be set by other means, too. I.e. we become 312 * independent of usage in command-line programs. 313 */ 314 struct OptionValues { 315 const char *keyvalue; // option "k" 316 const char *debug; // option "" 317 int limit; // option "l" 318 const char *check; // option "c" 319 const char *simple_input; // option "i" 320 321 #ifdef HAVE_CHEMISTRY_CCA 322 string cca_load; // option "cca-path" 323 string cc_path; // option "cca-load" 324 #endif 325 }; 326 327 /** Parse remainder options not treated by ComputeOptions() into temporary storage. 328 * 329 * \param options option structure to obtain values from 330 * \param values remaining option values which are processed later and now 331 * stored in a temporary structure 332 */ 333 void parseRemainderOptions( 334 GetLongOpt &options, 335 struct OptionValues &values) 336 { 337 values.keyvalue = options.retrieve("k"); 338 values.debug = options.retrieve("d"); 339 values.limit = atoi(options.retrieve("l")); 340 values.check = options.retrieve("c"); 341 values.simple_input = options.retrieve("i"); 342 343 #ifdef HAVE_CHEMISTRY_CCA 344 values.cca_load = options.retrieve("cca-load"); 345 values.cca_path = options.retrieve("cca-path"); 346 #endif 347 } 348 307 349 /** Sets object and generic input file names. 308 350 * 309 351 * \param object_input filename of object-oriented input 310 352 * \param generic_input filename of generic input 311 * \param options option structure353 * \param options (command-line)option structure 312 354 * \param argc argument count 313 355 * \param argv argument array … … 573 615 * \param grp message group 574 616 * \param parsedkev keyvalue container on return 575 * \param optionsoptions structure617 * \param values (command-line) options structure 576 618 * \param input input file name 577 619 * \param generic_input filename of generic input … … 580 622 Ref<MessageGrp> &grp, 581 623 Ref<ParsedKeyVal> &parsedkv, 582 GetLongOpt &options,624 struct OptionValues &values, 583 625 const char *&input, 584 626 const char *&generic_input … … 624 666 MPQCIn mpqcin; 625 667 char *simple_input_text = mpqcin.parse_string(in_char_array); 626 if ( options.retrieve("i")) {668 if (values.simple_input) { 627 669 ExEnv::out0() << "Generated object-oriented input file:" << endl 628 670 << simple_input_text … … 700 742 * 701 743 * \param keyval keyvalue container 702 * \param options parsed command lineoptions744 * \param values parsed (command-line) options 703 745 */ 704 746 void prepareCCA( 705 747 Ref<KeyVal> &keyval, 706 GetLongOpt &options748 struct OptionValues &values 707 749 ) 708 750 { … … 712 754 bool do_cca = keyval->booleanvalue("do_cca",falsevalue); 713 755 714 string cca_path( options.retrieve("cca-path"));715 string cca_load( options.retrieve("cca-load"));756 string cca_path(values.cca_path); 757 string cca_load(values.cca_load); 716 758 if(cca_path.size()==0) 717 759 cca_path = keyval->stringvalue("cca_path",emptystring); … … 752 794 Ref<MessageGrp> &grp, 753 795 Ref<Debugger> &debugger, 754 GetLongOpt &options,796 struct OptionValues &values, 755 797 char **argv) 756 798 { … … 760 802 debugger->set_exec(argv[0]); 761 803 debugger->set_prefix(grp->me()); 762 if ( options.retrieve("d"))804 if (values.debug) 763 805 debugger->debug("Starting debugger because -d given on command line."); 764 806 } … … 867 909 /** Checks whether limit on command-line exceeds the basis functions. 868 910 * 869 * \param options parsed command-line options870 911 * \param mole molecular energy object 912 * \param values temporarily storage for (command-line) options 871 913 * \return 0 - not exceeded, 1 - exceeded 872 914 */ 873 915 int checkBasisSetLimit( 874 GetLongOpt &options,875 Ref<MolecularEnergy> &mole916 Ref<MolecularEnergy> &mole, 917 struct OptionValues &values 876 918 ) 877 919 { 878 int check = ( options.retrieve("c") !=0);879 int limit = atoi(options.retrieve("l"));920 int check = (values.check != (const char *)0); 921 int limit = values.limit; 880 922 if (limit) { 881 923 Ref<Wavefunction> wfn; wfn << mole; … … 1130 1172 ostream *outstream = 0; 1131 1173 ComputeOptions(options, output, outstream); 1174 OptionValues values; 1175 parseRemainderOptions(options, values); 1132 1176 1133 1177 // get the message group. first try the commandline and environment … … 1145 1189 // parse input into keyvalue container 1146 1190 Ref<ParsedKeyVal> parsedkv; 1147 parseInputfile(grp, parsedkv, options, input, generic_input);1148 if ( options.retrieve("k")) parsedkv->verbose(1);1191 parseInputfile(grp, parsedkv, values, input, generic_input); 1192 if (values.keyvalue) parsedkv->verbose(1); 1149 1193 Ref<KeyVal> keyval = new PrefixKeyVal(parsedkv.pointer(),"mpqc"); 1150 1194 … … 1183 1227 1184 1228 // prepare CCA if available 1185 prepareCCA(keyval, options);1229 prepareCCA(keyval, values); 1186 1230 1187 1231 // now set up the debugger 1188 1232 Ref<Debugger> debugger; 1189 setupDebugger(keyval, grp, debugger, options, argv);1233 setupDebugger(keyval, grp, debugger, values, argv); 1190 1234 1191 1235 // now check to see what matrix kit to use … … 1250 1294 1251 1295 // check basis set limit 1252 const int check = checkBasisSetLimit( options, mole);1296 const int check = checkBasisSetLimit(mole, values); 1253 1297 if (check) { 1254 1298 ExEnv::out0() << endl << indent 
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  
