Changeset 27594e for src


Ignore:
Timestamp:
Dec 10, 2012, 10:10:58 AM (12 years ago)
Author:
Frederik Heber <heber@…>
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:
4f056e
Parents:
86cfac5
git-author:
Frederik Heber <heber@…> (08/31/12 17:19:30)
git-committer:
Frederik Heber <heber@…> (12/10/12 10:10:58)
Message:

Added FragmentationChargeDensity to contain summed up charge density.

Location:
src
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/FragmentationAction/FragmentationAutomationAction.cpp

    r86cfac5 r27594e  
    4949#include "Fragmentation/Automation/createMatrixNrLookup.hpp"
    5050#include "Fragmentation/Automation/extractJobIds.hpp"
     51#include "Fragmentation/Automation/FragmentationChargeDensity.hpp"
    5152#include "Fragmentation/Automation/FragmentationResults.hpp"
    5253#include "Fragmentation/Automation/MPQCFragmentController.hpp"
     
    6263#include "Fragmentation/KeySet.hpp"
    6364#include "Fragmentation/KeySetsContainer.hpp"
    64 #include "Fragmentation/Summation/OrthogonalSumUpPerLevel.hpp"
    6565#include "Fragmentation/Summation/writeTable.hpp"
    6666#include "Graph/DepthFirstSearchAnalysis.hpp"
     
    6969#include "Jobs/MPQCData.hpp"
    7070#include "Jobs/MPQCData_printKeyNames.hpp"
    71 #include "Jobs/Grid/SamplingGrid.hpp"
    7271#ifdef HAVE_VMG
    7372#include "Jobs/VMGDebugGridJob.hpp"
     
    211210  return true;
    212211}
     212
    213213/** Print MPQCData from received results.
    214214 *
    215  * @param fragmentData MPQCData resulting from the jobs, each associated to a job
     215 * @param fragmentData MPQCData resulting from the jobs, associated to job id
    216216 * @param KeySetFilename filename with keysets to associate forces correctly
    217217 * @param NoAtoms total number of atoms
    218  * @param full_sample summed up charge density of electrons from fragments on return
    219  * @param full_fragment summed up positions and charges of nuclei from fragments on return
    220  */
    221 bool sumUpChargeDensity(
    222     const std::map<JobId_t,MPQCData> &fragmentData,
     218 * @param full_sample summed up charge from fragments on return
     219 */
     220bool printReceivedMPQCResults(
     221    const std::map<JobId_t, MPQCData> &fragmentData,
    223222    const std::string &KeySetFilename,
    224     std::vector<SamplingGrid> &full_sample,
    225     Fragment &full_fragment)
     223    size_t NoAtoms)
    226224{
    227225  // create a vector of all job ids
     
    234232  // create lookup from job nr to fragment number
    235233  size_t FragmentCounter = 0;
    236   const std::map< JobId_t, size_t > MatrixNrLookup =
    237       createMatrixNrLookup(jobids, FragmentCounter);
    238 
    239   // initialise keysets
    240   KeySetsContainer KeySet;
    241   {
    242     // else needs keysets without hydrogens
    243     std::stringstream filename;
    244     filename << FRAGMENTPREFIX << KEYSETFILE;
    245     if (!KeySet.ParseKeySets(KeySetFilename, filename.str(), FragmentCounter)) return false;
    246   }
    247 
    248   /// prepare for OrthogonalSummation
    249 
    250   // convert KeySetContainer to IndexSetContainer
    251   IndexSetContainer::ptr container(new IndexSetContainer(KeySet));
    252   // create the map of all keysets
    253   SubsetMap::ptr subsetmap(new SubsetMap(*container));
    254 
    255   /// convert all MPQCData to MPQCDataMap_t
    256   std::vector<MPQCDataGridMap_t> Result_Grid_fused(
    257     OrthogonalSumUpPerLevel<MPQCDataGridMap_t, MPQCData, MPQCDataGridVector_t>(
    258         fragmentData, MatrixNrLookup, container, subsetmap));
    259   std::vector<MPQCDataFragmentMap_t> Result_Fragment_fused(
    260     OrthogonalSumUpPerLevel<MPQCDataFragmentMap_t, MPQCData, MPQCDataFragmentVector_t>(
    261         fragmentData, MatrixNrLookup, container, subsetmap));
    262   // obtain full grid
    263   full_sample.clear();
    264   full_sample.reserve(Result_Grid_fused.size());
    265   for (std::vector<MPQCDataGridMap_t>::const_iterator iter = ++Result_Grid_fused.begin();
    266       iter !=Result_Grid_fused.end();
    267       ++iter)
    268     full_sample.push_back(boost::fusion::at_key<MPQCDataFused::sampled_grid>((*iter)));
    269   full_fragment = boost::fusion::at_key<MPQCDataFused::fragment>(Result_Fragment_fused.back());
    270 
    271   return true;
    272 }
    273 
    274 /** Print MPQCData from received results.
    275  *
    276  * @param fragmentData MPQCData resulting from the jobs, associated to job id
    277  * @param KeySetFilename filename with keysets to associate forces correctly
    278  * @param NoAtoms total number of atoms
    279  * @param full_sample summed up charge from fragments on return
    280  */
    281 bool printReceivedMPQCResults(
    282     const std::map<JobId_t, MPQCData> &fragmentData,
    283     const std::string &KeySetFilename,
    284     size_t NoAtoms)
    285 {
    286   // create a vector of all job ids
    287   std::vector<JobId_t> jobids;
    288   std::transform(fragmentData.begin(),fragmentData.end(),
    289       std::back_inserter(jobids),
    290       boost::bind( &std::map<JobId_t,MPQCData>::value_type::first, boost::lambda::_1 )
    291   );
    292 
    293   // create lookup from job nr to fragment number
    294   size_t FragmentCounter = 0;
    295234  const std::map< JobId_t, size_t > MatrixNrLookup=
    296235      createMatrixNrLookup(jobids, FragmentCounter);
    297 
    298236
    299237  // place results into maps
     
    467405  // obtain combined charge density
    468406  LOG(1, "INFO: Parsing fragment files from " << params.path.get() << ".");
    469   std::vector<SamplingGrid> full_sample; // have charges from level 2 onward summed up
    470   Fragment full_fragment;
    471   sumUpChargeDensity(
     407  FragmentationChargeDensity summedChargeDensity(
    472408      fragmentData,
    473       params.path.get(),
    474       full_sample,
    475       full_fragment);
     409      params.path.get());
     410  const std::vector<SamplingGrid> full_sample = summedChargeDensity.getFullSampledGrid();
    476411
    477412  // Phase Four: obtain more ids
    478   vmgcontroller.requestIds(fragmentData.size()+full_sample.size());
     413  const size_t NoJobs = fragmentData.size()+full_sample.size();
     414  vmgcontroller.requestIds(NoJobs);
    479415
    480416  // Phase Five: create VMGJobs
    481417  const size_t near_field_cells = params.near_field_cells.get();
    482   if (!vmgcontroller.createLongRangeJobs(fragmentData, full_sample, full_fragment, near_field_cells))
     418  if (!vmgcontroller.createLongRangeJobs(
     419      fragmentData,
     420      full_sample,
     421      summedChargeDensity.getFragment(), near_field_cells))
    483422    return Action::failure;
    484423
    485424  // Phase Six: calculate result
    486   vmgcontroller.waitforResults(fragmentData.size()+full_sample.size());
     425  vmgcontroller.waitforResults(NoJobs);
    487426  std::map<JobId_t, VMGData> longrangeData;
    488427  vmgcontroller.getResults(longrangeData);
    489   ASSERT( fragmentData.size()+full_sample.size() == longrangeData.size(),
     428  ASSERT( NoJobs == longrangeData.size(),
    490429      "FragmentationFragmentationAutomationAction::performCall() - number of MPQCresults+"
    491       +toString(full_sample.size())+" "+toString(fragmentData.size()+full_sample.size())
     430      +toString(full_sample)+" "
     431      +toString(NoJobs)
    492432      +" and VMGresults "+toString(longrangeData.size())+" don't match.");
    493433
  • src/Fragmentation/Automation/Makefile.am

    r86cfac5 r27594e  
    44FRAGMENTATIONAUTOMATIONSOURCE = \
    55        Fragmentation/Automation/createMatrixNrLookup.cpp \
     6        Fragmentation/Automation/FragmentationChargeDensity.cpp \
    67        Fragmentation/Automation/FragmentationResults.cpp \
    78        Fragmentation/Automation/MPQCFragmentController.cpp \
     
    1718        Fragmentation/Automation/createMatrixNrLookup.hpp \
    1819        Fragmentation/Automation/extractJobIds.hpp \
     20        Fragmentation/Automation/FragmentationChargeDensity.hpp \
    1921        Fragmentation/Automation/FragmentationResults.hpp \
    2022        Fragmentation/Automation/MPQCFragmentController.hpp \
Note: See TracChangeset for help on using the changeset viewer.