Changes in / [1cf5df:1ca488]
- Files:
-
- 52 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile.am
r1cf5df r1ca488 3 3 4 4 EXTRA_DIST = autogen.sh 5 6 .PHONY: doc 7 doc: 8 cd doc && make doxygen-docs -
doc/Doxyfile
r1cf5df r1ca488 125 125 # configuration options related to source browsing 126 126 #--------------------------------------------------------------------------- 127 SOURCE_BROWSER = NO127 SOURCE_BROWSER = YES 128 128 INLINE_SOURCES = NO 129 129 STRIP_CODE_COMMENTS = YES -
src/Makefile.am
r1cf5df r1ca488 5 5 ANALYSISHEADER = analysis_bonds.hpp analysis_correlation.hpp 6 6 7 SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp 8 HEADER = ${ANALYSISHEADER} ${ATOMHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp info.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp 7 ACTIONSSOURCE = Actions/Action.cpp Actions/MethodAction.cpp Actions/ActionSequence.cpp Actions/MakroAction.cpp Actions/ErrorAction.cpp Actions/ActionRegistry.cpp 8 ACTIONSHEADER = Actions/Action.hpp Actions/MethodAction.hpp Actions/ActionSequence.hpp Actions/MakroAction.hpp Actions/ErrorAction.hpp Actions/ActionRegistry.hpp 9 10 VIEWSOURCE = Views/View.cpp Views/StringView.cpp Views/MethodStringView.cpp Views/StreamStringView.cpp 11 VIEWHEADER = Views/View.hpp Views/StringView.hpp Views/MethodStringView.hpp Views/StreamStringView.hpp 12 13 MENUSOURCE = Menu/Menu.cpp Menu/TextMenu.cpp Menu/MenuItem.cpp Menu/SubMenuItem.cpp Menu/ActionMenuItem.cpp Menu/SeperatorItem.cpp Menu/DisplayMenuItem.cpp 14 MENUHEADER = Menu/Menu.hpp Menu/TextMenu.hpp Menu/MenuItem.hpp Menu/SubMenuItem.hpp Menu/ActionMenuItem.hpp Menu/SeperatorItem.hpp Menu/DisplayMenuItem.hpp 15 16 UISOURCE = ${ACTIONSSOURCE} ${VIEWSOURCE} ${MENUSOURCE} UIElements/UIFactory.cpp UIElements/TextUIFactory.cpp UIElements/MainWindow.cpp UIElements/TextWindow.cpp UIElements/Dialog.cpp UIElements/TextDialog.cpp 17 UIHEADER = ${ACTIONSHEADER} ${VIEWHEADER} ${MENUHEADER} UIElements/UIFactory.hpp UIElements/TextUIFactory.hpp UIElements/MainWindow.hpp UIElements/TextWindow.hpp UIElements/Dialog.hpp UIElements/TextDialog.hpp 18 19 SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} ${UISOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp menu.cpp 20 HEADER = ${ANALYSISHEADER} ${ATOMHEADER} ${UIHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp info.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp menu.hpp 9 21 10 22 BOOST_LIB = $(BOOST_LDFLAGS) $(BOOST_MPL_LIB) -
src/builder.cpp
r1cf5df r1ca488 48 48 49 49 50 #include <boost/bind.hpp> 51 50 52 using namespace std; 51 53 … … 65 67 #include "molecule.hpp" 66 68 #include "periodentafel.hpp" 69 #include "UIElements/UIFactory.hpp" 70 #include "UIElements/MainWindow.hpp" 71 #include "UIElements/Dialog.hpp" 72 #include "Menu/ActionMenuItem.hpp" 73 #include "Actions/ActionRegistry.hpp" 74 #include "Actions/MethodAction.hpp" 67 75 #include "version.h" 68 76 69 77 /********************************************* Subsubmenu routine ************************************/ 70 78 #if 0 71 79 /** Submenu for adding atoms to the molecule. 72 80 * \param *periode periodentafel … … 1153 1161 }; 1154 1162 1155 1156 1163 /********************************************** Test routine **************************************/ 1157 1164 … … 1237 1244 }; 1238 1245 1239 /** Tries given filename or standard on saving the config file. 1240 * \param *ConfigFileName name of file 1241 * \param *configuration pointer to configuration structure with all the values 1242 * \param *periode pointer to periodentafel structure with all the elements 1243 * \param *molecules list of molecules structure with all the atoms and coordinates 1244 */ 1245 static void SaveConfig(char *ConfigFileName, config *configuration, periodentafel *periode, MoleculeListClass *molecules) 1246 { 1247 char filename[MAXSTRINGSIZE]; 1248 ofstream output; 1249 molecule *mol = new molecule(periode); 1250 mol->SetNameFromFilename(ConfigFileName); 1251 1252 if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) { 1253 eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl; 1254 } 1255 1256 1257 // first save as PDB data 1258 if (ConfigFileName != NULL) 1259 strcpy(filename, ConfigFileName); 1260 if (output == NULL) 1261 strcpy(filename,"main_pcp_linux"); 1262 Log() << Verbose(0) << "Saving as pdb input "; 1263 if (configuration->SavePDB(filename, molecules)) 1264 Log() << Verbose(0) << "done." << endl; 1265 else 1266 Log() << Verbose(0) << "failed." << endl; 1267 1268 // then save as tremolo data file 1269 if (ConfigFileName != NULL) 1270 strcpy(filename, ConfigFileName); 1271 if (output == NULL) 1272 strcpy(filename,"main_pcp_linux"); 1273 Log() << Verbose(0) << "Saving as tremolo data input "; 1274 if (configuration->SaveTREMOLO(filename, molecules)) 1275 Log() << Verbose(0) << "done." << endl; 1276 else 1277 Log() << Verbose(0) << "failed." << endl; 1278 1279 // translate each to its center and merge all molecules in MoleculeListClass into this molecule 1280 int N = molecules->ListOfMolecules.size(); 1281 int *src = new int[N]; 1282 N=0; 1283 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) { 1284 src[N++] = (*ListRunner)->IndexNr; 1285 (*ListRunner)->Translate(&(*ListRunner)->Center); 1286 } 1287 molecules->SimpleMultiAdd(mol, src, N); 1288 delete[](src); 1289 1290 // ... and translate back 1291 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) { 1292 (*ListRunner)->Center.Scale(-1.); 1293 (*ListRunner)->Translate(&(*ListRunner)->Center); 1294 (*ListRunner)->Center.Scale(-1.); 1295 } 1296 1297 Log() << Verbose(0) << "Storing configuration ... " << endl; 1298 // get correct valence orbitals 1299 mol->CalculateOrbitals(*configuration); 1300 configuration->InitMaxMinStopStep = configuration->MaxMinStopStep = configuration->MaxPsiDouble; 1301 if (ConfigFileName != NULL) { // test the file name 1302 strcpy(filename, ConfigFileName); 1303 output.open(filename, ios::trunc); 1304 } else if (strlen(configuration->configname) != 0) { 1305 strcpy(filename, configuration->configname); 1306 output.open(configuration->configname, ios::trunc); 1307 } else { 1308 strcpy(filename, DEFAULTCONFIG); 1309 output.open(DEFAULTCONFIG, ios::trunc); 1310 } 1311 output.close(); 1312 output.clear(); 1313 Log() << Verbose(0) << "Saving of config file "; 1314 if (configuration->Save(filename, periode, mol)) 1315 Log() << Verbose(0) << "successful." << endl; 1316 else 1317 Log() << Verbose(0) << "failed." << endl; 1318 1319 // and save to xyz file 1320 if (ConfigFileName != NULL) { 1321 strcpy(filename, ConfigFileName); 1322 strcat(filename, ".xyz"); 1323 output.open(filename, ios::trunc); 1324 } 1325 if (output == NULL) { 1326 strcpy(filename,"main_pcp_linux"); 1327 strcat(filename, ".xyz"); 1328 output.open(filename, ios::trunc); 1329 } 1330 Log() << Verbose(0) << "Saving of XYZ file "; 1331 if (mol->MDSteps <= 1) { 1332 if (mol->OutputXYZ(&output)) 1333 Log() << Verbose(0) << "successful." << endl; 1334 else 1335 Log() << Verbose(0) << "failed." << endl; 1336 } else { 1337 if (mol->OutputTrajectoriesXYZ(&output)) 1338 Log() << Verbose(0) << "successful." << endl; 1339 else 1340 Log() << Verbose(0) << "failed." << endl; 1341 } 1342 output.close(); 1343 output.clear(); 1344 1345 // and save as MPQC configuration 1346 if (ConfigFileName != NULL) 1347 strcpy(filename, ConfigFileName); 1348 if (output == NULL) 1349 strcpy(filename,"main_pcp_linux"); 1350 Log() << Verbose(0) << "Saving as mpqc input "; 1351 if (configuration->SaveMPQC(filename, mol)) 1352 Log() << Verbose(0) << "done." << endl; 1353 else 1354 Log() << Verbose(0) << "failed." << endl; 1355 1356 if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) { 1357 eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl; 1358 } 1359 1360 delete(mol); 1361 }; 1246 #endif 1362 1247 1363 1248 /** Parses the command line options. … … 1371 1256 * \return exit code (0 - successful, all else - something's wrong) 1372 1257 */ 1373 static int ParseCommandLineOptions(int argc, char **argv, MoleculeListClass *&molecules, periodentafel *&periode, config& configuration, char *&ConfigFileName) 1258 static int ParseCommandLineOptions(int argc, char **argv, MoleculeListClass *&molecules, periodentafel *&periode,\ 1259 config& configuration, char *&ConfigFileName) 1374 1260 { 1375 1261 Vector x,y,z,n; // coordinates for absolute point in cell volume … … 2196 2082 } while (argptr < argc); 2197 2083 if (SaveFlag) 2198 SaveConfig(ConfigFileName, &configuration, periode, molecules);2084 configuration.SaveAll(ConfigFileName, periode, molecules); 2199 2085 } else { // no arguments, hence scan the elements db 2200 2086 if (periode->LoadPeriodentafel(configuration.databasepath)) … … 2207 2093 }; 2208 2094 2095 /***************************************** Functions used to build all menus **********************/ 2096 2097 void populateEditMoleculesMenu(Menu* editMoleculesMenu,MoleculeListClass *molecules, config *configuration, periodentafel *periode){ 2098 // build the EditMoleculesMenu 2099 Action *createMoleculeAction = new MethodAction("createMoleculeAction",boost::bind(&MoleculeListClass::createNewMolecule,molecules,periode)); 2100 new ActionMenuItem('c',"create new molecule",editMoleculesMenu,createMoleculeAction); 2101 2102 Action *loadMoleculeAction = new MethodAction("loadMoleculeAction",boost::bind(&MoleculeListClass::loadFromXYZ,molecules,periode)); 2103 new ActionMenuItem('l',"load molecule from xyz file",editMoleculesMenu,loadMoleculeAction); 2104 2105 Action *changeFilenameAction = new MethodAction("changeFilenameAction",boost::bind(&MoleculeListClass::changeName,molecules)); 2106 new ActionMenuItem('n',"change molecule's name",editMoleculesMenu,changeFilenameAction); 2107 2108 Action *giveFilenameAction = new MethodAction("giveFilenameAction",boost::bind(&MoleculeListClass::setMoleculeFilename,molecules)); 2109 new ActionMenuItem('N',"give molecules filename",editMoleculesMenu,giveFilenameAction); 2110 2111 Action *parseAtomsAction = new MethodAction("parseAtomsAction",boost::bind(&MoleculeListClass::parseXYZIntoMolecule,molecules)); 2112 new ActionMenuItem('p',"parse atoms in xyz file into molecule",editMoleculesMenu,parseAtomsAction); 2113 2114 Action *eraseMoleculeAction = new MethodAction("eraseMoleculeAction",boost::bind(&MoleculeListClass::eraseMolecule,molecules)); 2115 new ActionMenuItem('r',"remove a molecule",editMoleculesMenu,eraseMoleculeAction); 2116 } 2117 2118 2209 2119 /********************************************** Main routine **************************************/ 2210 2120 2211 2121 int main(int argc, char **argv) 2212 2122 { 2213 periodentafel *periode = new periodentafel; // and a period table of all elements 2214 MoleculeListClass *molecules = new MoleculeListClass; // list of all molecules 2215 molecule *mol = NULL; 2216 config *configuration = new config; 2217 char choice; // menu choice char 2218 Vector x,y,z,n; // coordinates for absolute point in cell volume 2219 ifstream test; 2220 ofstream output; 2221 string line; 2222 char *ConfigFileName = NULL; 2223 int j; 2224 2225 cout << ESPACKVersion << endl; 2226 2227 setVerbosity(0); 2228 2229 // =========================== PARSE COMMAND LINE OPTIONS ==================================== 2230 j = ParseCommandLineOptions(argc, argv, molecules, periode, *configuration, ConfigFileName); 2231 switch(j) { 2232 case 255: // something went wrong 2233 case 2: // just for -f option 2234 case 1: // just for -v and -h options 2235 delete(molecules); // also free's all molecules contained 2236 delete(periode); 2237 delete(configuration); 2238 Log() << Verbose(0) << "Maximum of allocated memory: " 2239 << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl; 2240 Log() << Verbose(0) << "Remaining non-freed memory: " 2241 << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl; 2242 MemoryUsageObserver::getInstance()->purgeInstance(); 2243 logger::purgeInstance(); 2244 errorLogger::purgeInstance(); 2245 return (j == 1 ? 0 : j); 2246 default: 2247 break; 2248 } 2249 2250 // General stuff 2251 if (molecules->ListOfMolecules.size() == 0) { 2252 mol = new molecule(periode); 2253 if (mol->cell_size[0] == 0.) { 2254 Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl; 2255 for (int i=0;i<6;i++) { 2256 Log() << Verbose(1) << "Cell size" << i << ": "; 2257 cin >> mol->cell_size[i]; 2258 } 2123 periodentafel *periode = new periodentafel; 2124 MoleculeListClass *molecules = new MoleculeListClass; 2125 molecule *mol = NULL; 2126 config *configuration = new config; 2127 Vector x, y, z, n; 2128 ifstream test; 2129 ofstream output; 2130 string line; 2131 char *ConfigFileName = NULL; 2132 int j; 2133 setVerbosity(0); 2134 /* structure of ParseCommandLineOptions will be refactored later */ 2135 j = ParseCommandLineOptions(argc, argv, molecules, periode, *configuration, ConfigFileName); 2136 switch (j){ 2137 case 255: 2138 case 2: 2139 case 1: 2140 delete (molecules); 2141 delete (periode); 2142 delete (configuration); 2143 Log() << Verbose(0) << "Maximum of allocated memory: " << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl; 2144 Log() << Verbose(0) << "Remaining non-freed memory: " << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl; 2145 MemoryUsageObserver::getInstance()->purgeInstance(); 2146 logger::purgeInstance(); 2147 errorLogger::purgeInstance(); 2148 return (j == 1 ? 0 : j); 2149 default: 2150 break; 2259 2151 } 2260 mol->ActiveFlag = true; 2261 molecules->insert(mol); 2262 } 2263 2264 // =========================== START INTERACTIVE SESSION ==================================== 2265 2266 // now the main construction loop 2267 Log() << Verbose(0) << endl << "Now comes the real construction..." << endl; 2268 do { 2269 Log() << Verbose(0) << endl << endl; 2270 Log() << Verbose(0) << "============Molecule list=======================" << endl; 2271 molecules->Enumerate((ofstream *)&cout); 2272 Log() << Verbose(0) << "============Menu===============================" << endl; 2273 Log() << Verbose(0) << "a - set molecule (in)active" << endl; 2274 Log() << Verbose(0) << "e - edit molecules (load, parse, save)" << endl; 2275 Log() << Verbose(0) << "g - globally manipulate atoms in molecule" << endl; 2276 Log() << Verbose(0) << "M - Merge molecules" << endl; 2277 Log() << Verbose(0) << "m - manipulate atoms" << endl; 2278 Log() << Verbose(0) << "-----------------------------------------------" << endl; 2279 Log() << Verbose(0) << "c - edit the current configuration" << endl; 2280 Log() << Verbose(0) << "-----------------------------------------------" << endl; 2281 Log() << Verbose(0) << "s - save current setup to config file" << endl; 2282 Log() << Verbose(0) << "T - call the current test routine" << endl; 2283 Log() << Verbose(0) << "q - quit" << endl; 2284 Log() << Verbose(0) << "===============================================" << endl; 2285 Log() << Verbose(0) << "Input: "; 2286 cin >> choice; 2287 2288 switch (choice) { 2289 case 'a': // (in)activate molecule 2290 { 2291 Log() << Verbose(0) << "Enter index of molecule: "; 2292 cin >> j; 2293 for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) 2294 if ((*ListRunner)->IndexNr == j) 2295 (*ListRunner)->ActiveFlag = !(*ListRunner)->ActiveFlag; 2152 if(molecules->ListOfMolecules.size() == 0){ 2153 mol = new molecule(periode); 2154 if(mol->cell_size[0] == 0.){ 2155 Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl; 2156 for(int i = 0;i < 6;i++){ 2157 Log() << Verbose(1) << "Cell size" << i << ": "; 2158 cin >> mol->cell_size[i]; 2159 } 2296 2160 } 2297 break; 2298 2299 case 'c': // edit each field of the configuration 2300 configuration->Edit(); 2301 break; 2302 2303 case 'e': // create molecule 2304 EditMolecules(periode, molecules); 2305 break; 2306 2307 case 'g': // manipulate molecules 2308 ManipulateMolecules(periode, molecules, configuration); 2309 break; 2310 2311 case 'M': // merge molecules 2312 MergeMolecules(periode, molecules); 2313 break; 2314 2315 case 'm': // manipulate atoms 2316 ManipulateAtoms(periode, molecules, configuration); 2317 break; 2318 2319 case 'q': // quit 2320 break; 2321 2322 case 's': // save to config file 2323 SaveConfig(ConfigFileName, configuration, periode, molecules); 2324 break; 2325 2326 case 'T': 2327 testroutine(molecules); 2328 break; 2329 2330 default: 2331 break; 2332 }; 2333 } while (choice != 'q'); 2334 2335 // save element data base 2336 if (periode->StorePeriodentafel(configuration->databasepath)) //ElementsFileName 2337 Log() << Verbose(0) << "Saving of elements.db successful." << endl; 2338 else 2339 Log() << Verbose(0) << "Saving of elements.db failed." << endl; 2340 2341 delete(molecules); // also free's all molecules contained 2342 delete(periode); 2161 2162 mol->ActiveFlag = true; 2163 molecules->insert(mol); 2164 } 2165 2166 { 2167 cout << ESPACKVersion << endl; 2168 2169 setVerbosity(0); 2170 2171 menuPopulaters populaters; 2172 populaters.MakeEditMoleculesMenu = populateEditMoleculesMenu; 2173 2174 UIFactory::makeUserInterface(UIFactory::Text); 2175 MainWindow *mainWindow = UIFactory::get()->makeMainWindow(populaters,molecules, configuration, periode, ConfigFileName); 2176 mainWindow->display(); 2177 delete mainWindow; 2178 } 2179 2180 if(periode->StorePeriodentafel(configuration->databasepath)) 2181 Log() << Verbose(0) << "Saving of elements.db successful." << endl; 2182 2183 else 2184 Log() << Verbose(0) << "Saving of elements.db failed." << endl; 2185 2186 delete (molecules); 2187 delete(periode); 2343 2188 delete(configuration); 2189 2190 2344 2191 2345 2192 Log() << Verbose(0) << "Maximum of allocated memory: " … … 2350 2197 logger::purgeInstance(); 2351 2198 errorLogger::purgeInstance(); 2352 2199 UIFactory::purgeInstance(); 2200 ActionRegistry::purgeRegistry(); 2353 2201 return (0); 2354 2202 } -
src/config.cpp
r1cf5df r1ca488 1776 1776 }; 1777 1777 1778 1779 /** Tries given filename or standard on saving the config file. 1780 * \param *ConfigFileName name of file 1781 * \param *periode pointer to periodentafel structure with all the elements 1782 * \param *molecules list of molecules structure with all the atoms and coordinates 1783 */ 1784 void config::SaveAll(char *ConfigFileName, periodentafel *periode, MoleculeListClass *molecules) 1785 { 1786 char filename[MAXSTRINGSIZE]; 1787 ofstream output; 1788 molecule *mol = new molecule(periode); 1789 mol->SetNameFromFilename(ConfigFileName); 1790 1791 if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) { 1792 eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl; 1793 } 1794 1795 1796 // first save as PDB data 1797 if (ConfigFileName != NULL) 1798 strcpy(filename, ConfigFileName); 1799 if (output == NULL) 1800 strcpy(filename,"main_pcp_linux"); 1801 Log() << Verbose(0) << "Saving as pdb input "; 1802 if (configuration->SavePDB(filename, molecules)) 1803 Log() << Verbose(0) << "done." << endl; 1804 else 1805 Log() << Verbose(0) << "failed." << endl; 1806 1807 // then save as tremolo data file 1808 if (ConfigFileName != NULL) 1809 strcpy(filename, ConfigFileName); 1810 if (output == NULL) 1811 strcpy(filename,"main_pcp_linux"); 1812 Log() << Verbose(0) << "Saving as tremolo data input "; 1813 if (configuration->SaveTREMOLO(filename, molecules)) 1814 Log() << Verbose(0) << "done." << endl; 1815 else 1816 Log() << Verbose(0) << "failed." << endl; 1817 1818 // translate each to its center and merge all molecules in MoleculeListClass into this molecule 1819 int N = molecules->ListOfMolecules.size(); 1820 int *src = new int[N]; 1821 N=0; 1822 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) { 1823 src[N++] = (*ListRunner)->IndexNr; 1824 (*ListRunner)->Translate(&(*ListRunner)->Center); 1825 } 1826 molecules->SimpleMultiAdd(mol, src, N); 1827 delete[](src); 1828 1829 // ... and translate back 1830 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) { 1831 (*ListRunner)->Center.Scale(-1.); 1832 (*ListRunner)->Translate(&(*ListRunner)->Center); 1833 (*ListRunner)->Center.Scale(-1.); 1834 } 1835 1836 Log() << Verbose(0) << "Storing configuration ... " << endl; 1837 // get correct valence orbitals 1838 mol->CalculateOrbitals(*configuration); 1839 configuration->InitMaxMinStopStep = configuration->MaxMinStopStep = configuration->MaxPsiDouble; 1840 if (ConfigFileName != NULL) { // test the file name 1841 strcpy(filename, ConfigFileName); 1842 output.open(filename, ios::trunc); 1843 } else if (strlen(configuration->configname) != 0) { 1844 strcpy(filename, configuration->configname); 1845 output.open(configuration->configname, ios::trunc); 1846 } else { 1847 strcpy(filename, DEFAULTCONFIG); 1848 output.open(DEFAULTCONFIG, ios::trunc); 1849 } 1850 output.close(); 1851 output.clear(); 1852 Log() << Verbose(0) << "Saving of config file "; 1853 if (configuration->Save(filename, periode, mol)) 1854 Log() << Verbose(0) << "successful." << endl; 1855 else 1856 Log() << Verbose(0) << "failed." << endl; 1857 1858 // and save to xyz file 1859 if (ConfigFileName != NULL) { 1860 strcpy(filename, ConfigFileName); 1861 strcat(filename, ".xyz"); 1862 output.open(filename, ios::trunc); 1863 } 1864 if (output == NULL) { 1865 strcpy(filename,"main_pcp_linux"); 1866 strcat(filename, ".xyz"); 1867 output.open(filename, ios::trunc); 1868 } 1869 Log() << Verbose(0) << "Saving of XYZ file "; 1870 if (mol->MDSteps <= 1) { 1871 if (mol->OutputXYZ(&output)) 1872 Log() << Verbose(0) << "successful." << endl; 1873 else 1874 Log() << Verbose(0) << "failed." << endl; 1875 } else { 1876 if (mol->OutputTrajectoriesXYZ(&output)) 1877 Log() << Verbose(0) << "successful." << endl; 1878 else 1879 Log() << Verbose(0) << "failed." << endl; 1880 } 1881 output.close(); 1882 output.clear(); 1883 1884 // and save as MPQC configuration 1885 if (ConfigFileName != NULL) 1886 strcpy(filename, ConfigFileName); 1887 if (output == NULL) 1888 strcpy(filename,"main_pcp_linux"); 1889 Log() << Verbose(0) << "Saving as mpqc input "; 1890 if (configuration->SaveMPQC(filename, mol)) 1891 Log() << Verbose(0) << "done." << endl; 1892 else 1893 Log() << Verbose(0) << "failed." << endl; 1894 1895 if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) { 1896 eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl; 1897 } 1898 1899 delete(mol); 1900 }; 1901 1778 1902 /** Reads parameter from a parsed file. 1779 1903 * The file is either parsed for a certain keyword or if null is given for -
src/config.hpp
r1cf5df r1ca488 146 146 bool SaveTREMOLO(const char * const filename, const MoleculeListClass * const MolList) const; 147 147 148 void SaveAll(char *ConfigFileName, periodentafel *periode, MoleculeListClass *molecules); 149 148 150 void Edit(); 149 151 bool GetIsAngstroem() const; -
src/defs.hpp
r1cf5df r1ca488 77 77 #define UPDATECOUNT 10 //!< update ten sites per BOSSANOVA interval 78 78 79 #define STD_MENU_LENGTH 60 80 #define STD_MENU_TITLE_SPACER '=' 81 #define STD_SEPERATOR_SPACER '-' 82 79 83 #endif /*DEFS_HPP_*/ -
src/molecule.cpp
r1cf5df r1ca488 1081 1081 } 1082 1082 }; 1083 1084 void molecule::flipActiveFlag(){ 1085 ActiveFlag = !ActiveFlag; 1086 } -
src/molecule.hpp
r1cf5df r1ca488 297 297 bool OutputTemperatureFromTrajectories(ofstream * const output, int startstep, int endstep); 298 298 299 // Manipulation routines 300 void flipActiveFlag(); 301 299 302 private: 300 303 int last_atom; //!< number given to last atom … … 325 328 int CountAllAtoms() const; 326 329 330 // Methods moved here from the menus 331 // TODO: more refactoring needed on these methods 332 void flipChosen(); 333 void createNewMolecule(periodentafel *periode); 334 void loadFromXYZ(periodentafel *periode); 335 void changeName(); 336 void setMoleculeFilename(); 337 void parseXYZIntoMolecule(); 338 void eraseMolecule(); 339 340 327 341 // merging of molecules 328 342 bool SimpleMerge(molecule *mol, molecule *srcmol); -
src/moleculelist.cpp
r1cf5df r1ca488 142 142 143 143 // header 144 Log() << Verbose(0) << "Index\tName\t\tAtoms\tFormula\tCenter\tSize" << endl;145 Log() << Verbose(0) << "-----------------------------------------------" << endl;144 (*out) << "Index\tName\t\tAtoms\tFormula\tCenter\tSize" << endl; 145 (*out) << "-----------------------------------------------" << endl; 146 146 if (ListOfMolecules.size() == 0) 147 Log() << Verbose(0) << "\tNone" << endl;147 (*out) << "\tNone" << endl; 148 148 else { 149 149 Origin.Zero(); … … 162 162 } 163 163 // output Index, Name, number of atoms, chemical formula 164 Log() << Verbose(0) << ((*ListRunner)->ActiveFlag ? "*" : " ") << (*ListRunner)->IndexNr << "\t" << (*ListRunner)->name << "\t\t" << (*ListRunner)->AtomCount << "\t";164 (*out) << ((*ListRunner)->ActiveFlag ? "*" : " ") << (*ListRunner)->IndexNr << "\t" << (*ListRunner)->name << "\t\t" << (*ListRunner)->AtomCount << "\t"; 165 165 Elemental = (*ListRunner)->elemente->end; 166 166 while(Elemental->previous != (*ListRunner)->elemente->start) { 167 167 Elemental = Elemental->previous; 168 168 if (Counts[Elemental->Z] != 0) 169 Log() << Verbose(0) << Elemental->symbol << Counts[Elemental->Z];169 (*out) << Elemental->symbol << Counts[Elemental->Z]; 170 170 } 171 171 // Center and size 172 Log() << Verbose(0) << "\t" << (*ListRunner)->Center << "\t" << sqrt(size) << endl;172 (*out) << "\t" << (*ListRunner)->Center << "\t" << sqrt(size) << endl; 173 173 } 174 174 } … … 844 844 } 845 845 846 /*********** 847 * Methods Moved here from the menus 848 */ 849 850 void MoleculeListClass::flipChosen() { 851 int j; 852 Log() << Verbose(0) << "Enter index of molecule: "; 853 cin >> j; 854 for(MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) 855 if ((*ListRunner)->IndexNr == j) 856 (*ListRunner)->ActiveFlag = !(*ListRunner)->ActiveFlag; 857 } 858 859 void MoleculeListClass::createNewMolecule(periodentafel *periode) { 860 molecule *mol = NULL; 861 mol = new molecule(periode); 862 insert(mol); 863 }; 864 865 void MoleculeListClass::loadFromXYZ(periodentafel *periode){ 866 molecule *mol = NULL; 867 Vector center; 868 char filename[MAXSTRINGSIZE]; 869 Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl; 870 mol = new molecule(periode); 871 do { 872 Log() << Verbose(0) << "Enter file name: "; 873 cin >> filename; 874 } while (!mol->AddXYZFile(filename)); 875 mol->SetNameFromFilename(filename); 876 // center at set box dimensions 877 mol->CenterEdge(¢er); 878 mol->cell_size[0] = center.x[0]; 879 mol->cell_size[1] = 0; 880 mol->cell_size[2] = center.x[1]; 881 mol->cell_size[3] = 0; 882 mol->cell_size[4] = 0; 883 mol->cell_size[5] = center.x[2]; 884 insert(mol); 885 } 886 887 void MoleculeListClass::changeName(){ 888 char filename[MAXSTRINGSIZE]; 889 molecule *mol = NULL; 890 int nr; 891 do { 892 Log() << Verbose(0) << "Enter index of molecule: "; 893 cin >> nr; 894 mol = ReturnIndex(nr); 895 } while (mol == NULL); 896 Log() << Verbose(0) << "Enter name: "; 897 cin >> filename; 898 strcpy(mol->name, filename); 899 } 900 901 void MoleculeListClass::setMoleculeFilename() { 902 char filename[MAXSTRINGSIZE]; 903 int nr; 904 molecule *mol = NULL; 905 do { 906 Log() << Verbose(0) << "Enter index of molecule: "; 907 cin >> nr; 908 mol = ReturnIndex(nr); 909 } while (mol == NULL); 910 Log() << Verbose(0) << "Enter name: "; 911 cin >> filename; 912 mol->SetNameFromFilename(filename); 913 } 914 915 void MoleculeListClass::parseXYZIntoMolecule(){ 916 char filename[MAXSTRINGSIZE]; 917 int nr; 918 molecule *mol = NULL; 919 mol = NULL; 920 do { 921 Log() << Verbose(0) << "Enter index of molecule: "; 922 cin >> nr; 923 mol = ReturnIndex(nr); 924 } while (mol == NULL); 925 Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl; 926 do { 927 Log() << Verbose(0) << "Enter file name: "; 928 cin >> filename; 929 } while (!mol->AddXYZFile(filename)); 930 mol->SetNameFromFilename(filename); 931 }; 932 933 void MoleculeListClass::eraseMolecule(){ 934 int nr; 935 molecule *mol = NULL; 936 Log() << Verbose(0) << "Enter index of molecule: "; 937 cin >> nr; 938 for(MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) 939 if (nr == (*ListRunner)->IndexNr) { 940 mol = *ListRunner; 941 ListOfMolecules.erase(ListRunner); 942 delete(mol); 943 break; 944 } 945 }; 946 846 947 847 948 /******************************************* Class MoleculeLeafClass ************************************************/ -
src/unittests/Makefile.am
r1cf5df r1ca488 4 4 AM_CXXFLAGS = $(CPPUNIT_CFLAGS) 5 5 6 TESTS = ActOnAllUnitTest AnalysisBondsUnitTests AnalysisCorrelationToPointUnitTest AnalysisCorrelationToSurfaceUnitTest AnalysisPairCorrelationUnitTest BondGraphUnitTest InfoUnitTest ListOfBondsUnitTest LogUnitTest MemoryUsageObserverUnitTest MemoryAllocatorUnitTest StackClassUnitTest VectorUnitTest 6 MENUTESTS = ActionSequenceTest 7 8 TESTS = ActOnAllUnitTest AnalysisBondsUnitTests AnalysisCorrelationToPointUnitTest AnalysisCorrelationToSurfaceUnitTest AnalysisPairCorrelationUnitTest BondGraphUnitTest InfoUnitTest ListOfBondsUnitTest LogUnitTest MemoryUsageObserverUnitTest MemoryAllocatorUnitTest StackClassUnitTest VectorUnitTest ${MENUTESTS} 9 7 10 check_PROGRAMS = $(TESTS) 8 11 noinst_PROGRAMS = $(TESTS) … … 47 50 VectorUnitTest_LDADD = ../libmolecuilder.a 48 51 52 ActionSequenceTest_SOURCES = ActionSequenceTest.cpp ActionSequenceTest.hpp 53 ActionSequenceTest_LDADD = ../libmolecuilder.a 49 54 50 55 #AUTOMAKE_OPTIONS = parallel-tests
Note:
See TracChangeset
for help on using the changeset viewer.