- Timestamp:
- Dec 10, 2012, 10:10:57 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:
- 447481
- Parents:
- 238868
- git-author:
- Frederik Heber <heber@…> (08/31/12 12:31:11)
- git-committer:
- Frederik Heber <heber@…> (12/10/12 10:10:57)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/FragmentationAction/FragmentationAutomationAction.cpp
r238868 ra2295a 247 247 const std::map<JobId_t,MPQCData> &fragmentData, 248 248 const std::string &KeySetFilename, 249 SamplingGrid&full_sample,249 std::vector<SamplingGrid> &full_sample, 250 250 Fragment &full_fragment) 251 251 { … … 286 286 fragmentData, MatrixNrLookup, container, subsetmap)); 287 287 // obtain full grid 288 full_sample = boost::fusion::at_key<MPQCDataFused::sampled_grid>(Result_Grid_fused.back()); 288 full_sample.clear(); 289 full_sample.reserve(Result_Grid_fused.size()); 290 for (std::vector<MPQCDataGridMap_t>::const_iterator iter = ++Result_Grid_fused.begin(); 291 iter !=Result_Grid_fused.end(); 292 ++iter) 293 full_sample.push_back(boost::fusion::at_key<MPQCDataFused::sampled_grid>((*iter))); 289 294 full_fragment = boost::fusion::at_key<MPQCDataFused::fragment>(Result_Fragment_fused.back()); 290 295 … … 459 464 * @param fragmentData MPQCData resulting from the jobs 460 465 * @param longrangeData VMGData resulting from long-range jobs 461 * @param fullsolutionData VMGData resulting from long-range of full problem 466 * @param fullsolutionData VMGData resulting from long-range of full problem from level 2 onward 462 467 * @param KeySetFilename filename with keysets to associate forces correctly 463 468 * @param NoAtoms total number of atoms … … 467 472 const std::map<JobId_t,MPQCData> &fragmentData, 468 473 const std::map<JobId_t,VMGData> &longrangeData, 469 const VMGData&fullsolutionData,474 const std::vector<VMGData> &fullsolutionData, 470 475 const std::string &KeySetFilename, 471 476 size_t NoAtoms, 472 SamplingGrid&full_sample)477 std::vector<SamplingGrid> &full_sample) 473 478 { 474 479 // create lookup from job nr to fragment number … … 550 555 VMGMatrixNrLookup); 551 556 epotentialSummer(subsetmap->getMaximumSubsetLevel()); 552 SamplingGrid full_sample_solution = fullsolutionData.sampled_potential; 553 // LOG(0, "Remaining long-range energy from energy_potential is " << full_sample_solution.integral()-epotentialSummer.getFullContribution() << "."); 554 full_sample_solution -= potentialSummer.getFullContribution(); 555 // multiply element-wise with charge distribution 556 LOG(0, "Remaining long-range potential integral is " << full_sample_solution.integral() << "."); 557 full_sample_solution *= full_sample; 558 LOG(0, "Remaining long-range energy from potential integral is " << full_sample_solution.integral() << "."); 557 558 std::vector<VMGDataLongRangeMap_t> Result_LongRange_fused; 559 Result_LongRange_fused.reserve(subsetmap->getMaximumSubsetLevel()); 560 for (size_t level = 1; level <= subsetmap->getMaximumSubsetLevel(); ++level) { 561 // weight times correct charge density of the same level 562 // NOTE: potential for level 1 is not calculated as saturation hydrogen 563 // are not removed on this level yet 564 const size_t potentiallevel = level < 2 ? 0 : (level-2); 565 SamplingGrid charge_weight = boost::fusion::at_key<MPQCDataFused::sampled_grid>(Result_Grid_fused[level-1]); 566 SamplingGrid full_sample_solution = fullsolutionData[potentiallevel].sampled_potential; 567 SamplingGrid short_range_correction = potentialSummer(level); 568 // LOG(0, "Remaining long-range energy from energy_potential is " << full_sample_solution.integral()-epotentialSummer.getFullContribution() << "."); 569 full_sample_solution -= short_range_correction; 570 // multiply element-wise with charge distribution 571 VMGDataLongRangeMap_t instance; 572 boost::fusion::at_key<VMGDataFused::potential_longrange>(instance) = full_sample_solution.integral(); 573 LOG(0, "Remaining long-range potential integral of level " << level << " is " 574 << full_sample_solution.integral() << "."); 575 boost::fusion::at_key<VMGDataFused::potential_shortrange>(instance) = short_range_correction.integral(); 576 LOG(0, "Short-range correction potential integral of level " << level << " is " 577 << short_range_correction.integral() << "."); 578 boost::fusion::at_key<VMGDataFused::energy_longrange>(instance) = full_sample_solution.integral(charge_weight); 579 LOG(0, "Remaining long-range energy from potential integral of level " << level << " is " 580 << full_sample_solution.integral(charge_weight) << "."); 581 boost::fusion::at_key<VMGDataFused::energy_shortrange>(instance) = short_range_correction.integral(charge_weight); 582 LOG(0, "Short-range correction energy from potential integral of level " << level << " is " 583 << short_range_correction.integral(charge_weight) << "."); 584 Result_LongRange_fused.push_back(instance); 585 } 586 { 587 // LOG(0, "Remaining long-range energy from energy_potential is " << full_sample_solution.integral()-epotentialSummer.getFullContribution() << "."); 588 SamplingGrid full_sample_solution = fullsolutionData.back().sampled_potential; 589 SamplingGrid short_range_correction = potentialSummer.getFullContribution(); 590 full_sample_solution -= short_range_correction; 591 // multiply element-wise with charge distribution 592 LOG(0, "Remaining long-range potential integral is " << full_sample_solution.integral() << "."); 593 LOG(0, "Short-range correction potential integral of level is " << short_range_correction.integral() << "."); 594 LOG(0, "Remaining long-range energy from potential integral is " 595 << full_sample_solution.integral(full_sample.back()) << "."); 596 LOG(0, "Short-range correction energy from potential integral is " 597 << short_range_correction.integral(full_sample.back()) << "."); 598 } 559 599 560 600 // TODO: Extract long-range corrections to forces … … 567 607 VMGMatrixNrLookup); 568 608 elongSummer(subsetmap->getMaximumSubsetLevel()); 569 double e_long = fullsolutionData. e_long;609 double e_long = fullsolutionData.back().e_long; 570 610 e_long -= elongSummer.getFullContribution(); 571 611 LOG(0, "Remaining long-range energy is " << e_long << "."); … … 577 617 Result_Energy_fused, MaxLevel); 578 618 LOG(0, "Energy table is \n" << energyresult); 619 620 const std::string gridresult = 621 writeTable<VMGDataLongRangeMap_t, VMGDataLongRangeVector_t >()( 622 Result_LongRange_fused, MaxLevel); 623 LOG(0, "LongRange table is \n" << gridresult); 624 579 625 const std::string eigenvalueresult; 580 581 626 LOG(0, "Eigenvalue table is \n" << eigenvalueresult); 627 582 628 const std::string forceresult = 583 629 writeTable<MPQCDataForceMap_t, MPQCDataForceVector_t>()( … … 635 681 // obtain combined charge density 636 682 LOG(1, "INFO: Parsing fragment files from " << params.path.get() << "."); 637 SamplingGrid full_sample;683 std::vector<SamplingGrid> full_sample; // have charges from level 2 onward summed up 638 684 Fragment full_fragment; 639 685 sumUpChargeDensity( … … 644 690 645 691 // Phase Four: obtain more ids 646 vmgcontroller.requestIds(fragmentData.size()+ 1);692 vmgcontroller.requestIds(fragmentData.size()+full_sample.size()); 647 693 648 694 // Phase Five: create VMGJobs … … 652 698 653 699 // Phase Six: calculate result 654 vmgcontroller.waitforResults(fragmentData.size()+ 1);700 vmgcontroller.waitforResults(fragmentData.size()+full_sample.size()); 655 701 std::map<JobId_t, VMGData> longrangeData; 656 702 vmgcontroller.getResults(longrangeData); 657 ASSERT( fragmentData.size()+1 == longrangeData.size(), 658 "FragmentationFragmentationAutomationAction::performCall() - number of MPQCresults+1 " 659 +toString(fragmentData.size()+1)+" and VMGresults "+toString(longrangeData.size())+" don't match."); 660 661 // remove full solution from map (must be highest id), has to be treated extra 662 VMGData fullsolutionData = (--longrangeData.end())->second; 663 longrangeData.erase(--longrangeData.end()); 703 ASSERT( fragmentData.size()+full_sample.size() == longrangeData.size(), 704 "FragmentationFragmentationAutomationAction::performCall() - number of MPQCresults+" 705 +toString(full_sample.size())+" "+toString(fragmentData.size()+full_sample.size()) 706 +" and VMGresults "+toString(longrangeData.size())+" don't match."); 707 708 // remove full solution corresponding to full_sample from map (must be highest ids), has to be treated extra 709 std::map<JobId_t, VMGData>::iterator iter = longrangeData.end(); 710 for (size_t i=0;i<full_sample.size();++i) 711 --iter; 712 std::map<JobId_t, VMGData>::iterator remove_iter = iter; 713 std::vector<VMGData> fullsolutionData; 714 for (; iter != longrangeData.end(); ++iter) 715 fullsolutionData.push_back(iter->second); 716 longrangeData.erase(remove_iter, longrangeData.end()); 664 717 665 718 // Final phase: print result … … 674 727 full_sample); 675 728 676 // create debug jobs to print the summed-up potential to vtk files 677 debugcontroller.requestIds(1); 678 if (!debugcontroller.createDebugJobs(std::vector<SamplingGrid>(1,full_sample))) 679 return Action::failure; 680 debugcontroller.waitforResults(1); 681 std::map<JobId_t, std::string> debugData; 682 debugcontroller.getResults(debugData); 729 if (!full_sample.empty()) { 730 // create debug jobs to print the summed-up potential to vtk files 731 debugcontroller.requestIds(full_sample.size()); 732 if (!debugcontroller.createDebugJobs(full_sample)) 733 return Action::failure; 734 debugcontroller.waitforResults(full_sample.size()); 735 std::map<JobId_t, std::string> debugData; 736 debugcontroller.getResults(debugData); 737 } 683 738 } 684 739 }
Note:
See TracChangeset
for help on using the changeset viewer.