source: src/Actions/FragmentationAction/FragmentationAutomationAction.cpp@ 240c3e

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
Last change on this file since 240c3e was 240c3e, checked in by Frederik Heber <heber@…>, 13 years ago

FragmentationAutomationAction now uses a file containing a serialized HomologyContainer.

  • the idea is that we append the calculated keysets als HomologyGraphs to the instance that is afterwards again serialized to file.
  • so far, we do not yet create the graphs, we only parse the file and write again the instance.
  • new parameter "homology-file".
  • Property mode set to 100644
File size: 19.6 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
5 *
6 *
7 * This file is part of MoleCuilder.
8 *
9 * MoleCuilder is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * MoleCuilder is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23/*
24 * FragmentationAutomationAction.cpp
25 *
26 * Created on: May 18, 2012
27 * Author: heber
28 */
29
30// include config.h
31#ifdef HAVE_CONFIG_H
32#include <config.h>
33#endif
34
35#include <boost/archive/text_iarchive.hpp>
36// boost asio needs specific operator new
37#include <boost/asio.hpp>
38
39#include "CodePatterns/MemDebug.hpp"
40
41// include headers that implement a archive in simple text format
42#include <boost/archive/text_oarchive.hpp>
43#include <boost/archive/text_iarchive.hpp>
44
45
46#include <boost/mpl/remove.hpp>
47#include <boost/lambda/lambda.hpp>
48
49#include <iostream>
50
51#include "CodePatterns/Assert.hpp"
52#include "CodePatterns/Info.hpp"
53#include "CodePatterns/Log.hpp"
54#include "JobMarket/Jobs/FragmentJob.hpp"
55
56#include "Fragmentation/Automation/createMatrixNrLookup.hpp"
57#include "Fragmentation/Automation/extractJobIds.hpp"
58#include "Fragmentation/Automation/FragmentationChargeDensity.hpp"
59#include "Fragmentation/Automation/FragmentationResults.hpp"
60#include "Fragmentation/Automation/MPQCFragmentController.hpp"
61#include "Fragmentation/Automation/VMGDebugGridFragmentController.hpp"
62#include "Fragmentation/Automation/VMGFragmentController.hpp"
63#include "Fragmentation/EnergyMatrix.hpp"
64#include "Fragmentation/ForceMatrix.hpp"
65#include "Fragmentation/Fragmentation.hpp"
66#include "Fragmentation/Homology/HomologyContainer.hpp"
67#include "Fragmentation/Homology/HomologyGraph.hpp"
68#include "Fragmentation/SetValues/Fragment.hpp"
69#include "Fragmentation/SetValues/Histogram.hpp"
70#include "Fragmentation/SetValues/IndexedVectors.hpp"
71#include "Fragmentation/HydrogenSaturation_enum.hpp"
72#include "Fragmentation/KeySet.hpp"
73#include "Fragmentation/KeySetsContainer.hpp"
74#include "Fragmentation/Summation/writeTable.hpp"
75#include "Graph/DepthFirstSearchAnalysis.hpp"
76#include "Helpers/defs.hpp"
77#include "Jobs/MPQCJob.hpp"
78#include "Jobs/MPQCData.hpp"
79#include "Jobs/MPQCData_printKeyNames.hpp"
80#ifdef HAVE_VMG
81#include "Jobs/VMGDebugGridJob.hpp"
82#include "Jobs/VMGJob.hpp"
83#include "Jobs/VMGData.hpp"
84#include "Jobs/VMGDataFused.hpp"
85#include "Jobs/VMGDataMap.hpp"
86#include "Jobs/VMGData_printKeyNames.hpp"
87#endif
88#include "World.hpp"
89
90#include <fstream>
91#include <iostream>
92#include <string>
93#include <vector>
94
95#include <boost/mpl/for_each.hpp>
96
97#include "Actions/FragmentationAction/FragmentationAutomationAction.hpp"
98
99using namespace MoleCuilder;
100
101// and construct the stuff
102#include "FragmentationAutomationAction.def"
103#include "Action_impl_pre.hpp"
104/** =========== define the function ====================== */
105
106class controller_AddOn;
107
108// needs to be defined for using the FragmentController
109controller_AddOn *getAddOn()
110{
111 return NULL;
112}
113
114/** Helper function to get number of atoms somehow.
115 *
116 * Here, we just parse the number of lines in the adjacency file as
117 * it should correspond to the number of atoms, except when some atoms
118 * are not bonded, but then fragmentation makes no sense.
119 *
120 * @param path path to the adjacency file
121 */
122size_t getNoAtomsFromAdjacencyFile(const std::string &path)
123{
124 size_t NoAtoms = 0;
125
126 // parse in special file to get atom count (from line count)
127 std::string filename(path);
128 filename += FRAGMENTPREFIX;
129 filename += ADJACENCYFILE;
130 std::ifstream adjacency(filename.c_str());
131 if (adjacency.fail()) {
132 LOG(0, endl << "getNoAtomsFromAdjacencyFile() - Unable to open " << filename << ", is the directory correct?");
133 return false;
134 }
135 std::string buffer;
136 while (getline(adjacency, buffer))
137 NoAtoms++;
138 LOG(1, "INFO: There are " << NoAtoms << " atoms.");
139
140 return NoAtoms;
141}
142
143
144
145/** Place results from FragmentResult into EnergyMatrix and ForceMatrix.
146 *
147 * @param fragmentData MPQCData resulting from the jobs
148 * @param MatrixNrLookup Lookup up-map from job id to fragment number
149 * @param FragmentCounter total number of fragments
150 * @param NoAtoms total number of atoms
151 * @param Energy energy matrix to be filled on return
152 * @param Force force matrix to be filled on return
153 * @return true - everything ok, false - else
154 */
155bool putResultsintoMatrices(
156 const std::map<JobId_t, MPQCData> &fragmentData,
157 const std::map< JobId_t, size_t > &MatrixNrLookup,
158 const size_t FragmentCounter,
159 const size_t NoAtoms,
160 EnergyMatrix &Energy,
161 ForceMatrix &Force)
162{
163 for (std::map<JobId_t, MPQCData>::const_iterator dataiter = fragmentData.begin();
164 dataiter != fragmentData.end(); ++dataiter) {
165 const MPQCData &extractedData = dataiter->second;
166 const JobId_t &jobid = dataiter->first;
167 std::map< JobId_t, size_t >::const_iterator nriter = MatrixNrLookup.find(jobid);
168 ASSERT( nriter != MatrixNrLookup.end(),
169 "putResultsintoMatrices() - MatrixNrLookup does not contain id "
170 +toString(jobid)+".");
171 // place results into EnergyMatrix ...
172 {
173 MatrixContainer::MatrixArray matrix;
174 matrix.resize(1);
175 matrix[0].resize(1, extractedData.energies.total);
176 if (!Energy.AddMatrix(
177 std::string("MPQCJob ")+toString(jobid),
178 matrix,
179 nriter->second)) {
180 ELOG(1, "Adding energy matrix failed.");
181 return false;
182 }
183 }
184 // ... and ForceMatrix (with two empty columns in front)
185 {
186 MatrixContainer::MatrixArray matrix;
187 const size_t rows = extractedData.forces.size();
188 matrix.resize(rows);
189 for (size_t i=0;i<rows;++i) {
190 const size_t columns = 2+extractedData.forces[i].size();
191 matrix[i].resize(columns, 0.);
192 // for (size_t j=0;j<2;++j)
193 // matrix[i][j] = 0.;
194 for (size_t j=2;j<columns;++j)
195 matrix[i][j] = extractedData.forces[i][j-2];
196 }
197 if (!Force.AddMatrix(
198 std::string("MPQCJob ")+toString(jobid),
199 matrix,
200 nriter->second)) {
201 ELOG(1, "Adding force matrix failed.");
202 return false;
203 }
204 }
205 }
206 // add one more matrix (not required for energy)
207 MatrixContainer::MatrixArray matrix;
208 matrix.resize(1);
209 matrix[0].resize(1, 0.);
210 if (!Energy.AddMatrix(std::string("MPQCJob total"), matrix, FragmentCounter))
211 return false;
212 // but for energy because we need to know total number of atoms
213 matrix.resize(NoAtoms);
214 for (size_t i = 0; i< NoAtoms; ++i)
215 matrix[i].resize(2+NDIM, 0.);
216 if (!Force.AddMatrix(std::string("MPQCJob total"), matrix, FragmentCounter))
217 return false;
218
219 return true;
220}
221
222/** Print MPQCData from received results.
223 *
224 * @param fragmentData MPQCData resulting from the jobs, associated to job id
225 * @param KeySetFilename filename with keysets to associate forces correctly
226 * @param NoAtoms total number of atoms
227 * @param full_sample summed up charge from fragments on return
228 */
229bool printReceivedMPQCResults(
230 const std::map<JobId_t, MPQCData> &fragmentData,
231 const std::string &KeySetFilename,
232 size_t NoAtoms)
233{
234 // create a vector of all job ids
235 std::vector<JobId_t> jobids;
236 std::transform(fragmentData.begin(),fragmentData.end(),
237 std::back_inserter(jobids),
238 boost::bind( &std::map<JobId_t,MPQCData>::value_type::first, boost::lambda::_1 )
239 );
240
241 // create lookup from job nr to fragment number
242 size_t FragmentCounter = 0;
243 const std::map< JobId_t, size_t > MatrixNrLookup=
244 createMatrixNrLookup(jobids, FragmentCounter);
245
246 // place results into maps
247 EnergyMatrix Energy;
248 ForceMatrix Force;
249 if (!putResultsintoMatrices(fragmentData, MatrixNrLookup, FragmentCounter, NoAtoms, Energy, Force))
250 return false;
251
252 // initialise keysets
253 KeySetsContainer KeySet;
254 KeySetsContainer ForceKeySet;
255 if (!Energy.InitialiseIndices()) return false;
256
257 if (!Force.ParseIndices(KeySetFilename.c_str())) return false;
258
259 {
260 // else needs keysets without hydrogens
261 std::stringstream filename;
262 filename << FRAGMENTPREFIX << KEYSETFILE;
263 if (!KeySet.ParseKeySets(KeySetFilename, filename.str(), FragmentCounter)) return false;
264 }
265
266 {
267 // forces need keysets including hydrogens
268 std::stringstream filename;
269 filename << FRAGMENTPREFIX << FORCESFILE;
270 if (!ForceKeySet.ParseKeySets(KeySetFilename, filename.str(), FragmentCounter)) return false;
271 }
272
273 // combine all found data
274 if (!KeySet.ParseManyBodyTerms()) return false;
275
276 EnergyMatrix EnergyFragments;
277 ForceMatrix ForceFragments;
278 if (!EnergyFragments.AllocateMatrix(Energy.Header, Energy.MatrixCounter, Energy.RowCounter, Energy.ColumnCounter)) return false;
279 if (!ForceFragments.AllocateMatrix(Force.Header, Force.MatrixCounter, Force.RowCounter, Force.ColumnCounter)) return false;
280
281 if(!Energy.SetLastMatrix(0., 0)) return false;
282 if(!Force.SetLastMatrix(0., 2)) return false;
283
284 for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
285 // --------- sum up energy --------------------
286 LOG(1, "INFO: Summing energy of order " << BondOrder+1 << " ...");
287 if (!EnergyFragments.SumSubManyBodyTerms(Energy, KeySet, BondOrder)) return false;
288 if (!Energy.SumSubEnergy(EnergyFragments, NULL, KeySet, BondOrder, 1.)) return false;
289
290 // --------- sum up Forces --------------------
291 LOG(1, "INFO: Summing forces of order " << BondOrder+1 << " ...");
292 if (!ForceFragments.SumSubManyBodyTerms(Force, KeySet, BondOrder)) return false;
293 if (!Force.SumSubForces(ForceFragments, KeySet, BondOrder, 1.)) return false;
294 }
295
296 // for debugging print resulting energy and forces
297 LOG(1, "INFO: Resulting energy is " << Energy.Matrix[ FragmentCounter ][0][0]);
298 std::stringstream output;
299 for (int i=0; i< Force.RowCounter[FragmentCounter]; ++i) {
300 for (int j=0; j< Force.ColumnCounter[FragmentCounter]; ++j)
301 output << Force.Matrix[ FragmentCounter ][i][j] << " ";
302 output << "\n";
303 }
304 LOG(1, "INFO: Resulting forces are " << std::endl << output.str());
305
306 return true;
307}
308
309void writeToFile(const std::string &filename, const std::string contents)
310{
311 std::ofstream tablefile(filename.c_str());
312 tablefile << contents;
313 tablefile.close();
314}
315
316/** Print MPQCData from received results.
317 *
318 * @param results summed up results container
319 */
320void printReceivedFullResults(
321 const FragmentationResults &results)
322{
323 // print tables (without eigenvalues, they go extra)
324 {
325 typedef boost::mpl::remove<MPQCDataEnergyVector_t, MPQCDataFused::energy_eigenvalues>::type
326 MPQCDataEnergyVector_noeigenvalues_t;
327 const std::string energyresult =
328 writeTable<MPQCDataEnergyMap_t, MPQCDataEnergyVector_noeigenvalues_t >()(
329 results.Result_Energy_fused, results.getMaxLevel());
330 LOG(0, "Energy table is \n" << energyresult);
331 std::string filename;
332 filename += FRAGMENTPREFIX + std::string("_Energy.dat");
333 writeToFile(filename, energyresult);
334 }
335
336 {
337 const std::string gridresult =
338 writeTable<VMGDataMap_t, VMGDataVector_t >()(
339 results.Result_LongRange_fused, results.getMaxLevel(), 2);
340 LOG(0, "VMG table is \n" << gridresult);
341 std::string filename;
342 filename += FRAGMENTPREFIX + std::string("_VMGEnergy.dat");
343 writeToFile(filename, gridresult);
344 }
345
346 {
347 const std::string gridresult =
348 writeTable<VMGDataLongRangeMap_t, VMGDataLongRangeVector_t >()(
349 results.Result_LongRangeIntegrated_fused, results.getMaxLevel(), 2);
350 LOG(0, "LongRange table is \n" << gridresult);
351 std::string filename;
352 filename += FRAGMENTPREFIX + std::string("_LongRangeEnergy.dat");
353 writeToFile(filename, gridresult);
354 }
355
356 {
357 const std::string eigenvalueresult;
358 LOG(0, "Eigenvalue table is \n" << eigenvalueresult);
359 std::string filename;
360 filename += FRAGMENTPREFIX + std::string("_Eigenvalues.dat");
361 writeToFile(filename, eigenvalueresult);
362 }
363
364 {
365 const std::string forceresult =
366 writeTable<MPQCDataForceMap_t, MPQCDataForceVector_t>()(
367 results.Result_Force_fused, results.getMaxLevel());
368 LOG(0, "Force table is \n" << forceresult);
369 std::string filename;
370 filename += FRAGMENTPREFIX + std::string("_Forces.dat");
371 writeToFile(filename, forceresult);
372 }
373 // we don't want to print grid to a table
374 {
375 // print times (without flops for now)
376 typedef boost::mpl::remove<
377 boost::mpl::remove<MPQCDataTimeVector_t, MPQCDataFused::times_total_flops>::type,
378 MPQCDataFused::times_gather_flops>::type
379 MPQCDataTimeVector_noflops_t;
380 const std::string timesresult =
381 writeTable<MPQCDataTimeMap_t, MPQCDataTimeVector_noflops_t >()(
382 results.Result_Time_fused, results.getMaxLevel());
383 LOG(0, "Times table is \n" << timesresult);
384 std::string filename;
385 filename += FRAGMENTPREFIX + std::string("_Times.dat");
386 writeToFile(filename, timesresult);
387 }
388}
389
390bool appendToHomologyFile(const boost::filesystem::path &homology_file)
391{
392 // read homology container (if present)
393 HomologyContainer homology_container;
394 if (boost::filesystem::exists(homology_file)) {
395 std::ifstream returnstream(homology_file.string().c_str());
396 if (returnstream.good()) {
397 boost::archive::text_iarchive ia(returnstream);
398 ia >> homology_container;
399 } else {
400 ELOG(2, "Failed to parse from " << homology_file.string() << ".");
401 }
402 returnstream.close();
403 } else {
404 LOG(2, "Could not open " << homology_file.string()
405 << ", creating empty container.");
406 }
407
408 // append all fragments to a HomologyContainer
409 HomologyContainer::container_t values;
410 // TODO: prepare HomologyGraphs ...
411 homology_container.insert(values);
412
413 // store homology container again
414 std::ofstream outputstream(homology_file.string().c_str());
415 if (outputstream.fail()) { // check if opened
416 boost::archive::text_oarchive oa(outputstream);
417 oa << homology_container;
418 if (outputstream.fail()) { // check if correctly written
419 LOG(1, "Failed to write to file " << homology_file.string() << ".");
420 return false;
421 } else
422 outputstream.close();
423 } else {
424 LOG(1, "Failed to open file " << homology_file.string()
425 << " for writing.");
426 return false;
427 }
428 return true;
429}
430
431Action::state_ptr FragmentationFragmentationAutomationAction::performCall() {
432 boost::asio::io_service io_service;
433
434 // TODO: Have io_service run in second thread and merge with current again eventually
435
436 size_t Exitflag = 0;
437 std::map<JobId_t, MPQCData> fragmentData;
438 {
439 MPQCFragmentController mpqccontroller(io_service);
440 mpqccontroller.setHost(params.host.get());
441 mpqccontroller.setPort(params.port.get());
442 mpqccontroller.setLevel(params.level.get());
443 // Phase One: obtain ids
444 std::vector< boost::filesystem::path > jobfiles = params.jobfiles.get();
445 mpqccontroller.requestIds(jobfiles.size());
446
447 // Phase Two: create and add MPQCJobs
448 if (!mpqccontroller.addJobsFromFiles(params.executable.get().string(), jobfiles))
449 return Action::failure;
450
451 // Phase Three: calculate result
452 mpqccontroller.waitforResults(jobfiles.size());
453 mpqccontroller.getResults(fragmentData);
454
455 Exitflag += mpqccontroller.getExitflag();
456 }
457
458#ifdef HAVE_VMG
459 if (params.DoLongrange.get()) {
460 if ( World::getInstance().getAllAtoms().size() == 0) {
461 ELOG(1, "Please load the full molecule into the world before starting this action.");
462 return Action::failure;
463 }
464
465 // obtain combined charge density
466 FragmentationChargeDensity summedChargeDensity(
467 fragmentData,
468 params.path.get());
469 const std::vector<SamplingGrid> full_sample = summedChargeDensity.getFullSampledGrid();
470
471 LOG(1, "INFO: There are " << fragmentData.size() << " short-range and "
472 << full_sample.size() << " level-wise long-range jobs.");
473
474 // Phase Four: obtain more ids
475 std::map<JobId_t, VMGData> longrangeData;
476 {
477 VMGFragmentController vmgcontroller(io_service);
478 vmgcontroller.setHost(params.host.get());
479 vmgcontroller.setPort(params.port.get());
480 const size_t NoJobs = fragmentData.size()+full_sample.size();
481 vmgcontroller.requestIds(NoJobs);
482
483 // Phase Five: create VMGJobs
484 const size_t near_field_cells = params.near_field_cells.get();
485 const size_t interpolation_degree = params.interpolation_degree.get();
486 if (!vmgcontroller.createLongRangeJobs(
487 fragmentData,
488 full_sample,
489 summedChargeDensity.getFragment(),
490 near_field_cells,
491 interpolation_degree))
492 return Action::failure;
493
494 // Phase Six: calculate result
495 vmgcontroller.waitforResults(NoJobs);
496 vmgcontroller.getResults(longrangeData);
497 ASSERT( NoJobs == longrangeData.size(),
498 "FragmentationFragmentationAutomationAction::performCall() - number of MPQCresults+"
499 +toString(full_sample.size())+"="+toString(NoJobs)
500 +" and VMGresults "+toString(longrangeData.size())+" don't match.");
501 Exitflag += vmgcontroller.getExitflag();
502 }
503
504 // remove full solution corresponding to full_sample from map (must be highest ids), has to be treated extra
505 std::map<JobId_t, VMGData>::iterator iter = longrangeData.end();
506 for (size_t i=0;i<full_sample.size();++i)
507 --iter;
508 std::map<JobId_t, VMGData>::iterator remove_iter = iter;
509 std::vector<VMGData> fullsolutionData;
510 for (; iter != longrangeData.end(); ++iter)
511 fullsolutionData.push_back(iter->second);
512 longrangeData.erase(remove_iter, longrangeData.end());
513
514 // Final phase: sum up and print result
515 {
516 FragmentationResults results(
517 fragmentData,
518 longrangeData,
519 fullsolutionData,
520 params.path.get(),
521 getNoAtomsFromAdjacencyFile(params.path.get()),
522 full_sample);
523
524 LOG(1, "INFO: Parsing fragment files from " << params.path.get() << ".");
525 printReceivedFullResults(results);
526 }
527
528 // append all keysets to homology file
529 if (Exitflag != 0) {
530 const boost::filesystem::path &homology_file = params.homology_file.get();
531 if (!appendToHomologyFile(homology_file))
532 Exitflag = 1;
533 }
534
535 std::map<JobId_t, std::string> debugData;
536 {
537 if (!full_sample.empty()) {
538 // create debug jobs for each level to print the summed-up potential to vtk files
539 VMGDebugGridFragmentController debugcontroller(io_service);
540 debugcontroller.setHost(params.host.get());
541 debugcontroller.setPort(params.port.get());
542 debugcontroller.requestIds(full_sample.size());
543 if (!debugcontroller.createDebugJobs(full_sample))
544 return Action::failure;
545 debugcontroller.waitforResults(full_sample.size());
546 debugcontroller.getResults(debugData);
547 Exitflag += debugcontroller.getExitflag();
548 }
549 }
550 }
551#else
552 // Final phase: print result
553 {
554 LOG(1, "INFO: Parsing fragment files from " << params.path.get() << ".");
555 printReceivedMPQCResults(
556 fragmentData,
557 params.path.get(),
558 getNoAtomsFromAdjacencyFile(params.path.get()));
559 }
560#endif
561
562 return (Exitflag == 0) ? Action::success : Action::failure;
563}
564
565Action::state_ptr FragmentationFragmentationAutomationAction::performUndo(Action::state_ptr _state) {
566 return Action::success;
567}
568
569Action::state_ptr FragmentationFragmentationAutomationAction::performRedo(Action::state_ptr _state){
570 return Action::success;
571}
572
573bool FragmentationFragmentationAutomationAction::canUndo() {
574 return false;
575}
576
577bool FragmentationFragmentationAutomationAction::shouldUndo() {
578 return false;
579}
580/** =========== end of function ====================== */
Note: See TracBrowser for help on using the repository browser.