/*
* Project: MoleCuilder
* Description: creates and alters molecular systems
* Copyright (C) 2012 University of Bonn. All rights reserved.
* Copyright (C) 2013 Frederik Heber. 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 .
*/
/*
* FragmentationChargeDensity.cpp
*
* Created on: Aug 31, 2012
* Author: heber
*/
// include config.h
#ifdef HAVE_CONFIG_H
#include
#endif
#include "CodePatterns/MemDebug.hpp"
#include "FragmentationChargeDensity.hpp"
#include
#include
#include
#include "CodePatterns/Assert.hpp"
#include "CodePatterns/Log.hpp"
#include "Fragmentation/KeySetsContainer.hpp"
#include "Fragmentation/parseKeySetFile.hpp"
#include "Fragmentation/Summation/Containers/createMatrixNrLookup.hpp"
#include "Fragmentation/Summation/Containers/extractJobIds.hpp"
#include "Fragmentation/Summation/IndexSetContainer.hpp"
#include "Fragmentation/Summation/OrthogonalSumUpPerLevel.hpp"
#include "Fragmentation/Summation/SubsetMap.hpp"
#include "Helpers/defs.hpp"
FragmentationChargeDensity::FragmentationChargeDensity(
const std::map &fragmentData,
const KeySetsContainer &KeySet)
{
// create a vector of all job ids
std::vector jobids;
std::transform(fragmentData.begin(),fragmentData.end(),
std::back_inserter(jobids),
boost::bind( &std::map::value_type::first, boost::lambda::_1 )
);
// create lookup from job nr to fragment number
size_t FragmentCounter = 0;
std::vector ValueMask(fragmentData.size(), true);
const std::map< JobId_t, size_t > MatrixNrLookup =
createMatrixNrLookup(jobids, FragmentCounter, ValueMask);
/// prepare for OrthogonalSummation
// convert KeySetContainer to IndexSetContainer
IndexSetContainer::ptr container(new IndexSetContainer(KeySet));
// create the map of all keysets
SubsetMap::ptr subsetmap(new SubsetMap(*container));
/// convert all MPQCData to MPQCDataMap_t
OrthogonalSumUpPerLevel(
fragmentData, MatrixNrLookup, container, subsetmap,
Result_Grid_fused, Result_perIndexSet_Grid);
}
std::vector FragmentationChargeDensity::getFullSampledGrid()
{
std::vector full_sample;
full_sample.reserve(Result_Grid_fused.size());
for (std::vector::const_iterator iter = Result_Grid_fused.begin();
iter !=Result_Grid_fused.end();
++iter)
full_sample.push_back(boost::fusion::at_key((*iter)));
return full_sample;
}