Changeset 235bed for src/config.cpp
- Timestamp:
- Jan 5, 2010, 9:23:25 AM (15 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 820a42
- Parents:
- 6b932c7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/config.cpp
r6b932c7 r235bed 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.