source: src/Fragmentation/Exporters/ExportGraph_ToJobs.cpp@ f73351

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 f73351 was a953c4, checked in by Frederik Heber <heber@…>, 12 years ago

Using priorizing of jobs.

  • we now require JobMarket 1.1.4.
  • FragmentJobQueue::parseJobs() sets job priority from number of lines.
  • ExportGraph_ToJobs::operator() sets job priority from number of keys.
  • Property mode set to 100644
File size: 4.4 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2011 University of Bonn. All rights reserved.
5 * Copyright (C) 2013 Frederik Heber. All rights reserved.
6 *
7 *
8 * This file is part of MoleCuilder.
9 *
10 * MoleCuilder is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * MoleCuilder is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24/*
25 * ExportGraph_ToJobs.cpp
26 *
27 * Created on: 08.03.2012
28 * Author: heber
29 */
30
31// include config.h
32#ifdef HAVE_CONFIG_H
33#include <config.h>
34#endif
35
36// boost asio required before MemDebug due to placement new
37#include <boost/asio.hpp>
38
39#include "CodePatterns/MemDebug.hpp"
40
41#include "Fragmentation/Exporters/ExportGraph_ToJobs.hpp"
42
43#include <algorithm>
44
45#include "Box.hpp"
46#include "Fragmentation/KeySet.hpp"
47#include "Fragmentation/Automation/FragmentJobQueue.hpp"
48#include "Fragmentation/Automation/MPQCFragmentController.hpp"
49#include "Helpers/defs.hpp"
50#include "Jobs/MPQCJob.hpp"
51#include "LinearAlgebra/RealSpaceMatrix.hpp"
52#include "Parser/FormatParserStorage.hpp"
53#include "World.hpp"
54
55ExportGraph_ToJobs::ExportGraph_ToJobs(
56 const Graph &_graph,
57 const enum HydrogenTreatment _treatment,
58 const enum HydrogenSaturation _saturation) :
59 ExportGraph(_graph, _treatment, _saturation),
60 level(5)
61{}
62
63ExportGraph_ToJobs::~ExportGraph_ToJobs()
64{}
65
66void ExportGraph_ToJobs::operator()()
67{
68 std::vector<FragmentJob::ptr> jobs;
69 KeySetsContainer KeySets;
70 KeySetsContainer FullKeySets;
71 jobs.reserve(TotalGraph.size());
72 LOG(1, "INFO: Creating " << TotalGraph.size() << " possible bond fragmentation jobs.");
73
74 // gather info about the domain
75 double begin[NDIM] = { 0., 0., 0. };
76 RealSpaceMatrix M = World::getInstance().getDomain().getM();
77 M *= 1./AtomicLengthToAngstroem; // scale to atomic length units
78 const double size = M.at(0,0);
79 double end[NDIM] = { size, size, size };
80 const ParserTypes jobtype =
81 FormatParserStorage::getInstance().getTypeFromName("mpqc");
82
83 // go through all fragments, output to stream and create job therefrom
84 ExportGraph::SaturatedFragment_ptr CurrentFragment = getNextFragment();
85 for (; (CurrentFragment != NULL) && (CurrentFragment->getKeySet() != ExportGraph::EmptySet);
86 CurrentFragment = getNextFragment()) {
87 const KeySet &set = CurrentFragment->getKeySet();
88 LOG(2, "INFO: Creating bond fragment job for set " << set << ".");
89 // store config in stream
90 {
91 std::stringstream output;
92 // save to stream
93 CurrentFragment->OutputConfig(output, jobtype);
94 // create job and insert
95 FragmentJob::ptr testJob( new MPQCJob(JobId::IllegalJob, output.str(), begin, end, level) );
96 testJob->setPriority(CurrentFragment->getKeySet().size());
97 jobs.push_back(testJob);
98
99 // order is the same as the number of non-hydrogen atoms
100 const KeySet &keyset = CurrentFragment->getKeySet();
101 const size_t order = keyset.size();
102 const KeySet &fullmolecule = CurrentFragment->getFullMolecule();
103 const KeySet &saturationhydrogens = CurrentFragment->getSaturationHydrogens();
104 KeySetsContainer::IntVector indices(keyset.begin(), keyset.end());
105 KeySetsContainer::IntVector forceindices(fullmolecule.begin(), fullmolecule.end());
106 {
107 // replace all saturated hydrogen indices by "-1"
108 for (KeySetsContainer::IntVector::iterator iter = forceindices.begin();
109 iter != forceindices.end();
110 ++iter)
111 if (saturationhydrogens.find(*iter) != saturationhydrogens.end())
112 *iter = -1;
113 }
114 KeySets.insert(indices, order);
115 FullKeySets.insert(forceindices, order);
116 }
117 // store force index reference file
118 // explicitly release fragment
119 CurrentFragment.reset();
120 }
121 if (CurrentFragment == NULL) {
122 ELOG(1, "Some error while obtaining the next fragment occured.");
123 return;
124 }
125
126 // push final jobs
127 FragmentJobQueue::getInstance().addJobs(jobs, KeySets, FullKeySets);
128}
Note: See TracBrowser for help on using the repository browser.