Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/builder.cpp

    r486aa5 ra68d44  
    9595  switch (choice) {
    9696    default:
    97       Log() << Verbose(0) << "Not a valid choice." << endl;
     97      eLog() << Verbose(2) << "Not a valid choice." << endl;
    9898      break;
    9999      case 'a': // absolute coordinates of atom
     
    109109        valid = true;
    110110        do {
    111           if (!valid) Log() << Verbose(0) << "Resulting position out of cell." << endl;
     111          if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;
    112112          Log() << Verbose(0) << "Enter reference coordinates." << endl;
    113113          x.AskPosition(mol->cell_size, true);
     
    125125        valid = true;
    126126        do {
    127           if (!valid) Log() << Verbose(0) << "Resulting position out of cell." << endl;
     127          if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;
    128128          second = mol->AskAtom("Enter atom number: ");
    129129          Log() << Verbose(0) << "Enter relative coordinates." << endl;
     
    142142        do {
    143143          if (!valid) {
    144             Log() << Verbose(0) << "Resulting coordinates out of cell - ";
    145             first->x.Output();
    146             Log() << Verbose(0) << endl;
     144            eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl;
    147145          }
    148146          Log() << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl;
     
    671669  Log() << Verbose(0) << "===============================================" << endl;
    672670  if (molecules->NumberOfActiveMolecules() > 1)
    673     Log() << Verbose(0) << "WARNING: There is more than one molecule active! Atoms will be added to each." << endl;
     671    eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;
    674672  Log() << Verbose(0) << "INPUT: ";
    675673  cin >> choice;
     
    794792  Log() << Verbose(0) << "===============================================" << endl;
    795793  if (molecules->NumberOfActiveMolecules() > 1)
    796     Log() << Verbose(0) << "WARNING: There is more than one molecule active! Atoms will be added to each." << endl;
     794    eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;
    797795  Log() << Verbose(0) << "INPUT: ";
    798796  cin >> choice;
     
    827825          }
    828826          if (count != j)
    829             Log() << Verbose(0) << "ERROR: AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;
     827            eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;
    830828          x.Zero();
    831829          y.Zero();
     
    11721170  else {
    11731171    eLog() << Verbose(0) << "I don't have anything to test on ... ";
     1172    performCriticalExit();
    11741173    return;
    11751174  }
     
    12481247  ofstream output;
    12491248  molecule *mol = new molecule(periode);
     1249  mol->SetNameFromFilename(ConfigFileName);
    12501250
    12511251  if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) {
    1252     eLog() << Verbose(0) << "WARNING: config is found under different path then stated in config file::defaultpath!" << endl;
     1252    eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl;
    12531253  }
    12541254
     
    13541354
    13551355  if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) {
    1356     eLog() << Verbose(0) << "WARNING: config is found under different path then stated in config file::defaultpath!" << endl;
     1356    eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl;
    13571357  }
    13581358
     
    13861386  int argptr;
    13871387  molecule *mol = NULL;
    1388   string BondGraphFileName("");
     1388  string BondGraphFileName("\n");
     1389  int verbosity = 0;
    13891390  strncpy(configuration.databasepath, LocalPath, MAXSTRINGSIZE-1);
    13901391
     
    14321433            Log() << Verbose(0) << "\t-T x1 x2 x3\tTranslate periodically all atoms by this vector (x1,x2,x3)." << endl;
    14331434            Log() << Verbose(0) << "\t-u rho\tsuspend in water solution and output necessary cell lengths, average density rho and repetition." << endl;
    1434             Log() << Verbose(0) << "\t-v/-V\t\tGives version information." << endl;
     1435            Log() << Verbose(0) << "\t-v\t\tsets verbosity (more is more)." << endl;
     1436            Log() << Verbose(0) << "\t-V\t\tGives version information." << endl;
    14351437            Log() << Verbose(0) << "Note: config files must not begin with '-' !" << endl;
    14361438            return (1);
    14371439            break;
    14381440          case 'v':
     1441            while (argv[argptr-1][verbosity+1] == 'v') {
     1442              verbosity++;
     1443            }
     1444            setVerbosity(verbosity);
     1445            Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl;
     1446            break;
    14391447          case 'V':
    14401448            Log() << Verbose(0) << argv[0] << " " << VERSIONSTRING << endl;
     
    14451453            if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    14461454              eLog() << Verbose(0) << "Not enough or invalid arguments for specifying element db: -e <db file>" << endl;
     1455              performCriticalExit();
    14471456            } else {
    14481457              Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl;
     
    14541463            if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    14551464              eLog() << Verbose(0) << "Not enough or invalid arguments for specifying bond length table: -g <table file>" << endl;
     1465              performCriticalExit();
    14561466            } else {
    14571467              BondGraphFileName = argv[argptr];
     
    15301540       mol = new molecule(periode);
    15311541       mol->ActiveFlag = true;
     1542       if (ConfigFileName != NULL)
     1543         mol->SetNameFromFilename(ConfigFileName);
    15321544       molecules->insert(mol);
     1545     }
     1546     if (configuration.BG == NULL) {
     1547       configuration.BG = new BondGraph(configuration.GetIsAngstroem());
     1548       if ((BondGraphFileName.empty()) && (configuration.BG->LoadBondLengthTable(BondGraphFileName))) {
     1549         Log() << Verbose(0) << "Bond length table loaded successfully." << endl;
     1550       } else {
     1551         eLog() << Verbose(1) << "Bond length table loading failed." << endl;
     1552       }
    15331553     }
    15341554
     
    15461566                ExitFlag = 255;
    15471567                eLog() << Verbose(0) << "Not enough arguments for parsing: -p <xyz file>" << endl;
     1568                performCriticalExit();
    15481569              } else {
    15491570                SaveFlag = true;
     
    15531574                else {
    15541575                  Log() << Verbose(2) << "File found and parsed." << endl;
     1576                  // @TODO rather do the dissection afterwards
     1577//                  mol->SetNameFromFilename(argv[argptr]);
     1578//                  molecules->ListOfMolecules.remove(mol);
     1579//                  molecules->DissectMoleculeIntoConnectedSubgraphs(mol,&configuration);
     1580//                  delete(mol);
     1581//                  if (molecules->ListOfMolecules.size() != 0) {
     1582//                    for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     1583//                      if ((*ListRunner)->ActiveFlag) {
     1584//                        mol = *ListRunner;
     1585//                        break;
     1586//                      }
     1587//                  }
    15551588                  configPresent = present;
    15561589                }
     
    15621595                ExitFlag = 255;
    15631596                eLog() << Verbose(0) << "Not enough or invalid arguments for adding atom: -a <element> <x> <y> <z>" << endl;
     1597                performCriticalExit();
    15641598              } else {
    15651599                SaveFlag = true;
     
    15901624                ExitFlag = 255;
    15911625                eLog() << Verbose(0) << "Not enough or invalid arguments given for setting MPQC basis: -B <basis name>" << endl;
     1626                performCriticalExit();
    15921627              } else {
    15931628                configuration.basis = argv[argptr];
     
    16341669                ExitFlag = 255;
    16351670                eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C <Z> <output> <bin output>" << endl;
     1671                performCriticalExit();
    16361672              } else {
    16371673                SaveFlag = false;
     
    16801716                ExitFlag = 255;
    16811717                eLog() << Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> <element>" << endl;
     1718                performCriticalExit();
    16821719              } else {
    16831720                SaveFlag = true;
     
    16931730                ExitFlag = 255;
    16941731                eLog() << Verbose(0) << "Not enough or invalid arguments given for filling box with water: -F <dist_x> <dist_y> <dist_z> <randatom> <randmol> <DoRotate>" << endl;
     1732                performCriticalExit();
    16951733              } else {
    16961734                SaveFlag = true;
     
    17311769                ExitFlag =255;
    17321770                eLog() << Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl;
     1771                performCriticalExit();
    17331772              } else {
    17341773                Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl;
     
    17441783                ExitFlag = 255;
    17451784                eLog() << Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl;
     1785                performCriticalExit();
    17461786              } else {
    17471787                class Tesselation *T = NULL;
    17481788                const LinkedCell *LCList = NULL;
    1749                 string filename(argv[argptr+1]);
    1750                 filename.append(".csv");
    1751                 Log() << Verbose(0) << "Evaluating non-convex envelope.";
     1789                molecule * Boundary = NULL;
     1790                //string filename(argv[argptr+1]);
     1791                //filename.append(".csv");
     1792                Log() << Verbose(0) << "Evaluating non-convex envelope of biggest molecule.";
    17521793                Log() << Verbose(1) << "Using rolling ball of radius " << atof(argv[argptr]) << " and storing tecplot data in " << argv[argptr+1] << "." << endl;
     1794                // find biggest molecule
     1795                int counter  = 0;
     1796                for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
     1797                  (*BigFinder)->CountAtoms();
     1798                  if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) {
     1799                    Boundary = *BigFinder;
     1800                  }
     1801                  counter++;
     1802                }
     1803                Log() << Verbose(1) << "Biggest molecule has " << Boundary->AtomCount << " atoms." << endl;
    17531804                start = clock();
    1754                 LCList = new LinkedCell(mol, atof(argv[argptr])*2.);
    1755                 FindNonConvexBorder(mol, T, LCList, atof(argv[argptr]), argv[argptr+1]);
     1805                LCList = new LinkedCell(Boundary, atof(argv[argptr])*2.);
     1806                if (!FindNonConvexBorder(Boundary, T, LCList, atof(argv[argptr]), argv[argptr+1]))
     1807                  ExitFlag = 255;
    17561808                //FindDistributionOfEllipsoids(T, &LCList, N, number, filename.c_str());
    17571809                end = clock();
    17581810                Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
    17591811                delete(LCList);
     1812                delete(T);
    17601813                argptr+=2;
    17611814              }
     
    17661819                ExitFlag = 255;
    17671820                eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -S <temperature file>" << endl;
     1821                performCriticalExit();
    17681822              } else {
    17691823                Log() << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl;
     
    17831837                ExitFlag = 255;
    17841838                eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -L <step0> <step1> <prefix> <identity mapping?>" << endl;
     1839                performCriticalExit();
    17851840              } else {
    17861841                SaveFlag = true;
     
    18001855                ExitFlag = 255;
    18011856                eLog() << Verbose(0) << "Not enough or invalid arguments given for parsing and integrating forces: -P <forces file>" << endl;
     1857                performCriticalExit();
    18021858              } else {
    18031859                SaveFlag = true;
     
    18151871                ExitFlag = 255;
    18161872                eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <id> <distance>" << endl;
     1873                performCriticalExit();
    18171874              } else {
    18181875                SaveFlag = true;
     
    18301887                  }
    18311888                } else {
    1832                   eLog() << Verbose(0) << "Removal failed due to missing atoms on molecule or wrong id." << endl;
     1889                  eLog() << Verbose(1) << "Removal failed due to missing atoms on molecule or wrong id." << endl;
    18331890                }
    18341891                argptr+=2;
     
    18401897                ExitFlag = 255;
    18411898                eLog() << Verbose(0) << "Not enough or invalid arguments given for translation: -t <x> <y> <z>" << endl;
     1899                performCriticalExit();
    18421900              } else {
    18431901                if (ExitFlag == 0) ExitFlag = 1;
     
    18551913                ExitFlag = 255;
    18561914                eLog() << Verbose(0) << "Not enough or invalid arguments given for periodic translation: -T <x> <y> <z>" << endl;
     1915                performCriticalExit();
    18571916              } else {
    18581917                if (ExitFlag == 0) ExitFlag = 1;
     
    18701929                ExitFlag = 255;
    18711930                eLog() << Verbose(0) << "Not enough or invalid arguments given for scaling: -s <factor_x> [factor_y] [factor_z]" << endl;
     1931                performCriticalExit();
    18721932              } else {
    18731933                SaveFlag = true;
     
    18931953                ExitFlag = 255;
    18941954                eLog() << Verbose(0) << "Not enough or invalid arguments given for centering in box: -b <xx> <xy> <xz> <yy> <yz> <zz>" << endl;
     1955                performCriticalExit();
    18951956              } else {
    18961957                SaveFlag = true;
     
    19101971                ExitFlag = 255;
    19111972                eLog() << Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl;
     1973                performCriticalExit();
    19121974              } else {
    19131975                SaveFlag = true;
     
    19271989                ExitFlag = 255;
    19281990                eLog() << Verbose(0) << "Not enough or invalid arguments given for centering with boundary: -c <boundary_x> <boundary_y> <boundary_z>" << endl;
     1991                performCriticalExit();
    19291992              } else {
    19301993                SaveFlag = true;
     
    19602023                ExitFlag = 255;
    19612024                eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -r <id>" << endl;
     2025                performCriticalExit();
    19622026              } else {
    19632027                SaveFlag = true;
     
    19732037                ExitFlag = 255;
    19742038                eLog() << Verbose(0) << "Not enough or invalid arguments for fragmentation: -f <max. bond distance> <bond order>" << endl;
     2039                performCriticalExit();
    19752040              } else {
    19762041                Log() << Verbose(0) << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl;
     
    19912056              j = atoi(argv[argptr++]);
    19922057              if ((j<0) || (j>1)) {
    1993                 eLog() << Verbose(1) << "ERROR: Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl;
     2058                eLog() << Verbose(1) << "Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl;
    19942059                j = 0;
    19952060              }
     
    20062071                ExitFlag = 255;
    20072072                eLog() << Verbose(0) << "Not enough or invalid arguments given for convex envelope: -o <convex output file> <non-convex output file>" << endl;
     2073                performCriticalExit();
    20082074              } else {
    20092075                class Tesselation *TesselStruct = NULL;
     
    20302096                ExitFlag = 255;
    20312097                eLog() << Verbose(0) << "Not enough or invalid arguments given for suspension with specified volume: -U <volume> <density>" << endl;
    2032                 volume = -1; // for case 'u': don't print error again
     2098                performCriticalExit();
    20332099              } else {
    20342100                volume = atof(argv[argptr++]);
     
    20412107                  ExitFlag = 255;
    20422108                  eLog() << Verbose(0) << "Not enough arguments given for suspension: -u <density>" << endl;
     2109                  performCriticalExit();
    20432110              } else {
    20442111                double density;
     
    20472114                density = atof(argv[argptr++]);
    20482115                if (density < 1.0) {
    2049                   eLog() << Verbose(0) << "Density must be greater than 1.0g/cm^3 !" << endl;
     2116                  eLog() << Verbose(1) << "Density must be greater than 1.0g/cm^3 !" << endl;
    20502117                  density = 1.3;
    20512118                }
     
    20532120//                  repetition[i] = atoi(argv[argptr++]);
    20542121//                  if (repetition[i] < 1)
    2055 //                    eLog() << Verbose(0) << "ERROR: repetition value must be greater 1!" << endl;
     2122//                    eLog() << Verbose(1) << "repetition value must be greater 1!" << endl;
    20562123//                  repetition[i] = 1;
    20572124//                }
     
    20642131                ExitFlag = 255;
    20652132                eLog() << Verbose(0) << "Not enough or invalid arguments given for repeating cells: -d <repeat_x> <repeat_y> <repeat_z>" << endl;
     2133                performCriticalExit();
    20662134              } else {
    20672135                SaveFlag = true;
     
    20722140                  Vector ** vectors;
    20732141                  if (faktor < 1) {
    2074                     eLog() << Verbose(0) << "ERROR: Repetition faktor mus be greater than 1!" << endl;
     2142                    eLog() << Verbose(1) << "Repetition factor mus be greater than 1!" << endl;
    20752143                    faktor = 1;
    20762144                  }
     
    20892157                    }
    20902158                    if (count != j)
    2091                       Log() << Verbose(0) << "ERROR: AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;
     2159                      eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;
    20922160                    x.Zero();
    20932161                    y.Zero();
     
    21542222  int j;
    21552223
    2156   setVerbosity(2);
     2224  setVerbosity(0);
    21572225
    21582226  // =========================== PARSE COMMAND LINE OPTIONS ====================================
Note: See TracChangeset for help on using the changeset viewer.