- Timestamp:
- Apr 15, 2013, 10:28:25 AM (12 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:
- 503acc1
- Parents:
- 4f44ae
- git-author:
- Frederik Heber <heber@…> (03/04/13 14:14:10)
- git-committer:
- Frederik Heber <heber@…> (04/15/13 10:28:25)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/FragmentationAction/FragmentationAutomationAction.cpp
r4f44ae rbae7bc 60 60 #include "Fragmentation/Automation/FragmentationResults.hpp" 61 61 #include "Fragmentation/Automation/MPQCFragmentController.hpp" 62 #include "Fragmentation/Automation/parseKeySetFile.hpp"63 62 #include "Fragmentation/Automation/VMGDebugGridFragmentController.hpp" 64 63 #include "Fragmentation/Automation/VMGFragmentController.hpp" … … 224 223 * 225 224 * @param fragmentData MPQCData resulting from the jobs, associated to job id 226 * @param KeySetFilename filename with keysets to associate forces correctly 225 * @param MatrixNrLookup map with enumerated jobids 226 * @param KeySet KeySets of all (non-hydrogen) atoms 227 * @param ForceKeySet KeySets of all atoms except those added by saturation 227 228 * @param NoAtoms total number of atoms 228 * @param full_sample summed up charge from fragments on return229 229 */ 230 230 bool printReceivedMPQCResults( 231 231 const std::map<JobId_t, MPQCData> &fragmentData, 232 const std::string &KeySetFilename, 232 const std::map< JobId_t, size_t > MatrixNrLookup, 233 KeySetsContainer KeySet, 234 const KeySetsContainer &ForceKeySet, 233 235 size_t NoAtoms) 234 236 { 235 // create a vector of all job ids 236 std::vector<JobId_t> jobids; 237 std::transform(fragmentData.begin(),fragmentData.end(), 238 std::back_inserter(jobids), 239 boost::bind( &std::map<JobId_t,MPQCData>::value_type::first, boost::lambda::_1 ) 240 ); 241 242 // create lookup from job nr to fragment number 243 size_t FragmentCounter = 0; 244 const std::map< JobId_t, size_t > MatrixNrLookup= 245 createMatrixNrLookup(jobids, FragmentCounter); 237 size_t FragmentCounter = MatrixNrLookup.size(); 246 238 247 239 // place results into maps … … 253 245 if (!Energy.InitialiseIndices()) return false; 254 246 255 if (!Force.ParseIndices(KeySetFilename.c_str())) return false; 256 257 // initialise keysets 258 KeySetsContainer KeySet; 259 parseKeySetFile(KeySet, KeySetFilename, FragmentCounter, NonHydrogenKeySets); 260 KeySetsContainer ForceKeySet; 261 parseKeySetFile(ForceKeySet, KeySetFilename, FragmentCounter, HydrogenKeySets); 247 if (!Force.ParseIndices(ForceKeySet)) return false; 262 248 263 249 // combine all found data … … 295 281 296 282 return true; 283 } 284 285 /** Print MPQCData from received results. 286 * 287 * @param fragmentData MPQCData resulting from the jobs, associated to job id 288 * @param KeySetFilename filename with keysets to associate forces correctly 289 * @param NoAtoms total number of atoms 290 */ 291 bool printReceivedMPQCResults( 292 const std::map<JobId_t, MPQCData> &fragmentData, 293 const std::string &KeySetFilename, 294 size_t NoAtoms) 295 { 296 // create a vector of all job ids 297 std::vector<JobId_t> jobids; 298 std::transform(fragmentData.begin(),fragmentData.end(), 299 std::back_inserter(jobids), 300 boost::bind( &std::map<JobId_t,MPQCData>::value_type::first, boost::lambda::_1 ) 301 ); 302 303 // create lookup from job nr to fragment number 304 size_t FragmentCounter = 0; 305 const std::map< JobId_t, size_t > MatrixNrLookup = 306 createMatrixNrLookup(jobids, FragmentCounter); 307 308 // initialise keysets 309 KeySetsContainer KeySet; 310 parseKeySetFile(KeySet, KeySetFilename, FragmentCounter, NonHydrogenKeySets); 311 KeySetsContainer ForceKeySet; 312 parseKeySetFile(ForceKeySet, KeySetFilename, FragmentCounter, HydrogenKeySets); 313 314 return printReceivedMPQCResults( 315 fragmentData, 316 MatrixNrLookup, 317 KeySet, 318 ForceKeySet, 319 NoAtoms); 320 } 321 322 /** Print MPQCData from received results. 323 * 324 * @param fragmentData MPQCData resulting from the jobs, associated to job id 325 * @param KeySet KeySets of all (non-hydrogen) atoms 326 * @param ForceKeySet KeySets of all atoms except those added by saturation 327 * @param NoAtoms total number of atoms 328 */ 329 bool printReceivedMPQCResults( 330 const std::map<JobId_t, MPQCData> &fragmentData, 331 const KeySetsContainer &KeySet, 332 const KeySetsContainer &ForceKeySet, 333 size_t NoAtoms) 334 { 335 // create a vector of all job ids 336 std::vector<JobId_t> jobids; 337 std::transform(fragmentData.begin(),fragmentData.end(), 338 std::back_inserter(jobids), 339 boost::bind( &std::map<JobId_t,MPQCData>::value_type::first, boost::lambda::_1 ) 340 ); 341 342 // create lookup from job nr to fragment number 343 size_t FragmentCounter = 0; 344 const std::map< JobId_t, size_t > MatrixNrLookup = 345 createMatrixNrLookup(jobids, FragmentCounter); 346 347 return printReceivedMPQCResults( 348 fragmentData, 349 MatrixNrLookup, 350 KeySet, 351 ForceKeySet, 352 NoAtoms); 297 353 } 298 354 … … 382 438 bool appendToHomologyFile( 383 439 const boost::filesystem::path &homology_file, 384 const FragmentationResults &results, 385 const std::string &KeySetFilename) 440 const FragmentationResults &results) 386 441 { 387 442 /// read homology container (if present) … … 479 534 // TODO: Have io_service run in second thread and merge with current again eventually 480 535 481 // check some things prior to work482 enum OutputType_t {483 ToFiles,484 ToJobs,485 ToNone486 };487 enum OutputType_t outputtype = ToNone;488 if (params.jobfiles.get().size() != 0) {489 // we got no job files, hence we use FragmentJobQueue490 if (params.path.get().size() == 0) {491 ELOG(1, "Missing path to fragment files.");492 return Action::failure;493 }494 outputtype = ToFiles;495 496 // parse in fragment-jobs if given497 if(!FragmentJobQueue::getInstance().addJobsFromFiles(498 params.jobfiles.get(),499 params.level.get()))500 return Action::failure;501 } else {502 if (params.path.get().size() != 0) {503 ELOG(2, "Path to fragment given although we use FragmentJobQueue.");504 }505 outputtype = ToJobs;506 }507 508 536 size_t Exitflag = 0; 509 537 std::map<JobId_t, MPQCData> fragmentData; … … 537 565 FragmentationChargeDensity summedChargeDensity( 538 566 fragmentData, 539 params.path.get());567 FragmentJobQueue::getInstance().getKeySets()); 540 568 const std::vector<SamplingGrid> full_sample = summedChargeDensity.getFullSampledGrid(); 541 542 569 LOG(1, "INFO: There are " << fragmentData.size() << " short-range and " 543 570 << full_sample.size() << " level-wise long-range jobs."); … … 587 614 fragmentData, 588 615 longrangeData, 589 params.path.get()); 616 FragmentJobQueue::getInstance().getKeySets(), 617 FragmentJobQueue::getInstance().getFullKeySets()); 590 618 results( 591 619 fragmentData, … … 593 621 fullsolutionData, 594 622 full_sample); 595 { 596 LOG(1, "INFO: Parsing fragment files from " << params.path.get() << "."); 597 printReceivedFullResults(results); 598 } 623 printReceivedFullResults(results); 599 624 600 625 // append all keysets to homology file … … 603 628 if (homology_file.string() != "") { 604 629 LOG(1, "INFO: Appending HomologyGraphs to file " << homology_file.string() << "."); 605 if (!appendToHomologyFile(homology_file, results , params.path.get()))630 if (!appendToHomologyFile(homology_file, results)) 606 631 Exitflag = 1; 607 632 } … … 630 655 printReceivedMPQCResults( 631 656 fragmentData, 632 params.path.get(), 633 getNoAtomsFromAdjacencyFile(params.path.get())); 657 FragmentJobQueue::getInstance().getKeySets(), 658 FragmentJobQueue::getInstance().getFullKeySets(), 659 World::getInstance().getAllAtoms().size())); 634 660 } 635 661 #endif 662 663 // now clear all present jobs as we are done 664 FragmentJobQueue::getInstance().clear(); 636 665 637 666 return (Exitflag == 0) ? Action::success : Action::failure;
Note:
See TracChangeset
for help on using the changeset viewer.