Ignore:
Timestamp:
Jun 27, 2012, 4:07:20 PM (13 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:
95b384
Parents:
509014
git-author:
Frederik Heber <heber@…> (02/22/12 16:41:15)
git-committer:
Frederik Heber <heber@…> (06/27/12 16:07:20)
Message:

Added specific Command to controller to receive mpqc results and combine them.

  • new entry in CommandIndices ReceiveMPQCIndex.
  • is not done. This should be implemented using the already present methods in the rest of MoleCuilder. This should go into the function printreceivedmpqcresults().
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Automation/controller.cpp

    r509014 r986885  
    2727#include "CodePatterns/MemDebug.hpp"
    2828
     29#include <boost/archive/text_oarchive.hpp>
     30#include <boost/archive/text_iarchive.hpp>
    2931#include <fstream>
    3032#include <iostream>
     
    4446#include "Controller/Commands/ShutdownOperation.hpp"
    4547#include "Jobs/MPQCCommandJob.hpp"
     48#include "Jobs/MPQCCommandJob_MPQCData.hpp"
    4649#include "Jobs/SystemCommandJob.hpp"
    4750#include "Results/FragmentResult.hpp"
     
    5356  CheckResultsIndex = 3,
    5457  ReceiveResultsIndex = 4,
    55   ShutdownIndex = 5
     58  ReceiveMPQCIndex = 5,
     59  ShutdownIndex = 6,
    5660};
    5761
     
    208212}
    209213
     214/** Print received results.
     215 *
     216 * @param controller FragmentController with CommandRegistry
     217 */
     218void printreceivedmpqcresults(FragmentController &controller, const std::string &KeySetFilename)
     219{
     220  SendResultsOperation *sendres = static_cast<SendResultsOperation *>(
     221      controller.Commands.getByName("sendresults"));
     222  std::vector<FragmentResult::ptr> results = sendres->getResults();
     223
     224  // parse in KeySetfile
     225//  const size_t MAXBUFFER = 256;
     226  std::ifstream inputfile;
     227  inputfile.open(KeySetFilename.c_str());
     228//  while (inputfile.getline(buffer, MAXBUFFER)) {
     229//
     230//  }
     231  inputfile.close();
     232
     233  // combine all found data
     234  std::vector<MPQCData> fragmentData(results.size());
     235  MPQCData combinedData;
     236
     237  LOG(2, "DEBUG: Parsing now through " << results.size() << " results.");
     238  for (std::vector<FragmentResult::ptr>::const_iterator iter = results.begin();
     239      iter != results.end(); ++iter) {
     240    LOG(1, "RESULT: job #"+toString((*iter)->getId())+": "+toString((*iter)->result));
     241    MPQCData extractedData;
     242    std::stringstream inputstream((*iter)->result);
     243    boost::archive::text_iarchive ia(inputstream);
     244    ia >> extractedData;
     245    LOG(1, "INFO: extracted data is " << extractedData << ".");
     246  }
     247}
     248
    210249/** Sends shutdown signal to server
    211250 *
     
    255294  CommandsMap.insert( std::make_pair("checkresults", CheckResultsIndex) );
    256295  CommandsMap.insert( std::make_pair("receiveresults", ReceiveResultsIndex) );
     296  CommandsMap.insert( std::make_pair("receivempqc", ReceiveMPQCIndex) );
    257297  CommandsMap.insert( std::make_pair("shutdown", ShutdownIndex) );
    258298  try
     
    301341        break;
    302342      case ReceiveResultsIndex:
     343        break;
     344      case ReceiveMPQCIndex:
    303345        break;
    304346      case ShutdownIndex:
     
    364406        break;
    365407      }
     408      case ReceiveMPQCIndex:
     409      {
     410        receiveresults(controller, argv[1], argv[2]);
     411        break;
     412      }
    366413      case ShutdownIndex:
    367414      {
     
    395442      {
    396443        printreceivedresults(controller);
     444        break;
     445      }
     446      case ReceiveMPQCIndex:
     447      {
     448        if (argc == 4) {
     449          ELOG(1, "'receivempqc' requires one option: [KeySetFilename].");
     450        } else {
     451          const std::string KeySetFilename = argv[4];
     452          LOG(1, "INFO: Parsing id associations from " << KeySetFilename << ".");
     453          printreceivedmpqcresults(controller, KeySetFilename);
     454        }
    397455        break;
    398456      }
Note: See TracChangeset for help on using the changeset viewer.