Changes in src/config.cpp [cbc5fb:49e1ae]
- File:
-
- 1 edited
-
src/config.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/config.cpp
rcbc5fb r49e1ae 8 8 #include <cstring> 9 9 10 #include "World.hpp"11 10 #include "atom.hpp" 12 11 #include "bond.hpp" … … 733 732 sprintf(keyword,"%s_%i",name, j+1); 734 733 if (repetition == 0) { 735 neues = World::get()->createAtom();734 neues = new atom(); 736 735 AtomList[i][j] = neues; 737 736 LinearList[ FileBuffer->LineMapping[FileBuffer->CurrentLine] ] = neues; … … 812 811 sprintf(keyword,"%s_%i",name, j+1); 813 812 if (repetition == 0) { 814 neues = World::get()->createAtom();813 neues = new atom(); 815 814 AtomList[i][j] = neues; 816 815 LinearList[ FileBuffer->LineMapping[FileBuffer->CurrentLine] ] = neues; … … 851 850 void config::Load(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, MoleculeListClass * const &MolList) 852 851 { 853 molecule *mol = World::get()->createMolecule();852 molecule *mol = new molecule(periode); 854 853 ifstream *file = new ifstream(filename); 855 854 if (file == NULL) { … … 1089 1088 void config::LoadOld(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, MoleculeListClass * const &MolList) 1090 1089 { 1091 molecule *mol = World::get()->createMolecule();1090 molecule *mol = new molecule(periode); 1092 1091 ifstream *file = new ifstream(filename); 1093 1092 if (file == NULL) { … … 1288 1287 } 1289 1288 istringstream input2(zeile); 1290 atom *neues = World::get()->createAtom();1289 atom *neues = new atom(); 1291 1290 input2 >> neues->x.x[0]; // x 1292 1291 input2 >> neues->x.x[1]; // y … … 1778 1777 }; 1779 1778 1780 1781 /** Tries given filename or standard on saving the config file.1782 * \param *ConfigFileName name of file1783 * \param *periode pointer to periodentafel structure with all the elements1784 * \param *molecules list of molecules structure with all the atoms and coordinates1785 */1786 void config::SaveAll(char *ConfigFileName, periodentafel *periode, MoleculeListClass *molecules)1787 {1788 char filename[MAXSTRINGSIZE];1789 ofstream output;1790 molecule *mol = World::get()->createMolecule();1791 mol->SetNameFromFilename(ConfigFileName);1792 1793 if (!strcmp(configpath, GetDefaultPath())) {1794 eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl;1795 }1796 1797 1798 // first save as PDB data1799 if (ConfigFileName != NULL)1800 strcpy(filename, ConfigFileName);1801 if (output == NULL)1802 strcpy(filename,"main_pcp_linux");1803 Log() << Verbose(0) << "Saving as pdb input ";1804 if (SavePDB(filename, molecules))1805 Log() << Verbose(0) << "done." << endl;1806 else1807 Log() << Verbose(0) << "failed." << endl;1808 1809 // then save as tremolo data file1810 if (ConfigFileName != NULL)1811 strcpy(filename, ConfigFileName);1812 if (output == NULL)1813 strcpy(filename,"main_pcp_linux");1814 Log() << Verbose(0) << "Saving as tremolo data input ";1815 if (SaveTREMOLO(filename, molecules))1816 Log() << Verbose(0) << "done." << endl;1817 else1818 Log() << Verbose(0) << "failed." << endl;1819 1820 // translate each to its center and merge all molecules in MoleculeListClass into this molecule1821 int N = molecules->ListOfMolecules.size();1822 int *src = new int[N];1823 N=0;1824 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {1825 src[N++] = (*ListRunner)->IndexNr;1826 (*ListRunner)->Translate(&(*ListRunner)->Center);1827 }1828 molecules->SimpleMultiAdd(mol, src, N);1829 delete[](src);1830 1831 // ... and translate back1832 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {1833 (*ListRunner)->Center.Scale(-1.);1834 (*ListRunner)->Translate(&(*ListRunner)->Center);1835 (*ListRunner)->Center.Scale(-1.);1836 }1837 1838 Log() << Verbose(0) << "Storing configuration ... " << endl;1839 // get correct valence orbitals1840 mol->CalculateOrbitals(*this);1841 InitMaxMinStopStep = MaxMinStopStep = MaxPsiDouble;1842 if (ConfigFileName != NULL) { // test the file name1843 strcpy(filename, ConfigFileName);1844 output.open(filename, ios::trunc);1845 } else if (strlen(configname) != 0) {1846 strcpy(filename, configname);1847 output.open(configname, ios::trunc);1848 } else {1849 strcpy(filename, DEFAULTCONFIG);1850 output.open(DEFAULTCONFIG, ios::trunc);1851 }1852 output.close();1853 output.clear();1854 Log() << Verbose(0) << "Saving of config file ";1855 if (Save(filename, periode, mol))1856 Log() << Verbose(0) << "successful." << endl;1857 else1858 Log() << Verbose(0) << "failed." << endl;1859 1860 // and save to xyz file1861 if (ConfigFileName != NULL) {1862 strcpy(filename, ConfigFileName);1863 strcat(filename, ".xyz");1864 output.open(filename, ios::trunc);1865 }1866 if (output == NULL) {1867 strcpy(filename,"main_pcp_linux");1868 strcat(filename, ".xyz");1869 output.open(filename, ios::trunc);1870 }1871 Log() << Verbose(0) << "Saving of XYZ file ";1872 if (mol->MDSteps <= 1) {1873 if (mol->OutputXYZ(&output))1874 Log() << Verbose(0) << "successful." << endl;1875 else1876 Log() << Verbose(0) << "failed." << endl;1877 } else {1878 if (mol->OutputTrajectoriesXYZ(&output))1879 Log() << Verbose(0) << "successful." << endl;1880 else1881 Log() << Verbose(0) << "failed." << endl;1882 }1883 output.close();1884 output.clear();1885 1886 // and save as MPQC configuration1887 if (ConfigFileName != NULL)1888 strcpy(filename, ConfigFileName);1889 if (output == NULL)1890 strcpy(filename,"main_pcp_linux");1891 Log() << Verbose(0) << "Saving as mpqc input ";1892 if (SaveMPQC(filename, mol))1893 Log() << Verbose(0) << "done." << endl;1894 else1895 Log() << Verbose(0) << "failed." << endl;1896 1897 if (!strcmp(configpath, GetDefaultPath())) {1898 eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl;1899 }1900 1901 World::get()->destroyMolecule(mol);1902 };1903 1904 1779 /** Reads parameter from a parsed file. 1905 1780 * The file is either parsed for a certain keyword or if null is given for
Note:
See TracChangeset
for help on using the changeset viewer.
