/*
* Project: MoleCuilder
* Description: creates and alters molecular systems
* Copyright (C) 2017 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 .
*/
/*
* BondVectors.cpp
*
* Created on: Jun 13, 2017
* Author: heber
*/
// include config.h
#ifdef HAVE_CONFIG_H
#include
#endif
//#include "CodePatterns/MemDebug.hpp"
#include "BondVectors.hpp"
#include
#include
#include "Atom/atom.hpp"
BondVectors::mapped_t BondVectors::getBondVectorsAtStep(
const size_t &_step) const
{
mapped_t returnlist;
ASSERT( !container.empty(),
"BondVectors::getBondVectors() - container empty, not set properly?");
for (container_t::const_iterator iter = container.begin();
iter != container.end(); ++iter) {
const bond::ptr ¤t_bond = *iter;
Vector BondVector = current_bond->leftatom->getPositionAtStep(_step)
- current_bond->rightatom->getPositionAtStep(_step);
BondVector.Normalize();
returnlist.insert( std::make_pair(current_bond, BondVector) );
}
ASSERT( returnlist.size() == container.size(),
"BondVectors::getBondVectors() - not same amount of bond vectors as bonds?");
return returnlist;
}
size_t BondVectors::getIndexForBond(const bond::ptr &_bond) const
{
std::pair<
container_t::const_iterator,
container_t::const_iterator> iters =
std::equal_range(container.begin(), container.end(), _bond);
if (iters.first != container.end())
return std::distance(container.begin(), iters.first);
else
return (size_t)-1;
}