Changes in src/builder.cpp [97ebf8:50dfda]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/builder.cpp ¶
r97ebf8 r50dfda 77 77 #include "Actions/ActionRegistry.hpp" 78 78 #include "Actions/ActionHistory.hpp" 79 #include "Actions/MapOfActions.hpp"80 79 #include "Actions/MethodAction.hpp" 81 80 #include "Actions/MoleculeAction/ChangeNameAction.hpp" … … 1481 1480 1482 1481 /** Parses the command line options. 1483 * Note that this function is from now on transitional. All commands that are not passed1484 * here are handled by CommandLineParser and the actions of CommandLineUIFactory.1485 1482 * \param argc argument count 1486 1483 * \param **argv arguments array … … 1490 1487 * \param *ConfigFileName pointer to config file name in **argv 1491 1488 * \param *PathToDatabases pointer to db's path in **argv 1492 * \param &ArgcList list of arguments that we do not parse here1493 1489 * \return exit code (0 - successful, all else - something's wrong) 1494 1490 */ 1495 static int ParseCommandLineOptions(int argc, char **argv, MoleculeListClass *&molecules, periodentafel *&periode, 1496 config& configuration, char *&ConfigFileName , list<int> &ArgcList)1491 static int ParseCommandLineOptions(int argc, char **argv, MoleculeListClass *&molecules, periodentafel *&periode,\ 1492 config& configuration, char *&ConfigFileName) 1497 1493 { 1498 1494 Vector x,y,z,n; // coordinates for absolute point in cell volume … … 1512 1508 molecule *mol = NULL; 1513 1509 string BondGraphFileName("\n"); 1510 int verbosity = 0; 1514 1511 strncpy(configuration.databasepath, LocalPath, MAXSTRINGSIZE-1); 1515 1512 … … 1525 1522 case 'H': 1526 1523 case '?': 1527 ArgcList.push_back(argptr-1); 1528 return(1); 1524 DoLog(0) && (Log() << Verbose(0) << "MoleCuilder suite" << endl << "==================" << endl << endl); 1525 DoLog(0) && (Log() << Verbose(0) << "Usage: " << argv[0] << "[config file] [-{acefpsthH?vfrp}] [further arguments]" << endl); 1526 DoLog(0) && (Log() << Verbose(0) << "or simply " << argv[0] << " without arguments for interactive session." << endl); 1527 DoLog(0) && (Log() << Verbose(0) << "\t-a Z x1 x2 x3\tAdd new atom of element Z at coordinates (x1,x2,x3)." << endl); 1528 DoLog(0) && (Log() << Verbose(0) << "\t-A <source>\tCreate adjacency list from bonds parsed from 'dbond'-style file." <<endl); 1529 DoLog(0) && (Log() << Verbose(0) << "\t-b xx xy xz yy yz zz\tCenter atoms in domain with given symmetric matrix of (xx,xy,xz,yy,yz,zz)." << endl); 1530 DoLog(0) && (Log() << Verbose(0) << "\t-B xx xy xz yy yz zz\tBound atoms by domain with given symmetric matrix of (xx,xy,xz,yy,yz,zz)." << endl); 1531 DoLog(0) && (Log() << Verbose(0) << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl); 1532 DoLog(0) && (Log() << Verbose(0) << "\t-C <type> [params] <output> <bin output> <BinWidth> <BinStart> <BinEnd>\tPair Correlation analysis." << endl); 1533 DoLog(0) && (Log() << Verbose(0) << "\t-d x1 x2 x3\tDuplicate cell along each axis by given factor." << endl); 1534 DoLog(0) && (Log() << Verbose(0) << "\t-D <bond distance>\tDepth-First-Search Analysis of the molecule, giving cycles and tree/back edges." << endl); 1535 DoLog(0) && (Log() << Verbose(0) << "\t-e <file>\tSets the databases path to be parsed (default: ./)." << endl); 1536 DoLog(0) && (Log() << Verbose(0) << "\t-E <id> <Z>\tChange atom <id>'s element to <Z>, <id> begins at 0." << endl); 1537 DoLog(0) && (Log() << Verbose(0) << "\t-f <dist> <order>\tFragments the molecule in BOSSANOVA manner (with/out rings compressed) and stores config files in same dir as config (return code 0 - fragmented, 2 - no fragmentation necessary)." << endl); 1538 DoLog(0) && (Log() << Verbose(0) << "\t-F <xyz of filler> <dist_x> <dist_y> <dist_z> <epsilon> <randatom> <randmol> <DoRotate>\tFilling Box with water molecules." << endl); 1539 DoLog(0) && (Log() << Verbose(0) << "\t-FF <MaxDistance> <xyz of filler> <dist_x> <dist_y> <dist_z> <epsilon> <randatom> <randmol> <DoRotate>\tFilling Box with water molecules." << endl); 1540 DoLog(0) && (Log() << Verbose(0) << "\t-g <file>\tParses a bond length table from the given file." << endl); 1541 DoLog(0) && (Log() << Verbose(0) << "\t-h/-H/-?\tGive this help screen." << endl); 1542 DoLog(0) && (Log() << Verbose(0) << "\t-I\t Dissect current system of molecules into a set of disconnected (subgraphs of) molecules." << endl); 1543 DoLog(0) && (Log() << Verbose(0) << "\t-j\t<path> Store all bonds to file." << endl); 1544 DoLog(0) && (Log() << Verbose(0) << "\t-J\t<path> Store adjacency per atom to file." << endl); 1545 DoLog(0) && (Log() << Verbose(0) << "\t-L <step0> <step1> <prefix>\tStore a linear interpolation between two configurations <step0> and <step1> into single config files with prefix <prefix> and as Trajectories into the current config file." << endl); 1546 DoLog(0) && (Log() << Verbose(0) << "\t-m <0/1>\tCalculate (0)/ Align in(1) PAS with greatest EV along z axis." << endl); 1547 DoLog(0) && (Log() << Verbose(0) << "\t-M <basis>\tSetting basis to store to MPQC config files." << endl); 1548 DoLog(0) && (Log() << Verbose(0) << "\t-n\tFast parsing (i.e. no trajectories are looked for)." << endl); 1549 DoLog(0) && (Log() << Verbose(0) << "\t-N <radius> <file>\tGet non-convex-envelope." << endl); 1550 DoLog(0) && (Log() << Verbose(0) << "\t-o <out>\tGet volume of the convex envelope (and store to tecplot file)." << endl); 1551 DoLog(0) && (Log() << Verbose(0) << "\t-O\tCenter atoms in origin." << endl); 1552 DoLog(0) && (Log() << Verbose(0) << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl); 1553 DoLog(0) && (Log() << Verbose(0) << "\t-P <file>\tParse given forces file and append as an MD step to config file via Verlet." << endl); 1554 DoLog(0) && (Log() << Verbose(0) << "\t-r <id>\t\tRemove an atom with given id." << endl); 1555 DoLog(0) && (Log() << Verbose(0) << "\t-R <id> <radius>\t\tRemove all atoms out of sphere around a given one." << endl); 1556 DoLog(0) && (Log() << Verbose(0) << "\t-s x1 x2 x3\tScale all atom coordinates by this vector (x1,x2,x3)." << endl); 1557 DoLog(0) && (Log() << Verbose(0) << "\t-S <file> Store temperatures from the config file in <file>." << endl); 1558 DoLog(0) && (Log() << Verbose(0) << "\t-t x1 x2 x3\tTranslate all atoms by this vector (x1,x2,x3)." << endl); 1559 DoLog(0) && (Log() << Verbose(0) << "\t-T x1 x2 x3\tTranslate periodically all atoms by this vector (x1,x2,x3)." << endl); 1560 DoLog(0) && (Log() << Verbose(0) << "\t-u rho\tsuspend in water solution and output necessary cell lengths, average density rho and repetition." << endl); 1561 DoLog(0) && (Log() << Verbose(0) << "\t-v\t\tsets verbosity (more is more)." << endl); 1562 DoLog(0) && (Log() << Verbose(0) << "\t-V\t\tGives version information." << endl); 1563 DoLog(0) && (Log() << Verbose(0) << "\t-X\t\tset default name of a molecule." << endl); 1564 DoLog(0) && (Log() << Verbose(0) << "Note: config files must not begin with '-' !" << endl); 1565 return (1); 1529 1566 break; 1530 1567 case 'v': 1531 ArgcList.push_back(argptr-1); 1532 return(1); 1568 while (argv[argptr-1][verbosity+1] == 'v') { 1569 verbosity++; 1570 } 1571 setVerbosity(verbosity); 1572 DoLog(0) && (Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl); 1533 1573 break; 1534 1574 case 'V': 1535 ArgcList.push_back(argptr-1);1536 ArgcList.push_back(argptr);1537 argptr++;1575 DoLog(0) && (Log() << Verbose(0) << argv[0] << " " << VERSIONSTRING << endl); 1576 DoLog(0) && (Log() << Verbose(0) << "Build your own molecule position set." << endl); 1577 return (1); 1538 1578 break; 1539 1579 case 'B': … … 2475 2515 2476 2516 void cleanUp(){ 2517 UIFactory::purgeInstance(); 2477 2518 World::purgeInstance(); 2478 2519 Log() << Verbose(0) << "Maximum of allocated memory: " … … 2483 2524 logger::purgeInstance(); 2484 2525 errorLogger::purgeInstance(); 2485 UIFactory::purgeInstance();2486 MapOfActions::purgeInstance();2487 2526 CommandLineParser::purgeInstance(); 2488 2527 ActionRegistry::purgeInstance(); … … 2497 2536 ofstream output; 2498 2537 string line; 2499 char **Arguments = NULL;2500 int ArgcSize = 0;2501 bool ArgumentsCopied = false;2502 2538 2503 2539 cout << ESPACKVersion << endl; … … 2507 2543 ActionHistory::init(); 2508 2544 2509 // Parse command line options and if present create respective UI2510 2545 { 2511 list<int> ArgcList; 2512 ArgcList.push_back(0); // push back program! 2513 ArgcList.push_back(1); // push back config file name 2514 char ConfigFileName[MAXSTRINGSIZE]; 2515 // handle arguments by ParseCommandLineOptions() 2516 ParseCommandLineOptions(argc,argv,World::getInstance().getMolecules(),World::getInstance().getPeriode(),*World::getInstance().getConfig(), (char *&)ConfigFileName, ArgcList); 2517 // copy all remaining arguments to a new argv 2518 Arguments = Malloc<char *>(ArgcList.size(), "main - **Arguments"); 2519 cout << "The following arguments are handled by CommandLineParser: "; 2520 for (list<int>::iterator ArgcRunner = ArgcList.begin(); ArgcRunner != ArgcList.end(); ++ArgcRunner) { 2521 Arguments[ArgcSize] = Malloc<char>(strlen(argv[*ArgcRunner])+2, "main - *Arguments[]"); 2522 strcpy(Arguments[ArgcSize], argv[*ArgcRunner]); 2523 cout << " " << argv[*ArgcRunner]; 2524 ArgcSize++; 2525 } 2526 cout << endl; 2527 ArgumentsCopied = true; 2528 // handle remaining arguments by CommandLineParser 2529 MapOfActions::getInstance().AddOptionsToParser(); 2530 CommandLineParser::getInstance().Run(ArgcSize,Arguments); 2531 if (!CommandLineParser::getInstance().isEmpty()) { 2532 DoLog(0) && (Log() << Verbose(0) << "Setting UI to CommandLine." << endl); 2546 // Parse command line options and if present create respective UI 2547 CommandLineParser::getInstance().generic.add_options() 2548 ("help,h", "produce help message") 2549 ("version,v", "show version") 2550 ("parse-xyz,p", po::value< vector<string> >(), "parse xyz file into World") 2551 ; 2552 CommandLineParser::getInstance().Run(argc,argv); 2553 if (!CommandLineParser::getInstance().isEmpty()) 2533 2554 UIFactory::makeUserInterface(UIFactory::CommandLine); 2534 } else { 2535 DoLog(0) && (Log() << Verbose(0) << "Setting UI to Text." << endl); 2555 else 2536 2556 UIFactory::makeUserInterface(UIFactory::Text); 2537 }2538 2557 } 2539 2558 … … 2550 2569 Log() << Verbose(0) << "Saving of elements.db failed." << endl; 2551 2570 2552 // free the new argv2553 if (ArgumentsCopied) {2554 for (int i=0; i<ArgcSize;i++)2555 Free(&Arguments[i]);2556 Free(&Arguments);2557 }2558 2559 2571 cleanUp(); 2572 2560 2573 Memory::getState(); 2561 2574 return (0);
Note:
See TracChangeset
for help on using the changeset viewer.