- Timestamp:
- Nov 21, 2012, 10:03:23 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:
- c74fdb
- Parents:
- 94d530f
- git-author:
- Frederik Heber <heber@…> (08/08/12 13:17:44)
- git-committer:
- Frederik Heber <heber@…> (11/21/12 10:03:23)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/FragmentationAction/FragmentationAutomationAction.cpp
r94d530f r849cd8 65 65 #include "Jobs/MPQCData.hpp" 66 66 #include "Jobs/MPQCData_printKeyNames.hpp" 67 #include "Jobs/Grid/SamplingGrid.hpp" 67 68 #include "LinearAlgebra/RealSpaceMatrix.hpp" 68 69 #ifdef HAVE_VMG … … 428 429 * @param KeySetFilename filename with keysets to associate forces correctly 429 430 * @param NoAtoms total number of atoms 431 * @param full_sample summed up charge from fragments on return 432 */ 433 bool sumUpChargeDensity( 434 const std::vector<FragmentResult::ptr> &results, 435 const std::vector<MPQCData> &fragmentData, 436 const std::string &KeySetFilename, 437 SamplingGrid &full_sample) 438 { 439 // create lookup from job nr to fragment number 440 std::map< JobId_t, size_t > MatrixNrLookup; 441 size_t FragmentCounter = 0; 442 createMatrixNrLookup(results, MatrixNrLookup, FragmentCounter); 443 444 // initialise keysets 445 KeySetsContainer KeySet; 446 { 447 // else needs keysets without hydrogens 448 std::stringstream filename; 449 filename << FRAGMENTPREFIX << KEYSETFILE; 450 if (!KeySet.ParseKeySets(KeySetFilename, filename.str(), FragmentCounter)) return false; 451 } 452 453 /// prepare for OrthogonalSummation 454 455 // convert KeySetContainer to IndexSetContainer 456 IndexSetContainer::ptr container(new IndexSetContainer(KeySet)); 457 // create the map of all keysets 458 SubsetMap::ptr subsetmap(new SubsetMap(*container)); 459 460 // create a vector of all job ids 461 std::vector<JobId_t> jobids(results.size(), JobId::IllegalJob); 462 std::transform(results.begin(), results.end(), jobids.begin(), 463 boost::bind(&FragmentResult::getId, 464 boost::bind(&FragmentResult::ptr::operator->, _1))); 465 466 /// convert all MPQCData to MPQCDataMap_t 467 std::vector<MPQCDataGridMap_t> Result_Grid_fused( 468 SumUpPerLevel<MPQCDataGridMap_t, MPQCDataGridVector_t>( 469 fragmentData, jobids, MatrixNrLookup, container, subsetmap)); 470 // obtain full grid 471 full_sample = boost::fusion::at_key<MPQCDataFused::sampled_grid>(Result_Grid_fused.back()); 472 473 return true; 474 } 475 476 477 /** Print MPQCData from received results. 478 * 479 * @param results results with ids to associate with fragment number 480 * @param fragmentData MPQCData resulting from the jobs 481 * @param KeySetFilename filename with keysets to associate forces correctly 482 * @param NoAtoms total number of atoms 483 * @param full_sample summed up charge from fragments on return 430 484 */ 431 485 bool printReceivedMPQCResults( … … 433 487 const std::vector<MPQCData> &fragmentData, 434 488 const std::string &KeySetFilename, 435 size_t NoAtoms) 489 size_t NoAtoms, 490 SamplingGrid &full_sample) 436 491 { 437 492 // create lookup from job nr to fragment number … … 507 562 Result_Force_fused); 508 563 boost::mpl::for_each<MPQCDataForceVector_t>(boost::ref(forceSummer)); 564 565 // obtain full grid 566 full_sample = boost::fusion::at_key<MPQCDataFused::sampled_grid>(Result_Grid_fused.back()); 509 567 510 568 // print tables (without eigenvalues, they go extra) … … 614 672 FragmentController &controller, 615 673 const FragmentationFragmentationAutomationAction::FragmentationFragmentationAutomationParameters ¶ms, 616 const std::vector<MPQCData> &fragmentData) 674 const std::vector<MPQCData> &fragmentData, 675 const SamplingGrid &full_sampled_grid) 617 676 { 618 677 std::vector<FragmentJob::ptr> jobs; … … 629 688 } 630 689 631 // add one more job for the full calculation632 // TODO: Here, we actually have to combine all the other sampled_grids633 690 { 634 const int level = LEVEL; 635 const int GRID = pow(2, level); 636 std::vector<double> full_sample(GRID*GRID*GRID, 0.); 637 double begin[NDIM] = { 0., 0., 0. }; 638 const RealSpaceMatrix& M = World::getInstance().getDomain().getM(); 639 const double size = M.at(0,0); 640 ASSERT( M.determinant() == size*size*size, 641 "createLongRangeJobs() - current domain matrix "+toString(M)+" is not cubic."); 642 const SamplingGrid full_sampled_grid(begin, size, level, full_sample); 691 // const int level = LEVEL; 692 // const int GRID = pow(2, level); 693 // double begin[NDIM] = { 0., 0., 0. }; 694 // const RealSpaceMatrix& M = World::getInstance().getDomain().getM(); 695 // const double size = M.at(0,0); 696 // ASSERT( M.determinant() == size*size*size, 697 // "createLongRangeJobs() - current domain matrix "+toString(M)+" is not cubic."); 643 698 const std::vector< std::vector<double> > positions; 644 699 const std::vector<double> charges; 645 700 const JobId_t next_id = controller.getAvailableId(); 646 LOG(1, "INFO: Creating full VMGJob with " << full_sample .size()701 LOG(1, "INFO: Creating full VMGJob with " << full_sampled_grid.sampled_grid.size() 647 702 << " gridpoints and " << charges.size() << " particle charges."); 648 703 FragmentJob::ptr testJob( … … 706 761 ConvertFragmentResultToMPQCData(MPQCresults, fragmentData); 707 762 708 // print intermediate short-range results709 {710 LOG(1, "INFO: Parsing fragment files from " << params.path.get() << ".");711 printReceivedMPQCResults(712 MPQCresults,713 fragmentData,714 params.path.get(),715 getNoAtomsFromAdjacencyFile(params.path.get()));716 }717 718 763 #ifdef HAVE_VMG 719 764 if (params.DoLongrange.get()) { 765 // obtain combined charge density 766 LOG(1, "INFO: Parsing fragment files from " << params.path.get() << "."); 767 SamplingGrid full_sample; 768 sumUpChargeDensity( 769 MPQCresults, 770 fragmentData, 771 params.path.get(), 772 full_sample); 773 720 774 // Phase Four: obtain more ids 721 775 requestIds(controller, params, fragmentData.size()+1); … … 723 777 724 778 // Phase Five: create VMGJobs 725 if (!createLongRangeJobs(controller, params, fragmentData ))779 if (!createLongRangeJobs(controller, params, fragmentData, full_sample)) 726 780 return Action::failure; 727 781 RunService(io_service, "Adding VMGJobs"); … … 742 796 fragmentData, 743 797 params.path.get(), 744 getNoAtomsFromAdjacencyFile(params.path.get())); 798 getNoAtomsFromAdjacencyFile(params.path.get()), 799 full_sample); 745 800 } 746 801 }
Note:
See TracChangeset
for help on using the changeset viewer.