Changeset 9a5bcd for src/config.cpp
- Timestamp:
- Oct 17, 2008, 1:20:42 PM (17 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, Candidate_v1.7.0, 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:
- 4ee3df
- Parents:
- f00693
- File:
-
- 1 edited
-
src/config.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/config.cpp
rf00693 r9a5bcd 971 971 972 972 /** Stores all elements of config structure from which they can be re-read. 973 * \param output open output *file stream to write to973 * \param *filename name of file 974 974 * \param *periode pointer to a periodentafel class with all elements 975 975 * \param *mol pointer to molecule containing all atoms of the molecule 976 976 */ 977 bool config::Save( ofstream *output, periodentafel *periode, molecule *mol) const977 bool config::Save(const char *filename, periodentafel *periode, molecule *mol) const 978 978 { 979 979 bool result = true; 980 980 // bring MaxTypes up to date 981 981 mol->CountElements(); 982 ofstream *output = NULL; 983 output = new ofstream(filename, ios::out); 982 984 if (output != NULL) { 983 985 *output << "# ParallelCarParinello - main configuration file - created with molecuilder" << endl; … … 1067 1069 else 1068 1070 result = result && mol->OutputTrajectories(output); 1071 output->close(); 1072 output->clear(); 1073 delete(output); 1069 1074 return result; 1070 1075 } else … … 1074 1079 /** Stores all elements in a MPQC input file. 1075 1080 * Note that this format cannot be parsed again. 1076 * \param output open output *file stream to write to1081 * \param *filename name of file (without ".in" suffix!) 1077 1082 * \param *mol pointer to molecule containing all atoms of the molecule 1078 1083 */ 1079 bool config::SaveMPQC( ofstream *output, molecule *mol) const1084 bool config::SaveMPQC(const char *filename, molecule *mol) const 1080 1085 { 1081 1086 int ElementNo = 0; 1082 1087 int AtomNo; 1083 1088 atom *Walker = NULL; 1084 element *runner = mol->elemente->start;1089 element *runner = NULL; 1085 1090 Vector *center = NULL; 1086 1091 ofstream *output = NULL; 1092 stringstream *fname = NULL; 1093 1094 // first without hessian 1095 fname = new stringstream; 1096 *fname << filename << ".in"; 1097 output = new ofstream(fname->str().c_str(), ios::out); 1087 1098 *output << "% Created by MoleCuilder" << endl; 1088 1099 *output << "mpqc: (" << endl; … … 1100 1111 center = mol->DetermineCenterOfAll(output); 1101 1112 // output of atoms 1113 runner = mol->elemente->start; 1102 1114 while (runner->next != mol->elemente->end) { // go through every element 1103 1115 runner = runner->next; … … 1122 1134 *output << "\tmolecule = $:molecule" << endl; 1123 1135 *output << ")" << endl; 1136 output->close(); 1137 delete(output); 1138 delete(fname); 1139 1140 // second with hessian 1141 fname = new stringstream; 1142 *fname << filename << ".hess.in"; 1143 output = new ofstream(fname->str().c_str(), ios::out); 1144 *output << "% Created by MoleCuilder" << endl; 1145 *output << "mpqc: (" << endl; 1146 *output << "\tsavestate = no" << endl; 1147 *output << "\tdo_gradient = yes" << endl; 1148 *output << "\tmole<CLHF>: (" << endl; 1149 *output << "\t\tmaxiter = 200" << endl; 1150 *output << "\t\tbasis = $:basis" << endl; 1151 *output << "\t\tmolecule = $:molecule" << endl; 1152 *output << "\t)" << endl; 1153 *output << "\tfreq<MolecularFrequencies>: (" << endl; 1154 *output << "\t\tmolecule=$:molecule" << endl; 1155 *output << "\t)" << endl; 1156 *output << ")" << endl; 1157 *output << "molecule<Molecule>: (" << endl; 1158 *output << "\tunit = " << (IsAngstroem ? "angstrom" : "bohr" ) << endl; 1159 *output << "\t{ atoms geometry } = {" << endl; 1160 center = mol->DetermineCenterOfAll(output); 1161 // output of atoms 1162 runner = mol->elemente->start; 1163 while (runner->next != mol->elemente->end) { // go through every element 1164 runner = runner->next; 1165 if (mol->ElementsInMolecule[runner->Z]) { // if this element got atoms 1166 ElementNo++; 1167 AtomNo = 0; 1168 Walker = mol->start; 1169 while (Walker->next != mol->end) { // go through every atom of this element 1170 Walker = Walker->next; 1171 if (Walker->type == runner) { // if this atom fits to element 1172 AtomNo++; 1173 *output << "\t\t" << Walker->type->symbol << " [ " << Walker->x.x[0]-center->x[0] << "\t" << Walker->x.x[1]-center->x[1] << "\t" << Walker->x.x[2]-center->x[2] << " ]" << endl; 1174 } 1175 } 1176 } 1177 } 1178 delete(center); 1179 *output << "\t}" << endl; 1180 *output << ")" << endl; 1181 *output << "basis<GaussianBasisSet>: (" << endl; 1182 *output << "\tname = \"3-21G\"" << endl; 1183 *output << "\tmolecule = $:molecule" << endl; 1184 *output << ")" << endl; 1185 output->close(); 1186 delete(output); 1187 delete(fname); 1188 1124 1189 return true; 1125 1190 };
Note:
See TracChangeset
for help on using the changeset viewer.
