Changes in molecuilder/src/builder.cpp [486aa5:a68d44]
- File:
-
- 1 edited
-
molecuilder/src/builder.cpp (modified) (47 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/builder.cpp
r486aa5 ra68d44 95 95 switch (choice) { 96 96 default: 97 Log() << Verbose(0) << "Not a valid choice." << endl;97 eLog() << Verbose(2) << "Not a valid choice." << endl; 98 98 break; 99 99 case 'a': // absolute coordinates of atom … … 109 109 valid = true; 110 110 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; 112 112 Log() << Verbose(0) << "Enter reference coordinates." << endl; 113 113 x.AskPosition(mol->cell_size, true); … … 125 125 valid = true; 126 126 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; 128 128 second = mol->AskAtom("Enter atom number: "); 129 129 Log() << Verbose(0) << "Enter relative coordinates." << endl; … … 142 142 do { 143 143 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; 147 145 } 148 146 Log() << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl; … … 671 669 Log() << Verbose(0) << "===============================================" << endl; 672 670 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; 674 672 Log() << Verbose(0) << "INPUT: "; 675 673 cin >> choice; … … 794 792 Log() << Verbose(0) << "===============================================" << endl; 795 793 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; 797 795 Log() << Verbose(0) << "INPUT: "; 798 796 cin >> choice; … … 827 825 } 828 826 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; 830 828 x.Zero(); 831 829 y.Zero(); … … 1172 1170 else { 1173 1171 eLog() << Verbose(0) << "I don't have anything to test on ... "; 1172 performCriticalExit(); 1174 1173 return; 1175 1174 } … … 1248 1247 ofstream output; 1249 1248 molecule *mol = new molecule(periode); 1249 mol->SetNameFromFilename(ConfigFileName); 1250 1250 1251 1251 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; 1253 1253 } 1254 1254 … … 1354 1354 1355 1355 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; 1357 1357 } 1358 1358 … … 1386 1386 int argptr; 1387 1387 molecule *mol = NULL; 1388 string BondGraphFileName(""); 1388 string BondGraphFileName("\n"); 1389 int verbosity = 0; 1389 1390 strncpy(configuration.databasepath, LocalPath, MAXSTRINGSIZE-1); 1390 1391 … … 1432 1433 Log() << Verbose(0) << "\t-T x1 x2 x3\tTranslate periodically all atoms by this vector (x1,x2,x3)." << endl; 1433 1434 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; 1435 1437 Log() << Verbose(0) << "Note: config files must not begin with '-' !" << endl; 1436 1438 return (1); 1437 1439 break; 1438 1440 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; 1439 1447 case 'V': 1440 1448 Log() << Verbose(0) << argv[0] << " " << VERSIONSTRING << endl; … … 1445 1453 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1446 1454 eLog() << Verbose(0) << "Not enough or invalid arguments for specifying element db: -e <db file>" << endl; 1455 performCriticalExit(); 1447 1456 } else { 1448 1457 Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl; … … 1454 1463 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1455 1464 eLog() << Verbose(0) << "Not enough or invalid arguments for specifying bond length table: -g <table file>" << endl; 1465 performCriticalExit(); 1456 1466 } else { 1457 1467 BondGraphFileName = argv[argptr]; … … 1530 1540 mol = new molecule(periode); 1531 1541 mol->ActiveFlag = true; 1542 if (ConfigFileName != NULL) 1543 mol->SetNameFromFilename(ConfigFileName); 1532 1544 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 } 1533 1553 } 1534 1554 … … 1546 1566 ExitFlag = 255; 1547 1567 eLog() << Verbose(0) << "Not enough arguments for parsing: -p <xyz file>" << endl; 1568 performCriticalExit(); 1548 1569 } else { 1549 1570 SaveFlag = true; … … 1553 1574 else { 1554 1575 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 // } 1555 1588 configPresent = present; 1556 1589 } … … 1562 1595 ExitFlag = 255; 1563 1596 eLog() << Verbose(0) << "Not enough or invalid arguments for adding atom: -a <element> <x> <y> <z>" << endl; 1597 performCriticalExit(); 1564 1598 } else { 1565 1599 SaveFlag = true; … … 1590 1624 ExitFlag = 255; 1591 1625 eLog() << Verbose(0) << "Not enough or invalid arguments given for setting MPQC basis: -B <basis name>" << endl; 1626 performCriticalExit(); 1592 1627 } else { 1593 1628 configuration.basis = argv[argptr]; … … 1634 1669 ExitFlag = 255; 1635 1670 eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C <Z> <output> <bin output>" << endl; 1671 performCriticalExit(); 1636 1672 } else { 1637 1673 SaveFlag = false; … … 1680 1716 ExitFlag = 255; 1681 1717 eLog() << Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> <element>" << endl; 1718 performCriticalExit(); 1682 1719 } else { 1683 1720 SaveFlag = true; … … 1693 1730 ExitFlag = 255; 1694 1731 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(); 1695 1733 } else { 1696 1734 SaveFlag = true; … … 1731 1769 ExitFlag =255; 1732 1770 eLog() << Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl; 1771 performCriticalExit(); 1733 1772 } else { 1734 1773 Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl; … … 1744 1783 ExitFlag = 255; 1745 1784 eLog() << Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl; 1785 performCriticalExit(); 1746 1786 } else { 1747 1787 class Tesselation *T = NULL; 1748 1788 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."; 1752 1793 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; 1753 1804 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; 1756 1808 //FindDistributionOfEllipsoids(T, &LCList, N, number, filename.c_str()); 1757 1809 end = clock(); 1758 1810 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl; 1759 1811 delete(LCList); 1812 delete(T); 1760 1813 argptr+=2; 1761 1814 } … … 1766 1819 ExitFlag = 255; 1767 1820 eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -S <temperature file>" << endl; 1821 performCriticalExit(); 1768 1822 } else { 1769 1823 Log() << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl; … … 1783 1837 ExitFlag = 255; 1784 1838 eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -L <step0> <step1> <prefix> <identity mapping?>" << endl; 1839 performCriticalExit(); 1785 1840 } else { 1786 1841 SaveFlag = true; … … 1800 1855 ExitFlag = 255; 1801 1856 eLog() << Verbose(0) << "Not enough or invalid arguments given for parsing and integrating forces: -P <forces file>" << endl; 1857 performCriticalExit(); 1802 1858 } else { 1803 1859 SaveFlag = true; … … 1815 1871 ExitFlag = 255; 1816 1872 eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <id> <distance>" << endl; 1873 performCriticalExit(); 1817 1874 } else { 1818 1875 SaveFlag = true; … … 1830 1887 } 1831 1888 } 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; 1833 1890 } 1834 1891 argptr+=2; … … 1840 1897 ExitFlag = 255; 1841 1898 eLog() << Verbose(0) << "Not enough or invalid arguments given for translation: -t <x> <y> <z>" << endl; 1899 performCriticalExit(); 1842 1900 } else { 1843 1901 if (ExitFlag == 0) ExitFlag = 1; … … 1855 1913 ExitFlag = 255; 1856 1914 eLog() << Verbose(0) << "Not enough or invalid arguments given for periodic translation: -T <x> <y> <z>" << endl; 1915 performCriticalExit(); 1857 1916 } else { 1858 1917 if (ExitFlag == 0) ExitFlag = 1; … … 1870 1929 ExitFlag = 255; 1871 1930 eLog() << Verbose(0) << "Not enough or invalid arguments given for scaling: -s <factor_x> [factor_y] [factor_z]" << endl; 1931 performCriticalExit(); 1872 1932 } else { 1873 1933 SaveFlag = true; … … 1893 1953 ExitFlag = 255; 1894 1954 eLog() << Verbose(0) << "Not enough or invalid arguments given for centering in box: -b <xx> <xy> <xz> <yy> <yz> <zz>" << endl; 1955 performCriticalExit(); 1895 1956 } else { 1896 1957 SaveFlag = true; … … 1910 1971 ExitFlag = 255; 1911 1972 eLog() << Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl; 1973 performCriticalExit(); 1912 1974 } else { 1913 1975 SaveFlag = true; … … 1927 1989 ExitFlag = 255; 1928 1990 eLog() << Verbose(0) << "Not enough or invalid arguments given for centering with boundary: -c <boundary_x> <boundary_y> <boundary_z>" << endl; 1991 performCriticalExit(); 1929 1992 } else { 1930 1993 SaveFlag = true; … … 1960 2023 ExitFlag = 255; 1961 2024 eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -r <id>" << endl; 2025 performCriticalExit(); 1962 2026 } else { 1963 2027 SaveFlag = true; … … 1973 2037 ExitFlag = 255; 1974 2038 eLog() << Verbose(0) << "Not enough or invalid arguments for fragmentation: -f <max. bond distance> <bond order>" << endl; 2039 performCriticalExit(); 1975 2040 } else { 1976 2041 Log() << Verbose(0) << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl; … … 1991 2056 j = atoi(argv[argptr++]); 1992 2057 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; 1994 2059 j = 0; 1995 2060 } … … 2006 2071 ExitFlag = 255; 2007 2072 eLog() << Verbose(0) << "Not enough or invalid arguments given for convex envelope: -o <convex output file> <non-convex output file>" << endl; 2073 performCriticalExit(); 2008 2074 } else { 2009 2075 class Tesselation *TesselStruct = NULL; … … 2030 2096 ExitFlag = 255; 2031 2097 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 again2098 performCriticalExit(); 2033 2099 } else { 2034 2100 volume = atof(argv[argptr++]); … … 2041 2107 ExitFlag = 255; 2042 2108 eLog() << Verbose(0) << "Not enough arguments given for suspension: -u <density>" << endl; 2109 performCriticalExit(); 2043 2110 } else { 2044 2111 double density; … … 2047 2114 density = atof(argv[argptr++]); 2048 2115 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; 2050 2117 density = 1.3; 2051 2118 } … … 2053 2120 // repetition[i] = atoi(argv[argptr++]); 2054 2121 // 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; 2056 2123 // repetition[i] = 1; 2057 2124 // } … … 2064 2131 ExitFlag = 255; 2065 2132 eLog() << Verbose(0) << "Not enough or invalid arguments given for repeating cells: -d <repeat_x> <repeat_y> <repeat_z>" << endl; 2133 performCriticalExit(); 2066 2134 } else { 2067 2135 SaveFlag = true; … … 2072 2140 Vector ** vectors; 2073 2141 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; 2075 2143 faktor = 1; 2076 2144 } … … 2089 2157 } 2090 2158 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; 2092 2160 x.Zero(); 2093 2161 y.Zero(); … … 2154 2222 int j; 2155 2223 2156 setVerbosity( 2);2224 setVerbosity(0); 2157 2225 2158 2226 // =========================== PARSE COMMAND LINE OPTIONS ====================================
Note:
See TracChangeset
for help on using the changeset viewer.
