Changeset 538744 for molecuilder/src/config.cpp
- Timestamp:
- Jan 5, 2010, 9:23:25 AM (16 years ago)
- Children:
- 70c4aa6
- Parents:
- 16f86d
- File:
-
- 1 edited
-
molecuilder/src/config.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/config.cpp
r16f86d r538744 1771 1771 }; 1772 1772 1773 1774 /** Tries given filename or standard on saving the config file. 1775 * \param *ConfigFileName name of file 1776 * \param *periode pointer to periodentafel structure with all the elements 1777 * \param *molecules list of molecules structure with all the atoms and coordinates 1778 */ 1779 void config::SaveAll(char *ConfigFileName, periodentafel *periode, MoleculeListClass *molecules) 1780 { 1781 char filename[MAXSTRINGSIZE]; 1782 ofstream output; 1783 molecule *mol = new molecule(periode); 1784 1785 if (!strcmp(configpath, GetDefaultPath())) { 1786 eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl; 1787 } 1788 1789 1790 // first save as PDB data 1791 if (ConfigFileName != NULL) 1792 strcpy(filename, ConfigFileName); 1793 else 1794 strcpy(filename,"main_pcp_linux"); 1795 Log() << Verbose(0) << "Saving as pdb input "; 1796 if (SavePDB(filename, molecules)) 1797 Log() << Verbose(0) << "done." << endl; 1798 else 1799 Log() << Verbose(0) << "failed." << endl; 1800 1801 // then save as tremolo data file 1802 if (ConfigFileName != NULL) 1803 strcpy(filename, ConfigFileName); 1804 else 1805 strcpy(filename,"main_pcp_linux"); 1806 Log() << Verbose(0) << "Saving as tremolo data input "; 1807 if (SaveTREMOLO(filename, molecules)) 1808 Log() << Verbose(0) << "done." << endl; 1809 else 1810 Log() << Verbose(0) << "failed." << endl; 1811 1812 // translate each to its center and merge all molecules in MoleculeListClass into this molecule 1813 int N = molecules->ListOfMolecules.size(); 1814 int *src = new int[N]; 1815 N=0; 1816 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) { 1817 src[N++] = (*ListRunner)->IndexNr; 1818 (*ListRunner)->Translate(&(*ListRunner)->Center); 1819 } 1820 molecules->SimpleMultiAdd(mol, src, N); 1821 delete[](src); 1822 1823 // ... and translate back 1824 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) { 1825 (*ListRunner)->Center.Scale(-1.); 1826 (*ListRunner)->Translate(&(*ListRunner)->Center); 1827 (*ListRunner)->Center.Scale(-1.); 1828 } 1829 1830 Log() << Verbose(0) << "Storing configuration ... " << endl; 1831 // get correct valence orbitals 1832 mol->CalculateOrbitals(*this); 1833 InitMaxMinStopStep = MaxMinStopStep = MaxPsiDouble; 1834 if (ConfigFileName != NULL) { // test the file name 1835 strcpy(filename, ConfigFileName); 1836 output.open(filename, ios::trunc); 1837 } else if (strlen(configname) != 0) { 1838 strcpy(filename, configname); 1839 output.open(configname, ios::trunc); 1840 } else { 1841 strcpy(filename, DEFAULTCONFIG); 1842 output.open(DEFAULTCONFIG, ios::trunc); 1843 } 1844 output.close(); 1845 output.clear(); 1846 Log() << Verbose(0) << "Saving of config file "; 1847 if (Save(filename, periode, mol)) 1848 Log() << Verbose(0) << "successful." << endl; 1849 else 1850 Log() << Verbose(0) << "failed." << endl; 1851 1852 // and save to xyz file 1853 if (ConfigFileName != NULL) { 1854 strcpy(filename, ConfigFileName); 1855 strcat(filename, ".xyz"); 1856 output.open(filename, ios::trunc); 1857 } 1858 else { 1859 strcpy(filename,"main_pcp_linux"); 1860 strcat(filename, ".xyz"); 1861 output.open(filename, ios::trunc); 1862 } 1863 Log() << Verbose(0) << "Saving of XYZ file "; 1864 if (mol->MDSteps <= 1) { 1865 if (mol->OutputXYZ(&output)) 1866 Log() << Verbose(0) << "successful." << endl; 1867 else 1868 Log() << Verbose(0) << "failed." << endl; 1869 } else { 1870 if (mol->OutputTrajectoriesXYZ(&output)) 1871 Log() << Verbose(0) << "successful." << endl; 1872 else 1873 Log() << Verbose(0) << "failed." << endl; 1874 } 1875 output.close(); 1876 output.clear(); 1877 1878 // and save as MPQC configuration 1879 if (ConfigFileName != NULL) 1880 strcpy(filename, ConfigFileName); 1881 else 1882 strcpy(filename,"main_pcp_linux"); 1883 Log() << Verbose(0) << "Saving as mpqc input "; 1884 if (SaveMPQC(filename, mol)) 1885 Log() << Verbose(0) << "done." << endl; 1886 else 1887 Log() << Verbose(0) << "failed." << endl; 1888 1889 if (!strcmp(configpath, GetDefaultPath())) { 1890 eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl; 1891 } 1892 1893 delete(mol); 1894 }; 1895 1773 1896 /** Reads parameter from a parsed file. 1774 1897 * 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.
