/*
* Project: MoleCuilder
* Description: creates and alters molecular systems
* Copyright (C) 2012 University of Bonn. All rights reserved.
*
*
* This file is part of MoleCuilder.
*
* MoleCuilder is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* MoleCuilder is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MoleCuilder. If not, see .
*/
/*
* ExportGraph_ToFiles.cpp
*
* Created on: 08.03.2012
* Author: heber
*/
// include config.h
#ifdef HAVE_CONFIG_H
#include
#endif
#include "CodePatterns/MemDebug.hpp"
#include "ExportGraph_ToFiles.hpp"
#include "CodePatterns/Info.hpp"
#include "CodePatterns/Log.hpp"
#include "Bond/bond.hpp"
#include "Element/element.hpp"
#include "Fragmentation/Graph.hpp"
#include "Fragmentation/KeySet.hpp"
#include "Fragmentation/SortIndex.hpp"
#include "Graph/ListOfLocalAtoms.hpp"
#include "molecule.hpp"
#include "MoleculeListClass.hpp"
#include "Parser/FormatParserStorage.hpp"
#include "World.hpp"
/** Constructor for class ExportGraph_ToFiles.
*
* @param _graph instance of Graph containing keyset of each fragment
* @param _treatment whether to always add already present hydrogens or not
* @param _saturation whether to saturate dangling bonds with hydrogen or not
*/
ExportGraph_ToFiles::ExportGraph_ToFiles(
const Graph &_graph,
const enum HydrogenTreatment _treatment,
const enum HydrogenSaturation _saturation) :
ExportGraph(_graph, _treatment, _saturation)
{}
/** Destructor of class ExportGraph_ToFiles.
*
* We free all created molecules again and also removed their copied atoms.
*/
ExportGraph_ToFiles::~ExportGraph_ToFiles()
{}
/** Actual implementation of the export to files function.
*/
void ExportGraph_ToFiles::operator()()
{
ExportGraph::operator()();
// ===== 9. Save fragments' configuration and keyset files et al to disk ===
LOG(1, "Writing " << BondFragments.ListOfMolecules.size() << " possible bond fragmentation configs");
bool write_status = true;
for (std::vector::const_iterator iter = typelist.begin();
iter != typelist.end();
++iter) {
LOG(2, "INFO: Writing bond fragments for type " << (*iter) << ".");
write_status = write_status
&& BondFragments.OutputConfigForListOfFragments(
prefix,
FormatParserStorage::getInstance().getTypeFromName(*iter));
}
if (write_status)
LOG(1, "All configs written.");
else
LOG(1, "Some config writing failed.");
// store force index reference file
{
SortIndex_t SortIndex;
BondFragments.StoreForcesFile(prefix, SortIndex);
}
// store keysets file
TotalGraph.StoreKeySetFile(prefix);
// store Hydrogen saturation correction file
BondFragments.AddHydrogenCorrection(prefix);
// restore orbital and Stop values
//CalculateOrbitals(*configuration);
}