Changeset 235bed for src/menu.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/menu.cpp
r6b932c7 r235bed 1142 1142 new SeperatorItem(main_menu); 1143 1143 1144 Action *saveConfigAction = new MethodAction(boost::bind(& oldmenu::SaveConfig,this,ConfigFileName, configuration, periode, molecules));1144 Action *saveConfigAction = new MethodAction(boost::bind(&config::SaveAll,configuration, ConfigFileName, periode, molecules)); 1145 1145 new ActionMenuItem('s',"save current setup to config file",main_menu,saveConfigAction); 1146 1146 … … 1204 1204 delete returnAction; 1205 1205 }; 1206 1207 /** Tries given filename or standard on saving the config file.1208 * \param *ConfigFileName name of file1209 * \param *configuration pointer to configuration structure with all the values1210 * \param *periode pointer to periodentafel structure with all the elements1211 * \param *molecules list of molecules structure with all the atoms and coordinates1212 */1213 void oldmenu::SaveConfig(char *ConfigFileName, config *configuration, periodentafel *periode, MoleculeListClass *molecules)1214 {1215 char filename[MAXSTRINGSIZE];1216 ofstream output;1217 molecule *mol = new molecule(periode);1218 1219 if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) {1220 eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl;1221 }1222 1223 1224 // first save as PDB data1225 if (ConfigFileName != NULL)1226 strcpy(filename, ConfigFileName);1227 else1228 strcpy(filename,"main_pcp_linux");1229 Log() << Verbose(0) << "Saving as pdb input ";1230 if (configuration->SavePDB(filename, molecules))1231 Log() << Verbose(0) << "done." << endl;1232 else1233 Log() << Verbose(0) << "failed." << endl;1234 1235 // then save as tremolo data file1236 if (ConfigFileName != NULL)1237 strcpy(filename, ConfigFileName);1238 else1239 strcpy(filename,"main_pcp_linux");1240 Log() << Verbose(0) << "Saving as tremolo data input ";1241 if (configuration->SaveTREMOLO(filename, molecules))1242 Log() << Verbose(0) << "done." << endl;1243 else1244 Log() << Verbose(0) << "failed." << endl;1245 1246 // translate each to its center and merge all molecules in MoleculeListClass into this molecule1247 int N = molecules->ListOfMolecules.size();1248 int *src = new int[N];1249 N=0;1250 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {1251 src[N++] = (*ListRunner)->IndexNr;1252 (*ListRunner)->Translate(&(*ListRunner)->Center);1253 }1254 molecules->SimpleMultiAdd(mol, src, N);1255 delete[](src);1256 1257 // ... and translate back1258 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {1259 (*ListRunner)->Center.Scale(-1.);1260 (*ListRunner)->Translate(&(*ListRunner)->Center);1261 (*ListRunner)->Center.Scale(-1.);1262 }1263 1264 Log() << Verbose(0) << "Storing configuration ... " << endl;1265 // get correct valence orbitals1266 mol->CalculateOrbitals(*configuration);1267 configuration->InitMaxMinStopStep = configuration->MaxMinStopStep = configuration->MaxPsiDouble;1268 if (ConfigFileName != NULL) { // test the file name1269 strcpy(filename, ConfigFileName);1270 output.open(filename, ios::trunc);1271 } else if (strlen(configuration->configname) != 0) {1272 strcpy(filename, configuration->configname);1273 output.open(configuration->configname, ios::trunc);1274 } else {1275 strcpy(filename, DEFAULTCONFIG);1276 output.open(DEFAULTCONFIG, ios::trunc);1277 }1278 output.close();1279 output.clear();1280 Log() << Verbose(0) << "Saving of config file ";1281 if (configuration->Save(filename, periode, mol))1282 Log() << Verbose(0) << "successful." << endl;1283 else1284 Log() << Verbose(0) << "failed." << endl;1285 1286 // and save to xyz file1287 if (ConfigFileName != NULL) {1288 strcpy(filename, ConfigFileName);1289 strcat(filename, ".xyz");1290 output.open(filename, ios::trunc);1291 }1292 else {1293 strcpy(filename,"main_pcp_linux");1294 strcat(filename, ".xyz");1295 output.open(filename, ios::trunc);1296 }1297 Log() << Verbose(0) << "Saving of XYZ file ";1298 if (mol->MDSteps <= 1) {1299 if (mol->OutputXYZ(&output))1300 Log() << Verbose(0) << "successful." << endl;1301 else1302 Log() << Verbose(0) << "failed." << endl;1303 } else {1304 if (mol->OutputTrajectoriesXYZ(&output))1305 Log() << Verbose(0) << "successful." << endl;1306 else1307 Log() << Verbose(0) << "failed." << endl;1308 }1309 output.close();1310 output.clear();1311 1312 // and save as MPQC configuration1313 if (ConfigFileName != NULL)1314 strcpy(filename, ConfigFileName);1315 else1316 strcpy(filename,"main_pcp_linux");1317 Log() << Verbose(0) << "Saving as mpqc input ";1318 if (configuration->SaveMPQC(filename, mol))1319 Log() << Verbose(0) << "done." << endl;1320 else1321 Log() << Verbose(0) << "failed." << endl;1322 1323 if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) {1324 eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl;1325 }1326 1327 delete(mol);1328 };
Note:
See TracChangeset
for help on using the changeset viewer.