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