- Timestamp:
- Dec 10, 2012, 10:10:58 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:
- 86cfac5
- Parents:
- a3112d
- git-author:
- Frederik Heber <heber@…> (08/31/12 16:39:17)
- git-committer:
- Frederik Heber <heber@…> (12/10/12 10:10:58)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/FragmentationAction/FragmentationAutomationAction.cpp
ra3112d r376a3b 49 49 #include "Fragmentation/Automation/createMatrixNrLookup.hpp" 50 50 #include "Fragmentation/Automation/extractJobIds.hpp" 51 #include "Fragmentation/Automation/FragmentationResults.hpp" 51 52 #include "Fragmentation/Automation/MPQCFragmentController.hpp" 52 53 #include "Fragmentation/Automation/VMGDebugGridFragmentController.hpp" … … 62 63 #include "Fragmentation/KeySetsContainer.hpp" 63 64 #include "Fragmentation/Summation/OrthogonalSumUpPerLevel.hpp" 64 #include "Fragmentation/Summation/SumUpPerLevel.hpp"65 #include "Fragmentation/Summation/OrthogonalFullSummator.hpp"66 65 #include "Fragmentation/Summation/writeTable.hpp" 67 66 #include "Graph/DepthFirstSearchAnalysis.hpp" … … 362 361 /** Print MPQCData from received results. 363 362 * 364 * @param fragmentData MPQCData resulting from the jobs 365 * @param longrangeData VMGData resulting from long-range jobs 366 * @param fullsolutionData VMGData resulting from long-range of full problem from level 2 onward 367 * @param KeySetFilename filename with keysets to associate forces correctly 368 * @param NoAtoms total number of atoms 369 * @param full_sample summed up charge from fragments on return 370 */ 371 bool printReceivedFullResults( 372 const std::map<JobId_t,MPQCData> &fragmentData, 373 const std::map<JobId_t,VMGData> &longrangeData, 374 const std::vector<VMGData> &fullsolutionData, 375 const std::string &KeySetFilename, 376 size_t NoAtoms, 377 std::vector<SamplingGrid> &full_sample) 363 * @param results summed up results container 364 */ 365 void printReceivedFullResults( 366 const FragmentationResults &results) 378 367 { 379 // create lookup from job nr to fragment number 380 size_t MPQCFragmentCounter = 0; 381 const std::vector<JobId_t> mpqcjobids = extractJobIds<MPQCData>(fragmentData); 382 const std::map< JobId_t, size_t > MPQCMatrixNrLookup = 383 createMatrixNrLookup(mpqcjobids, MPQCFragmentCounter); 384 385 size_t VMGFragmentCounter = 0; 386 const std::vector<JobId_t> vmgjobids = extractJobIds<VMGData>(longrangeData); 387 const std::map< JobId_t, size_t > VMGMatrixNrLookup = 388 createMatrixNrLookup(vmgjobids, VMGFragmentCounter); 389 390 // initialise keysets 391 KeySetsContainer KeySet; 392 KeySetsContainer ForceKeySet; 393 { 394 // else needs keysets without hydrogens 395 std::stringstream filename; 396 filename << FRAGMENTPREFIX << KEYSETFILE; 397 if (!KeySet.ParseKeySets(KeySetFilename, filename.str(), MPQCFragmentCounter)) return false; 398 } 399 400 { 401 // forces need keysets including hydrogens 402 std::stringstream filename; 403 filename << FRAGMENTPREFIX << FORCESFILE; 404 if (!ForceKeySet.ParseKeySets(KeySetFilename, filename.str(), MPQCFragmentCounter)) return false; 405 } 406 407 /// prepare for OrthogonalSummation 408 409 // convert KeySetContainer to IndexSetContainer 410 IndexSetContainer::ptr container(new IndexSetContainer(KeySet)); 411 // create the map of all keysets 412 SubsetMap::ptr subsetmap(new SubsetMap(*container)); 413 414 /// convert all MPQCData to MPQCDataMap_t 415 { 416 ASSERT( ForceKeySet.KeySets.size() == fragmentData.size(), 417 "printReceivedFullResults() - ForceKeySet's KeySets and fragmentData differ in size."); 418 419 typedef boost::mpl::remove<MPQCDataEnergyVector_t, MPQCDataFused::energy_eigenvalues>::type MPQCDataEnergyVector_noeigenvalues_t; 420 std::vector<MPQCDataEnergyMap_t> Result_Energy_fused( 421 OrthogonalSumUpPerLevel<MPQCDataEnergyMap_t, MPQCData, MPQCDataEnergyVector_t>( 422 fragmentData, MPQCMatrixNrLookup, container, subsetmap)); 423 std::vector<MPQCDataGridMap_t> Result_Grid_fused( 424 OrthogonalSumUpPerLevel<MPQCDataGridMap_t, MPQCData, MPQCDataGridVector_t>( 425 fragmentData, MPQCMatrixNrLookup, container, subsetmap)); 426 std::vector<MPQCDataTimeMap_t> Result_Time_fused( 427 SumUpPerLevel<MPQCDataTimeMap_t, MPQCData, MPQCDataTimeVector_t>( 428 fragmentData, MPQCMatrixNrLookup, container, subsetmap)); 429 std::vector<MPQCDataFragmentMap_t> Result_Fragment_fused( 430 OrthogonalSumUpPerLevel<MPQCDataFragmentMap_t, MPQCData, MPQCDataFragmentVector_t>( 431 fragmentData, MPQCMatrixNrLookup, container, subsetmap)); 432 433 // force has extra converter 434 std::map<JobId_t, MPQCDataForceMap_t> MPQCData_Force_fused; 435 convertMPQCDatatoForceMap(fragmentData, ForceKeySet, MPQCData_Force_fused); 436 std::vector<MPQCDataForceMap_t> Result_Force_fused(subsetmap->getMaximumSubsetLevel()); 437 AllLevelOrthogonalSummator<MPQCDataForceMap_t> forceSummer( 438 subsetmap, 439 MPQCData_Force_fused, 440 container->getContainer(), 441 MPQCMatrixNrLookup, 442 Result_Force_fused); 443 boost::mpl::for_each<MPQCDataForceVector_t>(boost::ref(forceSummer)); 444 445 // obtain full grid 446 std::map<JobId_t, VMGDataMap_t> VMGData_Potential_fused; 447 convertDataTo<VMGData, VMGDataMap_t>(longrangeData, VMGData_Potential_fused); 448 OrthogonalFullSummator<VMGDataMap_t, VMGDataFused::sampled_potential> potentialSummer( 449 subsetmap, 450 VMGData_Potential_fused, 451 container->getContainer(), 452 VMGMatrixNrLookup); 453 potentialSummer(subsetmap->getMaximumSubsetLevel()); 454 OrthogonalFullSummator<VMGDataMap_t, VMGDataFused::energy_potential> epotentialSummer( 455 subsetmap, 456 VMGData_Potential_fused, 457 container->getContainer(), 458 VMGMatrixNrLookup); 459 epotentialSummer(subsetmap->getMaximumSubsetLevel()); 460 461 std::vector<VMGDataLongRangeMap_t> Result_LongRange_fused; 462 Result_LongRange_fused.reserve(subsetmap->getMaximumSubsetLevel()); 463 for (size_t level = 1; level <= subsetmap->getMaximumSubsetLevel(); ++level) { 464 // weight times correct charge density of the same level 465 // NOTE: potential for level 1 is not calculated as saturation hydrogen 466 // are not removed on this level yet 467 const size_t potentiallevel = level < 2 ? 0 : (level-2); 468 SamplingGrid charge_weight = boost::fusion::at_key<MPQCDataFused::sampled_grid>(Result_Grid_fused[level-1]); 469 SamplingGrid full_sample_solution = fullsolutionData[potentiallevel].sampled_potential; 470 SamplingGrid short_range_correction = potentialSummer(level); 471 // LOG(0, "Remaining long-range energy from energy_potential is " << full_sample_solution.integral()-epotentialSummer.getFullContribution() << "."); 472 full_sample_solution -= short_range_correction; 473 // multiply element-wise with charge distribution 474 VMGDataLongRangeMap_t instance; 475 boost::fusion::at_key<VMGDataFused::potential_longrange>(instance) = full_sample_solution.integral(); 476 LOG(0, "Remaining long-range potential integral of level " << level << " is " 477 << full_sample_solution.integral() << "."); 478 boost::fusion::at_key<VMGDataFused::potential_shortrange>(instance) = short_range_correction.integral(); 479 LOG(0, "Short-range correction potential integral of level " << level << " is " 480 << short_range_correction.integral() << "."); 481 boost::fusion::at_key<VMGDataFused::energy_longrange>(instance) = full_sample_solution.integral(charge_weight); 482 LOG(0, "Remaining long-range energy from potential integral of level " << level << " is " 483 << full_sample_solution.integral(charge_weight) << "."); 484 boost::fusion::at_key<VMGDataFused::energy_shortrange>(instance) = short_range_correction.integral(charge_weight); 485 LOG(0, "Short-range correction energy from potential integral of level " << level << " is " 486 << short_range_correction.integral(charge_weight) << "."); 487 Result_LongRange_fused.push_back(instance); 488 } 489 { 490 // LOG(0, "Remaining long-range energy from energy_potential is " << full_sample_solution.integral()-epotentialSummer.getFullContribution() << "."); 491 SamplingGrid full_sample_solution = fullsolutionData.back().sampled_potential; 492 SamplingGrid short_range_correction = potentialSummer.getFullContribution(); 493 full_sample_solution -= short_range_correction; 494 // multiply element-wise with charge distribution 495 LOG(0, "Remaining long-range potential integral is " << full_sample_solution.integral() << "."); 496 LOG(0, "Short-range correction potential integral of level is " << short_range_correction.integral() << "."); 497 LOG(0, "Remaining long-range energy from potential integral is " 498 << full_sample_solution.integral(full_sample.back()) << "."); 499 LOG(0, "Short-range correction energy from potential integral is " 500 << short_range_correction.integral(full_sample.back()) << "."); 501 } 502 503 // TODO: Extract long-range corrections to forces 504 // NOTE: potential is in atomic length units, NOT IN ANGSTROEM! 505 506 OrthogonalFullSummator<VMGDataMap_t, VMGDataFused::energy_long> elongSummer( 507 subsetmap, 508 VMGData_Potential_fused, 509 container->getContainer(), 510 VMGMatrixNrLookup); 511 elongSummer(subsetmap->getMaximumSubsetLevel()); 512 double e_long = fullsolutionData.back().e_long; 513 e_long -= elongSummer.getFullContribution(); 514 LOG(0, "Remaining long-range energy is " << e_long << "."); 515 516 // print tables (without eigenvalues, they go extra) 517 const size_t MaxLevel = subsetmap->getMaximumSubsetLevel(); 518 const std::string energyresult = 519 writeTable<MPQCDataEnergyMap_t, MPQCDataEnergyVector_noeigenvalues_t >()( 520 Result_Energy_fused, MaxLevel); 521 LOG(0, "Energy table is \n" << energyresult); 522 523 const std::string gridresult = 524 writeTable<VMGDataLongRangeMap_t, VMGDataLongRangeVector_t >()( 525 Result_LongRange_fused, MaxLevel); 526 LOG(0, "LongRange table is \n" << gridresult); 527 528 const std::string eigenvalueresult; 529 LOG(0, "Eigenvalue table is \n" << eigenvalueresult); 530 531 const std::string forceresult = 532 writeTable<MPQCDataForceMap_t, MPQCDataForceVector_t>()( 533 Result_Force_fused, MaxLevel); 534 LOG(0, "Force table is \n" << forceresult); 535 // we don't want to print grid to a table 536 // print times (without flops for now) 537 typedef boost::mpl::remove< 538 boost::mpl::remove<MPQCDataTimeVector_t, MPQCDataFused::times_total_flops>::type, 539 MPQCDataFused::times_gather_flops>::type 540 MPQCDataTimeVector_noflops_t; 541 const std::string timesresult = 542 writeTable<MPQCDataTimeMap_t, MPQCDataTimeVector_noflops_t >()( 543 Result_Time_fused, MaxLevel); 544 LOG(0, "Times table is \n" << timesresult); 545 } 546 547 return true; 368 // print tables (without eigenvalues, they go extra) 369 typedef boost::mpl::remove<MPQCDataEnergyVector_t, MPQCDataFused::energy_eigenvalues>::type 370 MPQCDataEnergyVector_noeigenvalues_t; 371 const std::string energyresult = 372 writeTable<MPQCDataEnergyMap_t, MPQCDataEnergyVector_noeigenvalues_t >()( 373 results.Result_Energy_fused, results.getMaxLevel()); 374 LOG(0, "Energy table is \n" << energyresult); 375 376 const std::string gridresult = 377 writeTable<VMGDataLongRangeMap_t, VMGDataLongRangeVector_t >()( 378 results.Result_LongRangeIntegrated_fused, results.getMaxLevel()); 379 LOG(0, "LongRange table is \n" << gridresult); 380 381 const std::string eigenvalueresult; 382 LOG(0, "Eigenvalue table is \n" << eigenvalueresult); 383 384 const std::string forceresult = 385 writeTable<MPQCDataForceMap_t, MPQCDataForceVector_t>()( 386 results.Result_Force_fused, results.getMaxLevel()); 387 LOG(0, "Force table is \n" << forceresult); 388 // we don't want to print grid to a table 389 // print times (without flops for now) 390 typedef boost::mpl::remove< 391 boost::mpl::remove<MPQCDataTimeVector_t, MPQCDataFused::times_total_flops>::type, 392 MPQCDataFused::times_gather_flops>::type 393 MPQCDataTimeVector_noflops_t; 394 const std::string timesresult = 395 writeTable<MPQCDataTimeMap_t, MPQCDataTimeVector_noflops_t >()( 396 results.Result_Time_fused, results.getMaxLevel()); 397 LOG(0, "Times table is \n" << timesresult); 548 398 } 549 399 … … 619 469 longrangeData.erase(remove_iter, longrangeData.end()); 620 470 621 // Final phase: print result471 // Final phase: sum up and print result 622 472 { 623 LOG(1, "INFO: Parsing fragment files from " << params.path.get() << "."); 624 printReceivedFullResults( 473 FragmentationResults results( 625 474 fragmentData, 626 475 longrangeData, … … 630 479 full_sample); 631 480 481 LOG(1, "INFO: Parsing fragment files from " << params.path.get() << "."); 482 printReceivedFullResults(results); 483 632 484 if (!full_sample.empty()) { 633 // create debug jobs to print the summed-up potential to vtk files485 // create debug jobs for each level to print the summed-up potential to vtk files 634 486 debugcontroller.requestIds(full_sample.size()); 635 487 if (!debugcontroller.createDebugJobs(full_sample))
Note:
See TracChangeset
for help on using the changeset viewer.