source: src/Fragmentation/Exporters/ExportGraph_ToJobs.cpp@ 0983e6

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator 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_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since 0983e6 was 9593d1, checked in by Frederik Heber <heber@…>, 9 years ago

FIX: Picking maximum axis length in ExportGraph_ToJobs for MPQCJob.

  • note that so far domains needs to be cubic.
  • Property mode set to 100644
File size: 4.7 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 "Helpers/defs.hpp"
49#ifdef HAVE_JOBMARKET
50#include "Jobs/MPQCJob.hpp"
51#else
52#include "Jobs/MPQCCommandJob.hpp"
53#endif
54#include "LinearAlgebra/RealSpaceMatrix.hpp"
55#include "Parser/FormatParserStorage.hpp"
56#include "World.hpp"
57
58ExportGraph_ToJobs::ExportGraph_ToJobs(
59 const Graph &_graph,
60 const enum HydrogenTreatment _treatment,
61 const enum HydrogenSaturation _saturation,
62 const SaturatedFragment::GlobalSaturationPositions_t &_globalsaturationpositions) :
63 ExportGraph(_graph, _treatment, _saturation,_globalsaturationpositions),
64 level(5)
65{}
66
67ExportGraph_ToJobs::~ExportGraph_ToJobs()
68{}
69
70void ExportGraph_ToJobs::operator()()
71{
72 std::vector<FragmentJob::ptr> jobs;
73 KeySetsContainer KeySets;
74 KeySetsContainer FullKeySets;
75 jobs.reserve(TotalGraph.size());
76 LOG(1, "INFO: Creating " << TotalGraph.size() << " possible bond fragmentation jobs.");
77
78 // gather info about the domain
79 double begin[NDIM] = { 0., 0., 0. };
80 RealSpaceMatrix M = World::getInstance().getDomain().getM();
81 M *= 1./AtomicLengthToAngstroem; // scale to atomic length units
82 const double size = std::max( std::max(M.at(0,0), M.at(1,1)), M.at(2,2));
83 double end[NDIM] = { size, size, size };
84 const ParserTypes jobtype =
85 FormatParserStorage::getInstance().getTypeFromName("mpqc");
86
87 // go through all fragments, output to stream and create job therefrom
88 ExportGraph::SaturatedFragment_ptr CurrentFragment = getNextFragment();
89 for (; (CurrentFragment != NULL) && (CurrentFragment->getKeySet() != ExportGraph::EmptySet);
90 CurrentFragment = getNextFragment()) {
91 const KeySet &set = CurrentFragment->getKeySet();
92 LOG(2, "INFO: Creating bond fragment job for set " << set << ".");
93 // store config in stream
94 {
95 std::stringstream output;
96 // save to stream
97 CurrentFragment->OutputConfig(output, jobtype);
98 // create job and insert
99 FragmentJob::ptr testJob(
100#ifdef HAVE_JOBMARKET
101 new MPQCJob(JobId::IllegalJob, output.str(), begin, end, level)
102#else
103 new MPQCCommandJob(output.str(), JobId::IllegalJob)
104#endif
105 );
106 testJob->setPriority(CurrentFragment->getKeySet().size());
107 jobs.push_back(testJob);
108
109 // order is the same as the number of non-hydrogen atoms
110 const KeySet &keyset = CurrentFragment->getKeySet();
111 const size_t order = keyset.size();
112 const KeySet &fullmolecule = CurrentFragment->getFullMolecule();
113 const KeySet &saturationhydrogens = CurrentFragment->getSaturationHydrogens();
114 KeySetsContainer::IntVector indices(keyset.begin(), keyset.end());
115 KeySetsContainer::IntVector forceindices(fullmolecule.begin(), fullmolecule.end());
116 {
117 // replace all saturated hydrogen indices by "-1"
118 for (KeySetsContainer::IntVector::iterator iter = forceindices.begin();
119 iter != forceindices.end();
120 ++iter)
121 if (saturationhydrogens.find(*iter) != saturationhydrogens.end())
122 *iter = -1;
123 }
124 KeySets.insert(indices, order);
125 FullKeySets.insert(forceindices, order);
126 }
127 // store force index reference file
128 // explicitly release fragment
129 CurrentFragment.reset();
130 }
131 if (CurrentFragment == NULL) {
132 ELOG(1, "Some error while obtaining the next fragment occured.");
133 return;
134 }
135
136 // push final jobs
137 FragmentJobQueue::getInstance().addJobs(jobs, KeySets, FullKeySets);
138}
Note: See TracBrowser for help on using the repository browser.